Updated corelib's unit tests to use QSignalSpy's functor constructor

The intent is to provide compile time validation of signals and to help
detect signal overloading in the future.

Change-Id: I9d5d46ed4b70c5d0cd407deb5928b1e76d37e007
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
Keith Gardner 2014-04-22 21:31:47 -07:00 committed by The Qt Project
parent fe70367fe0
commit 43f52f93b5
19 changed files with 341 additions and 337 deletions

View File

@ -137,7 +137,7 @@ private:
void tst_QAnimationGroup::emptyGroup()
{
QSequentialAnimationGroup group;
QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy groupStateChangedSpy(&group, &QSequentialAnimationGroup::stateChanged);
QVERIFY(groupStateChangedSpy.isValid());
QCOMPARE(group.state(), QAnimationGroup::Stopped);

View File

@ -256,10 +256,10 @@ void tst_QParallelAnimationGroup::stateChanged()
group.addAnimation(anim3);
group.addAnimation(anim4);
QSignalSpy spy1(anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy spy2(anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy spy3(anim3, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy spy4(anim4, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy spy1(anim1, &TestAnimation::stateChanged);
QSignalSpy spy2(anim2, &TestAnimation::stateChanged);
QSignalSpy spy3(anim3, &TestAnimation::stateChanged);
QSignalSpy spy4(anim4, &TestAnimation::stateChanged);
QVERIFY(spy1.isValid());
QVERIFY(spy2.isValid());
@ -434,8 +434,8 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup()
anim.setEndValue(100);
anim.setDuration(200);
QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy childStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy groupStateChangedSpy(&group, &QParallelAnimationGroup::stateChanged);
QSignalSpy childStateChangedSpy(&anim, &TestAnimation::stateChanged);
QVERIFY(groupStateChangedSpy.isValid());
QVERIFY(childStateChangedSpy.isValid());
@ -601,8 +601,8 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild()
anim2.setEndValue(100);
anim2.setDuration(200);
QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy stateChangedSpy1(&anim1, &TestAnimation::stateChanged);
QSignalSpy stateChangedSpy2(&anim2, &TestAnimation::stateChanged);
QVERIFY(stateChangedSpy1.isValid());
QVERIFY(stateChangedSpy2.isValid());
@ -669,20 +669,20 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation()
anim3.setEndValue(100);
anim3.setDuration(10);
QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy finishedSpy1(&anim1, SIGNAL(finished()));
QSignalSpy stateChangedSpy1(&anim1, &TestAnimation::stateChanged);
QSignalSpy finishedSpy1(&anim1, &TestAnimation::finished);
QVERIFY(stateChangedSpy1.isValid());
QVERIFY(finishedSpy1.isValid());
QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy finishedSpy2(&anim2, SIGNAL(finished()));
QSignalSpy stateChangedSpy2(&anim2, &TestAnimation::stateChanged);
QSignalSpy finishedSpy2(&anim2, &TestAnimation::finished);
QVERIFY(stateChangedSpy2.isValid());
QVERIFY(finishedSpy2.isValid());
QSignalSpy stateChangedSpy3(&anim3, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy finishedSpy3(&anim3, SIGNAL(finished()));
QSignalSpy stateChangedSpy3(&anim3, &TestAnimation::stateChanged);
QSignalSpy finishedSpy3(&anim3, &TestAnimation::finished);
QVERIFY(stateChangedSpy3.isValid());
QVERIFY(finishedSpy3.isValid());
@ -760,7 +760,7 @@ void tst_QParallelAnimationGroup::stopUncontrolledAnimations()
loopsForever.setDuration(100);
loopsForever.setLoopCount(-1);
QSignalSpy stateChangedSpy(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy stateChangedSpy(&anim1, &TestAnimation::stateChanged);
QVERIFY(stateChangedSpy.isValid());
group.addAnimation(&anim1);
@ -968,7 +968,7 @@ void tst_QParallelAnimationGroup::pauseResume()
{
QParallelAnimationGroup group;
TestAnimation2 *anim = new TestAnimation2(250, &group); // 0, duration = 250;
QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy spy(anim, &TestAnimation::stateChanged);
QVERIFY(spy.isValid());
QCOMPARE(group.duration(), 250);
group.start();

View File

@ -230,9 +230,9 @@ void tst_QPropertyAnimation::statesAndSignals()
anim = new DummyPropertyAnimation;
anim->setDuration(100);
QSignalSpy finishedSpy(anim, SIGNAL(finished()));
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy currentLoopSpy(anim, SIGNAL(currentLoopChanged(int)));
QSignalSpy finishedSpy(anim, &QPropertyAnimation::finished);
QSignalSpy runningSpy(anim, &QPropertyAnimation::stateChanged);
QSignalSpy currentLoopSpy(anim, &QPropertyAnimation::currentLoopChanged);
QVERIFY(finishedSpy.isValid());
QVERIFY(runningSpy.isValid());
@ -311,8 +311,8 @@ void tst_QPropertyAnimation::deletion1()
QPointer<QPropertyAnimation> anim = new QPropertyAnimation(object, "minimumWidth");
//test that the animation is deleted correctly depending of the deletion flag passed in start()
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy finishedSpy(anim, SIGNAL(finished()));
QSignalSpy runningSpy(anim.data(), &QPropertyAnimation::stateChanged);
QSignalSpy finishedSpy(anim.data(), &QPropertyAnimation::finished);
QVERIFY(runningSpy.isValid());
QVERIFY(finishedSpy.isValid());
anim->setStartValue(10);
@ -355,8 +355,8 @@ void tst_QPropertyAnimation::deletion2()
anim->setEndValue(20);
anim->setDuration(200);
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy finishedSpy(anim, SIGNAL(finished()));
QSignalSpy runningSpy(anim.data(), &QPropertyAnimation::stateChanged);
QSignalSpy finishedSpy(anim.data(), &QPropertyAnimation::finished);
QVERIFY(runningSpy.isValid());
QVERIFY(finishedSpy.isValid());
@ -389,8 +389,8 @@ void tst_QPropertyAnimation::deletion3()
anim->setEndValue(20);
anim->setDuration(200);
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy finishedSpy(anim, SIGNAL(finished()));
QSignalSpy runningSpy(anim, &QPropertyAnimation::stateChanged);
QSignalSpy finishedSpy(anim, &QPropertyAnimation::finished);
QVERIFY(runningSpy.isValid());
QVERIFY(finishedSpy.isValid());
@ -490,7 +490,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning()
//normal case: the animation finishes and is deleted
QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole");
anim->setEndValue(100);
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy runningSpy(anim.data(), &QVariantAnimation::stateChanged);
QVERIFY(runningSpy.isValid());
anim->start(QVariantAnimation::DeleteWhenStopped);
QTest::qWait(anim->duration() + 100);
@ -501,7 +501,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning()
{
QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole");
anim->setEndValue(100);
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy runningSpy(anim.data(), &QVariantAnimation::stateChanged);
QVERIFY(runningSpy.isValid());
anim->start(QVariantAnimation::DeleteWhenStopped);
QTest::qWait(anim->duration()/2);
@ -850,7 +850,7 @@ void tst_QPropertyAnimation::setStartEndValues()
void tst_QPropertyAnimation::zeroDurationStart()
{
DummyPropertyAnimation anim;
QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy spy(&anim, &DummyPropertyAnimation::stateChanged);
QVERIFY(spy.isValid());
anim.setDuration(0);
QCOMPARE(anim.state(), QAbstractAnimation::Stopped);
@ -972,7 +972,7 @@ void tst_QPropertyAnimation::operationsInStates()
o.setProperty("ole", 42);
QPropertyAnimation anim(&o, "ole");
anim.setEndValue(100);
QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy spy(&anim, &QPropertyAnimation::stateChanged);
QVERIFY(spy.isValid());
anim.stop();
@ -1132,7 +1132,7 @@ void tst_QPropertyAnimation::valueChanged()
QPropertyAnimation anim(&o, "ole");
anim.setEndValue(5);
anim.setDuration(1000);
QSignalSpy spy(&anim, SIGNAL(valueChanged(QVariant)));
QSignalSpy spy(&anim, &QPropertyAnimation::valueChanged);
QVERIFY(spy.isValid());
anim.start();
@ -1263,8 +1263,8 @@ void tst_QPropertyAnimation::zeroLoopCount()
anim->setDuration(20);
anim->setLoopCount(0);
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy finishedSpy(anim, SIGNAL(finished()));
QSignalSpy runningSpy(anim, &QPropertyAnimation::stateChanged);
QSignalSpy finishedSpy(anim, &QPropertyAnimation::finished);
QVERIFY(runningSpy.isValid());
QVERIFY(finishedSpy.isValid());

View File

@ -637,8 +637,8 @@ void tst_QSequentialAnimationGroup::pauseAndResume()
sequence->addAnimation(a3_s_o1);
sequence->setLoopCount(2);
QSignalSpy a1StateChangedSpy(a1_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy seqStateChangedSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy a1StateChangedSpy(a1_s_o1, &QVariantAnimation::stateChanged);
QSignalSpy seqStateChangedSpy(sequence, &QAnimationGroup::stateChanged);
QVERIFY(a1StateChangedSpy.isValid());
QVERIFY(seqStateChangedSpy.isValid());
@ -744,8 +744,8 @@ void tst_QSequentialAnimationGroup::restart()
{
// sequence operating on same object/property
QAnimationGroup *sequence = new QSequentialAnimationGroup();
QSignalSpy seqCurrentAnimChangedSpy(sequence, SIGNAL(currentAnimationChanged(QAbstractAnimation*)));
QSignalSpy seqStateChangedSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy seqCurrentAnimChangedSpy(static_cast<QSequentialAnimationGroup*>(sequence), &QSequentialAnimationGroup::currentAnimationChanged);
QSignalSpy seqStateChangedSpy(sequence, &QAnimationGroup::stateChanged);
QVERIFY(seqCurrentAnimChangedSpy.isValid());
QVERIFY(seqStateChangedSpy.isValid());
@ -756,7 +756,7 @@ void tst_QSequentialAnimationGroup::restart()
for (int i = 0; i < 3; i++) {
anims[i] = new DummyPropertyAnimation;
anims[i]->setDuration(100);
animsStateChanged[i] = new QSignalSpy(anims[i], SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
animsStateChanged[i] = new QSignalSpy(anims[i], &QVariantAnimation::stateChanged);
QVERIFY(animsStateChanged[i]->isValid());
}
@ -816,10 +816,10 @@ void tst_QSequentialAnimationGroup::looping()
QAbstractAnimation *a2_s_o1 = new DummyPropertyAnimation;
QAbstractAnimation *a3_s_o1 = new DummyPropertyAnimation;
QSignalSpy a1Spy(a1_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy a2Spy(a2_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy a3Spy(a3_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy seqSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy a1Spy(a1_s_o1, &QAbstractAnimation::stateChanged);
QSignalSpy a2Spy(a2_s_o1, &QAbstractAnimation::stateChanged);
QSignalSpy a3Spy(a3_s_o1, &QAbstractAnimation::stateChanged);
QSignalSpy seqSpy(sequence, &QSequentialAnimationGroup::stateChanged);
QVERIFY(a1Spy.isValid());
QVERIFY(a2Spy.isValid());
@ -833,7 +833,7 @@ void tst_QSequentialAnimationGroup::looping()
sequence->setLoopCount(2);
QSequentialAnimationGroup group;
QSignalSpy groupSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy groupSpy(&group, &QSequentialAnimationGroup::stateChanged);
QVERIFY(groupSpy.isValid());
group.addAnimation(sequence);
@ -1101,8 +1101,8 @@ void tst_QSequentialAnimationGroup::updateChildrenWithRunningGroup()
anim.setEndValue(100);
anim.setDuration(200);
QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy childStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy groupStateChangedSpy(&group, &QSequentialAnimationGroup::stateChanged);
QSignalSpy childStateChangedSpy(&anim, &TestAnimation::stateChanged);
QVERIFY(groupStateChangedSpy.isValid());
QVERIFY(childStateChangedSpy.isValid());
@ -1268,8 +1268,8 @@ void tst_QSequentialAnimationGroup::startGroupWithRunningChild()
anim2->setEndValue(100);
anim2->setDuration(200);
QSignalSpy stateChangedSpy1(anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy stateChangedSpy2(anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy stateChangedSpy1(anim1, &TestAnimation::stateChanged);
QSignalSpy stateChangedSpy2(anim2, &TestAnimation::stateChanged);
QVERIFY(stateChangedSpy1.isValid());
QVERIFY(stateChangedSpy2.isValid());
@ -1345,7 +1345,7 @@ void tst_QSequentialAnimationGroup::zeroDurationAnimation()
anim3->setEndValue(100);
anim3->setDuration(0);
QSignalSpy stateChangedSpy(anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy stateChangedSpy(anim1, &TestAnimation::stateChanged);
QVERIFY(stateChangedSpy.isValid());
group.addAnimation(anim1);
@ -1417,7 +1417,7 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation()
//first we test a group with one uncontrolled animation
QSequentialAnimationGroup group;
UncontrolledAnimation notTimeDriven(&o1, &group);
QSignalSpy spy(&group, SIGNAL(finished()));
QSignalSpy spy(&group, &QSequentialAnimationGroup::finished);
QVERIFY(spy.isValid());
group.start();
@ -1437,7 +1437,7 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation()
// lets make sure the seeking will work again
spy.clear();
DummyPropertyAnimation anim(&group);
QSignalSpy animStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy animStateChangedSpy(&anim, &DummyPropertyAnimation::stateChanged);
QVERIFY(animStateChangedSpy.isValid());
group.setCurrentTime(300);
@ -1639,7 +1639,7 @@ void tst_QSequentialAnimationGroup::pauseResume()
QPropertyAnimation *anim = new QPropertyAnimation(&dummy, "foo", &group);
anim->setDuration(250);
anim->setEndValue(250);
QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
QSignalSpy spy(anim, &QPropertyAnimation::stateChanged);
QVERIFY(spy.isValid());
QCOMPARE(group.duration(), 250);
group.start();

View File

@ -138,7 +138,7 @@ void tst_QFileSystemWatcher::basicTest()
watcher.setObjectName(QLatin1String("_qt_autotest_force_engine_") + backend);
QVERIFY(watcher.addPath(testFile.fileName()));
QSignalSpy changedSpy(&watcher, SIGNAL(fileChanged(QString)));
QSignalSpy changedSpy(&watcher, &QFileSystemWatcher::fileChanged);
QVERIFY(changedSpy.isValid());
QEventLoop eventLoop;
QTimer timer;
@ -276,7 +276,7 @@ void tst_QFileSystemWatcher::watchDirectory()
watcher.setObjectName(QLatin1String("_qt_autotest_force_engine_") + backend);
QVERIFY(watcher.addPath(testDir.absolutePath()));
QSignalSpy changedSpy(&watcher, SIGNAL(directoryChanged(QString)));
QSignalSpy changedSpy(&watcher, &QFileSystemWatcher::directoryChanged);
QVERIFY(changedSpy.isValid());
QEventLoop eventLoop;
QTimer timer;
@ -436,8 +436,8 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
QVERIFY(watcher.addPath(testDir.absolutePath()));
QVERIFY(watcher.addPath(testFileName));
QSignalSpy fileChangedSpy(&watcher, SIGNAL(fileChanged(QString)));
QSignalSpy dirChangedSpy(&watcher, SIGNAL(directoryChanged(QString)));
QSignalSpy fileChangedSpy(&watcher, &QFileSystemWatcher::fileChanged);
QSignalSpy dirChangedSpy(&watcher, &QFileSystemWatcher::directoryChanged);
QVERIFY(fileChangedSpy.isValid());
QVERIFY(dirChangedSpy.isValid());
QEventLoop eventLoop;
@ -596,7 +596,7 @@ void tst_QFileSystemWatcher::QTBUG2331()
QVERIFY(watcher.addPath(temporaryDirectory.path()));
// watch signal
QSignalSpy changedSpy(&watcher, SIGNAL(directoryChanged(QString)));
QSignalSpy changedSpy(&watcher, &QFileSystemWatcher::directoryChanged);
QVERIFY(changedSpy.isValid());
// remove directory, we should get one change signal, and we should no longer
@ -675,7 +675,7 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved()
connect(&watcher, SIGNAL(fileChanged(QString)), &signalReceiver, SLOT(fileChanged(QString)));
// watch signals
QSignalSpy changedSpy(&watcher, SIGNAL(fileChanged(QString)));
QSignalSpy changedSpy(&watcher, &QFileSystemWatcher::fileChanged);
QVERIFY(changedSpy.isValid());
// move files to second directory

View File

@ -259,7 +259,7 @@ void tst_QProcess::simpleStart()
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
process = new QProcess;
QSignalSpy spy(process, SIGNAL(stateChanged(QProcess::ProcessState)));
QSignalSpy spy(process, &QProcess::stateChanged);
QVERIFY(spy.isValid());
connect(process, SIGNAL(readyRead()), this, SLOT(readFromProcess()));
@ -351,7 +351,7 @@ void tst_QProcess::crashTest()
{
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
process = new QProcess;
QSignalSpy stateSpy(process, SIGNAL(stateChanged(QProcess::ProcessState)));
QSignalSpy stateSpy(process, &QProcess::stateChanged);
QVERIFY(stateSpy.isValid());
process->start("testProcessCrash/testProcessCrash");
QVERIFY(process->waitForStarted(5000));
@ -359,8 +359,8 @@ void tst_QProcess::crashTest()
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError)));
QSignalSpy spy2(process, SIGNAL(finished(int,QProcess::ExitStatus)));
QSignalSpy spy(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
QSignalSpy spy2(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
QVERIFY(spy.isValid());
QVERIFY(spy2.isValid());
@ -394,8 +394,8 @@ void tst_QProcess::crashTest2()
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError)));
QSignalSpy spy2(process, SIGNAL(finished(int,QProcess::ExitStatus)));
QSignalSpy spy(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
QSignalSpy spy2(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
QVERIFY(spy.isValid());
QVERIFY(spy2.isValid());
@ -503,8 +503,8 @@ void tst_QProcess::echoTest2()
QCOMPARE(process->error(), QProcess::Timedout);
process->write("Hello");
QSignalSpy spy1(process, SIGNAL(readyReadStandardOutput()));
QSignalSpy spy2(process, SIGNAL(readyReadStandardError()));
QSignalSpy spy1(process, &QProcess::readyReadStandardOutput);
QSignalSpy spy2(process, &QProcess::readyReadStandardError);
QVERIFY(spy1.isValid());
QVERIFY(spy2.isValid());
@ -685,7 +685,7 @@ void tst_QProcess::readTimeoutAndThenCrash()
QCOMPARE(process->error(), QProcess::Timedout);
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError)));
QSignalSpy spy(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
QVERIFY(spy.isValid());
process->kill();
@ -887,7 +887,7 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
QProcess proc;
connect(&proc, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
QSignalSpy spy(&proc, SIGNAL(readyRead()));
QSignalSpy spy(&proc, &QProcess::readyRead);
QVERIFY(spy.isValid());
proc.start("testProcessEcho/testProcessEcho");
@ -1283,7 +1283,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot()
process->start("testProcessEcho/testProcessEcho");
QVERIFY(process->waitForStarted(5000));
QSignalSpy spy(process, SIGNAL(readyRead()));
QSignalSpy spy(process, &QProcess::readyRead);
QVERIFY(spy.isValid());
process->write("foo");
QTestEventLoop::instance().enterLoop(30);
@ -1323,7 +1323,7 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
process->start("testProcessEcho/testProcessEcho");
QVERIFY(process->waitForStarted(5000));
QSignalSpy spy(process, SIGNAL(bytesWritten(qint64)));
QSignalSpy spy(process, &QProcess::bytesWritten);
QVERIFY(spy.isValid());
process->write("f");
QTestEventLoop::instance().enterLoop(30);
@ -1538,10 +1538,10 @@ void tst_QProcess::failToStart()
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
QProcess process;
QSignalSpy stateSpy(&process, SIGNAL(stateChanged(QProcess::ProcessState)));
QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError)));
QSignalSpy finishedSpy(&process, SIGNAL(finished(int)));
QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
QSignalSpy stateSpy(&process, &QProcess::stateChanged);
QSignalSpy errorSpy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
QSignalSpy finishedSpy(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
QVERIFY(stateSpy.isValid());
QVERIFY(errorSpy.isValid());
@ -1605,9 +1605,9 @@ void tst_QProcess::failToStartWithWait()
QProcess process;
QEventLoop loop;
QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError)));
QSignalSpy finishedSpy(&process, SIGNAL(finished(int)));
QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
QSignalSpy errorSpy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
QSignalSpy finishedSpy(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
QVERIFY(errorSpy.isValid());
QVERIFY(finishedSpy.isValid());
@ -1632,9 +1632,9 @@ void tst_QProcess::failToStartWithEventLoop()
QProcess process;
QEventLoop loop;
QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError)));
QSignalSpy finishedSpy(&process, SIGNAL(finished(int)));
QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
QSignalSpy errorSpy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
QSignalSpy finishedSpy(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
QVERIFY(errorSpy.isValid());
QVERIFY(finishedSpy.isValid());
@ -1864,9 +1864,9 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
QProcess process;
QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError)));
QSignalSpy finishedSpy1(&process, SIGNAL(finished(int)));
QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
QSignalSpy errorSpy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
QSignalSpy finishedSpy1(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
QVERIFY(errorSpy.isValid());
QVERIFY(finishedSpy1.isValid());
@ -2202,7 +2202,7 @@ void tst_QProcess::invalidProgramString()
QProcess process;
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
QSignalSpy spy(&process, SIGNAL(error(QProcess::ProcessError)));
QSignalSpy spy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
QVERIFY(spy.isValid());
process.start(programString);
@ -2218,8 +2218,8 @@ void tst_QProcess::onlyOneStartedSignal()
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
QProcess process;
QSignalSpy spyStarted(&process, SIGNAL(started()));
QSignalSpy spyFinished(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
QSignalSpy spyStarted(&process, &QProcess::started);
QSignalSpy spyFinished(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
QVERIFY(spyStarted.isValid());
QVERIFY(spyFinished.isValid());

View File

@ -158,6 +158,8 @@ public:
QVector<QVector<QString> > table;
};
Q_DECLARE_METATYPE(QAbstractItemModel::LayoutChangeHint);
QtTestModel::QtTestModel(int rows, int columns, QObject *parent)
: QAbstractItemModel(parent), cCount(columns), rCount(rows), wrongIndex(false)
{
@ -353,6 +355,8 @@ void tst_QAbstractItemModel::init()
insertCommand->setStartRow(0);
insertCommand->setEndRow(9);
insertCommand->doCommand();
qRegisterMetaType<QAbstractItemModel::LayoutChangeHint>();
}
void tst_QAbstractItemModel::cleanup()
@ -807,8 +811,8 @@ void tst_QAbstractItemModel::removeRows()
{
QtTestModel model(10, 10);
QSignalSpy rowsAboutToBeRemovedSpy(&model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
QSignalSpy rowsRemovedSpy(&model, SIGNAL(rowsRemoved(QModelIndex,int,int)));
QSignalSpy rowsAboutToBeRemovedSpy(&model, &QtTestModel::rowsAboutToBeRemoved);
QSignalSpy rowsRemovedSpy(&model, &QtTestModel::rowsRemoved);
QVERIFY(rowsAboutToBeRemovedSpy.isValid());
QVERIFY(rowsRemovedSpy.isValid());
@ -822,8 +826,8 @@ void tst_QAbstractItemModel::removeColumns()
{
QtTestModel model(10, 10);
QSignalSpy columnsAboutToBeRemovedSpy(&model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)));
QSignalSpy columnsRemovedSpy(&model, SIGNAL(columnsRemoved(QModelIndex,int,int)));
QSignalSpy columnsAboutToBeRemovedSpy(&model, &QtTestModel::columnsAboutToBeRemoved);
QSignalSpy columnsRemovedSpy(&model, &QtTestModel::columnsRemoved);
QVERIFY(columnsAboutToBeRemovedSpy.isValid());
QVERIFY(columnsRemovedSpy.isValid());
@ -837,8 +841,8 @@ void tst_QAbstractItemModel::insertRows()
{
QtTestModel model(10, 10);
QSignalSpy rowsAboutToBeInsertedSpy(&model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
QSignalSpy rowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex,int,int)));
QSignalSpy rowsAboutToBeInsertedSpy(&model, &QtTestModel::rowsAboutToBeInserted);
QSignalSpy rowsInsertedSpy(&model, &QtTestModel::rowsInserted);
QVERIFY(rowsAboutToBeInsertedSpy.isValid());
QVERIFY(rowsInsertedSpy.isValid());
@ -852,8 +856,8 @@ void tst_QAbstractItemModel::insertColumns()
{
QtTestModel model(10, 10);
QSignalSpy columnsAboutToBeInsertedSpy(&model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)));
QSignalSpy columnsInsertedSpy(&model, SIGNAL(columnsInserted(QModelIndex,int,int)));
QSignalSpy columnsAboutToBeInsertedSpy(&model, &QtTestModel::columnsAboutToBeInserted);
QSignalSpy columnsInsertedSpy(&model, &QtTestModel::columnsInserted);
QVERIFY(columnsAboutToBeInsertedSpy.isValid());
QVERIFY(columnsInsertedSpy.isValid());
@ -867,8 +871,8 @@ void tst_QAbstractItemModel::moveRows()
{
QtTestModel model(10, 10);
QSignalSpy rowsAboutToBeMovedSpy(&model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy rowsMovedSpy(&model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy rowsAboutToBeMovedSpy(&model, &QtTestModel::rowsAboutToBeMoved);
QSignalSpy rowsMovedSpy(&model, &QtTestModel::rowsMoved);
QVERIFY(rowsAboutToBeMovedSpy.isValid());
QVERIFY(rowsMovedSpy.isValid());
@ -882,8 +886,8 @@ void tst_QAbstractItemModel::moveColumns()
{
QtTestModel model(10, 10);
QSignalSpy columnsAboutToBeMovedSpy(&model, SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy columnsMovedSpy(&model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy columnsAboutToBeMovedSpy(&model, &QtTestModel::columnsAboutToBeMoved);
QSignalSpy columnsMovedSpy(&model, &QtTestModel::columnsMoved);
QVERIFY(columnsAboutToBeMovedSpy.isValid());
QVERIFY(columnsMovedSpy.isValid());
@ -901,7 +905,7 @@ void tst_QAbstractItemModel::reset()
{
QtTestModel model(10, 10);
QSignalSpy resetSpy(&model, SIGNAL(modelReset()));
QSignalSpy resetSpy(&model, &QtTestModel::modelReset);
QVERIFY(resetSpy.isValid());
model.reset();
QCOMPARE(resetSpy.count(), 1);
@ -1023,8 +1027,8 @@ void tst_QAbstractItemModel::testMoveSameParentDown()
}
}
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@ -1138,8 +1142,8 @@ void tst_QAbstractItemModel::testMoveSameParentUp()
}
}
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@ -1287,8 +1291,8 @@ void tst_QAbstractItemModel::testMoveToGrandParent()
}
}
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@ -1427,8 +1431,8 @@ void tst_QAbstractItemModel::testMoveToSibling()
persistentList << QPersistentModelIndex(idx);
}
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@ -1577,8 +1581,8 @@ void tst_QAbstractItemModel::testMoveToUncle()
persistentList << QPersistentModelIndex(idx);
}
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@ -1684,8 +1688,8 @@ void tst_QAbstractItemModel::testMoveToDescendants()
persistentList << QPersistentModelIndex(idx);
}
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@ -1748,8 +1752,8 @@ void tst_QAbstractItemModel::testMoveWithinOwnRange()
QFETCH(int, endRow);
QFETCH(int, destRow);
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@ -1841,8 +1845,8 @@ void ListenerObject::slotReset()
void tst_QAbstractItemModel::testReset()
{
QSignalSpy beforeResetSpy(m_model, SIGNAL(modelAboutToBeReset()));
QSignalSpy afterResetSpy(m_model, SIGNAL(modelReset()));
QSignalSpy beforeResetSpy(m_model, &DynamicTreeModel::modelAboutToBeReset);
QSignalSpy afterResetSpy(m_model, &DynamicTreeModel::modelReset);
QVERIFY(beforeResetSpy.isValid());
QVERIFY(afterResetSpy.isValid());
@ -1874,8 +1878,8 @@ void tst_QAbstractItemModel::testReset()
// Delete it because its slots test things which are not true after this point.
delete listener;
QSignalSpy proxyBeforeResetSpy(nullProxy, SIGNAL(modelAboutToBeReset()));
QSignalSpy proxyAfterResetSpy(nullProxy, SIGNAL(modelReset()));
QSignalSpy proxyBeforeResetSpy(nullProxy, &QSortFilterProxyModel::modelAboutToBeReset);
QSignalSpy proxyAfterResetSpy(nullProxy, &QSortFilterProxyModel::modelReset);
// Before setting it, it does not have custom roles.
QCOMPARE(nullProxy->roleNames().value(Qt::UserRole + 1), QByteArray());
@ -1925,8 +1929,8 @@ void tst_QAbstractItemModel::testDataChanged()
{
CustomRoleModel model;
QSignalSpy withRoles(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
QSignalSpy withoutRoles(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
QSignalSpy withRoles(&model, &CustomRoleModel::dataChanged);
QSignalSpy withoutRoles(&model, &CustomRoleModel::dataChanged);
QVERIFY(withRoles.isValid());
QVERIFY(withoutRoles.isValid());
@ -2027,8 +2031,8 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged()
QCOMPARE(model.rowCount(p1), 10);
QCOMPARE(model.rowCount(p2), 10);
QSignalSpy beforeSpy(&model, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
QSignalSpy afterSpy(&model, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
QSignalSpy beforeSpy(&model, &DynamicTreeModel::layoutAboutToBeChanged);
QSignalSpy afterSpy(&model, &DynamicTreeModel::layoutChanged);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@ -2043,8 +2047,8 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged()
const QVariantList beforeSignal = beforeSpy.first();
const QVariantList afterSignal = afterSpy.first();
QCOMPARE(beforeSignal.size(), 1);
QCOMPARE(afterSignal.size(), 1);
QCOMPARE(beforeSignal.size(), 2);
QCOMPARE(afterSignal.size(), 2);
const QList<QPersistentModelIndex> beforeParents = beforeSignal.first().value<QList<QPersistentModelIndex> >();
QCOMPARE(beforeParents.size(), 2);
@ -2093,8 +2097,8 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged()
const QPersistentModelIndex p2FirstPersistent = model.index(0, 0, p2);
const QPersistentModelIndex p2LastPersistent = model.index(9, 0, p2);
QSignalSpy beforeSpy(&model, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
QSignalSpy afterSpy(&model, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
QSignalSpy beforeSpy(&model, &DynamicTreeModel::layoutAboutToBeChanged);
QSignalSpy afterSpy(&model, &DynamicTreeModel::layoutChanged);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@ -2116,8 +2120,8 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged()
const QVariantList beforeSignal = beforeSpy.first();
const QVariantList afterSignal = afterSpy.first();
QCOMPARE(beforeSignal.size(), 1);
QCOMPARE(afterSignal.size(), 1);
QCOMPARE(beforeSignal.size(), 2);
QCOMPARE(afterSignal.size(), 2);
QVERIFY(p1FirstPersistent.row() == 1);
QVERIFY(p1LastPersistent.row() == 0);

View File

@ -163,10 +163,10 @@ void tst_QIdentityProxyModel::insertRows()
verifyIdentity(m_model);
QSignalSpy modelBeforeSpy(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
QSignalSpy modelAfterSpy(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)));
QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
QSignalSpy modelBeforeSpy(m_model, &QStandardItemModel::rowsAboutToBeInserted);
QSignalSpy modelAfterSpy(m_model, &QStandardItemModel::rowsInserted);
QSignalSpy proxyBeforeSpy(m_proxy, &QStandardItemModel::rowsAboutToBeInserted);
QSignalSpy proxyAfterSpy(m_proxy, &QStandardItemModel::rowsInserted);
QVERIFY(modelBeforeSpy.isValid());
QVERIFY(modelAfterSpy.isValid());
@ -203,10 +203,10 @@ void tst_QIdentityProxyModel::removeRows()
verifyIdentity(m_model);
QSignalSpy modelBeforeSpy(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
QSignalSpy modelAfterSpy(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)));
QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
QSignalSpy modelBeforeSpy(m_model, &QStandardItemModel::rowsAboutToBeRemoved);
QSignalSpy modelAfterSpy(m_model, &QStandardItemModel::rowsRemoved);
QSignalSpy proxyBeforeSpy(m_proxy, &QStandardItemModel::rowsAboutToBeRemoved);
QSignalSpy proxyAfterSpy(m_proxy, &QStandardItemModel::rowsRemoved);
QVERIFY(modelBeforeSpy.isValid());
QVERIFY(modelAfterSpy.isValid());
@ -257,10 +257,10 @@ void tst_QIdentityProxyModel::moveRows()
verifyIdentity(&model);
QSignalSpy modelBeforeSpy(&model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy modelAfterSpy(&model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy modelBeforeSpy(&model, &DynamicTreeModel::rowsAboutToBeMoved);
QSignalSpy modelAfterSpy(&model, &DynamicTreeModel::rowsMoved);
QSignalSpy proxyBeforeSpy(m_proxy, &QIdentityProxyModel::rowsAboutToBeMoved);
QSignalSpy proxyAfterSpy(m_proxy, &QIdentityProxyModel::rowsMoved);
QVERIFY(modelBeforeSpy.isValid());
QVERIFY(modelAfterSpy.isValid());
@ -318,10 +318,10 @@ void tst_QIdentityProxyModel::reset()
verifyIdentity(&model);
QSignalSpy modelBeforeSpy(&model, SIGNAL(modelAboutToBeReset()));
QSignalSpy modelAfterSpy(&model, SIGNAL(modelReset()));
QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(modelAboutToBeReset()));
QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(modelReset()));
QSignalSpy modelBeforeSpy(&model, &DynamicTreeModel::modelAboutToBeReset);
QSignalSpy modelAfterSpy(&model, &DynamicTreeModel::modelReset);
QSignalSpy proxyBeforeSpy(m_proxy, &QIdentityProxyModel::modelAboutToBeReset);
QSignalSpy proxyAfterSpy(m_proxy, &QIdentityProxyModel::modelReset);
QVERIFY(modelBeforeSpy.isValid());
QVERIFY(modelAfterSpy.isValid());
@ -351,8 +351,8 @@ void tst_QIdentityProxyModel::dataChanged()
verifyIdentity(&model);
QSignalSpy modelSpy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
QSignalSpy proxySpy(m_proxy, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
QSignalSpy modelSpy(&model, &DataChangedModel::dataChanged);
QSignalSpy proxySpy(m_proxy, &QIdentityProxyModel::dataChanged);
QVERIFY(modelSpy.isValid());
QVERIFY(proxySpy.isValid());

View File

@ -608,7 +608,7 @@ void tst_QItemModel::setData()
QFETCH(QString, modelType);
currentModel = testModels->createModel(modelType);
QVERIFY(currentModel);
QSignalSpy spy(currentModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
QSignalSpy spy(currentModel, &QAbstractItemModel::dataChanged);
QVERIFY(spy.isValid());
QCOMPARE(currentModel->setData(QModelIndex(), QVariant()), false);
QCOMPARE(spy.count(), 0);
@ -670,7 +670,7 @@ void tst_QItemModel::setHeaderData()
QVERIFY(index.isValid());
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
QSignalSpy spy(currentModel, SIGNAL(headerDataChanged(Qt::Orientation,int,int)));
QSignalSpy spy(currentModel, &QAbstractItemModel::headerDataChanged);
QVERIFY(spy.isValid());
QString text = "Index private pointers should always be the same";
@ -711,7 +711,7 @@ void tst_QItemModel::sort()
QVERIFY(currentModel->hasChildren(topIndex));
QModelIndex index = currentModel->index(0, 0, topIndex);
QVERIFY(index.isValid());
QSignalSpy spy(currentModel, SIGNAL(layoutChanged()));
QSignalSpy spy(currentModel, &QAbstractItemModel::layoutChanged);
QVERIFY(spy.isValid());
for (int i=-1; i < 10; ++i){
currentModel->sort(i);
@ -849,12 +849,12 @@ void tst_QItemModel::remove()
// When a row or column is removed there should be two signals.
// Watch to make sure they are emitted and get the row/column count when they do get emitted by connecting them to a slot
QSignalSpy columnsAboutToBeRemovedSpy(currentModel, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)));
QSignalSpy rowsAboutToBeRemovedSpy(currentModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
QSignalSpy columnsRemovedSpy(currentModel, SIGNAL(columnsRemoved(QModelIndex,int,int)));
QSignalSpy rowsRemovedSpy(currentModel, SIGNAL(rowsRemoved(QModelIndex,int,int)));
QSignalSpy modelResetSpy(currentModel, SIGNAL(modelReset()));
QSignalSpy modelLayoutChangedSpy(currentModel, SIGNAL(layoutChanged()));
QSignalSpy columnsAboutToBeRemovedSpy(currentModel, &QAbstractItemModel::columnsAboutToBeRemoved);
QSignalSpy rowsAboutToBeRemovedSpy(currentModel, &QAbstractItemModel::rowsAboutToBeRemoved);
QSignalSpy columnsRemovedSpy(currentModel, &QAbstractItemModel::columnsRemoved);
QSignalSpy rowsRemovedSpy(currentModel, &QAbstractItemModel::rowsRemoved);
QSignalSpy modelResetSpy(currentModel, &QAbstractItemModel::modelReset);
QSignalSpy modelLayoutChangedSpy(currentModel, &QAbstractItemModel::layoutChanged);
QVERIFY(columnsAboutToBeRemovedSpy.isValid());
QVERIFY(rowsAboutToBeRemovedSpy.isValid());
@ -1191,12 +1191,12 @@ void tst_QItemModel::insert()
// When a row or column is inserted there should be two signals.
// Watch to make sure they are emitted and get the row/column count when they do get emitted by connecting them to a slot
QSignalSpy columnsAboutToBeInsertedSpy(currentModel, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)));
QSignalSpy rowsAboutToBeInsertedSpy(currentModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
QSignalSpy columnsInsertedSpy(currentModel, SIGNAL(columnsInserted(QModelIndex,int,int)));
QSignalSpy rowsInsertedSpy(currentModel, SIGNAL(rowsInserted(QModelIndex,int,int)));
QSignalSpy modelResetSpy(currentModel, SIGNAL(modelReset()));
QSignalSpy modelLayoutChangedSpy(currentModel, SIGNAL(layoutChanged()));
QSignalSpy columnsAboutToBeInsertedSpy(currentModel, &QAbstractItemModel::columnsAboutToBeInserted);
QSignalSpy rowsAboutToBeInsertedSpy(currentModel, &QAbstractItemModel::rowsAboutToBeInserted);
QSignalSpy columnsInsertedSpy(currentModel, &QAbstractItemModel::columnsInserted);
QSignalSpy rowsInsertedSpy(currentModel, &QAbstractItemModel::rowsInserted);
QSignalSpy modelResetSpy(currentModel, &QAbstractItemModel::modelReset);
QSignalSpy modelLayoutChangedSpy(currentModel, &QAbstractItemModel::layoutChanged);
QVERIFY(columnsAboutToBeInsertedSpy.isValid());
QVERIFY(rowsAboutToBeInsertedSpy.isValid());

View File

@ -1529,7 +1529,7 @@ void tst_QItemSelectionModel::resetModel()
MyStandardItemModel model(20, 20);
QItemSelectionModel *selectionModel = new QItemSelectionModel(&model);
QSignalSpy spy(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
QSignalSpy spy(selectionModel, &QItemSelectionModel::selectionChanged);
QVERIFY(spy.isValid());
selectionModel->select(QItemSelection(model.index(0, 0), model.index(5, 5)), QItemSelectionModel::Select);
@ -1592,7 +1592,7 @@ void tst_QItemSelectionModel::removeRows()
MyStandardItemModel model(rowCount, columnCount);
QItemSelectionModel selections(&model);
QSignalSpy spy(&selections, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
QSignalSpy spy(&selections, &QItemSelectionModel::selectionChanged);
QVERIFY(spy.isValid());
QModelIndex tl = model.index(selectTop, selectLeft);
@ -1655,7 +1655,7 @@ void tst_QItemSelectionModel::removeColumns()
MyStandardItemModel model(rowCount, columnCount);
QItemSelectionModel selections(&model);
QSignalSpy spy(&selections, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
QSignalSpy spy(&selections, &QItemSelectionModel::selectionChanged);
QVERIFY(spy.isValid());
QModelIndex tl = model.index(selectTop, selectLeft);
@ -1914,12 +1914,9 @@ void tst_QItemSelectionModel::setCurrentIndex()
treemodel->index(0, 0, treemodel->index(0, 0)),
QItemSelectionModel::SelectCurrent);
QSignalSpy currentSpy(&selectionModel,
SIGNAL(currentChanged(QModelIndex,QModelIndex)));
QSignalSpy rowSpy(&selectionModel,
SIGNAL(currentRowChanged(QModelIndex,QModelIndex)));
QSignalSpy columnSpy(&selectionModel,
SIGNAL(currentColumnChanged(QModelIndex,QModelIndex)));
QSignalSpy currentSpy(&selectionModel, &QItemSelectionModel::currentChanged);
QSignalSpy rowSpy(&selectionModel, &QItemSelectionModel::currentRowChanged);
QSignalSpy columnSpy(&selectionModel, &QItemSelectionModel::currentColumnChanged);
QVERIFY(currentSpy.isValid());
QVERIFY(rowSpy.isValid());
@ -2223,7 +2220,7 @@ void tst_QItemSelectionModel::childrenDeselectionSignal()
QItemSelectionModel selectionModel(&model);
selectionModel.select(sel, QItemSelectionModel::SelectCurrent);
QSignalSpy deselectSpy(&selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
QSignalSpy deselectSpy(&selectionModel, &QItemSelectionModel::selectionChanged);
QVERIFY(deselectSpy.isValid());
model.removeRows(0, 1, root);
QVERIFY(deselectSpy.count() == 1);
@ -2406,7 +2403,7 @@ void tst_QItemSelectionModel::deselectRemovedMiddleRange()
RemovalObserver ro(&selModel);
QSignalSpy spy(&selModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
QSignalSpy spy(&selModel, &QItemSelectionModel::selectionChanged);
QVERIFY(spy.isValid());
bool ok = model.removeRows(4, 2);
@ -2738,7 +2735,7 @@ void tst_QItemSelectionModel::testClearCurrentIndex()
QItemSelectionModel selectionModel(&model, 0);
QSignalSpy currentIndexSpy(&selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)));
QSignalSpy currentIndexSpy(&selectionModel, &QItemSelectionModel::currentChanged);
QVERIFY(currentIndexSpy.isValid());
QModelIndex firstIndex = model.index(0, 0);

View File

@ -159,6 +159,8 @@ private:
QSortFilterProxyModel *m_proxy;
};
Q_DECLARE_METATYPE(QAbstractItemModel::LayoutChangeHint)
// Testing get/set functions
void tst_QSortFilterProxyModel::getSetCheck()
{
@ -177,6 +179,7 @@ void tst_QSortFilterProxyModel::getSetCheck()
tst_QSortFilterProxyModel::tst_QSortFilterProxyModel()
: m_model(0), m_proxy(0)
{
qRegisterMetaType<QAbstractItemModel::LayoutChangeHint>();
}
void tst_QSortFilterProxyModel::initTestCase()
@ -1472,7 +1475,7 @@ void tst_QSortFilterProxyModel::filterCurrent()
view.show();
view.setModel(&proxy);
QSignalSpy spy(view.selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)));
QSignalSpy spy(view.selectionModel(), &QItemSelectionModel::currentChanged);
QVERIFY(spy.isValid());
view.setCurrentIndex(proxy.index(0, 0));
@ -1620,10 +1623,10 @@ void tst_QSortFilterProxyModel::removeSourceRows()
proxy.sort(0, static_cast<Qt::SortOrder>(sortOrder));
(void)proxy.rowCount(QModelIndex()); // force mapping
QSignalSpy removeSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
QSignalSpy insertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
QSignalSpy aboutToRemoveSpy(&proxy, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
QSignalSpy aboutToInsertSpy(&proxy, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
QSignalSpy removeSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
QSignalSpy insertSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
QSignalSpy aboutToRemoveSpy(&proxy, &QSortFilterProxyModel::rowsAboutToBeRemoved);
QSignalSpy aboutToInsertSpy(&proxy, &QSortFilterProxyModel::rowsAboutToBeInserted);
QVERIFY(removeSpy.isValid());
QVERIFY(insertSpy.isValid());
@ -1801,8 +1804,8 @@ void tst_QSortFilterProxyModel::changeFilter()
proxy.sort(0, static_cast<Qt::SortOrder>(sortOrder));
(void)proxy.rowCount(QModelIndex()); // force mapping
QSignalSpy initialRemoveSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
QSignalSpy initialInsertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
QSignalSpy initialRemoveSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
QSignalSpy initialInsertSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
QVERIFY(initialRemoveSpy.isValid());
QVERIFY(initialInsertSpy.isValid());
@ -1825,8 +1828,8 @@ void tst_QSortFilterProxyModel::changeFilter()
QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), initialProxyItems.at(i));
}
QSignalSpy finalRemoveSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
QSignalSpy finalInsertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
QSignalSpy finalRemoveSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
QSignalSpy finalInsertSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
QVERIFY(finalRemoveSpy.isValid());
QVERIFY(finalInsertSpy.isValid());
@ -1976,8 +1979,8 @@ void tst_QSortFilterProxyModel::changeSourceData()
proxy.setFilterRegExp(filter);
QSignalSpy removeSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
QSignalSpy insertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
QSignalSpy removeSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
QSignalSpy insertSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
QVERIFY(removeSpy.isValid());
QVERIFY(insertSpy.isValid());
@ -2075,7 +2078,7 @@ void tst_QSortFilterProxyModel::selectionFilteredOut()
view.show();
view.setModel(&proxy);
QSignalSpy spy(view.selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)));
QSignalSpy spy(view.selectionModel(), &QItemSelectionModel::currentChanged);
QVERIFY(spy.isValid());
view.setCurrentIndex(proxy.index(0, 0));
@ -2190,8 +2193,8 @@ void tst_QSortFilterProxyModel::insertIntoChildrenlessItem()
QSortFilterProxyModel proxy;
proxy.setSourceModel(&model);
QSignalSpy colsInsertedSpy(&proxy, SIGNAL(columnsInserted(QModelIndex,int,int)));
QSignalSpy rowsInsertedSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
QSignalSpy colsInsertedSpy(&proxy, &QSortFilterProxyModel::columnsInserted);
QSignalSpy rowsInsertedSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
QVERIFY(colsInsertedSpy.isValid());
QVERIFY(rowsInsertedSpy.isValid());
@ -2270,7 +2273,7 @@ void tst_QSortFilterProxyModel::insertRowIntoFilteredParent()
EvenOddFilterModel proxy;
proxy.setSourceModel(&model);
QSignalSpy spy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
QSignalSpy spy(&proxy, &EvenOddFilterModel::rowsInserted);
QVERIFY(spy.isValid());
QStandardItem *itemA = new QStandardItem();
@ -2299,8 +2302,8 @@ void tst_QSortFilterProxyModel::filterOutParentAndFilterInChild()
QStandardItem *itemC = new QStandardItem("C");
itemA->appendRow(itemC); // filtered
QSignalSpy removedSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
QSignalSpy insertedSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
QSignalSpy removedSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
QSignalSpy insertedSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
QVERIFY(removedSpy.isValid());
QVERIFY(insertedSpy.isValid());
@ -2903,8 +2906,8 @@ void tst_QSortFilterProxyModel::appearsAndSort()
QCOMPARE(sourceModel.rowCount(), 3);
QCOMPARE(proxyModel.rowCount(), 0); //all rows are hidden at first;
QSignalSpy spyAbout1(&proxyModel, SIGNAL(layoutAboutToBeChanged()));
QSignalSpy spyChanged1(&proxyModel, SIGNAL(layoutChanged()));
QSignalSpy spyAbout1(&proxyModel, &PModel::layoutAboutToBeChanged);
QSignalSpy spyChanged1(&proxyModel, &PModel::layoutChanged);
QVERIFY(spyAbout1.isValid());
QVERIFY(spyChanged1.isValid());
@ -2915,8 +2918,8 @@ void tst_QSortFilterProxyModel::appearsAndSort()
secondProxyModel.setDynamicSortFilter(true);
secondProxyModel.sort(0, Qt::DescendingOrder);
QCOMPARE(secondProxyModel.rowCount(), 0); //all rows are hidden at first;
QSignalSpy spyAbout2(&secondProxyModel, SIGNAL(layoutAboutToBeChanged()));
QSignalSpy spyChanged2(&secondProxyModel, SIGNAL(layoutChanged()));
QSignalSpy spyAbout2(&secondProxyModel, &QSortFilterProxyModel::layoutAboutToBeChanged);
QSignalSpy spyChanged2(&secondProxyModel, &QSortFilterProxyModel::layoutChanged);
QVERIFY(spyAbout2.isValid());
QVERIFY(spyChanged2.isValid());
@ -3443,25 +3446,25 @@ void tst_QSortFilterProxyModel::testParentLayoutChanged()
proxy2.setSourceModel(&proxy);
proxy2.setObjectName("proxy2");
QSignalSpy dataChangedSpy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
QSignalSpy dataChangedSpy(&model, &QSortFilterProxyModel::dataChanged);
QVERIFY(dataChangedSpy.isValid());
// Verify that the no-arg signal is still emitted.
QSignalSpy layoutAboutToBeChangedSpy(&proxy, SIGNAL(layoutAboutToBeChanged()));
QSignalSpy layoutChangedSpy(&proxy, SIGNAL(layoutChanged()));
QSignalSpy layoutAboutToBeChangedSpy(&proxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
QSignalSpy layoutChangedSpy(&proxy, &QSortFilterProxyModel::layoutChanged);
QVERIFY(layoutAboutToBeChangedSpy.isValid());
QVERIFY(layoutChangedSpy.isValid());
QSignalSpy parentsAboutToBeChangedSpy(&proxy, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
QSignalSpy parentsChangedSpy(&proxy, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
QSignalSpy parentsAboutToBeChangedSpy(&proxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
QSignalSpy parentsChangedSpy(&proxy, &QSortFilterProxyModel::layoutChanged);
QVERIFY(parentsAboutToBeChangedSpy.isValid());
QVERIFY(parentsChangedSpy.isValid());
QSignalSpy proxy2ParentsAboutToBeChangedSpy(&proxy2, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
QSignalSpy proxy2ParentsChangedSpy(&proxy2, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
QSignalSpy proxy2ParentsAboutToBeChangedSpy(&proxy2, &QSortFilterProxyModel::layoutAboutToBeChanged);
QSignalSpy proxy2ParentsChangedSpy(&proxy2, &QSortFilterProxyModel::layoutChanged);
QVERIFY(proxy2ParentsAboutToBeChangedSpy.isValid());
QVERIFY(proxy2ParentsChangedSpy.isValid());
@ -3484,8 +3487,8 @@ void tst_QSortFilterProxyModel::testParentLayoutChanged()
QVariantList beforeSignal = parentsAboutToBeChangedSpy.first();
QVariantList afterSignal = parentsChangedSpy.first();
QCOMPARE(beforeSignal.size(), 1);
QCOMPARE(afterSignal.size(), 1);
QCOMPARE(beforeSignal.size(), 2);
QCOMPARE(afterSignal.size(), 2);
QList<QPersistentModelIndex> beforeParents = beforeSignal.first().value<QList<QPersistentModelIndex> >();
QList<QPersistentModelIndex> afterParents = afterSignal.first().value<QList<QPersistentModelIndex> >();
@ -3620,16 +3623,16 @@ void tst_QSortFilterProxyModel::moveSourceRows()
filterBothProxy.setSourceModel(&proxy);
filterBothProxy.setFilterRegExp("5"); // The parents are 6 and 3. This filters both out.
QSignalSpy modelBeforeSpy(&model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy modelAfterSpy(&model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy proxyBeforeMoveSpy(m_proxy, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy proxyAfterMoveSpy(m_proxy, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy proxyBeforeParentLayoutSpy(&proxy, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
QSignalSpy proxyAfterParentLayoutSpy(&proxy, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
QSignalSpy filterBeforeParentLayoutSpy(&filterProxy, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
QSignalSpy filterAfterParentLayoutSpy(&filterProxy, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
QSignalSpy filterBothBeforeParentLayoutSpy(&filterBothProxy, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
QSignalSpy filterBothAfterParentLayoutSpy(&filterBothProxy, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
QSignalSpy modelBeforeSpy(&model, &DynamicTreeModel::rowsAboutToBeMoved);
QSignalSpy modelAfterSpy(&model, &DynamicTreeModel::rowsMoved);
QSignalSpy proxyBeforeMoveSpy(m_proxy, &QSortFilterProxyModel::rowsAboutToBeMoved);
QSignalSpy proxyAfterMoveSpy(m_proxy, &QSortFilterProxyModel::rowsMoved);
QSignalSpy proxyBeforeParentLayoutSpy(&proxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
QSignalSpy proxyAfterParentLayoutSpy(&proxy, &QSortFilterProxyModel::layoutChanged);
QSignalSpy filterBeforeParentLayoutSpy(&filterProxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
QSignalSpy filterAfterParentLayoutSpy(&filterProxy, &QSortFilterProxyModel::layoutChanged);
QSignalSpy filterBothBeforeParentLayoutSpy(&filterBothProxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
QSignalSpy filterBothAfterParentLayoutSpy(&filterBothProxy, &QSortFilterProxyModel::layoutChanged);
QVERIFY(modelBeforeSpy.isValid());
QVERIFY(modelAfterSpy.isValid());

View File

@ -195,8 +195,8 @@ protected:
void tst_QEventLoop::processEvents()
{
QSignalSpy aboutToBlockSpy(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()));
QSignalSpy awakeSpy(QAbstractEventDispatcher::instance(), SIGNAL(awake()));
QSignalSpy aboutToBlockSpy(QAbstractEventDispatcher::instance(), &QAbstractEventDispatcher::aboutToBlock);
QSignalSpy awakeSpy(QAbstractEventDispatcher::instance(), &QAbstractEventDispatcher::awake);
QVERIFY(aboutToBlockSpy.isValid());
QVERIFY(awakeSpy.isValid());
@ -282,7 +282,7 @@ void tst_QEventLoop::exec()
thread.cond.wait(&thread.mutex);
// make sure the eventloop runs
QSignalSpy spy(QAbstractEventDispatcher::instance(&thread), SIGNAL(awake()));
QSignalSpy spy(QAbstractEventDispatcher::instance(&thread), &QAbstractEventDispatcher::awake);
QVERIFY(spy.isValid());
thread.cond.wakeOne();
thread.cond.wait(&thread.mutex);
@ -345,7 +345,7 @@ void tst_QEventLoop::wakeUp()
thread.start();
(void) eventLoop.exec();
QSignalSpy spy(QAbstractEventDispatcher::instance(&thread), SIGNAL(awake()));
QSignalSpy spy(QAbstractEventDispatcher::instance(&thread), &QAbstractEventDispatcher::awake);
QVERIFY(spy.isValid());
thread.eventLoop->wakeUp();
@ -633,7 +633,7 @@ void tst_QEventLoop::testQuitLock()
QTimer timer;
timer.setInterval(100);
QSignalSpy timerSpy(&timer, SIGNAL(timeout()));
QSignalSpy timerSpy(&timer, &QTimer::timeout);
timer.start();
QEventLoopPrivate* privateClass = static_cast<QEventLoopPrivate*>(QObjectPrivate::get(&eventLoop));

View File

@ -857,7 +857,7 @@ void tst_QMetaObject::invokeTypedefTypes()
{
qRegisterMetaType<CustomString>("CustomString");
QtTestCustomObject obj;
QSignalSpy spy(&obj, SIGNAL(sig_custom(CustomString)));
QSignalSpy spy(&obj, &QtTestCustomObject::sig_custom);
QVERIFY(spy.isValid());
QCOMPARE(spy.count(), 0);

View File

@ -1593,7 +1593,7 @@ void tst_QMetaObjectBuilder::usage_signal()
{
QScopedPointer<TestObject> testObject(new TestObject);
QSignalSpy propChangedSpy(testObject.data(), SIGNAL(intPropChanged(int)));
QSignalSpy propChangedSpy(testObject.data(), &TestObject::intPropChanged);
testObject->emitIntPropChanged();
QCOMPARE(propChangedSpy.count(), 1);
QCOMPARE(propChangedSpy.at(0).count(), 1);
@ -1608,7 +1608,7 @@ void tst_QMetaObjectBuilder::usage_property()
QCOMPARE(prop.type(), QVariant::Int);
QCOMPARE(prop.toInt(), testObject->intProp());
QSignalSpy propChangedSpy(testObject.data(), SIGNAL(intPropChanged(int)));
QSignalSpy propChangedSpy(testObject.data(), &TestObject::intPropChanged);
QVERIFY(testObject->intProp() != 123);
testObject->setProperty("intProp", 123);
QCOMPARE(propChangedSpy.count(), 1);

View File

@ -267,12 +267,12 @@ void tst_QSocketNotifier::posixSockets()
{
QSocketNotifier rn(posixSocket, QSocketNotifier::Read);
connect(&rn, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
QSignalSpy readSpy(&rn, SIGNAL(activated(int)));
QSignalSpy readSpy(&rn, &QSocketNotifier::activated);
QVERIFY(readSpy.isValid());
// No write notifier, some systems trigger write notification on socket creation, but not all
QSocketNotifier en(posixSocket, QSocketNotifier::Exception);
connect(&en, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
QSignalSpy errorSpy(&en, SIGNAL(activated(int)));
QSignalSpy errorSpy(&en, &QSocketNotifier::activated);
QVERIFY(errorSpy.isValid());
passive->write("hello",6);
@ -289,7 +289,7 @@ void tst_QSocketNotifier::posixSockets()
QSocketNotifier wn(posixSocket, QSocketNotifier::Write);
connect(&wn, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
QSignalSpy writeSpy(&wn, SIGNAL(activated(int)));
QSignalSpy writeSpy(&wn, &QSocketNotifier::activated);
QVERIFY(writeSpy.isValid());
qt_safe_write(posixSocket, "goodbye", 8);

View File

@ -264,8 +264,8 @@ void tst_QPluginLoader::deleteinstanceOnUnload()
PluginInterface *instance2 = qobject_cast<PluginInterface*>(loader2.instance());
QCOMPARE(instance2->pluginName(), QLatin1String("Plugin ok"));
QSignalSpy spy1(loader1.instance(), SIGNAL(destroyed()));
QSignalSpy spy2(loader2.instance(), SIGNAL(destroyed()));
QSignalSpy spy1(loader1.instance(), &QObject::destroyed);
QSignalSpy spy2(loader2.instance(), &QObject::destroyed);
QVERIFY(spy1.isValid());
QVERIFY(spy2.isValid());
if (pass == 0) {
@ -423,7 +423,7 @@ void tst_QPluginLoader::reloadPlugin()
QVERIFY(instance);
QCOMPARE(instance->pluginName(), QLatin1String("Plugin ok"));
QSignalSpy spy(loader.instance(), SIGNAL(destroyed()));
QSignalSpy spy(loader.instance(), &QObject::destroyed);
QVERIFY(spy.isValid());
QVERIFY(loader.unload()); // refcount reached 0, did really unload
QCOMPARE(spy.count(), 1);

View File

@ -916,7 +916,7 @@ void tst_QStateMachine::historyStateAfterRestart()
s2->addTransition(new EventTransition(QEvent::User, s1));
for (int x = 0; x < 2; ++x) {
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
@ -952,7 +952,7 @@ void tst_QStateMachine::historyStateAfterRestart()
QVERIFY(machine.configuration().contains(s2));
QVERIFY(machine.configuration().contains(s22));
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
QVERIFY(stoppedSpy.isValid());
machine.stop();
QTRY_COMPARE(stoppedSpy.count(), 1);
@ -1232,9 +1232,9 @@ void tst_QStateMachine::stateEntryAndExit()
QCOMPARE(trans->sourceState(), (QState*)s2);
}
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(stoppedSpy.isValid());
@ -1252,11 +1252,11 @@ void tst_QStateMachine::stateEntryAndExit()
QVERIFY(machine.configuration().isEmpty());
globalTick = 0;
QVERIFY(!machine.isRunning());
QSignalSpy s1EnteredSpy(s1, SIGNAL(entered()));
QSignalSpy s1ExitedSpy(s1, SIGNAL(exited()));
QSignalSpy tTriggeredSpy(t, SIGNAL(triggered()));
QSignalSpy s2EnteredSpy(s2, SIGNAL(entered()));
QSignalSpy s2ExitedSpy(s2, SIGNAL(exited()));
QSignalSpy s1EnteredSpy(s1, &TestState::entered);
QSignalSpy s1ExitedSpy(s1, &TestState::exited);
QSignalSpy tTriggeredSpy(t, &TestTransition::triggered);
QSignalSpy s2EnteredSpy(s2, &TestState::entered);
QSignalSpy s2ExitedSpy(s2, &TestState::exited);
QVERIFY(s1EnteredSpy.isValid());
QVERIFY(s1ExitedSpy.isValid());
@ -1312,8 +1312,8 @@ void tst_QStateMachine::stateEntryAndExit()
s12->addTransition(t2);
s2->addTransition(s3);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s1);
@ -1388,7 +1388,7 @@ void tst_QStateMachine::assignProperty()
QCOMPARE(s1->objectName(), QString::fromLatin1("foo"));
{
QSignalSpy propertiesAssignedSpy(s1, SIGNAL(propertiesAssigned()));
QSignalSpy propertiesAssignedSpy(s1, &QState::propertiesAssigned);
QVERIFY(propertiesAssignedSpy.isValid());
machine.start();
QTRY_COMPARE(propertiesAssignedSpy.count(), 1);
@ -1444,7 +1444,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@ -1473,7 +1473,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@ -1502,7 +1502,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@ -1552,7 +1552,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
s22->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@ -1587,7 +1587,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
machine.setInitialState(group);
machine.start();
QTRY_COMPARE(machine.configuration().contains(s1), true);
QSignalSpy propertiesAssignedSpy(s2, SIGNAL(propertiesAssigned()));
QSignalSpy propertiesAssignedSpy(s2, &QState::propertiesAssigned);
QVERIFY(propertiesAssignedSpy.isValid());
emitter.emitSignalWithNoArg();
QTRY_COMPARE(machine.configuration().contains(s2), true);
@ -1675,7 +1675,7 @@ void tst_QStateMachine::postEvent()
machine.addState(s1);
machine.addState(s2);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@ -1705,7 +1705,7 @@ void tst_QStateMachine::cancelDelayedEvent()
s1->addTransition(new StringTransition("a", s2));
machine.setInitialState(s1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
@ -1725,7 +1725,7 @@ void tst_QStateMachine::cancelDelayedEvent()
QVERIFY(machine.cancelDelayedEvent(id2));
QVERIFY(!machine.cancelDelayedEvent(id2));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
QTRY_COMPARE(finishedSpy.count(), 1);
QCOMPARE(machine.configuration().size(), 1);
@ -1740,7 +1740,7 @@ void tst_QStateMachine::postDelayedEventAndStop()
s1->addTransition(new StringTransition("a", s2));
machine.setInitialState(s1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
@ -1749,7 +1749,7 @@ void tst_QStateMachine::postDelayedEventAndStop()
int id1 = machine.postDelayedEvent(new StringEvent("a"), 0);
QVERIFY(id1 != -1);
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
QVERIFY(stoppedSpy.isValid());
machine.stop();
QTRY_COMPARE(stoppedSpy.count(), 1);
@ -1813,7 +1813,7 @@ void tst_QStateMachine::postDelayedEventFromThread()
DelayedEventPosterThread poster(&machine);
poster.start();
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@ -1826,11 +1826,11 @@ void tst_QStateMachine::stopAndPostEvent()
QStateMachine machine;
QState *s1 = new QState(&machine);
machine.setInitialState(s1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
QVERIFY(stoppedSpy.isValid());
machine.stop();
QCOMPARE(stoppedSpy.count(), 0);
@ -1850,7 +1850,7 @@ void tst_QStateMachine::stateFinished()
QFinalState *s2 = new QFinalState(&machine);
s1->addTransition(s1, SIGNAL(finished()), s2);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@ -1888,7 +1888,7 @@ void tst_QStateMachine::parallelStates()
s1->addTransition(s1, SIGNAL(finished()), s2);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
globalTick = 0;
machine.start();
@ -1933,9 +1933,9 @@ void tst_QStateMachine::parallelRootState()
QFinalState *s2_f = new QFinalState(s2);
s2->setInitialState(s2_f);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
@ -1984,7 +1984,7 @@ void tst_QStateMachine::allSourceToTargetConfigurations()
s2->addTransition(new StringTransition("f", s11));
s0->addTransition(new StringTransition("e", s211));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2094,7 +2094,7 @@ void tst_QStateMachine::signalTransitions()
QCOMPARE(trans->senderObject(), (QObject*)&emitter);
QCOMPARE(trans->signal(), QByteArray(SIGNAL(signalWithNoArg())));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2145,7 +2145,7 @@ void tst_QStateMachine::signalTransitions()
QCOMPARE(trans->senderObject(), (QObject*)&emitter);
QCOMPARE(trans->signal(), QByteArray("signalWithNoArg()"));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2170,7 +2170,7 @@ void tst_QStateMachine::signalTransitions()
TestSignalTransition *trans = new TestSignalTransition(&emitter, SIGNAL(signalWithIntArg(int)), s1);
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2196,7 +2196,7 @@ void tst_QStateMachine::signalTransitions()
TestSignalTransition *trans = new TestSignalTransition(&emitter, SIGNAL(signalWithStringArg(QString)), s1);
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2232,7 +2232,7 @@ void tst_QStateMachine::signalTransitions()
trans->setTargetState(s1);
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2251,7 +2251,7 @@ void tst_QStateMachine::signalTransitions()
QSignalTransition *t0 = s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), s1);
QSignalTransition *t1 = s1->addTransition(&emitter, SIGNAL(signalWithNoArg()), s0);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2300,8 +2300,8 @@ void tst_QStateMachine::signalTransitions()
QFinalState *s3 = new QFinalState(&machine);
s0->addTransition(&emitter, SIGNAL(signalWithStringArg(QString)), s3);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
@ -2341,8 +2341,8 @@ void tst_QStateMachine::signalTransitions()
QVERIFY(t1 != 0);
QCOMPARE(t1->signal(), QByteArray(SIGNAL(signalWithStringArg(QString))));
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
@ -2406,7 +2406,7 @@ void tst_QStateMachine::eventTransitions()
QCOMPARE(trans->targetState(), (QAbstractState*)s1);
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2459,7 +2459,7 @@ void tst_QStateMachine::eventTransitions()
QCOMPARE(trans->targetState(), (QAbstractState*)s1);
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2485,7 +2485,7 @@ void tst_QStateMachine::eventTransitions()
trans->setTargetState(s1);
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2508,7 +2508,7 @@ void tst_QStateMachine::eventTransitions()
trans->setTargetState(s1);
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2534,7 +2534,7 @@ void tst_QStateMachine::eventTransitions()
trans->setTargetState(s1);
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2557,7 +2557,7 @@ void tst_QStateMachine::eventTransitions()
t1->setTargetState(s0);
s1->addTransition(t1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2607,8 +2607,8 @@ void tst_QStateMachine::eventTransitions()
t1->setTargetState(s2);
s0->addTransition(t1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
@ -2637,7 +2637,7 @@ void tst_QStateMachine::eventTransitions()
trans->setTargetState(s1);
s0->addTransition(trans);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2655,7 +2655,7 @@ void tst_QStateMachine::eventTransitions()
QCOMPARE(trans->eventSourceReceived(), (QObject*)0);
QCOMPARE(trans->eventTypeReceived(), QEvent::None);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@ -2684,8 +2684,8 @@ void tst_QStateMachine::graphicsSceneEventTransitions()
s1->addTransition(t);
machine.setInitialState(s1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
machine.start();
@ -2734,7 +2734,7 @@ void tst_QStateMachine::historyStates()
root->setInitialState(s0);
s0->setInitialState(s00);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QCoreApplication::processEvents();
@ -2771,9 +2771,9 @@ void tst_QStateMachine::historyStates()
void tst_QStateMachine::startAndStop()
{
QStateMachine machine;
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(stoppedSpy.isValid());
@ -2827,9 +2827,9 @@ void tst_QStateMachine::targetStateWithNoParent()
QState s2;
s1->addTransition(&s2);
machine.setInitialState(s1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(stoppedSpy.isValid());
@ -3263,14 +3263,14 @@ void tst_QStateMachine::propertiesAssignedSignalTransitionsReuseAnimationGroup()
QParallelAnimationGroup animationGroup;
animationGroup.addAnimation(new QPropertyAnimation(object, "foo"));
QSignalSpy animationFinishedSpy(&animationGroup, SIGNAL(finished()));
QSignalSpy animationFinishedSpy(&animationGroup, &QParallelAnimationGroup::finished);
QVERIFY(animationFinishedSpy.isValid());
s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2)->addAnimation(&animationGroup);
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3)->addAnimation(&animationGroup);
s3->addTransition(s3, SIGNAL(propertiesAssigned()), s4);
machine.setInitialState(s1);
QSignalSpy machineFinishedSpy(&machine, SIGNAL(finished()));
QSignalSpy machineFinishedSpy(&machine, &QStateMachine::finished);
QVERIFY(machineFinishedSpy.isValid());
machine.start();
QTRY_COMPARE(machineFinishedSpy.count(), 1);
@ -3770,8 +3770,8 @@ void tst_QStateMachine::nestedStateMachines()
group->addTransition(group, SIGNAL(finished()), final);
machine.setInitialState(group);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
machine.start();
@ -3795,7 +3795,7 @@ void tst_QStateMachine::goToState()
QState *s1 = new QState(&machine);
QState *s2 = new QState(&machine);
machine.setInitialState(s1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
@ -3838,7 +3838,7 @@ void tst_QStateMachine::goToStateFromSourceWithTransition()
s1->addTransition(new QSignalTransition);
QState *s2 = new QState(&machine);
machine.setInitialState(s1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
@ -3928,7 +3928,7 @@ void tst_QStateMachine::postEventFromOtherThread()
poster.start();
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@ -3984,9 +3984,9 @@ void tst_QStateMachine::stopInTransitionToFinalState()
machine.setInitialState(s1);
QObject::connect(t1, SIGNAL(triggered()), &machine, SLOT(stop()));
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy s2EnteredSpy(s2, SIGNAL(entered()));
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QSignalSpy s2EnteredSpy(s2, &QFinalState::entered);
QVERIFY(stoppedSpy.isValid());
QVERIFY(finishedSpy.isValid());
QVERIFY(s2EnteredSpy.isValid());
@ -4029,13 +4029,13 @@ void tst_QStateMachine::stopInEventTest()
s1->addTransition(new StopInEventTestTransition());
machine.setInitialState(s1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(stoppedSpy.isValid());
QVERIFY(finishedSpy.isValid());
machine.postEvent(new QEvent(QEvent::User), QStateMachine::EventPriority(eventPriority));
@ -4070,7 +4070,7 @@ void tst_QStateMachine::testIncrementReceivers()
IncrementReceiversTest testObject;
s1->addTransition(&testObject, SIGNAL(mySignal()), s2);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
machine.start();
QMetaObject::invokeMethod(&testObject, "mySignal", Qt::QueuedConnection);
@ -4091,7 +4091,7 @@ void tst_QStateMachine::initialStateIsEnteredBeforeStartedEmitted()
// transition should trigger.
s1->addTransition(&machine, SIGNAL(started()), s2);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
}
@ -4226,9 +4226,9 @@ void tst_QStateMachine::transitionWithNoTarget()
EventTransition *t1 = new EventTransition(QEvent::User, /*target=*/0);
s1->addTransition(t1);
QSignalSpy s1EnteredSpy(s1, SIGNAL(entered()));
QSignalSpy s1ExitedSpy(s1, SIGNAL(exited()));
QSignalSpy t1TriggeredSpy(t1, SIGNAL(triggered()));
QSignalSpy s1EnteredSpy(s1, &QState::entered);
QSignalSpy s1ExitedSpy(s1, &QState::exited);
QSignalSpy t1TriggeredSpy(t1, &EventTransition::triggered);
machine.start();
QTRY_VERIFY(machine.configuration().contains(s1));
@ -4261,7 +4261,7 @@ void tst_QStateMachine::initialStateIsFinal()
QStateMachine machine;
QFinalState *f = new QFinalState(&machine);
machine.setInitialState(f);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
machine.start();
QTRY_VERIFY(machine.configuration().contains(f));
QTRY_COMPARE(finishedSpy.count(), 1);
@ -4921,8 +4921,8 @@ void tst_QStateMachine::signalTransitionSenderInDifferentThread2()
thread.start();
QTRY_VERIFY(thread.isRunning());
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy startedSpy(&machine, &QStateMachine::started);
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);

View File

@ -87,8 +87,8 @@ void tst_QFutureWatcher::startFinish()
{
QFutureWatcher<void> futureWatcher;
QSignalSpy startedSpy(&futureWatcher, SIGNAL(started()));
QSignalSpy finishedSpy(&futureWatcher, SIGNAL(finished()));
QSignalSpy startedSpy(&futureWatcher, &QFutureWatcher<void>::started);
QSignalSpy finishedSpy(&futureWatcher, &QFutureWatcher<void>::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
@ -322,7 +322,7 @@ void tst_QFutureWatcher::futureSignals()
a.reportStarted();
f.setFuture(a.future());
QSignalSpy progressSpy(&f, SIGNAL(progressValueChanged(int)));
QSignalSpy progressSpy(&f, &QFutureWatcher<void>::progressValueChanged);
QVERIFY(progressSpy.isValid());
const int progress = 1;
a.setProgressValue(progress);
@ -331,8 +331,8 @@ void tst_QFutureWatcher::futureSignals()
QCOMPARE(progressSpy.takeFirst().at(0).toInt(), 0);
QCOMPARE(progressSpy.takeFirst().at(0).toInt(), 1);
QSignalSpy finishedSpy(&f, SIGNAL(finished()));
QSignalSpy resultReadySpy(&f, SIGNAL(resultReadyAt(int)));
QSignalSpy finishedSpy(&f, &QFutureWatcher<void>::finished);
QSignalSpy resultReadySpy(&f, &QFutureWatcher<void>::resultReadyAt);
QVERIFY(finishedSpy.isValid());
QVERIFY(resultReadySpy.isValid());
@ -374,10 +374,10 @@ void tst_QFutureWatcher::watchFinishedFuture()
#endif
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
QSignalSpy startedSpy(&watcher, SIGNAL(started()));
QSignalSpy finishedSpy(&watcher, SIGNAL(finished()));
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
QSignalSpy canceledSpy(&watcher, SIGNAL(canceled()));
QSignalSpy startedSpy(&watcher, &QFutureWatcher<int>::started);
QSignalSpy finishedSpy(&watcher, &QFutureWatcher<int>::finished);
QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
QSignalSpy canceledSpy(&watcher, &QFutureWatcher<int>::canceled);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
@ -408,10 +408,10 @@ void tst_QFutureWatcher::watchCanceledFuture()
#endif
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
QSignalSpy startedSpy(&watcher, SIGNAL(started()));
QSignalSpy finishedSpy(&watcher, SIGNAL(finished()));
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
QSignalSpy canceledSpy(&watcher, SIGNAL(canceled()));
QSignalSpy startedSpy(&watcher, &QFutureWatcher<int>::started);
QSignalSpy finishedSpy(&watcher, &QFutureWatcher<int>::finished);
QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
QSignalSpy canceledSpy(&watcher, &QFutureWatcher<int>::canceled);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
@ -439,8 +439,8 @@ void tst_QFutureWatcher::disconnectRunningFuture()
SignalSlotObject object;
connect(watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
QSignalSpy finishedSpy(watcher, SIGNAL(finished()));
QSignalSpy resultReadySpy(watcher, SIGNAL(resultReadyAt(int)));
QSignalSpy finishedSpy(watcher, &QFutureWatcher<int>::finished);
QSignalSpy resultReadySpy(watcher, &QFutureWatcher<int>::resultReadyAt);
QVERIFY(finishedSpy.isValid());
QVERIFY(resultReadySpy.isValid());
@ -634,7 +634,7 @@ void tst_QFutureWatcher::changeFuture()
SignalSlotObject object;
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
QVERIFY(resultReadySpy.isValid());
watcher.setFuture(a); // Watch 'a' which will genere a resultReady event.
@ -666,7 +666,7 @@ void tst_QFutureWatcher::cancelEvents()
SignalSlotObject object;
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
QVERIFY(resultReadySpy.isValid());
watcher.setFuture(a);
@ -694,7 +694,7 @@ void tst_QFutureWatcher::pauseEvents()
SignalSlotObject object;
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
QVERIFY(resultReadySpy.isValid());
watcher.setFuture(a);
@ -720,7 +720,7 @@ void tst_QFutureWatcher::pauseEvents()
SignalSlotObject object;
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
QVERIFY(resultReadySpy.isValid());
watcher.setFuture(a);

View File

@ -102,7 +102,7 @@ void tst_QTimeLine::range()
// Verify that you can change the range in the timeLine
timeLine.setFrameRange(10, 20);
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
QVERIFY(spy.isValid());
timeLine.start();
#ifdef Q_OS_WINCE
@ -131,7 +131,7 @@ void tst_QTimeLine::currentTime()
{
QTimeLine timeLine(2000);
timeLine.setUpdateInterval((timeLine.duration()/2) / 33);
QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal)));
QSignalSpy spy(&timeLine, &QTimeLine::valueChanged);
QVERIFY(spy.isValid());
timeLine.setFrameRange(10, 20);
QCOMPARE(timeLine.currentTime(), 0);
@ -202,7 +202,7 @@ void tst_QTimeLine::frameRate()
// Default speed
timeLine.setUpdateInterval(1000 / 33);
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()*2);
@ -225,7 +225,7 @@ void tst_QTimeLine::value()
QVERIFY(timeLine.currentValue() == 0.0);
// Default speed
QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal)));
QSignalSpy spy(&timeLine, &QTimeLine::valueChanged);
QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()/3);
@ -256,7 +256,7 @@ void tst_QTimeLine::currentFrame()
QCOMPARE(timeLine.currentFrame(), 10);
// Default speed
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()/3);
@ -288,7 +288,7 @@ void tst_QTimeLine::loopCount()
QCOMPARE(timeLine.loopCount(), 0);
// Default speed infiniti looping
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration());
@ -306,8 +306,8 @@ void tst_QTimeLine::loopCount()
timeLine.setFrameRange(0, 2);
timeLine.setLoopCount(4);
QSignalSpy finishedSpy(&timeLine, SIGNAL(finished()));
QSignalSpy frameChangedSpy(&timeLine, SIGNAL(frameChanged(int)));
QSignalSpy finishedSpy(&timeLine, &QTimeLine::finished);
QSignalSpy frameChangedSpy(&timeLine, &QTimeLine::frameChanged);
QVERIFY(finishedSpy.isValid());
QVERIFY(frameChangedSpy.isValid());
QEventLoop loop;
@ -461,7 +461,7 @@ void tst_QTimeLine::frameChanged()
timeLine.setCurveShape(QTimeLine::LinearCurve);
timeLine.setFrameRange(0,9);
timeLine.setUpdateInterval(800);
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
QVERIFY(spy.isValid());
// Test what happens when duration expires before all frames are emitted.
@ -492,7 +492,7 @@ void tst_QTimeLine::stopped()
QTimeLine timeLine;
timeLine.setFrameRange(0, 9);
qRegisterMetaType<QTimeLine::State>("QTimeLine::State");
QSignalSpy spy(&timeLine, SIGNAL(stateChanged(QTimeLine::State)));
QSignalSpy spy(&timeLine, &QTimeLine::stateChanged);
QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()*2);
@ -510,7 +510,7 @@ void tst_QTimeLine::finished()
{
QTimeLine timeLine;
timeLine.setFrameRange(0,9);
QSignalSpy spy(&timeLine, SIGNAL(finished()));
QSignalSpy spy(&timeLine, &QTimeLine::finished);
QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()*2);
@ -543,7 +543,7 @@ void tst_QTimeLine::multipleTimeLines()
// Stopping a timer shouldn't affect the other timers
QTimeLine timeLine(200);
timeLine.setFrameRange(0,99);
QSignalSpy spy(&timeLine, SIGNAL(finished()));
QSignalSpy spy(&timeLine, &QTimeLine::finished);
QVERIFY(spy.isValid());
QTimeLine timeLineKiller;