Commit 50790f61 authored by Nikolai Kosjar's avatar Nikolai Kosjar

TextEditor: Avoid unneeded calls in BaseHoverHandler

In checkToolTip(), the call to decorateToolTip() is not needed since it
does not affect the priority.

In showToolTip(), we can assume that checkToolTip() was called and thus
avoid a call to identifyMatch().

TextEditorWidgetPrivate::processTooltipRequest() is the only caller of
checkToolTip() and showToolTip().

Change-Id: I362c697754b6a29c9c0b34f85d3022f00e3e1031
Reviewed-by: David Schulz's avatarDavid Schulz <david.schulz@qt.io>
parent a7e8406c
......@@ -33,11 +33,9 @@ namespace TextEditor {
BaseHoverHandler::~BaseHoverHandler()
{}
void BaseHoverHandler::showToolTip(TextEditorWidget *widget, const QPoint &point, int pos)
void BaseHoverHandler::showToolTip(TextEditorWidget *widget, const QPoint &point)
{
widget->setContextHelpId(QString());
process(widget, pos);
decorateToolTip();
operateTooltip(widget, point);
}
......@@ -101,18 +99,13 @@ const HelpItem &BaseHoverHandler::lastHelpItemIdentified() const
return m_lastHelpItemIdentified;
}
void BaseHoverHandler::clear()
void BaseHoverHandler::process(TextEditorWidget *widget, int pos)
{
m_toolTip.clear();
m_priority = -1;
m_lastHelpItemIdentified = HelpItem();
}
void BaseHoverHandler::process(TextEditorWidget *widget, int pos)
{
clear();
identifyMatch(widget, pos);
decorateToolTip();
}
void BaseHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos)
......
......@@ -44,7 +44,7 @@ public:
QString contextHelpId(TextEditorWidget *widget, int pos);
int checkToolTip(TextEditorWidget *widget, int pos);
void showToolTip(TextEditorWidget *widget, const QPoint &point, int pos);
void showToolTip(TextEditorWidget *widget, const QPoint &point);
protected:
enum {
......@@ -67,7 +67,6 @@ protected:
virtual void operateTooltip(TextEditorWidget *editorWidget, const QPoint &point);
private:
void clear();
void process(TextEditorWidget *widget, int pos);
QString m_toolTip;
......
......@@ -3143,7 +3143,7 @@ void TextEditorWidgetPrivate::processTooltipRequest(const QTextCursor &c)
}
if (highest)
highest->showToolTip(q, toolTipPoint, c.position());
highest->showToolTip(q, toolTipPoint);
}
bool TextEditorWidget::viewportEvent(QEvent *event)
......
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