MCPcopy Create free account
hub / github.com/KDAB/GammaRay / setQObject

Method setQObject

plugins/qmlsupport/qmltypeextension.cpp:37–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35QmlTypeExtension::~QmlTypeExtension() = default;
36
37bool 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
58bool QmlTypeExtension::setMetaObject(const QMetaObject *metaObject)
59{

Callers

nothing calls this directly

Calls 5

isValidFunction · 0.85
toObjectInstanceFunction · 0.85
metaObjectMethod · 0.45
urlMethod · 0.45
setObjectMethod · 0.45

Tested by

no test coverage detected