Skip to content

PythonQt.Qt.QMetaObject

QMetaObject

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

The Qt Meta-Object System in Qt is responsible for the signals and slots inter-object communication mechanism, runtime type information, and the Qt property system. A single QMetaObject instance is created for each QObject subclass that is used in an application, and this instance stores all the meta-information for the QObject subclass. This object is available as QObject::metaObject().

This class is not normally required for application programming, but it is useful if you write meta-applications, such as scripting engines or GUI builders.

The functions you are most likely to find useful are these:

The index functions indexOfConstructor(), indexOfMethod(), indexOfEnumerator(), and indexOfProperty() map names of constructors, member functions, enumerators, or properties to indexes in the meta-object. For example, Qt uses indexOfMethod() internally when you connect a signal to a slot.

Classes can also have a list of name--value pairs of additional class information, stored in QMetaClassInfo objects. The number of pairs is returned by classInfoCount(), single pairs are returned by classInfo(), and you can search for pairs with indexOfClassInfo().

Note: Operations that use the meta object system are generally thread- safe, as QMetaObjects are typically static read-only instances generated at compile time. However, if meta objects are dynamically modified by the application (for instance, when using QQmlPropertyMap), then the application has to explicitly synchronize access to the respective meta object.

Source: https://doc.qt.io/archives/qt-5.15/qmetaobject.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
checkConnectArgs function (self, signal: Any, method: Any) -> bool X.checkConnectArgs(signal, method) -> bool (shared captured text)
classInfo function (self, index: int) -> Any X.classInfo(index) -> PythonQt.QtCore.QMetaClassInfo (shared captured text)
classInfoCount function (self) -> int X.classInfoCount() -> int (shared captured text)
classInfoOffset function (self) -> int X.classInfoOffset() -> int (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> str Return the classname of the object (shared captured text)
constructor function (self, index: int) -> Any X.constructor(index) -> PythonQt.QtCore.QMetaMethod (shared captured text)
constructorCount function (self) -> int X.constructorCount() -> int (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
enumerator function (self, index: int) -> Any X.enumerator(index) -> PythonQt.QtCore.QMetaEnum (shared captured text)
enumeratorCount function (self) -> int X.enumeratorCount() -> int (shared captured text)
enumeratorOffset function (self) -> int X.enumeratorOffset() -> int (shared captured text)
getClassName function (self) -> int X.getClassName() -> int (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
indexOfClassInfo function (self, name: str) -> int X.indexOfClassInfo(name) -> int (shared captured text)
indexOfConstructor function (self, constructor: str) -> int X.indexOfConstructor(constructor) -> int (shared captured text)
indexOfEnumerator function (self, name: str) -> int X.indexOfEnumerator(name) -> int (shared captured text)
indexOfMethod function (self, method: str) -> int X.indexOfMethod(method) -> int (shared captured text)
indexOfProperty function (self, name: str) -> int X.indexOfProperty(name) -> int (shared captured text)
indexOfSignal function (self, signal: str) -> int X.indexOfSignal(signal) -> int (shared captured text)
indexOfSlot function (self, slot: str) -> int X.indexOfSlot(slot) -> int (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> bool Returns if the class inherits or is of given type name (shared captured text)
method function (self, index: int) -> Any X.method(index) -> PythonQt.QtCore.QMetaMethod (shared captured text)
methodCount function (self) -> int X.methodCount() -> int (shared captured text)
methodOffset function (self) -> int X.methodOffset() -> int (shared captured text)
normalizedSignature function (self, method: str) -> Any X.normalizedSignature(method) -> PythonQt.QtCore.QByteArray (shared captured text)
normalizedType function (self, type: str) -> Any X.normalizedType(type) -> PythonQt.QtCore.QByteArray (shared captured text)
property function (self, index: int) -> Any X.property(index) -> PythonQt.QtCore.QMetaProperty (shared captured text)
propertyCount function (self) -> int X.propertyCount() -> int (shared captured text)
propertyOffset function (self) -> int X.propertyOffset() -> int (shared captured text)
superClass function (self) -> Any X.superClass() -> PythonQt.QtCore.QMetaObject (shared captured text)
userProperty function (self) -> Any X.userProperty() -> PythonQt.QtCore.QMetaProperty (shared captured text)