From d1a011fd63943b207b97bd0e50dcafe5de2119dc Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 8 Jun 2009 13:28:23 +0200 Subject: Change order of functions in QInputDialog::getDouble() Fixes issue with decimals in the spinbox used for the double Task-number: 255502 Reviewed-by: mbm --- src/gui/dialogs/qinputdialog.cpp | 2 +- tests/auto/qinputdialog/tst_qinputdialog.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp index 8754324..b6bdf06 100644 --- a/src/gui/dialogs/qinputdialog.cpp +++ b/src/gui/dialogs/qinputdialog.cpp @@ -1250,9 +1250,9 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr QInputDialog dialog(parent, flags); dialog.setWindowTitle(title); dialog.setLabelText(label); + dialog.setDoubleDecimals(decimals); dialog.setDoubleRange(min, max); dialog.setDoubleValue(value); - dialog.setDoubleDecimals(decimals); int ret = dialog.exec(); if (ok) diff --git a/tests/auto/qinputdialog/tst_qinputdialog.cpp b/tests/auto/qinputdialog/tst_qinputdialog.cpp index 0f763fc..c635381 100644 --- a/tests/auto/qinputdialog/tst_qinputdialog.cpp +++ b/tests/auto/qinputdialog/tst_qinputdialog.cpp @@ -67,6 +67,7 @@ private slots: void getInteger(); void getDouble_data(); void getDouble(); + void task255502getDouble(); void getText_data(); void getText(); void getItem_data(); @@ -318,6 +319,20 @@ void tst_QInputDialog::getDouble() delete parent; } +void tst_QInputDialog::task255502getDouble() +{ + parent = new QWidget; + testFunc = &tst_QInputDialog::testFuncGetDouble; + startTimer(0); + bool ok = false; + const double value = 0.001; + const double result = + QInputDialog::getDouble(parent, "", "", value, -1, 1, 4, &ok); + QVERIFY(ok); + QCOMPARE(result, value); + delete parent; +} + void tst_QInputDialog::getText_data() { QTest::addColumn("text"); -- cgit v0.12