FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
PCReconstruct/dialogs/get_field.cpp at master · codearxiv/PCReconstruct · GitHub
codearxiv
PCReconstruct
Repository navigation
Code
Issues
2
(2)
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
PCReconstruct
/
dialogs
/
get_field.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
50 lines (44 loc) · 972 Bytes
Breadcrumbs
PCReconstruct
/
dialogs
/
get_field.cpp
Copy path
File metadata and controls
50 lines (44 loc) · 972 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
Copyright (C) 2019 Piotr (Peter) Beben <pdbcas@gmail.com>
//
See LICENSE included with this distribution.
#
include
"
get_field.h
"
#
include
<
QLineEdit
>
#
include
<
QIntValidator
>
#
include
<
QDoubleValidator
>
bool
get_integer_field
(
QLineEdit *lineEdit, QIntValidator *validator,
size_t
& field)
{
QString fieldStr = lineEdit->
text
();
int
pos =
0
;
if
(validator->
validate
(fieldStr, pos) != QValidator::Acceptable){
lineEdit->
clear
();
return
false
;
}
else
{
bool
ok;
field = fieldStr.
toULongLong
(&ok);
if
(!ok) {
lineEdit->
clear
();
return
false
;
}
}
return
true
;
}
bool
get_float_field
(
QLineEdit *lineEdit, QDoubleValidator *validator,
float
& field)
{
QString fieldStr = lineEdit->
text
();
int
pos =
0
;
if
(validator->
validate
(fieldStr, pos) != QValidator::Acceptable){
lineEdit->
clear
();
return
false
;
}
else
{
bool
ok;
field = fieldStr.
toFloat
(&ok);
if
(!ok) {
lineEdit->
clear
();
return
false
;
}
}
return
true
;
}
Back
|
FazBrowse Home
|
New Git URL