forked from qt-creator/qt-creator
QmlDesigner.NodeInstances: Fix id getter
Add getter for id in node instances.
This commit is contained in:
@@ -141,6 +141,8 @@ public:
|
||||
|
||||
static void registerDeclarativeTypes();
|
||||
|
||||
QString id() const;
|
||||
|
||||
#ifdef QTCREATOR_TEST
|
||||
QObject* testHandle() const;
|
||||
Internal::ObjectNodeInstance* internalInstance() const;
|
||||
|
||||
@@ -644,6 +644,11 @@ void NodeInstance::registerDeclarativeTypes()
|
||||
// qmlRegisterType<QmlDesigner::Internal::QmlPropertyChangesObject>();
|
||||
}
|
||||
|
||||
QString NodeInstance::id() const
|
||||
{
|
||||
return m_nodeInstance->id();
|
||||
}
|
||||
|
||||
#ifdef QTCREATOR_TEST
|
||||
QObject* NodeInstance::testHandle() const
|
||||
{
|
||||
|
||||
@@ -699,8 +699,8 @@ void NodeInstanceView::removeIdFromContext(QObject *object)
|
||||
{
|
||||
if (hasInstanceForObject(object)) {
|
||||
NodeInstance instance = instanceForObject(object);
|
||||
if (instance.internalInstance()) {
|
||||
QString id = instance.internalInstance()->id();
|
||||
if (instance.isValid()) {
|
||||
QString id = instance.id();
|
||||
if (!id.isEmpty())
|
||||
engine()->rootContext()->setContextProperty(id, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user