forked from qt-creator/qt-creator
Help: Avoid double lookup for help tooltips
Save the HelpItem directly in the tooltip instead of the help ID which would need to be looked up again. Change-Id: I107e82e89d9ea26cad9d6532ad4c687d1ac8f1ec Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include <QPointer>
|
||||
#include <QTimer>
|
||||
#include <QRect>
|
||||
#include <QVariant>
|
||||
|
||||
/*
|
||||
* In its current form QToolTip is not extensible. So this is an attempt to provide a more
|
||||
@@ -72,13 +73,13 @@ public:
|
||||
static ToolTip *instance();
|
||||
|
||||
static void show(const QPoint &pos, const QString &content, QWidget *w = nullptr,
|
||||
const QString &helpId = QString(), const QRect &rect = QRect());
|
||||
const QVariant &contextHelp = {}, const QRect &rect = QRect());
|
||||
static void show(const QPoint &pos, const QColor &color, QWidget *w = nullptr,
|
||||
const QString &helpId = QString(), const QRect &rect = QRect());
|
||||
const QVariant &contextHelp = {}, const QRect &rect = QRect());
|
||||
static void show(const QPoint &pos, QWidget *content, QWidget *w = nullptr,
|
||||
const QString &helpId = QString(), const QRect &rect = QRect());
|
||||
const QVariant &contextHelp = {}, const QRect &rect = QRect());
|
||||
static void show(const QPoint &pos, QLayout *content, QWidget *w = nullptr,
|
||||
const QString &helpId = QString(), const QRect &rect = QRect());
|
||||
const QVariant &contextHelp = {}, const QRect &rect = QRect());
|
||||
static void move(const QPoint &pos, QWidget *w);
|
||||
static void hide();
|
||||
static void hideImmediately();
|
||||
@@ -90,7 +91,7 @@ public:
|
||||
// using WidgetContent
|
||||
static bool pinToolTip(QWidget *w, QWidget *parent);
|
||||
|
||||
static QString contextHelpId();
|
||||
static QVariant contextHelp();
|
||||
|
||||
signals:
|
||||
void shown();
|
||||
@@ -98,13 +99,13 @@ signals:
|
||||
|
||||
private:
|
||||
void showInternal(const QPoint &pos, const QVariant &content, int typeId, QWidget *w,
|
||||
const QString &helpId, const QRect &rect);
|
||||
const QVariant &contextHelp, const QRect &rect);
|
||||
void hideTipImmediately();
|
||||
bool acceptShow(const QVariant &content, int typeId, const QPoint &pos, QWidget *w,
|
||||
const QString &helpId, const QRect &rect);
|
||||
const QVariant &contextHelp, const QRect &rect);
|
||||
void setUp(const QPoint &pos, QWidget *w, const QRect &rect);
|
||||
bool tipChanged(const QPoint &pos, const QVariant &content, int typeId, QWidget *w,
|
||||
const QString &helpId) const;
|
||||
const QVariant &contextHelp) const;
|
||||
void setTipRect(QWidget *w, const QRect &rect);
|
||||
void placeTip(const QPoint &pos, QWidget *w);
|
||||
void showTip();
|
||||
@@ -115,7 +116,7 @@ private:
|
||||
QRect m_rect;
|
||||
QTimer m_showTimer;
|
||||
QTimer m_hideDelayTimer;
|
||||
QString m_helpId;
|
||||
QVariant m_contextHelp;
|
||||
};
|
||||
|
||||
} // namespace Utils
|
||||
|
||||
Reference in New Issue
Block a user