##// END OF EJS Templates
added error printing for connect/disconnect...
florianlink -
r158:04c639a56aef
parent child
Show More
@@ -46,6 +46,7
46 46
47 47 bool PythonQtStdDecorators::connect(QObject* sender, const QByteArray& signal, PyObject* callable)
48 48 {
49 bool result = false;
49 50 QByteArray signalTmp;
50 51 char first = signal.at(0);
51 52 if (first>='0' && first<='9') {
@@ -55,10 +56,14 bool PythonQtStdDecorators::connect(QObject* sender, const QByteArray& signal, P
55 56 }
56 57
57 58 if (sender) {
58 return PythonQt::self()->addSignalHandler(sender, signalTmp, callable);
59 } else {
60 return false;
59 result = PythonQt::self()->addSignalHandler(sender, signalTmp, callable);
60 if (!result) {
61 if (sender->metaObject()->indexOfSignal(QMetaObject::normalizedSignature(signalTmp.constData()+1)) == -1) {
62 qWarning("PythonQt: QObject::connect() signal '%s' does not exist on %s", signal.constData(), sender->metaObject()->className());
63 }
64 }
61 65 }
66 return result;
62 67 }
63 68
64 69 bool PythonQtStdDecorators::connect(QObject* sender, const QByteArray& signal, QObject* receiver, const QByteArray& slot)
@@ -87,6 +92,7 bool PythonQtStdDecorators::connect(QObject* sender, const QByteArray& signal, Q
87 92
88 93 bool PythonQtStdDecorators::disconnect(QObject* sender, const QByteArray& signal, PyObject* callable)
89 94 {
95 bool result = false;
90 96 QByteArray signalTmp;
91 97 char first = signal.at(0);
92 98 if (first>='0' && first<='9') {
@@ -95,10 +101,14 bool PythonQtStdDecorators::disconnect(QObject* sender, const QByteArray& signal
95 101 signalTmp = "2" + signal;
96 102 }
97 103 if (sender) {
98 return PythonQt::self()->removeSignalHandler(sender, signalTmp, callable);
99 } else {
100 return false;
104 result = PythonQt::self()->removeSignalHandler(sender, signalTmp, callable);
105 if (!result) {
106 if (sender->metaObject()->indexOfSignal(QMetaObject::normalizedSignature(signalTmp.constData()+1)) == -1) {
107 qWarning("PythonQt: QObject::disconnect() signal '%s' does not exist on %s", signal.constData(), sender->metaObject()->className());
108 }
109 }
101 110 }
111 return result;
102 112 }
103 113
104 114 bool PythonQtStdDecorators::disconnect(QObject* sender, const QByteArray& signal, QObject* receiver, const QByteArray& slot)
General Comments 0
You need to be logged in to leave comments. Login now