summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@collabora.com>2012-01-20 02:30:02 +0200
committerQt by Nokia <qt-info@nokia.com>2012-01-22 22:10:02 +0100
commit7c247d3e70788fd601cdc4d45649d2c7ca1004f3 (patch)
tree77f54d9502f440704ea1ff51aab0ff031cb9e986
parent8ec2068f3d3e89d3b3c67ab65cf2b0ba694452a0 (diff)
Obsolete QInputDialog::getInteger() 'officially'.
It has long since been obsolete in code and removed from the documentation, but was never marked QT_DEPRECATED. Do so, and inline the implementation. Change-Id: Ic7bfdaf76269b7f9addeba83e64bc9525c581dda Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
-rw-r--r--dist/changes-5.0.02
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp25
-rw-r--r--src/widgets/dialogs/qinputdialog.h11
-rw-r--r--tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp26
4 files changed, 22 insertions, 42 deletions
diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0
index 96104d9f04..1c1255bc52 100644
--- a/dist/changes-5.0.0
+++ b/dist/changes-5.0.0
@@ -231,6 +231,8 @@ QtWidgets
* QWidget::setInputContext() and QApplication::setInputContext() are removed.
Input contexts are now platform specific.
+* QInputDialog::getInteger() has been obsoleted. Use QInputDialog::getInt() instead.
+
QtNetwork
---------
* QHostAddress::isLoopback() API added. Returns true if the address is
diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp
index 903d50edab..b9fde611d6 100644
--- a/src/widgets/dialogs/qinputdialog.cpp
+++ b/src/widgets/dialogs/qinputdialog.cpp
@@ -1331,18 +1331,6 @@ QString QInputDialog::getItem(QWidget *parent, const QString &title, const QStri
}
/*!
- \obsolete
-
- Use getInt() instead.
-*/
-int QInputDialog::getInteger(QWidget *parent, const QString &title, const QString &label,
- int value, int min, int max, int step, bool *ok,
- Qt::WindowFlags flags)
-{
- return getInt(parent, title, label, value, min, max, step, ok, flags);
-}
-
-/*!
\fn QString QInputDialog::getText(const QString &title, const QString &label,
QLineEdit::EchoMode echo = QLineEdit::Normal,
const QString &text = QString(), bool *ok = 0,
@@ -1355,19 +1343,6 @@ int QInputDialog::getInteger(QWidget *parent, const QString &title, const QStrin
*/
/*!
- \fn int QInputDialog::getInteger(const QString &title, const QString &label, int value = 0,
- int min = -2147483647, int max = 2147483647,
- int step = 1, bool *ok = 0,
- QWidget *parent = 0, const char *name = 0, Qt::WindowFlags flags = 0)
-
-
- Call getInteger(\a parent, \a title, \a label, \a value, \a
- min, \a max, \a step, \a ok, \a flags) instead.
-
- The \a name parameter is ignored.
-*/
-
-/*!
\fn double QInputDialog::getDouble(const QString &title, const QString &label, double value = 0,
double min = -2147483647, double max = 2147483647,
int decimals = 1, bool *ok = 0,
diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h
index 31ba6a3966..0db83ba5c8 100644
--- a/src/widgets/dialogs/qinputdialog.h
+++ b/src/widgets/dialogs/qinputdialog.h
@@ -183,11 +183,14 @@ public:
double minValue = -2147483647, double maxValue = 2147483647,
int decimals = 1, bool *ok = 0, Qt::WindowFlags flags = 0);
- // obsolete
- static int getInteger(QWidget *parent, const QString &title, const QString &label, int value = 0,
+#if QT_DEPRECATED_SINCE(5, 0)
+ QT_DEPRECATED static inline int getInteger(QWidget *parent, const QString &title, const QString &label, int value = 0,
int minValue = -2147483647, int maxValue = 2147483647,
- int step = 1, bool *ok = 0, Qt::WindowFlags flags = 0);
-
+ int step = 1, bool *ok = 0, Qt::WindowFlags flags = 0)
+ {
+ return getInt(parent, title, label, value, minValue, maxValue, step, ok, flags);
+ }
+#endif
Q_SIGNALS:
// ### emit signals!
diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
index 0a62ac3099..33a6f51707 100644
--- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
+++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
@@ -55,14 +55,14 @@ class tst_QInputDialog : public QObject
QWidget *parent;
QDialog::DialogCode doneCode;
void (*testFunc)(QInputDialog *);
- static void testFuncGetInteger(QInputDialog *dialog);
+ static void testFuncGetInt(QInputDialog *dialog);
static void testFuncGetDouble(QInputDialog *dialog);
static void testFuncGetText(QInputDialog *dialog);
static void testFuncGetItem(QInputDialog *dialog);
void timerEvent(QTimerEvent *event);
private slots:
- void getInteger_data();
- void getInteger();
+ void getInt_data();
+ void getInt();
void getDouble_data();
void getDouble();
void task255502getDouble();
@@ -222,7 +222,7 @@ void testGetItem(QInputDialog *dialog)
QVERIFY(okButton->isEnabled());
}
-void tst_QInputDialog::testFuncGetInteger(QInputDialog *dialog)
+void tst_QInputDialog::testFuncGetInt(QInputDialog *dialog)
{
testGetNumeric<QSpinBox, int>(dialog);
}
@@ -252,29 +252,29 @@ void tst_QInputDialog::timerEvent(QTimerEvent *event)
dialog->done(doneCode); // cause static function call to return
}
-void tst_QInputDialog::getInteger_data()
+void tst_QInputDialog::getInt_data()
{
QTest::addColumn<int>("min");
QTest::addColumn<int>("max");
- QTest::newRow("getInteger() - -") << -20 << -10;
- QTest::newRow("getInteger() - 0") << -20 << 0;
- QTest::newRow("getInteger() - +") << -20 << 20;
- QTest::newRow("getInteger() 0 +") << 0 << 20;
- QTest::newRow("getInteger() + +") << 10 << 20;
+ QTest::newRow("getInt() - -") << -20 << -10;
+ QTest::newRow("getInt() - 0") << -20 << 0;
+ QTest::newRow("getInt() - +") << -20 << 20;
+ QTest::newRow("getInt() 0 +") << 0 << 20;
+ QTest::newRow("getInt() + +") << 10 << 20;
}
-void tst_QInputDialog::getInteger()
+void tst_QInputDialog::getInt()
{
QFETCH(int, min);
QFETCH(int, max);
QVERIFY(min < max);
parent = new QWidget;
doneCode = QDialog::Accepted;
- testFunc = &tst_QInputDialog::testFuncGetInteger;
+ testFunc = &tst_QInputDialog::testFuncGetInt;
startTimer(0);
bool ok = false;
const int value = min + (max - min) / 2;
- const int result = QInputDialog::getInteger(parent, "", "", value, min, max, 1, &ok);
+ const int result = QInputDialog::getInt(parent, "", "", value, min, max, 1, &ok);
QVERIFY(ok);
QCOMPARE(result, value);
delete parent;