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:
Eike Ziller
2019-01-29 11:43:43 +01:00
parent 4e8c2c4b13
commit 32429e11c9
9 changed files with 67 additions and 57 deletions

View File

@@ -46,15 +46,15 @@ public:
virtual int showTime() const = 0;
virtual void configure(const QPoint &pos, QWidget *w) = 0;
virtual bool canHandleContentReplacement(int typeId) const = 0;
virtual bool equals(int typeId, const QVariant &other, const QString &helpId) const = 0;
virtual void setHelpId(const QString &id);
virtual QString helpId() const;
virtual bool equals(int typeId, const QVariant &other, const QVariant &contextHelp) const = 0;
virtual void setContextHelp(const QVariant &help);
virtual QVariant contextHelp() const;
protected:
const QMetaObject *metaObject() const override;
private:
QString m_helpId;
QVariant m_contextHelp;
};
class TextTip : public TipLabel
@@ -67,7 +67,7 @@ public:
void configure(const QPoint &pos, QWidget *w) override;
bool canHandleContentReplacement(int typeId) const override;
int showTime() const override;
bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const override;
bool equals(int typeId, const QVariant &other, const QVariant &otherContextHelp) const override;
void paintEvent(QPaintEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
@@ -84,7 +84,7 @@ public:
void configure(const QPoint &pos, QWidget *w) override;
bool canHandleContentReplacement(int typeId) const override;
int showTime() const override { return 4000; }
bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const override;
bool equals(int typeId, const QVariant &other, const QVariant &otherContextHelp) const override;
void paintEvent(QPaintEvent *event) override;
private:
@@ -104,7 +104,7 @@ public:
void configure(const QPoint &pos, QWidget *w) override;
bool canHandleContentReplacement(int typeId) const override;
int showTime() const override { return 30000; }
bool equals(int typeId, const QVariant &other, const QString &otherHelpId) const override;
bool equals(int typeId, const QVariant &other, const QVariant &otherContextHelp) const override;
bool isInteractive() const override { return true; }
private: