Commit bb3a6f05 authored by hjk's avatar hjk
Browse files

debugger: add test code for signal/slot debugging

parent 30d4c004
......@@ -799,6 +799,28 @@ def qdump__QObject(d, item):
d.putType(" ")
d.putValue(extractCString(metaStringData, offset))
# Active connection
with SubItem(d):
d.putName("currentSender")
d.putType(" ")
sender = d_ptr["currentSender"]
d.putValue(cleanAddress(sender))
if isNull(sender):
d.putNumChild(0)
else:
d.putNumChild(1)
iname = item.iname + ".currentSender"
if d.isExpandedIName(iname):
with Children(d):
# Sending object
d.putItem(Item(sender["sender"], iname, "object", "object"))
# Signal in sending object
with SubItem(d):
d.putName("signal")
d.putValue(sender["signal"])
d.putType(" ");
d.putNumChild(0)
# QObject
# static const uint qt_meta_data_QObject[] = {
......
......@@ -260,6 +260,7 @@ void QmlEngine::startDebugger()
return;
}
setState(AdapterStarted);
startSuccessful();
setState(InferiorStarting);
//m_frameRate = new CanvasFrameRate(0);
......@@ -306,8 +307,8 @@ void QmlEngine::setupConnection()
}
qDebug() << "CONNECTION SUCCESSFUL";
setState(InferiorRunningRequested);
setState(InferiorRunning);
startSuccessful();
reloadEngines();
}
......
......@@ -791,6 +791,42 @@ void testQObject(int &argc, char *argv[])
#endif
}
class Sender : public QObject
{
Q_OBJECT
public:
Sender() { setObjectName("Sender"); }
void doEmit() { emit aSignal(); }
signals:
void aSignal();
};
class Receiver : public QObject
{
Q_OBJECT
public:
Receiver() { setObjectName("Receiver"); }
public slots:
void aSlot() {
QObject *s = sender();
if (s) {
qDebug() << "SENDER: " << s;
} else {
qDebug() << "NO SENDER";
}
}
};
void testSignalSlot(int &argc, char *argv[])
{
QApplication app(argc, argv);
Sender sender;
Receiver receiver;
QObject::connect(&sender, SIGNAL(aSignal()), &receiver, SLOT(aSlot()));
sender.doEmit();
};
void testQPixmap()
{
QImage im(QSize(200, 200), QImage::Format_RGB32);
......@@ -1822,6 +1858,7 @@ int main(int argc, char *argv[])
testObject1();
testVector1();
testQHash1();
testSignalSlot(argc, argv);
QString hallo = "hallo";
QStringList list;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment