Skip to content
Snippets Groups Projects
Commit 48ff3f7a authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.NodeInstances: Fix id getter

Add getter for id in node instances.
parent 1a9bd5b1
No related branches found
No related tags found
No related merge requests found
...@@ -141,6 +141,8 @@ public: ...@@ -141,6 +141,8 @@ public:
static void registerDeclarativeTypes(); static void registerDeclarativeTypes();
QString id() const;
#ifdef QTCREATOR_TEST #ifdef QTCREATOR_TEST
QObject* testHandle() const; QObject* testHandle() const;
Internal::ObjectNodeInstance* internalInstance() const; Internal::ObjectNodeInstance* internalInstance() const;
......
...@@ -644,6 +644,11 @@ void NodeInstance::registerDeclarativeTypes() ...@@ -644,6 +644,11 @@ void NodeInstance::registerDeclarativeTypes()
// qmlRegisterType<QmlDesigner::Internal::QmlPropertyChangesObject>(); // qmlRegisterType<QmlDesigner::Internal::QmlPropertyChangesObject>();
} }
QString NodeInstance::id() const
{
return m_nodeInstance->id();
}
#ifdef QTCREATOR_TEST #ifdef QTCREATOR_TEST
QObject* NodeInstance::testHandle() const QObject* NodeInstance::testHandle() const
{ {
......
...@@ -699,8 +699,8 @@ void NodeInstanceView::removeIdFromContext(QObject *object) ...@@ -699,8 +699,8 @@ void NodeInstanceView::removeIdFromContext(QObject *object)
{ {
if (hasInstanceForObject(object)) { if (hasInstanceForObject(object)) {
NodeInstance instance = instanceForObject(object); NodeInstance instance = instanceForObject(object);
if (instance.internalInstance()) { if (instance.isValid()) {
QString id = instance.internalInstance()->id(); QString id = instance.id();
if (!id.isEmpty()) if (!id.isEmpty())
engine()->rootContext()->setContextProperty(id, 0); engine()->rootContext()->setContextProperty(id, 0);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment