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
qtooltip_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 QTOOLTIP_P_H
6#define QTOOLTIP_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 for the convenience
13// of qlayout*.cpp, and qabstractlayout.cpp. This header
14// file may change from version to version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QLabel>
20#include <QString>
21#include <QRect>
22#include <QToolTip>
23
25QT_BEGIN_NAMESPACE
26
27class Q_WIDGETS_EXPORT QTipLabel final : public QLabel
28{
29 Q_OBJECT
30public:
31 explicit QTipLabel(const QString &text, const QPoint &pos, QWidget *w, int msecDisplayTime);
32 ~QTipLabel() override;
33
34 void adjustTooltipScreen(const QPoint &pos);
35 void updateSize(const QPoint &pos);
36
37 bool eventFilter(QObject *, QEvent *) override;
38
39 void reuseTip(const QString &text, int msecDisplayTime, const QPoint &pos);
40 void hideTip();
41 void hideTipImmediately();
42 void setTipRect(QWidget *w, const QRect &r);
43 void restartExpireTimer(int msecDisplayTime);
44 bool tipChanged(const QPoint &pos, const QString &text, QObject *o);
45 void placeTip(const QPoint &pos, QWidget *w);
46
47 static QScreen *getTipScreen(const QPoint &pos, QWidget *w);
48protected:
49 void timerEvent(QTimerEvent *e) override;
50 void paintEvent(QPaintEvent *e) override;
51 void mouseMoveEvent(QMouseEvent *e) override;
52 void resizeEvent(QResizeEvent *e) override;
53
54#if QT_CONFIG(style_stylesheet)
55public Q_SLOTS:
56 void styleSheetParentDestroyed();
57
58private:
59 QWidget *styleSheetParent;
60#endif
61
62private:
63 friend class QToolTip;
64
65 static QTipLabel *instance;
66 QBasicTimer hideTimer, expireTimer;
67 QWidget *widget;
68 QRect rect;
69 bool fadingOut;
70};
71
72QT_END_NAMESPACE
73
74#endif // QTOOLTIP_P_H
QT_REQUIRE_CONFIG(tooltip)