forked from qt-creator/qt-creator
BaseHoverHandler: Code cosmetics
Change-Id: Ib91f3ffd0c0539712d0797fa1ef378d96bd82db6 Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -37,9 +37,17 @@
|
|||||||
|
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
|
|
||||||
using namespace TextEditor;
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
|
namespace TextEditor {
|
||||||
|
|
||||||
|
static BaseTextEditorWidget *baseTextEditor(ITextEditor *editor)
|
||||||
|
{
|
||||||
|
if (!editor)
|
||||||
|
return 0;
|
||||||
|
return qobject_cast<BaseTextEditorWidget *>(editor->widget());
|
||||||
|
}
|
||||||
|
|
||||||
BaseHoverHandler::BaseHoverHandler(QObject *parent) : QObject(parent), m_diagnosticTooltip(false)
|
BaseHoverHandler::BaseHoverHandler(QObject *parent) : QObject(parent), m_diagnosticTooltip(false)
|
||||||
{
|
{
|
||||||
// Listen for editor opened events in order to connect to tooltip/helpid requests
|
// Listen for editor opened events in order to connect to tooltip/helpid requests
|
||||||
@@ -94,13 +102,19 @@ void BaseHoverHandler::updateContextHelpId(TextEditor::ITextEditor *editor, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BaseHoverHandler::setToolTip(const QString &tooltip)
|
void BaseHoverHandler::setToolTip(const QString &tooltip)
|
||||||
{ m_toolTip = tooltip; }
|
{
|
||||||
|
m_toolTip = tooltip;
|
||||||
|
}
|
||||||
|
|
||||||
const QString &BaseHoverHandler::toolTip() const
|
const QString &BaseHoverHandler::toolTip() const
|
||||||
{ return m_toolTip; }
|
{
|
||||||
|
return m_toolTip;
|
||||||
|
}
|
||||||
|
|
||||||
void BaseHoverHandler::appendToolTip(const QString &extension)
|
void BaseHoverHandler::appendToolTip(const QString &extension)
|
||||||
{ m_toolTip.append(extension); }
|
{
|
||||||
|
m_toolTip.append(extension);
|
||||||
|
}
|
||||||
|
|
||||||
void BaseHoverHandler::addF1ToToolTip()
|
void BaseHoverHandler::addF1ToToolTip()
|
||||||
{
|
{
|
||||||
@@ -120,10 +134,14 @@ bool BaseHoverHandler::isDiagnosticTooltip() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BaseHoverHandler::setLastHelpItemIdentified(const HelpItem &help)
|
void BaseHoverHandler::setLastHelpItemIdentified(const HelpItem &help)
|
||||||
{ m_lastHelpItemIdentified = help; }
|
{
|
||||||
|
m_lastHelpItemIdentified = help;
|
||||||
|
}
|
||||||
|
|
||||||
const HelpItem &BaseHoverHandler::lastHelpItemIdentified() const
|
const HelpItem &BaseHoverHandler::lastHelpItemIdentified() const
|
||||||
{ return m_lastHelpItemIdentified; }
|
{
|
||||||
|
return m_lastHelpItemIdentified;
|
||||||
|
}
|
||||||
|
|
||||||
void BaseHoverHandler::clear()
|
void BaseHoverHandler::clear()
|
||||||
{
|
{
|
||||||
@@ -162,9 +180,4 @@ void BaseHoverHandler::operateTooltip(ITextEditor *editor, const QPoint &point)
|
|||||||
Utils::ToolTip::show(point, Utils::TextContent(m_toolTip), editor->widget());
|
Utils::ToolTip::show(point, Utils::TextContent(m_toolTip), editor->widget());
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseTextEditorWidget *BaseHoverHandler::baseTextEditor(ITextEditor *editor)
|
} // namespace TextEditor
|
||||||
{
|
|
||||||
if (!editor)
|
|
||||||
return 0;
|
|
||||||
return qobject_cast<BaseTextEditorWidget *>(editor->widget());
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -52,9 +52,10 @@ class BaseTextEditorWidget;
|
|||||||
class TEXTEDITOR_EXPORT BaseHoverHandler : public QObject
|
class TEXTEDITOR_EXPORT BaseHoverHandler : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BaseHoverHandler(QObject *parent = 0);
|
BaseHoverHandler(QObject *parent = 0);
|
||||||
virtual ~BaseHoverHandler();
|
~BaseHoverHandler();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void editorOpened(Core::IEditor *editor);
|
void editorOpened(Core::IEditor *editor);
|
||||||
@@ -74,8 +75,6 @@ protected:
|
|||||||
void setLastHelpItemIdentified(const HelpItem &help);
|
void setLastHelpItemIdentified(const HelpItem &help);
|
||||||
const HelpItem &lastHelpItemIdentified() const;
|
const HelpItem &lastHelpItemIdentified() const;
|
||||||
|
|
||||||
static BaseTextEditorWidget *baseTextEditor(ITextEditor *editor);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clear();
|
void clear();
|
||||||
void process(ITextEditor *editor, int pos);
|
void process(ITextEditor *editor, int pos);
|
||||||
|
|||||||
Reference in New Issue
Block a user