forked from qt-creator/qt-creator
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
This commit is contained in:
@@ -84,7 +84,6 @@ enum {
|
|||||||
UPDATE_DOCUMENT_DEFAULT_INTERVAL = 100,
|
UPDATE_DOCUMENT_DEFAULT_INTERVAL = 100,
|
||||||
UPDATE_USES_DEFAULT_INTERVAL = 150,
|
UPDATE_USES_DEFAULT_INTERVAL = 150,
|
||||||
UPDATE_OUTLINE_INTERVAL = 500, // msecs after new semantic info has been arrived / cursor has moved
|
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;
|
using namespace QmlJS;
|
||||||
@@ -680,7 +679,6 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) :
|
|||||||
m_modelManager(0),
|
m_modelManager(0),
|
||||||
m_contextPane(0),
|
m_contextPane(0),
|
||||||
m_updateSelectedElements(false),
|
m_updateSelectedElements(false),
|
||||||
m_toolTipPosition(0),
|
|
||||||
m_findReferences(new FindReferences(this))
|
m_findReferences(new FindReferences(this))
|
||||||
{
|
{
|
||||||
qRegisterMetaType<QmlJSEditor::Internal::SemanticInfo>("QmlJSEditor::Internal::SemanticInfo");
|
qRegisterMetaType<QmlJSEditor::Internal::SemanticInfo>("QmlJSEditor::Internal::SemanticInfo");
|
||||||
@@ -728,11 +726,6 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) :
|
|||||||
m_cursorPositionTimer->setSingleShot(true);
|
m_cursorPositionTimer->setSingleShot(true);
|
||||||
connect(m_cursorPositionTimer, SIGNAL(timeout()), this, SLOT(updateCursorPositionNow()));
|
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()));
|
baseTextDocument()->setSyntaxHighlighter(new Highlighter(document()));
|
||||||
|
|
||||||
m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<ModelManagerInterface>();
|
m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<ModelManagerInterface>();
|
||||||
@@ -1476,40 +1469,6 @@ void QmlJSTextEditor::performQuickFix(int index)
|
|||||||
op->perform();
|
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)
|
void QmlJSTextEditor::contextMenuEvent(QContextMenuEvent *e)
|
||||||
{
|
{
|
||||||
QMenu *menu = new QMenu();
|
QMenu *menu = new QMenu();
|
||||||
|
|||||||
@@ -281,8 +281,6 @@ private slots:
|
|||||||
void onRefactorMarkerClicked(const TextEditor::Internal::RefactorMarker &marker);
|
void onRefactorMarkerClicked(const TextEditor::Internal::RefactorMarker &marker);
|
||||||
|
|
||||||
void performQuickFix(int index);
|
void performQuickFix(int index);
|
||||||
void onTooltipRequested(TextEditor::ITextEditor* editor, QPoint point, int position);
|
|
||||||
void updateToolTipNow();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void contextMenuEvent(QContextMenuEvent *e);
|
void contextMenuEvent(QContextMenuEvent *e);
|
||||||
@@ -320,7 +318,6 @@ private:
|
|||||||
QTimer *m_semanticRehighlightTimer;
|
QTimer *m_semanticRehighlightTimer;
|
||||||
QTimer *m_updateOutlineTimer;
|
QTimer *m_updateOutlineTimer;
|
||||||
QTimer *m_updateOutlineIndexTimer;
|
QTimer *m_updateOutlineIndexTimer;
|
||||||
QTimer *m_toolTipTimer;
|
|
||||||
QTimer *m_cursorPositionTimer;
|
QTimer *m_cursorPositionTimer;
|
||||||
QComboBox *m_outlineCombo;
|
QComboBox *m_outlineCombo;
|
||||||
QmlOutlineModel *m_outlineModel;
|
QmlOutlineModel *m_outlineModel;
|
||||||
@@ -338,7 +335,6 @@ private:
|
|||||||
QmlJS::IContextPane *m_contextPane;
|
QmlJS::IContextPane *m_contextPane;
|
||||||
int m_oldCursorPosition;
|
int m_oldCursorPosition;
|
||||||
bool m_updateSelectedElements;
|
bool m_updateSelectedElements;
|
||||||
int m_toolTipPosition;
|
|
||||||
|
|
||||||
FindReferences *m_findReferences;
|
FindReferences *m_findReferences;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user