diff options
-rw-r--r-- | src/plugins/debugger/qml/qmllivetextpreview.cpp | 17 | ||||
-rw-r--r-- | src/plugins/debugger/qml/qmllivetextpreview.h | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/plugins/debugger/qml/qmllivetextpreview.cpp b/src/plugins/debugger/qml/qmllivetextpreview.cpp index 309885a3bc..2f940436a3 100644 --- a/src/plugins/debugger/qml/qmllivetextpreview.cpp +++ b/src/plugins/debugger/qml/qmllivetextpreview.cpp @@ -354,6 +354,7 @@ QmlLiveTextPreview::QmlLiveTextPreview(const QmlJS::Document::Ptr &doc, , m_nodeForOffset(0) , m_updateNodeForOffset(false) , m_changesUnsynchronizable(false) + , m_contentsChanged(false) { QTC_CHECK(doc->fileName() == initDoc->fileName()); @@ -385,10 +386,12 @@ void QmlLiveTextPreview::associateEditor(Core::IEditor *editor) if (!m_editors.contains(editWidget)) { m_editors << editWidget; - if (m_inspectorAdapter) + if (m_inspectorAdapter) { + connect(editWidget, SIGNAL(changed()), SLOT(editorContentsChanged())); connect(editWidget, SIGNAL(selectedElementsChanged(QList<QmlJS::AST::UiObjectMember*>,QString)), SLOT(changeSelectedElements(QList<QmlJS::AST::UiObjectMember*>,QString))); + } } } } @@ -589,6 +592,12 @@ void QmlLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc) if (doc->fileName() != m_previousDoc->fileName()) return; + // Changes to be applied when changes were made from the editor. + // m_contentsChanged ensures that the changes were made by the user in + // the editor before starting with the comparisons. + if (!m_contentsChanged) + return; + if (m_applyChangesToQmlInspector) { m_docWithUnappliedChanges.clear(); @@ -626,6 +635,12 @@ void QmlLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc) } else { m_docWithUnappliedChanges = doc; } + m_contentsChanged = false; +} + +void QmlLiveTextPreview::editorContentsChanged() +{ + m_contentsChanged = true; } QList<int> QmlLiveTextPreview::objectReferencesForOffset(quint32 offset) diff --git a/src/plugins/debugger/qml/qmllivetextpreview.h b/src/plugins/debugger/qml/qmllivetextpreview.h index adebbf2fd4..7a6c052bb9 100644 --- a/src/plugins/debugger/qml/qmllivetextpreview.h +++ b/src/plugins/debugger/qml/qmllivetextpreview.h @@ -83,6 +83,7 @@ private slots: void changeSelectedElements(const QList<QmlJS::AST::UiObjectMember *> offsets, const QString &wordAtCursor); void documentChanged(QmlJS::Document::Ptr doc); + void editorContentsChanged(); private: enum UnsyncronizableChangeType { @@ -115,6 +116,7 @@ private: QmlJS::AST::UiObjectMember *m_nodeForOffset; bool m_updateNodeForOffset; bool m_changesUnsynchronizable; + bool m_contentsChanged; friend class UpdateInspector; }; |