| 35 | QmlTypeExtension::~QmlTypeExtension() = default; |
| 36 | |
| 37 | bool QmlTypeExtension::setQObject(QObject *object) |
| 38 | { |
| 39 | if (!object) |
| 40 | return false; |
| 41 | // C++ QML type |
| 42 | if (setMetaObject(object->metaObject())) |
| 43 | return true; |
| 44 | |
| 45 | // QML-defined type |
| 46 | auto data = QQmlData::get(object); |
| 47 | if (!data || !data->compilationUnit) |
| 48 | return false; |
| 49 | |
| 50 | const auto qmlType = QQmlMetaType::qmlType(data->compilationUnit->url()); |
| 51 | if (!QmlType::isValid(qmlType)) |
| 52 | return false; |
| 53 | |
| 54 | m_typePropertyModel->setObject(QmlType::toObjectInstance(qmlType)); |
| 55 | return true; |
| 56 | } |
| 57 | |
| 58 | bool QmlTypeExtension::setMetaObject(const QMetaObject *metaObject) |
| 59 | { |
nothing calls this directly
no test coverage detected