1 #ifndef _PYTHONQTCLASSINFO_H
2 #define _PYTHONQTCLASSINFO_H
38 #include <QMetaObject>
39 #include <QMetaMethod>
156 void*
castTo(
void* ptr,
const char* classname);
187 _shellSetInstanceWrapperCB = cb;
192 return _shellSetInstanceWrapperCB;
241 void updateRefCountingCBs();
243 void createEnumWrappers(
const QObject* decoratorProvider);
244 void createEnumWrappers(
const QMetaObject* meta);
245 PyObject* findEnumWrapper(
const char* name);
248 void clearCachedMembers();
250 void* recursiveCastDownIfPossible(
void* ptr,
const char** resultClassName);
252 PythonQtSlotInfo* findDecoratorSlotsFromDecoratorProvider(
const char* memberName,
PythonQtSlotInfo* inputInfo,
bool &found, QHash<QByteArray, PythonQtMemberInfo>& memberCache,
int upcastingOffset);
253 void listDecoratorSlotsFromDecoratorProvider(QStringList& list,
bool metaOnly);
254 PythonQtSlotInfo* recursiveFindDecoratorSlotsFromDecoratorProvider(
const char* memberName,
PythonQtSlotInfo* inputInfo,
bool &found, QHash<QByteArray, PythonQtMemberInfo>& memberCache,
int upcastingOffset);
256 void recursiveCollectClassInfos(QList<PythonQtClassInfo*>& classInfoObjects);
257 void recursiveCollectDecoratorObjects(QList<QObject*>& decoratorObjects);
259 bool lookForPropertyAndCache(
const char* memberName);
260 bool lookForMethodAndCache(
const char* memberName);
261 bool lookForEnumAndCache(
const QMetaObject* m,
const char* memberName);
263 PythonQtSlotInfo* findDecoratorSlots(
const char* memberName,
PythonQtSlotInfo* tail,
bool &found, QHash<QByteArray, PythonQtMemberInfo>& memberCache,
int upcastingOffset);
264 int findCharOffset(
const char* sigStart,
char someChar);
266 QHash<QByteArray, PythonQtMemberInfo> _cachedMembers;
274 QList<PythonQtSlotInfo*> _decoratorSlots;
276 QList<PythonQtObjectPtr> _enumWrappers;
278 const QMetaObject* _meta;
280 QByteArray _wrappedClassName;
281 QList<ParentClassInfo> _parentClasses;
283 QList<PythonQtPolymorphicHandlerCB*> _polymorphicHandlers;
285 QList<PythonQtClassInfo*> _nestedClasses;
287 QObject* _decoratorProvider;
299 bool _richCompareDetectionDone;
300 bool _searchPolymorphicHandlerOnParent;
301 bool _searchRefCountCB;
QObject * PythonQtQObjectCreatorFunctionCB()
callback to create a QObject lazily
void PythonQtShellSetInstanceWrapperCB(void *object, PythonQtInstanceWrapper *wrapper)
void PythonQtVoidPtrCB(void *object)
void * PythonQtPolymorphicHandlerCB(const void *ptr, const char **class_name)
a class that stores all required information about a Qt object (and an optional associated C++ class ...
void setShellSetInstanceWrapperCB(PythonQtShellSetInstanceWrapperCB *cb)
set the shell set instance wrapper cb
void setReferenceCounting(PythonQtVoidPtrCB *refCB, PythonQtVoidPtrCB *unrefCB)
Sets reference counting callbacks for this class and all its subclasses.
bool supportsRichCompare()
void addNestedClass(PythonQtClassInfo *info)
add a nested class, so that it can be shown as outer class member
PythonQtClassInfo * getClassInfoForProperty(const QString &name)
Returns the class info for given property, if available.
bool isCPPWrapper()
returns if the class is a CPP wrapper
PyObject * copyObject(void *cppObject)
bool inherits(const char *classname)
returns if this class inherits from the given classname
void addDecoratorSlot(PythonQtSlotInfo *info)
add a decorator slot, ownership is passed to classinfo
void clearNotFoundCachedMembers()
clear all members that where cached as "NotFound"
QStringList memberList()
get list of all members (excluding properties, which can be listed with propertyList())
void setDecoratorProvider(PythonQtQObjectCreatorFunctionCB *cb)
set an additional decorator provider that offers additional decorator slots for this class
PythonQtSlotInfo * constructors()
get access to the constructor slot (which may be overloaded if there are multiple constructors)
int typeSlots() const
get the type capabilities
PythonQtShellSetInstanceWrapperCB * shellSetInstanceWrapperCB()
get the shell set instance wrapper cb
int metaTypeId()
get the meta type id of this class (only valid for isCPPWrapper() == true)
void addParentClass(const ParentClassInfo &info)
add the parent class info of a CPP object
static PyObject * findEnumWrapper(const QByteArray &name, PythonQtClassInfo *localScope, bool *isLocalEnum=NULL)
returns if the localScope has an enum of that type name or if the enum contains a :: scope,...
QString help()
get help string for the metaobject
PythonQtSlotInfo * destructor()
get access to the destructor slot
void addPolymorphicHandler(PythonQtPolymorphicHandlerCB *cb)
add a handler for polymorphic downcasting
PythonQtVoidPtrCB * referenceCountingRefCB()
Returns the ref counting CB, if there is any.
bool isQObject()
returns if the QObject
bool inherits(PythonQtClassInfo *info)
returns if this class inherits from the given classinfo
QStringList propertyList()
get list of all properties (on QObjects only, otherwise the list is empty)
void setupCPPObject(const QByteArray &classname)
setup as a CPP (non-QObject), taking the classname
void setDestructor(PythonQtSlotInfo *info)
set a destructor, ownership is passed to classinfo
PythonQtMemberInfo member(const char *member)
get the Python method definition for a given slot name (without return type and signature)
void addConstructor(PythonQtSlotInfo *info)
add a constructor, ownership is passed to classinfo
void setMetaObject(const QMetaObject *meta)
set the meta object, this will reset the caching
QByteArray unscopedClassName() const
get the unscoped classname (without ParentClass::) for nested classes
PythonQtVoidPtrCB * referenceCountingUnrefCB()
Returns the unref counting CB, if there is any.
PythonQtSlotInfo * getCopyConstructor()
Get the copy constructor for this class.
void setTypeSlots(int typeSlots)
set the type capabilities
void * castTo(void *ptr, const char *classname)
const QList< PythonQtClassInfo * > & nestedClasses()
get nested classes
void setPythonQtClassWrapper(PyObject *obj)
set the associated PythonQtClassWrapper (which handles instance creation of this type)
PyObject * pythonQtClassWrapper()
get the associated PythonQtClassWrapper (which handles instance creation of this type)
void setupQObject(const QMetaObject *meta)
setup as a QObject, taking the meta object as meta information about the QObject
QObject * decorator()
get the decorator qobject instance
const QMetaObject * metaObject()
get the meta object
PyObject * getPythonTypeForProperty(const QString &name)
void * castDownIfPossible(void *ptr, PythonQtClassInfo **resultClassInfo)
cast the pointer down in the class hierarchy if a polymorphic handler allows to do that
const QByteArray & className() const
get the classname (either of the QObject or of the wrapped CPP object)
a smart pointer that stores a PyObject pointer and that handles reference counting automatically
stores information about a slot, including a next pointer to overloaded slots
store information about parent classes
ParentClassInfo(PythonQtClassInfo *parent, int upcastingOffset=0)
PythonQtClassInfo * _parent
~PythonQtDynamicClassInfo()
const QMetaObject * _dynamicMetaObject
PythonQtClassInfo * _classInfo
PythonQtDynamicClassInfo()
PythonQtObjectPtr _enumValue
PythonQtMemberInfo(const QMetaProperty &prop)
PythonQtMemberInfo(const PythonQtObjectPtr &enumValue)
PythonQtMemberInfo(PythonQtSlotInfo *info)