diff options
Diffstat (limited to 'tests/auto/corelib/kernel/qobject/tst_qobject.cpp')
-rw-r--r-- | tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index f48f86cceb..c340d00361 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -140,6 +140,7 @@ private slots: void returnValue2_data(); void returnValue2(); void connectVirtualSlots(); + void connectFunctorArgDifference(); }; class SenderObject : public QObject @@ -5484,5 +5485,40 @@ void tst_QObject::connectVirtualSlots() */ } +struct SlotFunctor +{ + void operator()() {} +}; + +struct SlotFunctorString +{ + void operator()(const QString &) {} +}; + +void tst_QObject::connectFunctorArgDifference() +{ + QTimer timer; + // Compile-time tests that the connection is successful. + connect(&timer, &QTimer::timeout, SlotFunctor()); + connect(&timer, &QTimer::objectNameChanged, SlotFunctorString()); + connect(qApp, &QCoreApplication::aboutToQuit, SlotFunctor()); + + connect(&timer, &QTimer::objectNameChanged, SlotFunctor()); + QStringListModel model; + connect(&model, &QStringListModel::rowsInserted, SlotFunctor()); + +#if defined(Q_COMPILER_LAMBDA) + connect(&timer, &QTimer::timeout, [=](){}); + connect(&timer, &QTimer::objectNameChanged, [=](const QString &){}); + connect(qApp, &QCoreApplication::aboutToQuit, [=](){}); + + connect(&timer, &QTimer::objectNameChanged, [=](){}); + connect(&model, &QStringListModel::rowsInserted, [=](){}); + connect(&model, &QStringListModel::rowsInserted, [=](const QModelIndex &){}); +#endif + + QVERIFY(true); +} + QTEST_MAIN(tst_QObject) #include "tst_qobject.moc" |