Update Widgets/Util Tests to Qt5 Connection Syntax

Many of the tests still use the old connection signal/slot syntax for
tests. Since I recently made a change to one of the tests within the
Widgets/Util folder, I went through and updated the entire folder to the
Qt-5 connection syntax.

Change-Id: Iaaa5a38858eed41fbc897b66ef291f08458505f1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Addison Elliott 2016-12-14 01:01:58 -06:00
parent 04fbca3c91
commit 5319da1f6d
4 changed files with 59 additions and 59 deletions

View File

@ -1193,7 +1193,7 @@ void tst_QCompleter::disabledItems()
model->appendRow(suggestions);
model->appendRow(new QStandardItem("suggestions Enabled"));
QCompleter *completer = new QCompleter(model, &lineEdit);
QSignalSpy spy(completer, SIGNAL(activated(QString)));
QSignalSpy spy(completer, QOverload<const QString &>::of(&QCompleter::activated));
lineEdit.setCompleter(completer);
lineEdit.move(200, 200);
lineEdit.show();
@ -1219,7 +1219,7 @@ void tst_QCompleter::task178797_activatedOnReturn()
setFrameless(&ledit);
QCompleter *completer = new QCompleter(words, &ledit);
ledit.setCompleter(completer);
QSignalSpy spy(completer, SIGNAL(activated(QString)));
QSignalSpy spy(completer, QOverload<const QString &>::of(&QCompleter::activated));
QCOMPARE(spy.count(), 0);
ledit.move(200, 200);
ledit.show();
@ -1287,7 +1287,7 @@ public:
if (completer()) {
completer()->setCompletionMode(QCompleter::PopupCompletion);
completer()->setCompletionRole(Qt::DisplayRole);
connect(lineEdit(), SIGNAL(editingFinished()), SLOT(setCompletionPrefix()));
connect(lineEdit(), &QLineEdit::editingFinished, this, &task246056_ComboBox::setCompletionPrefix);
}
}
private slots:
@ -1306,7 +1306,7 @@ void tst_QCompleter::task246056_setCompletionPrefix()
comboBox.show();
QApplication::setActiveWindow(&comboBox);
QVERIFY(QTest::qWaitForWindowActive(&comboBox));
QSignalSpy spy(comboBox.completer(), SIGNAL(activated(QModelIndex)));
QSignalSpy spy(comboBox.completer(), QOverload<const QModelIndex &>::of(&QCompleter::activated));
QTest::keyPress(&comboBox, 'a');
QTest::keyPress(comboBox.completer()->popup(), Qt::Key_Down);
QTest::keyPress(comboBox.completer()->popup(), Qt::Key_Down);

View File

