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

Method declarationLocation

plugins/qmlsupport/qmlsupport.cpp:241–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241SourceLocation QmlObjectDataProvider::declarationLocation(const QObject *obj) const
242{
243 Q_ASSERT(obj);
244
245 // C++ QML type
246 auto qmlType = QQmlMetaType::qmlType(obj->metaObject());
247 if (QmlType::isValid(qmlType))
248 return SourceLocation(QmlType::callable(qmlType)->sourceUrl());
249
250 // QML-defined type
251 auto data = QQmlData::get(obj);
252 if (!data || !data->compilationUnit)
253 return SourceLocation();
254
255 qmlType = QQmlMetaType::qmlType(data->compilationUnit->url());
256 if (QmlType::isValid(qmlType))
257 return SourceLocation(QmlType::callable(qmlType)->sourceUrl());
258 return SourceLocation();
259}
260
261QmlSupport::QmlSupport(Probe *probe, QObject *parent)
262 : QObject(parent)

Callers

nothing calls this directly

Calls 5

isValidFunction · 0.85
SourceLocationClass · 0.85
callableFunction · 0.85
metaObjectMethod · 0.45
urlMethod · 0.45

Tested by

no test coverage detected