@@ -80,11 +80,16 PyObject* PythonQtConv::ConvertQtValueToPython(const PythonQtMethodInfo::Paramet | |||
|
80 | 80 | } else if ((info.typeId == PythonQtMethodInfo::Unknown || info.typeId >= QMetaType::User) && |
|
81 | 81 | info.name.startsWith("QList<")) { |
|
82 | 82 | // it is a QList template: |
|
83 | // (TODO: check what happens if this is a pointer type?!) | |
|
84 | 83 | QByteArray innerType = info.name.mid(6,info.name.length()-7); |
|
85 | 84 | if (innerType.endsWith("*")) { |
|
86 | 85 | innerType.truncate(innerType.length()-1); |
|
87 | return ConvertQListOfPointerTypeToPythonList((QList<void*>*)data, innerType); | |
|
86 | QList<void*>* listPtr; | |
|
87 | if (info.isPointer) { | |
|
88 | listPtr = *((QList<void*>**)data); | |
|
89 | } else { | |
|
90 | listPtr = (QList<void*>*)data; | |
|
91 | } | |
|
92 | return ConvertQListOfPointerTypeToPythonList(listPtr, innerType); | |
|
88 | 93 | } |
|
89 | 94 | } |
|
90 | 95 |
@@ -185,7 +185,13 PyObject *PythonQtSlotFunction_Call(PyObject *func, PyObject *args, PyObject *kw | |||
|
185 | 185 | PythonQtSlotInfo* info = f->m_ml; |
|
186 | 186 | if (PyObject_TypeCheck(f->m_self, &PythonQtInstanceWrapper_Type)) { |
|
187 | 187 | PythonQtInstanceWrapper* self = (PythonQtInstanceWrapper*) f->m_self; |
|
188 | return PythonQtSlotFunction_CallImpl(self->classInfo(), self->_obj, info, args, kw, self->_wrappedPtr); | |
|
188 | if (!info->isClassDecorator() && (self->_obj==NULL && self->_wrappedPtr==NULL)) { | |
|
189 | QString error = QString("Trying to call '") + f->m_ml->slotName() + "' on a destroyed " + self->classInfo()->className() + " object"; | |
|
190 | PyErr_SetString(PyExc_ValueError, error.toLatin1().data()); | |
|
191 | return NULL; | |
|
192 | } else { | |
|
193 | return PythonQtSlotFunction_CallImpl(self->classInfo(), self->_obj, info, args, kw, self->_wrappedPtr); | |
|
194 | } | |
|
189 | 195 | } else if (f->m_self->ob_type == &PythonQtClassWrapper_Type) { |
|
190 | 196 | PythonQtClassWrapper* type = (PythonQtClassWrapper*) f->m_self; |
|
191 | 197 | if (info->isClassDecorator()) { |
@@ -198,6 +204,11 PyObject *PythonQtSlotFunction_Call(PyObject *func, PyObject *args, PyObject *kw | |||
|
198 | 204 | if (PyObject_TypeCheck(firstArg, (PyTypeObject*)&PythonQtInstanceWrapper_Type) |
|
199 | 205 | && ((PythonQtInstanceWrapper*)firstArg)->classInfo()->inherits(type->classInfo())) { |
|
200 | 206 | PythonQtInstanceWrapper* self = (PythonQtInstanceWrapper*)firstArg; |
|
207 | if (!info->isClassDecorator() && (self->_obj==NULL && self->_wrappedPtr==NULL)) { | |
|
208 | QString error = QString("Trying to call '") + f->m_ml->slotName() + "' on a destroyed " + self->classInfo()->className() + " object"; | |
|
209 | PyErr_SetString(PyExc_ValueError, error.toLatin1().data()); | |
|
210 | return NULL; | |
|
211 | } | |
|
201 | 212 | // strip the first argument... |
|
202 | 213 | PyObject* newargs = PyTuple_GetSlice(args, 1, argc); |
|
203 | 214 | PyObject* result = PythonQtSlotFunction_CallImpl(self->classInfo(), self->_obj, info, newargs, kw, self->_wrappedPtr); |
@@ -144,14 +144,9 void PythonQtStdDecorators::setParent(QObject* o, QObject* parent) | |||
|
144 | 144 | o->setParent(parent); |
|
145 | 145 | } |
|
146 | 146 | |
|
147 |
|
|
|
147 | const QObjectList* PythonQtStdDecorators::children(QObject* o) | |
|
148 | 148 | { |
|
149 | QVariantList v; | |
|
150 | QListIterator<QObject*> it(o->children()); | |
|
151 | while (it.hasNext()) { | |
|
152 | v << qVariantFromValue(it.next()); | |
|
153 | } | |
|
154 | return v; | |
|
149 | return &o->children(); | |
|
155 | 150 | } |
|
156 | 151 | |
|
157 | 152 | QString PythonQtStdDecorators::tr(QObject* obj, const QByteArray& text, const QByteArray& ambig, int n) |
@@ -70,7 +70,7 public slots: | |||
|
70 | 70 | QObject* parent(QObject* o); |
|
71 | 71 | void setParent(QObject* o, QObject* parent); |
|
72 | 72 | |
|
73 |
|
|
|
73 | const QObjectList* children(QObject* o); | |
|
74 | 74 | |
|
75 | 75 | double static_Qt_qAbs(double a) { return qAbs(a); } |
|
76 | 76 | double static_Qt_qBound(double a,double b,double c) { return qBound(a,b,c); } |
General Comments 0
You need to be logged in to leave comments.
Login now