@ -118,7 +118,7 @@ void tst_QSystemTrayIcon::supportsMessages()
void tst_QSystemTrayIcon::lastWindowClosed()
{
QSignalSpy spy(qApp, SIGNAL(lastWindowClosed()));
QSignalSpy spy(qApp, &QApplication::lastWindowClosed);
QWidget window;
QSystemTrayIcon icon;
icon.setIcon(QIcon("whatever.png"));

View File

@ -379,12 +379,12 @@ void tst_QUndoGroup::checkSignals()
QUndoGroup group;
const QScopedPointer<QAction> undo_action(group.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redo_action(group.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&group, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&group, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&group, SIGNAL(canUndoChanged(bool)));
QSignalSpy undoTextChangedSpy(&group, SIGNAL(undoTextChanged(QString)));
QSignalSpy canRedoChangedSpy(&group, SIGNAL(canRedoChanged(bool)));
QSignalSpy redoTextChangedSpy(&group, SIGNAL(redoTextChanged(QString)));
QSignalSpy indexChangedSpy(&group, &QUndoGroup::indexChanged);
QSignalSpy cleanChangedSpy(&group, &QUndoGroup::cleanChanged);
QSignalSpy canUndoChangedSpy(&group, &QUndoGroup::canUndoChanged);
QSignalSpy undoTextChangedSpy(&group, &QUndoGroup::undoTextChanged);
QSignalSpy canRedoChangedSpy(&group, &QUndoGroup::canRedoChanged);
QSignalSpy redoTextChangedSpy(&group, &QUndoGroup::redoTextChanged);
QString str;

View File

@ -329,12 +329,12 @@ void tst_QUndoStack::undoRedo()
QUndoStack stack;
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
QSignalSpy undoTextChangedSpy(&stack, SIGNAL(undoTextChanged(QString)));
QSignalSpy canRedoChangedSpy(&stack, SIGNAL(canRedoChanged(bool)));
QSignalSpy redoTextChangedSpy(&stack, SIGNAL(redoTextChanged(QString)));
QSignalSpy indexChangedSpy(&stack, &QUndoStack::indexChanged);
QSignalSpy cleanChangedSpy(&stack, &QUndoStack::cleanChanged);
QSignalSpy canUndoChangedSpy(&stack, &QUndoStack::canUndoChanged);
QSignalSpy undoTextChangedSpy(&stack, &QUndoStack::undoTextChanged);
QSignalSpy canRedoChangedSpy(&stack, &QUndoStack::canRedoChanged);
QSignalSpy redoTextChangedSpy(&stack, &QUndoStack::redoTextChanged);
QString str;
// push, undo, redo
@ -690,12 +690,12 @@ void tst_QUndoStack::setIndex()
QUndoStack stack;
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
QSignalSpy undoTextChangedSpy(&stack, SIGNAL(undoTextChanged(QString)));
QSignalSpy canRedoChangedSpy(&stack, SIGNAL(canRedoChanged(bool)));
QSignalSpy redoTextChangedSpy(&stack, SIGNAL(redoTextChanged(QString)));
QSignalSpy indexChangedSpy(&stack, &QUndoStack::indexChanged);
QSignalSpy cleanChangedSpy(&stack, &QUndoStack::cleanChanged);
QSignalSpy canUndoChangedSpy(&stack, &QUndoStack::canUndoChanged);
QSignalSpy undoTextChangedSpy(&stack, &QUndoStack::undoTextChanged);
QSignalSpy canRedoChangedSpy(&stack, &QUndoStack::canRedoChanged);
QSignalSpy redoTextChangedSpy(&stack, &QUndoStack::redoTextChanged);
QString str;
stack.setIndex(10); // should do nothing
@ -954,12 +954,12 @@ void tst_QUndoStack::setClean()
QUndoStack stack;
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
QSignalSpy undoTextChangedSpy(&stack, SIGNAL(undoTextChanged(QString)));
QSignalSpy canRedoChangedSpy(&stack, SIGNAL(canRedoChanged(bool)));
QSignalSpy redoTextChangedSpy(&stack, SIGNAL(redoTextChanged(QString)));
QSignalSpy indexChangedSpy(&stack, &QUndoStack::indexChanged);
QSignalSpy cleanChangedSpy(&stack, &QUndoStack::cleanChanged);
QSignalSpy canUndoChangedSpy(&stack, &QUndoStack::canUndoChanged);
QSignalSpy undoTextChangedSpy(&stack, &QUndoStack::undoTextChanged);
QSignalSpy canRedoChangedSpy(&stack, &QUndoStack::canRedoChanged);
QSignalSpy redoTextChangedSpy(&stack, &QUndoStack::redoTextChanged);
QString str;
QCOMPARE(stack.cleanIndex(), 0);
@ -1351,12 +1351,12 @@ void tst_QUndoStack::clear()
QUndoStack stack;
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
QSignalSpy undoTextChangedSpy(&stack, SIGNAL(undoTextChanged(QString)));
QSignalSpy canRedoChangedSpy(&stack, SIGNAL(canRedoChanged(bool)));
QSignalSpy redoTextChangedSpy(&stack, SIGNAL(redoTextChanged(QString)));
QSignalSpy indexChangedSpy(&stack, &QUndoStack::indexChanged);
QSignalSpy cleanChangedSpy(&stack, &QUndoStack::cleanChanged);
QSignalSpy canUndoChangedSpy(&stack, &QUndoStack::canUndoChanged);
QSignalSpy undoTextChangedSpy(&stack, &QUndoStack::undoTextChanged);
QSignalSpy canRedoChangedSpy(&stack, &QUndoStack::canRedoChanged);
QSignalSpy redoTextChangedSpy(&stack, &QUndoStack::redoTextChanged);
QString str;
stack.clear();
@ -1549,12 +1549,12 @@ void tst_QUndoStack::childCommand()
QUndoStack stack;
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
QSignalSpy undoTextChangedSpy(&stack, SIGNAL(undoTextChanged(QString)));
QSignalSpy canRedoChangedSpy(&stack, SIGNAL(canRedoChanged(bool)));
QSignalSpy redoTextChangedSpy(&stack, SIGNAL(redoTextChanged(QString)));
QSignalSpy indexChangedSpy(&stack, &QUndoStack::indexChanged);
QSignalSpy cleanChangedSpy(&stack, &QUndoStack::cleanChanged);
QSignalSpy canUndoChangedSpy(&stack, &QUndoStack::canUndoChanged);
QSignalSpy undoTextChangedSpy(&stack, &QUndoStack::undoTextChanged);
QSignalSpy canRedoChangedSpy(&stack, &QUndoStack::canRedoChanged);
QSignalSpy redoTextChangedSpy(&stack, &QUndoStack::redoTextChanged);
QString str;
stack.push(new InsertCommand(&str, 0, "hello"));
@ -1659,12 +1659,12 @@ void tst_QUndoStack::macroBeginEnd()
QUndoStack stack;
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
QSignalSpy undoTextChangedSpy(&stack, SIGNAL(undoTextChanged(QString)));
QSignalSpy canRedoChangedSpy(&stack, SIGNAL(canRedoChanged(bool)));
QSignalSpy redoTextChangedSpy(&stack, SIGNAL(redoTextChanged(QString)));
QSignalSpy indexChangedSpy(&stack, &QUndoStack::indexChanged);
QSignalSpy cleanChangedSpy(&stack, &QUndoStack::cleanChanged);
QSignalSpy canUndoChangedSpy(&stack, &QUndoStack::canUndoChanged);
QSignalSpy undoTextChangedSpy(&stack, &QUndoStack::undoTextChanged);
QSignalSpy canRedoChangedSpy(&stack, &QUndoStack::canRedoChanged);
QSignalSpy redoTextChangedSpy(&stack, &QUndoStack::redoTextChanged);
QString str;
stack.beginMacro("ding");
@ -2126,12 +2126,12 @@ void tst_QUndoStack::compression()
QUndoStack stack;
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
QSignalSpy undoTextChangedSpy(&stack, SIGNAL(undoTextChanged(QString)));
QSignalSpy canRedoChangedSpy(&stack, SIGNAL(canRedoChanged(bool)));
QSignalSpy redoTextChangedSpy(&stack, SIGNAL(redoTextChanged(QString)));
QSignalSpy indexChangedSpy(&stack, &QUndoStack::indexChanged);
QSignalSpy cleanChangedSpy(&stack, &QUndoStack::cleanChanged);
QSignalSpy canUndoChangedSpy(&stack, &QUndoStack::canUndoChanged);
QSignalSpy undoTextChangedSpy(&stack, &QUndoStack::undoTextChanged);
QSignalSpy canRedoChangedSpy(&stack, &QUndoStack::canRedoChanged);
QSignalSpy redoTextChangedSpy(&stack, &QUndoStack::redoTextChanged);
QString str;
AppendCommand::delete_cnt = 0;
@ -2568,12 +2568,12 @@ void tst_QUndoStack::undoLimit()
QUndoStack stack;
const QScopedPointer<QAction> undoAction(stack.createUndoAction(0, QString("foo")));
const QScopedPointer<QAction> redoAction(stack.createRedoAction(0, QString("bar")));
QSignalSpy indexChangedSpy(&stack, SIGNAL(indexChanged(int)));
QSignalSpy cleanChangedSpy(&stack, SIGNAL(cleanChanged(bool)));
QSignalSpy canUndoChangedSpy(&stack, SIGNAL(canUndoChanged(bool)));
QSignalSpy undoTextChangedSpy(&stack, SIGNAL(undoTextChanged(QString)));
QSignalSpy canRedoChangedSpy(&stack, SIGNAL(canRedoChanged(bool)));
QSignalSpy redoTextChangedSpy(&stack, SIGNAL(redoTextChanged(QString)));
QSignalSpy indexChangedSpy(&stack, &QUndoStack::indexChanged);
QSignalSpy cleanChangedSpy(&stack, &QUndoStack::cleanChanged);
QSignalSpy canUndoChangedSpy(&stack, &QUndoStack::canUndoChanged);
QSignalSpy undoTextChangedSpy(&stack, &QUndoStack::undoTextChanged);
QSignalSpy canRedoChangedSpy(&stack, &QUndoStack::canRedoChanged);
QSignalSpy redoTextChangedSpy(&stack, &QUndoStack::redoTextChanged);
AppendCommand::delete_cnt = 0;
QString str;