summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-03-25 11:20:28 +0100
committerLars Knoll <lars.knoll@qt.io>2020-03-25 13:09:38 +0100
commit46ebd11e66f6f3180043a7258b46a1aff79a69f8 (patch)
tree840e53a49d7a0a0c99e99062554c88b702322332 /tests/auto/widgets/widgets
parentb15ed929f3f481914bf96203e691a552f6d9fe00 (diff)
Fix deprecation of QComboBox:::currentIndexChanged(const QString&)
Don't introduce another overload with two parameters. Users want a simple signal to connect to, not another overload. Deprecate the currentIndexChanged(QString) overload, usage of that can/should get replaced by currentTextChanged(). This partially reverts commit 11dc7b35c8c3957bd19087a5e3ae7cfc4f1a3343. Change-Id: I5e7d16413f3d62b1a5a7a197f510af2c45cdfa55 Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
Diffstat (limited to 'tests/auto/widgets/widgets')
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index c5be8a3f16..c934f8e27b 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -1208,7 +1208,8 @@ void tst_QComboBox::currentIndex()
QVERIFY(testWidget->currentText().isEmpty());
// spy on currentIndexChanged
- QSignalSpy indexChangedSpy(testWidget, SIGNAL(currentIndexChanged(int, QString)));
+ QSignalSpy indexChangedInt(testWidget, SIGNAL(currentIndexChanged(int)));
+ QSignalSpy indexChangedString(testWidget, SIGNAL(currentIndexChanged(QString)));
// stuff items into it
foreach(QString text, initialItems) {
@@ -1232,12 +1233,16 @@ void tst_QComboBox::currentIndex()
QCOMPARE(testWidget->currentText(), expectedCurrentText);
// check that signal count is correct
- QCOMPARE(indexChangedSpy.count(), expectedSignalCount);
+ QCOMPARE(indexChangedInt.count(), expectedSignalCount);
+ QCOMPARE(indexChangedString.count(), expectedSignalCount);
// compare with last sent signal values
- if (indexChangedSpy.count())
- QCOMPARE(indexChangedSpy.at(indexChangedSpy.count() - 1).at(0).toInt(),
- testWidget->currentIndex());
+ if (indexChangedInt.count())
+ QCOMPARE(indexChangedInt.at(indexChangedInt.count() - 1).at(0).toInt(),
+ testWidget->currentIndex());
+ if (indexChangedString.count())
+ QCOMPARE(indexChangedString.at(indexChangedString.count() - 1).at(0).toString(),
+ testWidget->currentText());
if (edit) {
testWidget->setCurrentIndex(-1);
@@ -2336,8 +2341,7 @@ public:
{
QStringList list;
list << "one" << "two";
- connect(this, SIGNAL(currentIndexChanged(int, QString)),
- this, SLOT(onCurrentIndexChanged(int)));
+ connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int)));
addItems(list);
}
public slots:
@@ -2763,7 +2767,7 @@ void tst_QComboBox::resetModel()
};
QComboBox cb;
StringListModel model({"1", "2"});
- QSignalSpy spy(&cb, QOverload<int, const QString &>::of(&QComboBox::currentIndexChanged));
+ QSignalSpy spy(&cb, QOverload<int>::of(&QComboBox::currentIndexChanged));
QCOMPARE(spy.count(), 0);
QCOMPARE(cb.currentIndex(), -1); //no selection