Fixed some warning messages during QtCore compilation.

Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
This commit is contained in:
renato 2010-01-28 17:37:18 -03:00 • committed by Renato Filho
commit 10a6f08867
2 changed files with 6 additions and 4 deletions

View file

@ -45,7 +45,7 @@ static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject
// Extract receiver from callback // Extract receiver from callback
bool usingGlobalReceiver; bool usingGlobalReceiver;
QObject* receiver = 0; QObject* receiver = 0;
PyObject* self; PyObject* self = 0;
if (PyMethod_Check(callback)) { if (PyMethod_Check(callback)) {
self = PyMethod_GET_SELF(callback); self = PyMethod_GET_SELF(callback);
if (SbkQObject_Check(self)) if (SbkQObject_Check(self))
@ -54,7 +54,11 @@ static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject
self = PyCFunction_GET_SELF(callback); self = PyCFunction_GET_SELF(callback);
if (self && SbkQObject_Check(self)) if (self && SbkQObject_Check(self))
receiver = SbkQObject_cptr(self); receiver = SbkQObject_cptr(self);
} else if (!PyFunction_Check(callback)) {
qWarning() << "Invalid callback object.";
return false;
} }
usingGlobalReceiver = !receiver; usingGlobalReceiver = !receiver;
if (usingGlobalReceiver) if (usingGlobalReceiver)
receiver = signalManager.globalReceiver(); receiver = signalManager.globalReceiver();
@ -64,7 +68,7 @@ static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject
const char* slot = callbackSig.constData(); const char* slot = callbackSig.constData();
int slotIndex = metaObject->indexOfSlot(slot); int slotIndex = metaObject->indexOfSlot(slot);
if (slotIndex == -1) { if (slotIndex == -1) {
if (!usingGlobalReceiver and !((SbkBaseWrapper*)self)->containsCppWrapper) { if (!usingGlobalReceiver and self and !((SbkBaseWrapper*)self)->containsCppWrapper) {
qWarning() << "You can't add dynamic slots on an object originated from C++."; qWarning() << "You can't add dynamic slots on an object originated from C++.";
return false; return false;
} }

View file

@ -1453,7 +1453,6 @@
<modify-function signature="findChild(const QString &amp;) const" remove="all" /> <modify-function signature="findChild(const QString &amp;) const" remove="all" />
<add-function signature="findChild(PyTypeObject*, const QString&amp;)" return-type="PyObject*"> <add-function signature="findChild(PyTypeObject*, const QString&amp;)" return-type="PyObject*">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
const char* type_name = %PYARG_1->ob_type->tp_name;
const bool isEmpty = %2.isEmpty(); const bool isEmpty = %2.isEmpty();
foreach(QObject* o, %CPPSELF.children()) { foreach(QObject* o, %CPPSELF.children()) {
if (isEmpty || %2 == o->objectName()) { if (isEmpty || %2 == o->objectName()) {
@ -1470,7 +1469,6 @@
<add-function signature="findChildren(PyTypeObject*, const QString&amp;)" return-type="PySequence*" > <add-function signature="findChildren(PyTypeObject*, const QString&amp;)" return-type="PySequence*" >
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
%PYARG_0 = PyList_New(0); %PYARG_0 = PyList_New(0);
const char* type_name = %PYARG_1->ob_type->tp_name;
const bool isEmpty = %2.isEmpty(); const bool isEmpty = %2.isEmpty();
foreach(QObject* o, %CPPSELF.children()) { foreach(QObject* o, %CPPSELF.children()) {
if (isEmpty || %2 == o->objectName()) { if (isEmpty || %2 == o->objectName()) {