From abdda35966e57c697895af3ca634123847f90ddd Mon Sep 17 00:00:00 2001 From: Thomas Hartmann <Thomas.Hartmann@nokia.com> Date: Fri, 13 Aug 2010 13:59:41 +0200 Subject: [PATCH] QmlJSEditor: refines textmarker logic The textmarker is now updated when the document gets updated and the textmarker is shown again, if the user closes the QuickToolBar. --- src/plugins/qmljseditor/qmljseditor.cpp | 16 +++++++++++++++- src/plugins/qmljseditor/qmljseditor.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index d3b41cb087d..6377fe226d3 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -711,8 +711,12 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) : m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<ModelManagerInterface>(); m_contextPane = ExtensionSystem::PluginManager::instance()->getObject<QmlJS::IContextPane>(); - if (m_contextPane) + + + if (m_contextPane) { connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(onCursorPositionChanged())); + connect(m_contextPane, SIGNAL(closed()), this, SLOT(showTextMarker())); + } m_oldCursorPosition = -1; if (m_modelManager) { @@ -975,11 +979,20 @@ void QmlJSTextEditor::updateCursorPositionNow() } } setRefactorMarkers(markers); + } else { + QList<TextEditor::Internal::RefactorMarker> markers; + setRefactorMarkers(markers); } m_oldCursorPosition = position(); } } +void QmlJSTextEditor::showTextMarker() +{ + m_oldCursorPosition = -1; + updateCursorPositionNow(); +} + void QmlJSTextEditor::updateUses() { m_updateUsesTimer->start(); @@ -1695,6 +1708,7 @@ void QmlJSTextEditor::updateSemanticInfo(const SemanticInfo &semanticInfo) Node *newNode = m_semanticInfo.declaringMemberNoProperties(position()); if (newNode) { m_contextPane->apply(editableInterface(), doc, m_semanticInfo.snapshot, newNode, true); + showTextMarker(); } } diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h index 5f9765a7a11..562bd64b3ff 100644 --- a/src/plugins/qmljseditor/qmljseditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -244,6 +244,7 @@ private slots: void updateOutlineNow(); void updateOutlineIndexNow(); void updateCursorPositionNow(); + void showTextMarker(); void updateFileName(); void updateUses(); -- GitLab