Commit a7e8406c authored by Nikolai Kosjar's avatar Nikolai Kosjar

TextEditor: Remove unneeded functions in BaseHoverHandler

Change-Id: Ic61babb48cca0711812256b766f1db62895901f6
Reviewed-by: David Schulz's avatarDavid Schulz <david.schulz@qt.io>
parent 658e468d
......@@ -97,7 +97,7 @@ void CppHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos)
m_positionForEditorDocumentProcessor = -1;
if (editorDocumentProcessorHasDiagnosticAt(editorWidget, pos)) {
setIsDiagnosticTooltip(true);
setPriority(Priority_Diagnostic);
m_positionForEditorDocumentProcessor = pos;
} else if (!editorWidget->extraSelectionTooltip(pos).isEmpty()) {
setToolTip(editorWidget->extraSelectionTooltip(pos));
......@@ -110,12 +110,14 @@ void CppHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos)
evaluator.execute();
if (evaluator.hasDiagnosis()) {
setToolTip(evaluator.diagnosis());
setIsDiagnosticTooltip(true);
setPriority(Priority_Diagnostic);
}
if (evaluator.identifiedCppElement()) {
const QSharedPointer<CppElement> &cppElement = evaluator.cppElement();
if (!isDiagnosticTooltip())
if (priority() != Priority_Diagnostic) {
setToolTip(cppElement->tooltip);
setPriority(cppElement->tooltip.isEmpty() ? Priority_None : Priority_Tooltip);
}
QStringList candidates = cppElement->helpIdCandidates;
candidates.removeDuplicates();
foreach (const QString &helpId, candidates) {
......@@ -143,7 +145,7 @@ void CppHoverHandler::decorateToolTip()
if (Qt::mightBeRichText(toolTip()))
setToolTip(toolTip().toHtmlEscaped());
if (isDiagnosticTooltip())
if (priority() != Priority_Diagnostic)
return;
const HelpItem &help = lastHelpItemIdentified();
......
......@@ -55,9 +55,6 @@ int BaseHoverHandler::priority() const
if (m_priority >= 0)
return m_priority;
if (isDiagnosticTooltip())
return Priority_Diagnostic;
if (lastHelpItemIdentified().isValid())
return Priority_Help;
......@@ -94,21 +91,6 @@ const QString &BaseHoverHandler::toolTip() const
return m_toolTip;
}
void BaseHoverHandler::appendToolTip(const QString &extension)
{
m_toolTip.append(extension);
}
void BaseHoverHandler::setIsDiagnosticTooltip(bool isDiagnosticTooltip)
{
m_diagnosticTooltip = isDiagnosticTooltip;
}
bool BaseHoverHandler::isDiagnosticTooltip() const
{
return m_diagnosticTooltip;
}
void BaseHoverHandler::setLastHelpItemIdentified(const HelpItem &help)
{
m_lastHelpItemIdentified = help;
......@@ -121,7 +103,6 @@ const HelpItem &BaseHoverHandler::lastHelpItemIdentified() const
void BaseHoverHandler::clear()
{
m_diagnosticTooltip = false;
m_toolTip.clear();
m_priority = -1;
m_lastHelpItemIdentified = HelpItem();
......@@ -146,11 +127,11 @@ void BaseHoverHandler::decorateToolTip()
if (Qt::mightBeRichText(toolTip()))
setToolTip(toolTip().toHtmlEscaped());
if (!isDiagnosticTooltip() && lastHelpItemIdentified().isValid()) {
if (priority() != Priority_Diagnostic && lastHelpItemIdentified().isValid()) {
const QString &contents = lastHelpItemIdentified().extractContent(false);
if (!contents.isEmpty()) {
setToolTip(toolTip().toHtmlEscaped());
appendToolTip(contents);
m_toolTip = toolTip().toHtmlEscaped();
m_toolTip.append(contents);
}
}
}
......
......@@ -57,12 +57,8 @@ protected:
int priority() const;
void setToolTip(const QString &tooltip);
void appendToolTip(const QString &extension);
const QString &toolTip() const;
void setIsDiagnosticTooltip(bool isDiagnosticTooltip);
bool isDiagnosticTooltip() const;
void setLastHelpItemIdentified(const HelpItem &help);
const HelpItem &lastHelpItemIdentified() const;
......@@ -74,7 +70,6 @@ private:
void clear();
void process(TextEditorWidget *widget, int pos);
bool m_diagnosticTooltip = false;
QString m_toolTip;
HelpItem m_lastHelpItemIdentified;
int m_priority = -1;
......
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