diff --git a/src/plugins/qmljsinspector/qmljsclientproxy.cpp b/src/plugins/qmljsinspector/qmljsclientproxy.cpp index e754d8075b1c389f019e46759e6b95e661a0941b..f8de468ebacc53abde40667f2d424cb4e58d8e78 100644 --- a/src/plugins/qmljsinspector/qmljsclientproxy.cpp +++ b/src/plugins/qmljsinspector/qmljsclientproxy.cpp @@ -262,6 +262,12 @@ QDeclarativeDebugObjectReference ClientProxy::objectReferenceForId(int debugId) return objectReferenceForId(debugId, m_rootObject); } +QDeclarativeDebugObjectReference QmlJSInspector::Internal::ClientProxy::rootObjectReference() const +{ + return m_rootObject; +} + + QDeclarativeDebugObjectReference ClientProxy::objectReferenceForId(int debugId, const QDeclarativeDebugObjectReference &objectRef) const { diff --git a/src/plugins/qmljsinspector/qmljsclientproxy.h b/src/plugins/qmljsinspector/qmljsclientproxy.h index 98db3616c796df5849dec8e20df499fa07951243..f266e3d09b63380230d16b7b644318e9fe61e52c 100644 --- a/src/plugins/qmljsinspector/qmljsclientproxy.h +++ b/src/plugins/qmljsinspector/qmljsclientproxy.h @@ -62,6 +62,7 @@ public: // returns the object references for the given url. QList<QDeclarativeDebugObjectReference> objectReferences(const QUrl &url = QUrl()) const; QDeclarativeDebugObjectReference objectReferenceForId(int debugId) const; + QDeclarativeDebugObjectReference rootObjectReference() const; void refreshObjectTree(); bool isConnected() const; diff --git a/src/plugins/qmljsinspector/qmljsinspector.cpp b/src/plugins/qmljsinspector/qmljsinspector.cpp index fee3bfa102c7f072fb94f8bda22bd832532d3b94..6aaf01fe0dda3aa00c600f79215127c6992e83ca 100644 --- a/src/plugins/qmljsinspector/qmljsinspector.cpp +++ b/src/plugins/qmljsinspector/qmljsinspector.cpp @@ -231,19 +231,9 @@ void Inspector::initializeDocuments() connect(em, SIGNAL(editorOpened(Core::IEditor*)), SLOT(createPreviewForEditor(Core::IEditor*))); // initial update -#if 0 foreach (Core::IEditor *editor, em->openedEditors()) { createPreviewForEditor(editor); } -#else - foreach (QmlJS::Document::Ptr doc, m_loadedSnapshot) { - QmlJSLiveTextPreview *preview = new QmlJSLiveTextPreview(doc, doc, this); - connect(preview, - SIGNAL(selectedItemsChanged(QList<QDeclarativeDebugObjectReference>)), - SLOT(changeSelectedItems(QList<QDeclarativeDebugObjectReference>))); - m_textPreviews.insert(doc->fileName(), preview); - } -#endif } void Inspector::serverReloaded() @@ -286,6 +276,7 @@ void Inspector::createPreviewForEditor(Core::IEditor *newEditor) SIGNAL(selectedItemsChanged(QList<QDeclarativeDebugObjectReference>)), SLOT(changeSelectedItems(QList<QDeclarativeDebugObjectReference>))); m_textPreviews.insert(newEditor->file()->fileName(), preview); + preview->updateDebugIds(m_clientProxy->rootObjectReference()); } } } diff --git a/src/plugins/qmljsinspector/qmljslivetextpreview.cpp b/src/plugins/qmljsinspector/qmljslivetextpreview.cpp index 554ef22750a4a186d1fd713f0d32717f6f0b5a42..b781be7c24a9891073882ee4d2890c43d3934081 100644 --- a/src/plugins/qmljsinspector/qmljslivetextpreview.cpp +++ b/src/plugins/qmljsinspector/qmljslivetextpreview.cpp @@ -144,12 +144,6 @@ QmlJSLiveTextPreview::QmlJSLiveTextPreview(const QmlJS::Document::Ptr &doc, cons connect(clientProxy, SIGNAL(objectTreeUpdated(QDeclarativeDebugObjectReference)), SLOT(updateDebugIds(QDeclarativeDebugObjectReference))); - - Core::EditorManager *em = Core::EditorManager::instance(); - QList<Core::IEditor *> editors = em->editorsForFileName(m_filename); - - foreach(Core::IEditor *editor, editors) - associateEditor(editor); } void QmlJSLiveTextPreview::resetInitialDoc(const QmlJS::Document::Ptr &doc) diff --git a/src/plugins/qmljsinspector/qmljslivetextpreview.h b/src/plugins/qmljsinspector/qmljslivetextpreview.h index 420875e45da5e056400d5a1c0b48d7a2705dc3e9..b40f534146ef4d96833f0a0497b5e25a6c00ecfc 100644 --- a/src/plugins/qmljsinspector/qmljslivetextpreview.h +++ b/src/plugins/qmljsinspector/qmljslivetextpreview.h @@ -49,6 +49,7 @@ signals: private slots: void changeSelectedElements(QList<int> offsets, const QString &wordAtCursor); void documentChanged(QmlJS::Document::Ptr doc); +public slots: void updateDebugIds(const QDeclarativeDebugObjectReference &rootReference); private: