##// END OF EJS Templates
added error printing for connect/disconnect...
florianlink -
r158:04c639a56aef
parent child
Show More
@@ -46,6 +46,7
46
46
47 bool PythonQtStdDecorators::connect(QObject* sender, const QByteArray& signal, PyObject* callable)
47 bool PythonQtStdDecorators::connect(QObject* sender, const QByteArray& signal, PyObject* callable)
48 {
48 {
49 bool result = false;
49 QByteArray signalTmp;
50 QByteArray signalTmp;
50 char first = signal.at(0);
51 char first = signal.at(0);
51 if (first>='0' && first<='9') {
52 if (first>='0' && first<='9') {
@@ -55,10 +56,14 bool PythonQtStdDecorators::connect(QObject* sender, const QByteArray& signal, P
55 }
56 }
56
57
57 if (sender) {
58 if (sender) {
58 return PythonQt::self()->addSignalHandler(sender, signalTmp, callable);
59 result = PythonQt::self()->addSignalHandler(sender, signalTmp, callable);
59 } else {
60 if (!result) {
60 return false;
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 bool PythonQtStdDecorators::connect(QObject* sender, const QByteArray& signal, QObject* receiver, const QByteArray& slot)
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 bool PythonQtStdDecorators::disconnect(QObject* sender, const QByteArray& signal, PyObject* callable)
93 bool PythonQtStdDecorators::disconnect(QObject* sender, const QByteArray& signal, PyObject* callable)
89 {
94 {
95 bool result = false;
90 QByteArray signalTmp;
96 QByteArray signalTmp;
91 char first = signal.at(0);
97 char first = signal.at(0);
92 if (first>='0' && first<='9') {
98 if (first>='0' && first<='9') {
@@ -95,10 +101,14 bool PythonQtStdDecorators::disconnect(QObject* sender, const QByteArray& signal
95 signalTmp = "2" + signal;
101 signalTmp = "2" + signal;
96 }
102 }
97 if (sender) {
103 if (sender) {
98 return PythonQt::self()->removeSignalHandler(sender, signalTmp, callable);
104 result = PythonQt::self()->removeSignalHandler(sender, signalTmp, callable);
99 } else {
105 if (!result) {
100 return false;
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 bool PythonQtStdDecorators::disconnect(QObject* sender, const QByteArray& signal, QObject* receiver, const QByteArray& slot)
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