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 <QPointer>
20#include <QLabel>
21#include <QString>
22#include <QRect>
23#include <QToolTip>
24
26QT_BEGIN_NAMESPACE
27
28class Q_WIDGETS_EXPORT QTipLabel final : public QLabel
29{
30 Q_OBJECT
31public:
32 explicit QTipLabel(const QString &text, QPoint pos, QWidget *w, std::chrono::milliseconds displayTime);
33 ~QTipLabel() override;
34
35 void adjustTooltipScreen(const QPoint &pos);
36 void updateSize(const QPoint &pos);
37
38 bool eventFilter(QObject *, QEvent *) override;
39
40 void reuseTip(const QString &text, std::chrono::milliseconds displayTime, QPoint pos);
41 void hideTip();
42 void hideTipImmediately();
43 void setTipRect(QWidget *w, const QRect &r);
44 void restartExpireTimer(std::chrono::milliseconds displayTime);
45 bool tipChanged(const QPoint &pos, const QString &text, QObject *o);
46 void placeTip(const QPoint &pos, QWidget *w);
47
48 static QScreen *getTipScreen(const QPoint &pos, QWidget *w);
49protected:
50 void timerEvent(QTimerEvent *e) override;
51 void paintEvent(QPaintEvent *e) override;
52 void mouseMoveEvent(QMouseEvent *e) override;
53 void resizeEvent(QResizeEvent *e) override;
54
55#if QT_CONFIG(style_stylesheet)
56public Q_SLOTS:
57 void styleSheetParentDestroyed();
58
59private:
60 QWidget *styleSheetParent;
61#endif
62
63private:
64 friend class QToolTip;
65
66 QBasicTimer hideTimer, expireTimer;
67 QPointer<QWidget> widget;
68 QRect rect;
69 bool fadingOut;
70};
71
72QT_END_NAMESPACE
73
74#endif // QTOOLTIP_P_H
QT_REQUIRE_CONFIG(tooltip)