Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquicktooltip_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QQUICKTOOLTIP_P_H
6#define QQUICKTOOLTIP_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuickTemplates2/private/qquickpopup_p.h>
20
22
24class QQuickToolTipAttached;
26
27class Q_QUICKTEMPLATES2_EXPORT QQuickToolTip : public QQuickPopup
28{
29 Q_OBJECT
30 Q_PROPERTY(int delay READ delay WRITE setDelay NOTIFY delayChanged FINAL)
31 Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged FINAL)
32 Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
33 QML_NAMED_ELEMENT(ToolTip)
34 QML_ATTACHED(QQuickToolTipAttached)
35 QML_ADDED_IN_VERSION(2, 0)
36
37public:
38 explicit QQuickToolTip(QQuickItem *parent = nullptr);
39
40 QString text() const;
41 void setText(const QString &text);
42
43 int delay() const;
44 void setDelay(int delay);
45
46 int timeout() const;
47 void setTimeout(int timeout);
48
49 void setVisible(bool visible) override;
50
51 static QQuickToolTipAttached *qmlAttachedProperties(QObject *object);
52
53Q_SIGNALS:
54 void textChanged();
55 void delayChanged();
56 void timeoutChanged();
57
58public Q_SLOTS:
59 Q_REVISION(2, 5) void show(const QString &text, int ms = -1);
60 Q_REVISION(2, 5) void hide();
61
62protected:
63 QFont defaultFont() const override;
64
65 void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) override;
66 void timerEvent(QTimerEvent *event) override;
67
68#if QT_CONFIG(accessibility)
69 QAccessible::Role accessibleRole() const override;
70 void accessibilityActiveChanged(bool active) override;
71#endif
72
73private:
74 Q_DISABLE_COPY(QQuickToolTip)
75 Q_DECLARE_PRIVATE(QQuickToolTip)
76};
77
78class Q_QUICKTEMPLATES2_EXPORT QQuickToolTipAttached : public QObject
79{
80 Q_OBJECT
81 Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
82 Q_PROPERTY(int delay READ delay WRITE setDelay NOTIFY delayChanged FINAL)
83 Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged FINAL)
84 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
85 Q_PROPERTY(QQuickToolTip *toolTip READ toolTip CONSTANT FINAL)
86
87public:
88 explicit QQuickToolTipAttached(QObject *parent = nullptr);
89
90 QString text() const;
91 void setText(const QString &text);
92
93 int delay() const;
94 void setDelay(int delay);
95
96 int timeout() const;
97 void setTimeout(int timeout);
98
99 bool isVisible() const;
100 void setVisible(bool visible);
101
102 QQuickToolTip *toolTip() const;
103
104Q_SIGNALS:
105 void textChanged();
106 void delayChanged();
107 void timeoutChanged();
108 void visibleChanged();
109
110public Q_SLOTS:
111 void show(const QString &text, int ms = -1);
112 void hide();
113
114private:
115 Q_DISABLE_COPY(QQuickToolTipAttached)
116 Q_DECLARE_PRIVATE(QQuickToolTipAttached)
117};
118
119QT_END_NAMESPACE
120
121#endif // QQUICKTOOLTIP_P_H
Provides tool tips for any control.