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.
Attachments
For Gerrit Dashboard: PYSIDE-2415 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
494974,3 | Add support for QQmlComponent in Property | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
495679,2 | Add support for QQmlComponent in Property | 6.5 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
495744,3 | Add support for QQmlComponent in Property | tqtc/lts-6.2 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |