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.
This commit is contained in:
Thomas Hartmann
2010-08-13 13:59:41 +02:00
parent 2c160a9b2a
commit abdda35966
2 changed files with 16 additions and 1 deletions

View File

@@ -711,8 +711,12 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) :
m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<ModelManagerInterface>(); m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<ModelManagerInterface>();
m_contextPane = ExtensionSystem::PluginManager::instance()->getObject<QmlJS::IContextPane>(); m_contextPane = ExtensionSystem::PluginManager::instance()->getObject<QmlJS::IContextPane>();
if (m_contextPane)
if (m_contextPane) {
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(onCursorPositionChanged())); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(onCursorPositionChanged()));
connect(m_contextPane, SIGNAL(closed()), this, SLOT(showTextMarker()));
}
m_oldCursorPosition = -1; m_oldCursorPosition = -1;
if (m_modelManager) { if (m_modelManager) {
@@ -975,11 +979,20 @@ void QmlJSTextEditor::updateCursorPositionNow()
} }
} }
setRefactorMarkers(markers); setRefactorMarkers(markers);
} else {
QList<TextEditor::Internal::RefactorMarker> markers;
setRefactorMarkers(markers);
} }
m_oldCursorPosition = position(); m_oldCursorPosition = position();
} }
} }
void QmlJSTextEditor::showTextMarker()
{
m_oldCursorPosition = -1;
updateCursorPositionNow();
}
void QmlJSTextEditor::updateUses() void QmlJSTextEditor::updateUses()
{ {
m_updateUsesTimer->start(); m_updateUsesTimer->start();
@@ -1695,6 +1708,7 @@ void QmlJSTextEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
Node *newNode = m_semanticInfo.declaringMemberNoProperties(position()); Node *newNode = m_semanticInfo.declaringMemberNoProperties(position());
if (newNode) { if (newNode) {
m_contextPane->apply(editableInterface(), doc, m_semanticInfo.snapshot, newNode, true); m_contextPane->apply(editableInterface(), doc, m_semanticInfo.snapshot, newNode, true);
showTextMarker();
} }
} }

View File

@@ -244,6 +244,7 @@ private slots:
void updateOutlineNow(); void updateOutlineNow();
void updateOutlineIndexNow(); void updateOutlineIndexNow();
void updateCursorPositionNow(); void updateCursorPositionNow();
void showTextMarker();
void updateFileName(); void updateFileName();
void updateUses(); void updateUses();