Commit e90a8a05 authored by hjk's avatar hjk

TextEditor: Only use tooltipOverrideRequested in *Widget

One signal less, one connection less, less indirection in user code.

Change-Id: Ie49d4a76982f2ff9d2b307ed541c33c6a7ea6480
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 558864f2
......@@ -1252,7 +1252,7 @@ void DebuggerToolTipManager::slotEditorOpened(IEditor *e)
BaseTextEditorWidget *widget = textEditor->editorWidget();
connect(widget->verticalScrollBar(), &QScrollBar::valueChanged,
this, &DebuggerToolTipManager::slotUpdateVisibleToolTips);
connect(textEditor, &BaseTextEditor::tooltipOverrideRequested,
connect(widget, &BaseTextEditorWidget::tooltipOverrideRequested,
this, &DebuggerToolTipManager::slotTooltipOverrideRequested);
}
}
......@@ -1298,21 +1298,21 @@ void DebuggerToolTipManager::leavingDebugMode()
}
void DebuggerToolTipManager::slotTooltipOverrideRequested
(BaseTextEditor *editor, const QPoint &point, int pos, bool *handled)
(BaseTextEditorWidget *editorWidget, const QPoint &point, int pos, bool *handled)
{
QTC_ASSERT(handled, return);
QTC_ASSERT(editor, return);
QTC_ASSERT(editorWidget, return);
const int movedDistance = (point - d->m_lastToolTipPoint).manhattanLength();
if (d->m_lastToolTipEditor == editor->editorWidget() && movedDistance < 25) {
if (d->m_lastToolTipEditor == editorWidget && movedDistance < 25) {
*handled = true;
return;
}
*handled = tryHandleToolTipOverride(editor->editorWidget(), point, pos);
*handled = tryHandleToolTipOverride(editorWidget, point, pos);
if (*handled) {
d->m_lastToolTipEditor = editor->editorWidget();
d->m_lastToolTipEditor = editorWidget;
d->m_lastToolTipPoint = point;
} else {
d->m_lastToolTipEditor = 0;
......
......@@ -132,7 +132,7 @@ private slots:
static void slotUpdateVisibleToolTips();
void slotDebuggerStateChanged(Debugger::DebuggerState);
void slotEditorOpened(Core::IEditor *);
void slotTooltipOverrideRequested(TextEditor::BaseTextEditor *editor,
void slotTooltipOverrideRequested(TextEditor::BaseTextEditorWidget *editorWidget,
const QPoint &point, int pos, bool *handled);
private:
......
......@@ -2964,7 +2964,7 @@ void BaseTextEditorWidgetPrivate::processTooltipRequest(const QTextCursor &c)
{
const QPoint toolTipPoint = q->toolTipPosition(c);
bool handled = false;
emit q->tooltipOverrideRequested(toolTipPoint, c.position(), &handled);
emit q->tooltipOverrideRequested(q, toolTipPoint, c.position(), &handled);
if (!handled)
emit q->tooltipRequested(toolTipPoint, c.position());
}
......@@ -7305,11 +7305,6 @@ BaseTextEditor *BaseTextEditorFactory::createEditorHelper(const BaseTextDocument
editor->markContextMenuRequested(editor, line, menu);
});
connect(widget, &BaseTextEditorWidget::tooltipOverrideRequested, editor,
[editor](const QPoint &globalPos, int position, bool *handled) {
editor->tooltipOverrideRequested(editor, globalPos, position, handled);
});
connect(widget, &BaseTextEditorWidget::tooltipRequested, editor,
[editor](const QPoint &globalPos, int position) {
editor->tooltipRequested(editor, globalPos, position);
......
......@@ -196,7 +196,6 @@ public:
signals:
void markRequested(TextEditor::BaseTextEditor *editor, int line, TextEditor::BaseTextEditor::MarkRequestKind kind);
void markContextMenuRequested(TextEditor::BaseTextEditor *editor, int line, QMenu *menu);
void tooltipOverrideRequested(TextEditor::BaseTextEditor *editor, const QPoint &globalPos, int position, bool *handled);
void tooltipRequested(TextEditor::BaseTextEditor *editor, const QPoint &globalPos, int position);
void markTooltipRequested(TextEditor::BaseTextEditor *editor, const QPoint &globalPos, int line);
void contextHelpIdRequested(TextEditor::BaseTextEditor *editor, int position);
......@@ -595,7 +594,8 @@ protected:
signals:
void markRequested(int line, TextEditor::BaseTextEditor::MarkRequestKind kind);
void markContextMenuRequested(int line, QMenu *menu);
void tooltipOverrideRequested(const QPoint &globalPos, int position, bool *handled);
void tooltipOverrideRequested(TextEditor::BaseTextEditorWidget *editorWidget,
const QPoint &globalPos, int position, bool *handled);
void tooltipRequested(const QPoint &globalPos, int position);
void markTooltipRequested(const QPoint &globalPos, int line);
void activateEditor();
......
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