From ff5eb006437ec041077c3ba324c136bed567e8d0 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann <Thomas.Hartmann@nokia.com> Date: Thu, 21 Oct 2010 15:10:48 +0200 Subject: [PATCH] QuickToolBar: do not show QuickToolBar as tooltip anymore. Most users perceived this as a bug and found it annoying in practice. So this feature gets removed. Reviewed-by: Roberto Raggi --- src/plugins/qmljseditor/qmljseditor.cpp | 41 ------------------------- src/plugins/qmljseditor/qmljseditor.h | 4 --- 2 files changed, 45 deletions(-) diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 0df9bed728a..d6684315d4f 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -84,7 +84,6 @@ enum { UPDATE_DOCUMENT_DEFAULT_INTERVAL = 100, UPDATE_USES_DEFAULT_INTERVAL = 150, UPDATE_OUTLINE_INTERVAL = 500, // msecs after new semantic info has been arrived / cursor has moved - TOOLTIP_TIMER_INTERVAL = 1000 // delay after we show the Quick ToolBar after a tooltip }; using namespace QmlJS; @@ -680,7 +679,6 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) : m_modelManager(0), m_contextPane(0), m_updateSelectedElements(false), - m_toolTipPosition(0), m_findReferences(new FindReferences(this)) { qRegisterMetaType<QmlJSEditor::Internal::SemanticInfo>("QmlJSEditor::Internal::SemanticInfo"); @@ -728,11 +726,6 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) : m_cursorPositionTimer->setSingleShot(true); connect(m_cursorPositionTimer, SIGNAL(timeout()), this, SLOT(updateCursorPositionNow())); - m_toolTipTimer = new QTimer(this); - m_toolTipTimer->setInterval(TOOLTIP_TIMER_INTERVAL); - m_toolTipTimer->setSingleShot(true); - connect(m_toolTipTimer, SIGNAL(timeout()), this, SLOT(updateToolTipNow())); - baseTextDocument()->setSyntaxHighlighter(new Highlighter(document())); m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<ModelManagerInterface>(); @@ -1476,40 +1469,6 @@ void QmlJSTextEditor::performQuickFix(int index) op->perform(); } -void QmlJSTextEditor::onTooltipRequested(TextEditor::ITextEditor* /* editor */, QPoint /* point */, int position) -{ - m_toolTipPosition = position; - if (m_contextPane) { - m_toolTipTimer->start(); - } -} - -void QmlJSTextEditor::updateToolTipNow() -{ - if (!TextEditor::ToolTip::instance()->isVisible()) - return; - - if (m_contextPane && m_semanticInfo.isValid()) { - Node *newNode = m_semanticInfo.declaringMemberNoProperties(m_toolTipPosition); - if (m_contextPane->isAvailable(editableInterface(), m_semanticInfo.lookupContext(), newNode)) { - if (UiQualifiedId *q = qualifiedTypeNameId(newNode)) { - const int start = q->identifierToken.begin(); - for (; q; q = q->next) { - if (! q->next) { - const int end = q->identifierToken.end(); - if (m_toolTipPosition >= start && m_toolTipPosition <= end) { - m_contextPane->apply(editableInterface(), m_semanticInfo.lookupContext(), newNode, false, true); - m_oldCursorPosition = m_toolTipPosition; - QList<TextEditor::Internal::RefactorMarker> markers; - setRefactorMarkers(markers); - } - } - } - } - } - } -} - void QmlJSTextEditor::contextMenuEvent(QContextMenuEvent *e) { QMenu *menu = new QMenu(); diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h index 6f5930d7410..e0082c371d1 100644 --- a/src/plugins/qmljseditor/qmljseditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -281,8 +281,6 @@ private slots: void onRefactorMarkerClicked(const TextEditor::Internal::RefactorMarker &marker); void performQuickFix(int index); - void onTooltipRequested(TextEditor::ITextEditor* editor, QPoint point, int position); - void updateToolTipNow(); protected: void contextMenuEvent(QContextMenuEvent *e); @@ -320,7 +318,6 @@ private: QTimer *m_semanticRehighlightTimer; QTimer *m_updateOutlineTimer; QTimer *m_updateOutlineIndexTimer; - QTimer *m_toolTipTimer; QTimer *m_cursorPositionTimer; QComboBox *m_outlineCombo; QmlOutlineModel *m_outlineModel; @@ -338,7 +335,6 @@ private: QmlJS::IContextPane *m_contextPane; int m_oldCursorPosition; bool m_updateSelectedElements; - int m_toolTipPosition; FindReferences *m_findReferences; }; -- GitLab