@@ -300,11 +300,19 static PyObject *PythonQtInstanceWrapper_getattro(PyObject *obj,PyObject *name) | |||
|
300 | 300 | } |
|
301 | 301 | break; |
|
302 | 302 | case PythonQtMemberInfo::NotFound: |
|
303 | // handle dynamic properties | |
|
304 | if (wrapper->_obj) { | |
|
305 | QVariant v = wrapper->_obj->property(attributeName); | |
|
306 | if (v.isValid()) { | |
|
307 | return PythonQtConv::QVariantToPyObject(v); | |
|
303 | { | |
|
304 | // check for a getter_ | |
|
305 | PythonQtMemberInfo member = wrapper->classInfo()->member(QByteArray("getter_") + attributeName); | |
|
306 | if (member._type == PythonQtMemberInfo::Slot) { | |
|
307 | return PythonQtSlotFunction_CallImpl(wrapper->classInfo(), wrapper->_obj, member._slot, NULL, NULL, wrapper->_wrappedPtr); | |
|
308 | } | |
|
309 | ||
|
310 | // handle dynamic properties | |
|
311 | if (wrapper->_obj) { | |
|
312 | QVariant v = wrapper->_obj->property(attributeName); | |
|
313 | if (v.isValid()) { | |
|
314 | return PythonQtConv::QVariantToPyObject(v); | |
|
315 | } | |
|
308 | 316 | } |
|
309 | 317 | } |
|
310 | 318 | break; |
@@ -339,7 +347,7 static PyObject *PythonQtInstanceWrapper_getattro(PyObject *obj,PyObject *name) | |||
|
339 | 347 | static int PythonQtInstanceWrapper_setattro(PyObject *obj,PyObject *name,PyObject *value) |
|
340 | 348 | { |
|
341 | 349 | QString error; |
|
342 | char *attributeName; | |
|
350 | const char *attributeName; | |
|
343 | 351 | PythonQtInstanceWrapper *wrapper = (PythonQtInstanceWrapper *)obj; |
|
344 | 352 | |
|
345 | 353 | if ((attributeName = PyString_AsString(name)) == NULL) |
@@ -385,6 +393,19 static int PythonQtInstanceWrapper_setattro(PyObject *obj,PyObject *name,PyObjec | |||
|
385 | 393 | } else if (member._type == PythonQtMemberInfo::EnumWrapper) { |
|
386 | 394 | error = QString("Enum '") + attributeName + "' can not be overwritten on " + obj->ob_type->tp_name + " object"; |
|
387 | 395 | } else if (member._type == PythonQtMemberInfo::NotFound) { |
|
396 | // check for a setter_ | |
|
397 | PythonQtMemberInfo setter = wrapper->classInfo()->member(QByteArray("setter_") + attributeName); | |
|
398 | if (setter._type == PythonQtMemberInfo::Slot) { | |
|
399 | // call the setter and ignore the result value | |
|
400 | void* result; | |
|
401 | PyObject* args = PyTuple_New(1); | |
|
402 | Py_INCREF(value); | |
|
403 | PyTuple_SET_ITEM(args, 0, value); | |
|
404 | PythonQtSlotFunction_CallImpl(wrapper->classInfo(), wrapper->_obj, setter._slot, args, NULL, wrapper->_wrappedPtr, &result); | |
|
405 | Py_DECREF(args); | |
|
406 | return 0; | |
|
407 | } | |
|
408 | ||
|
388 | 409 | // handle dynamic properties |
|
389 | 410 | if (wrapper->_obj) { |
|
390 | 411 | QVariant prop = wrapper->_obj->property(attributeName); |
@@ -233,7 +233,7 PyObject *PythonQtSlotFunction_Call(PyObject *func, PyObject *args, PyObject *kw | |||
|
233 | 233 | |
|
234 | 234 | PyObject *PythonQtSlotFunction_CallImpl(PythonQtClassInfo* classInfo, QObject* objectToCall, PythonQtSlotInfo* info, PyObject *args, PyObject * /*kw*/, void* firstArg, void** directReturnValuePointer) |
|
235 | 235 | { |
|
236 | int argc = PyTuple_Size(args); | |
|
236 | int argc = args?PyTuple_Size(args):0; | |
|
237 | 237 | |
|
238 | 238 | #ifdef PYTHONQT_DEBUG |
|
239 | 239 | std::cout << "called " << info->metaMethod()->typeName() << " " << info->metaMethod()->signature() << std::endl; |
General Comments 0
You need to be logged in to leave comments.
Login now