forked from qt-creator/qt-creator
debugger/basehoverhandler: introduce tooltipOverrideRequested and use it
Reviewed-by: con Task-number: QTCREATOR-201
This commit is contained in:
@@ -983,7 +983,8 @@ public slots:
|
||||
void editorAboutToClose(Core::IEditor *editor);
|
||||
void setBusyCursor(bool busy);
|
||||
void requestMark(TextEditor::ITextEditor *editor, int lineNumber);
|
||||
void showToolTip(TextEditor::ITextEditor *editor, const QPoint &pnt, int pos);
|
||||
void showToolTip(TextEditor::ITextEditor *editor,
|
||||
const QPoint &pnt, int pos, bool *handled);
|
||||
void requestContextMenu(TextEditor::ITextEditor *editor,
|
||||
int lineNumber, QMenu *menu);
|
||||
|
||||
@@ -1764,8 +1765,8 @@ void DebuggerPluginPrivate::editorOpened(Core::IEditor *editor)
|
||||
SIGNAL(markRequested(TextEditor::ITextEditor*,int)),
|
||||
SLOT(requestMark(TextEditor::ITextEditor*,int)));
|
||||
connect(editor,
|
||||
SIGNAL(tooltipRequested(TextEditor::ITextEditor*,QPoint,int)),
|
||||
SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int)));
|
||||
SIGNAL(tooltipOverrideRequested(TextEditor::ITextEditor*,QPoint,int,bool*)),
|
||||
SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int,bool*)));
|
||||
connect(textEditor,
|
||||
SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
|
||||
SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
|
||||
@@ -1782,8 +1783,8 @@ void DebuggerPluginPrivate::editorAboutToClose(Core::IEditor *editor)
|
||||
SIGNAL(markRequested(TextEditor::ITextEditor*,int)),
|
||||
this, SLOT(requestMark(TextEditor::ITextEditor*,int)));
|
||||
disconnect(editor,
|
||||
SIGNAL(tooltipRequested(TextEditor::ITextEditor*,QPoint,int)),
|
||||
this, SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int)));
|
||||
SIGNAL(tooltipOverrideRequested(TextEditor::ITextEditor*,QPoint,int,bool*)),
|
||||
this, SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int,bool*)));
|
||||
disconnect(textEditor,
|
||||
SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
|
||||
this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
|
||||
@@ -1943,7 +1944,7 @@ void DebuggerPluginPrivate::requestMark(ITextEditor *editor, int lineNumber)
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::showToolTip(ITextEditor *editor,
|
||||
const QPoint &point, int pos)
|
||||
const QPoint &point, int pos, bool *handled)
|
||||
{
|
||||
if (!isDebuggable(editor))
|
||||
return;
|
||||
@@ -1951,6 +1952,8 @@ void DebuggerPluginPrivate::showToolTip(ITextEditor *editor,
|
||||
return;
|
||||
if (state() != InferiorStopOk)
|
||||
return;
|
||||
QTC_ASSERT(handled, return);
|
||||
*handled = true;
|
||||
currentEngine()->setToolTipExpression(point, editor, pos);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,12 +81,6 @@ void BaseHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint
|
||||
|
||||
editor->setContextHelpId(QString());
|
||||
|
||||
ICore *core = ICore::instance();
|
||||
const int dbgContext =
|
||||
core->uniqueIDManager()->uniqueIdentifier(Debugger::Constants::C_DEBUGMODE);
|
||||
if (core->hasContext(dbgContext))
|
||||
return;
|
||||
|
||||
process(editor, pos);
|
||||
|
||||
const QPoint &actualPoint = point - QPoint(0,
|
||||
|
||||
@@ -2533,7 +2533,11 @@ bool BaseTextEditor::viewportEvent(QEvent *event)
|
||||
QPoint cursorPos = mapToGlobal(cursorRect(c).bottomRight() + QPoint(1,1));
|
||||
cursorPos.setX(cursorPos.x() + d->m_extraArea->width());
|
||||
|
||||
emit editableInterface()->tooltipRequested(editableInterface(), cursorPos, c.position());
|
||||
bool handled = false;
|
||||
BaseTextEditorEditable *editable = editableInterface();
|
||||
emit editable->tooltipOverrideRequested(editable, cursorPos, c.position(), &handled);
|
||||
if (!handled)
|
||||
emit editable->tooltipRequested(editable, cursorPos, c.position());
|
||||
return true;
|
||||
}
|
||||
return QPlainTextEdit::viewportEvent(event);
|
||||
|
||||
@@ -136,6 +136,7 @@ signals:
|
||||
void contentsChangedBecauseOfUndo();
|
||||
void markRequested(TextEditor::ITextEditor *editor, int line);
|
||||
void markContextMenuRequested(TextEditor::ITextEditor *editor, int line, QMenu *menu);
|
||||
void tooltipOverrideRequested(TextEditor::ITextEditor *editor, const QPoint &globalPos, int position, bool *handled);
|
||||
void tooltipRequested(TextEditor::ITextEditor *editor, const QPoint &globalPos, int position);
|
||||
void contextHelpIdRequested(TextEditor::ITextEditor *editor, int position);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user