@@ -209,8 +209,8 return Py_None; | |||||
209 | } |
|
209 | } | |
210 | } |
|
210 | } | |
211 |
|
211 | |||
212 | if (!ptr) { |
|
212 | if (!ptr && info.typeId!=PythonQtMethodInfo::Unknown) { | |
213 | // everything else is stored in a QVariant... |
|
213 | // everything else is stored in a QVariant, if we know the meta type... | |
214 | PythonQtValueStorage_ADD_VALUE(global_variantStorage, QVariant, QVariant::Type(info.typeId), ptr); |
|
214 | PythonQtValueStorage_ADD_VALUE(global_variantStorage, QVariant, QVariant::Type(info.typeId), ptr); | |
215 | // return the constData pointer that will be filled with the result value later on |
|
215 | // return the constData pointer that will be filled with the result value later on | |
216 | ptr = (void*)((QVariant*)ptr)->constData(); |
|
216 | ptr = (void*)((QVariant*)ptr)->constData(); |
@@ -78,27 +78,6 bool PythonQtCallSlot(PythonQtClassInfo* classInfo, QObject* objectToCall, PyObj | |||||
78 | const PythonQtSlotInfo::ParameterInfo& returnValueParam = params.at(0); |
|
78 | const PythonQtSlotInfo::ParameterInfo& returnValueParam = params.at(0); | |
79 | // set return argument to NULL |
|
79 | // set return argument to NULL | |
80 | argList[0] = NULL; |
|
80 | argList[0] = NULL; | |
81 |
|
||||
82 | if (returnValueParam.typeId != QMetaType::Void) { |
|
|||
83 | // extra handling of enum return value |
|
|||
84 | if (!returnValueParam.isPointer && returnValueParam.typeId == PythonQtMethodInfo::Unknown) { |
|
|||
85 | returnValueIsEnum = PythonQtClassInfo::hasEnum(returnValueParam.name, classInfo); |
|
|||
86 | if (returnValueIsEnum) { |
|
|||
87 | // create enum return value |
|
|||
88 | PythonQtValueStorage_ADD_VALUE(PythonQtConv::global_valueStorage, long, 0, argList[0]); |
|
|||
89 | } |
|
|||
90 | } |
|
|||
91 | if (argList[0]==NULL) { |
|
|||
92 | // create empty default value for the return value |
|
|||
93 | if (!directReturnValuePointer) { |
|
|||
94 | // create empty default value for the return value |
|
|||
95 | argList[0] = PythonQtConv::CreateQtReturnValue(returnValueParam); |
|
|||
96 | } else { |
|
|||
97 | // we can use our pointer directly! |
|
|||
98 | argList[0] = directReturnValuePointer; |
|
|||
99 | } |
|
|||
100 | } |
|
|||
101 | } |
|
|||
102 |
|
81 | |||
103 | bool ok = true; |
|
82 | bool ok = true; | |
104 | bool skipFirst = false; |
|
83 | bool skipFirst = false; | |
@@ -140,8 +119,32 bool PythonQtCallSlot(PythonQtClassInfo* classInfo, QObject* objectToCall, PyObj | |||||
140 | } |
|
119 | } | |
141 |
|
120 | |||
142 | if (ok) { |
|
121 | if (ok) { | |
|
122 | // parameters are ok, now create the qt return value which is assigned to by metacall | |||
|
123 | if (returnValueParam.typeId != QMetaType::Void) { | |||
|
124 | // extra handling of enum return value | |||
|
125 | if (!returnValueParam.isPointer && returnValueParam.typeId == PythonQtMethodInfo::Unknown) { | |||
|
126 | returnValueIsEnum = PythonQtClassInfo::hasEnum(returnValueParam.name, classInfo); | |||
|
127 | if (returnValueIsEnum) { | |||
|
128 | // create enum return value | |||
|
129 | PythonQtValueStorage_ADD_VALUE(PythonQtConv::global_valueStorage, long, 0, argList[0]); | |||
|
130 | } | |||
|
131 | } | |||
|
132 | if (argList[0]==NULL) { | |||
|
133 | // create empty default value for the return value | |||
|
134 | if (!directReturnValuePointer) { | |||
|
135 | // create empty default value for the return value | |||
|
136 | argList[0] = PythonQtConv::CreateQtReturnValue(returnValueParam); | |||
|
137 | } else { | |||
|
138 | // we can use our pointer directly! | |||
|
139 | argList[0] = directReturnValuePointer; | |||
|
140 | } | |||
|
141 | } | |||
|
142 | } | |||
|
143 | ||||
|
144 | // invoke the slot via metacall | |||
143 | (info->decorator()?info->decorator():objectToCall)->qt_metacall(QMetaObject::InvokeMetaMethod, info->slotIndex(), argList); |
|
145 | (info->decorator()?info->decorator():objectToCall)->qt_metacall(QMetaObject::InvokeMetaMethod, info->slotIndex(), argList); | |
144 |
|
146 | |||
|
147 | // handle the return value (which in most cases still needs to be converted to a Python object) | |||
145 | if (argList[0] || returnValueParam.typeId == QMetaType::Void) { |
|
148 | if (argList[0] || returnValueParam.typeId == QMetaType::Void) { | |
146 | if (directReturnValuePointer) { |
|
149 | if (directReturnValuePointer) { | |
147 | result = NULL; |
|
150 | result = NULL; | |
@@ -153,7 +156,7 bool PythonQtCallSlot(PythonQtClassInfo* classInfo, QObject* objectToCall, PyObj | |||||
153 | } |
|
156 | } | |
154 | } |
|
157 | } | |
155 | } else { |
|
158 | } else { | |
156 | QString e = QString("Called ") + info->fullSignature() + ", return type is ignored because it is unknown to PythonQt."; |
|
159 | QString e = QString("Called ") + info->fullSignature() + ", return type '" + returnValueParam.name + "' is ignored because it is unknown to PythonQt. Probaby you should register it using qRegisterMetaType()."; | |
157 | PyErr_SetString(PyExc_ValueError, e.toLatin1().data()); |
|
160 | PyErr_SetString(PyExc_ValueError, e.toLatin1().data()); | |
158 | result = NULL; |
|
161 | result = NULL; | |
159 | } |
|
162 | } |
General Comments 0
You need to be logged in to leave comments.
Login now