From 6d07b7256c350835917d30cf74c8180592b80452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=C3=A1n=20Maureira-Fredes?= Date: Thu, 15 Jul 2021 14:09:44 +0200 Subject: Implement qmlRegisterSingletonInstance Using a similar approach to the qmlRegisterSingletonType, but wrapping the instance (QObject) into a SingletonFunctor as described in Qt/C++. Add helper function PySide::isQObjectDerived Task-number: PYSIDE-487 Change-Id: Id0fd9da0351a9ba58eae006d7d882f9815f06742 Reviewed-by: Christian Tismer --- sources/pyside6/libpyside/pyside.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sources/pyside6/libpyside/pyside.h') diff --git a/sources/pyside6/libpyside/pyside.h b/sources/pyside6/libpyside/pyside.h index 1cb77b4c5..0c9ad92cf 100644 --- a/sources/pyside6/libpyside/pyside.h +++ b/sources/pyside6/libpyside/pyside.h @@ -105,6 +105,13 @@ PYSIDE_API void initQApp(); /// Return the size in bytes of a type that inherits QObject. PYSIDE_API std::size_t getSizeOfQObject(SbkObjectType *type); +/* Check if a PyTypeObject or its bases contains a QObject + * \param pyType is the PyTypeObject to check + * \param raiseError controls if a TypeError is raised when an object does not + * inherits from QObject + */ +PYSIDE_API bool isQObjectDerived(PyTypeObject *pyType, bool raiseError); + typedef void (*CleanupFunction)(void); /** -- cgit v1.2.3