From 50790f61872b4b2fadf103f946561406b6732318 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 19 Jun 2017 12:17:59 +0200 Subject: 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 --- src/plugins/texteditor/basehoverhandler.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/plugins/texteditor/basehoverhandler.cpp') diff --git a/src/plugins/texteditor/basehoverhandler.cpp b/src/plugins/texteditor/basehoverhandler.cpp index 7764f12dbd..abbf2154ab 100644 --- a/src/plugins/texteditor/basehoverhandler.cpp +++ b/src/plugins/texteditor/basehoverhandler.cpp @@ -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) -- cgit v1.2.1