Fixed type translate on QProperty.
Fix bug #431 Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
This commit is contained in:
parent
d094064ffe
commit
8e1e25a631
1 changed files with 2 additions and 25 deletions
|
|
@ -28,33 +28,10 @@
|
||||||
#include "qproperty_p.h"
|
#include "qproperty_p.h"
|
||||||
#include "dynamicqmetaobject_p.h"
|
#include "dynamicqmetaobject_p.h"
|
||||||
#include "qsignal.h"
|
#include "qsignal.h"
|
||||||
|
#include "qsignal_p.h"
|
||||||
|
|
||||||
#define QPROPERTY_CLASS_NAME "Property"
|
#define QPROPERTY_CLASS_NAME "Property"
|
||||||
|
|
||||||
char* translateTypeName(PyObject* type)
|
|
||||||
{
|
|
||||||
if (PyType_Check(type)) {
|
|
||||||
char* typeName = 0;
|
|
||||||
if (type->ob_type == &Shiboken::SbkBaseWrapperType_Type) {
|
|
||||||
Shiboken::SbkBaseWrapperType* objType = reinterpret_cast<Shiboken::SbkBaseWrapperType*>(type);
|
|
||||||
typeName = strdup(objType->original_name);
|
|
||||||
} else {
|
|
||||||
//tp_name return the full name
|
|
||||||
Shiboken::AutoDecRef otypeName(PyObject_GetAttrString(type, "__name__"));
|
|
||||||
typeName = strdup(PyString_AS_STRING(otypeName.object()));
|
|
||||||
}
|
|
||||||
if (Shiboken::TypeResolver::getType(typeName) == Shiboken::TypeResolver::ObjectType) {
|
|
||||||
typeName = reinterpret_cast<char*>(realloc(typeName, strlen(typeName) + 1));
|
|
||||||
typeName = strcat(typeName, "*");
|
|
||||||
}
|
|
||||||
return typeName;
|
|
||||||
} else if (PyString_Check(type)) {
|
|
||||||
return strdup(PyString_AS_STRING(type));
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -162,7 +139,7 @@ int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
|
||||||
if (!pData->fset && pData->fget)
|
if (!pData->fset && pData->fget)
|
||||||
pData->constant = true;
|
pData->constant = true;
|
||||||
|
|
||||||
pData->typeName = translateTypeName(type);
|
pData->typeName = PySide::getTypeName(type);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue