Double not recognized
-
Hi,
I have a strange thing:
In my country, the decimal separator is 'a comma.In a line edit with a QDoubleValidator I enter 1,5
but if i do
bool bIsOk = false;
double dValue = <my lineEdit>->text().toDouble(&bIsOk);bIsOk is still false.
Why ? because QDoubleValidator accepts my string.thanks
-
Hi,
I have a strange thing:
In my country, the decimal separator is 'a comma.In a line edit with a QDoubleValidator I enter 1,5
but if i do
bool bIsOk = false;
double dValue = <my lineEdit>->text().toDouble(&bIsOk);bIsOk is still false.
Why ? because QDoubleValidator accepts my string.thanks
-
double dValue =<my lineEdit>->locale().toDouble(<my lineEdit>->text());
on the other hand,
QLineEdit
+QDoubleValidator
=QDoubleSpinBox
+QDoubleSpinBox::setButtonSymbols(QAbstractSpinBox::NoButtons)
and you can useQDoubleSpinBox::value
to get the value directly in decimal