forked from qt-creator/qt-creator
Utils: Replace Tooltip hack with another tooltip hack
Instead of fooling moc into believing it operates on a class called QTipLabel and create a "QTipLabel" class name from that, create a metaobject with the "QTipLabel" class name directly. This trades messing around with namespaces for assumptions on the stability of QMetaObject class layout. Given that this is an exported class in Qt Core, that's unlikely to break soon. Change-Id: Iad24dd2a8a7f492e4b238d390888f89c6dd29ea9 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -33,17 +33,13 @@
|
||||
#include <QVariant>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#ifndef Q_MOC_RUN
|
||||
namespace Utils {
|
||||
namespace Internal {
|
||||
#endif
|
||||
|
||||
// Please do not change the name of this class. Detailed comments in tooltip.h.
|
||||
class QTipLabel : public QLabel
|
||||
class TipLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTipLabel(QWidget *parent);
|
||||
TipLabel(QWidget *parent);
|
||||
|
||||
virtual void setContent(const QVariant &content) = 0;
|
||||
virtual bool isInteractive() const { return false; }
|
||||
@@ -54,11 +50,14 @@ public:
|
||||
virtual void setHelpId(const QString &id);
|
||||
virtual QString helpId() const;
|
||||
|
||||
protected:
|
||||
const QMetaObject *metaObject() const override;
|
||||
|
||||
private:
|
||||
QString m_helpId;
|
||||
};
|
||||
|
||||
class TextTip : public QTipLabel
|
||||
class TextTip : public TipLabel
|
||||
{
|
||||
public:
|
||||
TextTip(QWidget *parent);
|
||||
@@ -76,7 +75,7 @@ private:
|
||||
QString m_text;
|
||||
};
|
||||
|
||||
class ColorTip : public QTipLabel
|
||||
class ColorTip : public TipLabel
|
||||
{
|
||||
public:
|
||||
ColorTip(QWidget *parent);
|
||||
@@ -93,7 +92,7 @@ private:
|
||||
QPixmap m_tilePixmap;
|
||||
};
|
||||
|
||||
class WidgetTip : public QTipLabel
|
||||
class WidgetTip : public TipLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -113,7 +112,5 @@ private:
|
||||
QVBoxLayout *m_layout;
|
||||
};
|
||||
|
||||
#ifndef Q_MOC_RUN
|
||||
} // namespace Internal
|
||||
} // namespace Utils
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user