Solved QInputDialog::getDouble only take int,but not double
-
Hi.
bool ok; double d = QInputDialog::getDouble(this, tr("ParametrForStrategy"), tr("double:"), 37.56, -10000, 10000, 0.01, &ok); if (ok) {qDebug()<<d;}
In dialog window I can only enter int, but not double. How to fix it?
-
bool ok; double d = QInputDialog::getDouble(this, tr("ParametrForStrategy"), tr("double:"), 37.56, -10000, 10000, 0.01, &ok); if (ok) {qDebug()<<d;}
Your seventh argument is incorrect. Documentation says that
decimals is the maximum number of decimal places the number may have
. Corrected version:bool ok; double d = QInputDialog::getDouble(this, tr("ParametrForStrategy"), tr("double:"), 37.56, -10000, 10000, 2, &ok); if (ok) {qDebug()<<d;}
-
thank you