Skip to content

PythonQt.Qt.QMetaType

QMetaType

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

The class is used as a helper to marshall types in QVariant and in queued signals and slots connections. It associates a type name to a type so that it can be created and destructed dynamically at run-time. Declare new types with Q_DECLARE_METATYPE() to make them available to QVariant and other template-based functions. Call qRegisterMetaType() to make types available to non-template based functions, such as the queued signal and slot connections.

Any class or struct that has a public default constructor, a public copy constructor, and a public destructor can be registered.

The following code allocates and destructs an instance of MyClass:

int id = QMetaType::type("MyClass");
if (id != QMetaType::UnknownType) {
    void *myClassPtr = QMetaType::create(id);
    ...
    QMetaType::destroy(id, myClassPtr);
    myClassPtr = 0;
}

If we want the stream operators operator<<() and operator>>() to work on QVariant objects that store custom types, the custom type must provide operator<<() and operator>>() operators.

Source: https://doc.qt.io/archives/qt-5.15/qmetatype.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
IsEnumeration attribute Any (shared captured text)
IsGadget attribute Any (shared captured text)
MovableType attribute Any (shared captured text)
NeedsConstruction attribute Any (shared captured text)
NeedsDestruction attribute Any (shared captured text)
PointerToQObject attribute Any (shared captured text)
SharedPointerToQObject attribute Any (shared captured text)
TrackingPointerToQObject attribute Any (shared captured text)
TypeFlag attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
TypeFlags attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
WasDeclaredAsMetaType attribute Any (shared captured text)
WeakPointerToQObject attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
compare function (self, lhs: Any, rhs: Any, typeId: Any, result: Any) -> bool X.compare(lhs, rhs, typeId, result) -> bool (shared captured text)
construct function (self, type: Any, where: Any, copy: Any) -> Any X.construct(type, where, copy) (shared captured text)
convert function (self, *args: Any, **kwargs: Any) -> Any X.convert(from, fromTypeId, to, toTypeId) -> bool (shared captured text)
create function (self, copy: Any) -> Any Returns a copy of copy, assuming it is of type type. (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
destroy function (self, type: Any, data: Any) -> Any X.destroy(type, data) (shared captured text)
destruct function (self, type: Any, where: Any) -> Any X.destruct(type, where) (shared captured text)
equals function (self, lhs: Any, rhs: Any, typeId: Any, result: Any) -> bool X.equals(lhs, rhs, typeId, result) -> bool (shared captured text)
flags function (self) -> Any Returns flags of the type for which this [QMetaType](https://doc.qt.io/archives/qt-5.15/qmetatype.html) instance was constructed. (shared captured text)
hasRegisteredComparators function (self, typeId: Any) -> bool X.hasRegisteredComparators(typeId) -> bool (shared captured text)
hasRegisteredConverterFunction function (self, fromTypeId: Any, toTypeId: Any) -> bool X.hasRegisteredConverterFunction(fromTypeId, toTypeId) -> bool (shared captured text)
hasRegisteredDebugStreamOperator function (self, typeId: Any) -> bool X.hasRegisteredDebugStreamOperator(typeId) -> bool (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
isRegistered function (self) -> bool X.isRegistered() -> bool (shared captured text)
isValid function (self) -> bool X.isValid() -> bool (shared captured text)
load function (self, stream: Any, type: Any, data: Any) -> bool X.load(stream, type, data) -> bool (shared captured text)
metaObject function (self) -> Any X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text)
metaObjectForType function (self, type: Any) -> Any X.metaObjectForType(type) -> PythonQt.QtCore.QMetaObject (shared captured text)
registerNormalizedTypedef function (self, normalizedTypeName: Any, aliasId: Any) -> int X.registerNormalizedTypedef(normalizedTypeName, aliasId) -> int (shared captured text)
registerTypedef function (self, typeName: Any, aliasId: Any) -> int X.registerTypedef(typeName, aliasId) -> int (shared captured text)
save function (self, stream: Any, type: Any, data: Any) -> bool X.save(stream, type, data) -> bool (shared captured text)
sizeOf function (self) -> int X.sizeOf() -> int (shared captured text)
type function (self, typeName: Any) -> int X.type(typeName) -> int (shared captured text)
typeFlags function (self, type: Any) -> Any Returns flags of the given type. (shared captured text)
typeName function (self, type: Any) -> int X.typeName(type) -> int (shared captured text)
unregisterType function (self, type: Any) -> bool X.unregisterType(type) -> bool (shared captured text)