Details
Description
Subclass QObject or a derived type with a property of type QQmlComponent:
from PySide6.QtCore import Property, QObject from PySide6.QtQml import QQmlComponent class WithComponent(QObject): def get_component(self) -> QQmlComponent | None: return None component = Property(QQmlComponent, fget=get_component)
Inspect the meta property:
m = WithComponent.staticMetaObject c = m.property(m.indexOfProperty("component")) print("Type ID:", c.typeId()) print("Type name:", c.typeName()) print("Metatype is valid:", c.metaType().isValid())
which yields
Type ID: 0 Type name: QQmlComponent* Metatype is valid: False
I'd expect to be able to use this property but the type is not valid and cannot be used in QML. I've tried other types such as QObject or QQuickItem and they do work.