summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorAxel Waggershauser <awagger@gmail.com>2013-03-06 17:18:48 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-07 08:37:26 +0100
commit6b68be9587c6d6946faff34f88d80de53f11ed86 (patch)
treefdee479ee1136782b86322ef31edb147549cf47d /tests/auto/corelib
parent079e3b4f3ee3ebe225539b5a896fec1e38804e11 (diff)
Let QMetaObject::connectSlotsByName(o) also check for signals of o
QMetaObject::connectSlotsByName(QObject* o) creates a list of all children to look for signals that match slots of o. This changeset simply adds the object o itself to that list. The motivation is to finally fix the long standing QtCreator bug QTCREATORBUG-6494. Where executing 'Go to slot...' and choosing 'accepted()' for a simple QDialog named 'MyDialog' will add a on_MyDialog_accepted() slot to MyDialog. That slot never gets connected. More details may be found in the linked QTBUG-7595. Task-number: QTBUG-7595 Task-number: QTCREATORBUG-6494 Change-Id: I35f52761791af697eabb569adb5faee6fae50638 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 17752c405c..db21ab4fe4 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -406,6 +406,8 @@ public:
connect(this, SIGNAL(on_Sender_signalLoopBack()), this, SLOT(slotLoopBack()));
}
+ void emitSignalNoParams() { emit signalNoParams(); }
+ void emit_signal_with_underscore() { emit signal_with_underscore(); }
public slots:
void on_Sender_signalNoParams() { called_slots << 1; }
@@ -419,6 +421,8 @@ public slots:
void on_Sender_signalManyParams2(int i1, int i2, int i3, QString string, bool onoff)
{ called_slots << 7; Q_UNUSED(i1);Q_UNUSED(i2);Q_UNUSED(i3);Q_UNUSED(string);Q_UNUSED(onoff); }
void slotLoopBack() { called_slots << 8; }
+ void on_Receiver_signalNoParams() { called_slots << 9; }
+ void on_Receiver_signal_with_underscore() { called_slots << 10; }
protected slots:
void o() { called_slots << -1; }
@@ -426,11 +430,14 @@ protected slots:
signals:
void on_Sender_signalLoopBack();
+ void signalNoParams();
+ void signal_with_underscore();
};
void tst_QObject::connectSlotsByName()
{
AutoConnectReceiver receiver;
+ receiver.setObjectName("Receiver");
AutoConnectSender sender(&receiver);
sender.setObjectName("Sender");
@@ -462,6 +469,14 @@ void tst_QObject::connectSlotsByName()
receiver.called_slots.clear();
sender.emitSignalLoopBack();
QCOMPARE(receiver.called_slots, QList<int>() << 8);
+
+ receiver.called_slots.clear();
+ receiver.emitSignalNoParams();
+ QCOMPARE(receiver.called_slots, QList<int>() << 9);
+
+ receiver.called_slots.clear();
+ receiver.emit_signal_with_underscore();
+ QCOMPARE(receiver.called_slots, QList<int>() << 10);
}
void tst_QObject::qobject_castTemplate()