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();
|
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()
|
|||||||
// 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)
|
|||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user