Commit ff5eb006 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

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
parent 6841707e
......@@ -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();
......
......@@ -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;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment