mirror of https://github.com/CGAL/cgal
use QDoubleValidator::fixup() in DoubleEdit::fixup()
with this version the user can write with scientific notation or standard notation, using . or , Note that when input is invalid, value() returns 0
This commit is contained in:
parent
1ca77d32af
commit
3fc14d8d56
|
|
@ -9,18 +9,16 @@ public:
|
|||
: QDoubleValidator(parent)
|
||||
{
|
||||
setLocale(QLocale::C);
|
||||
setNotation(QDoubleValidator::StandardNotation);
|
||||
}
|
||||
|
||||
void fixup ( QString & input ) const
|
||||
{
|
||||
input.replace(".", locale().decimalPoint());
|
||||
input.replace(",", locale().decimalPoint());
|
||||
// QDoubleValidator::fixup(input);
|
||||
QDoubleValidator::fixup(input);
|
||||
}
|
||||
QValidator::State validate ( QString & input, int & pos ) const
|
||||
{
|
||||
fixup(input);
|
||||
return QDoubleValidator::validate(input, pos);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue