Hi,
How I can convert a QLineEdit with editmask 999.999.999,99 to a double?
If I use lineedit->text().toDouble() only 0(zeros) are returned.
Thanks for help
Hi,
How I can convert a QLineEdit with editmask 999.999.999,99 to a double?
If I use lineedit->text().toDouble() only 0(zeros) are returned.
Thanks for help
try this
Qt Code:
text.toDouble();To copy to clipboard, switch view to plain text mode
No, see the results:
Value: 111.222.333,44
If I use your code the result is: 1.11222e+08
I really don't know what I do!
Thanks
it's kind of notation, use
and you will see what you wantQt Code:
qDebug( "%f", your_variable );To copy to clipboard, switch view to plain text mode
Thanks for your help.
You help-me to understand the process.
Now I'm using this:
QLocale locale;
locale.setDefault(QLocale::German); // Decimal point is Comma: 000.000,00
locale.setNumberOptions(QLocale::OmitGroupSeparato r);
bool ok;
double d;
d = locale.toDouble( LE_TEST->text(), &ok );
if(ok) {
qDebug( "%f", d );
}
The LE_TEST is using inputMask: 999.999.999,99
Thanks
Bookmarks