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
qquickhoverhandler_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 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 QQUICKHOVERHANDLER_H
6#define QQUICKHOVERHANDLER_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 <QtCore/qbasictimer.h>
20#include <QtGui/qevent.h>
21#include <QtQuick/qquickitem.h>
22
24
26
27class QQuickHoverHandlerPrivate;
28
29class Q_QUICK_EXPORT QQuickHoverHandler : public QQuickSinglePointHandler
30{
31 Q_OBJECT
32 Q_PROPERTY(bool hovered READ isHovered NOTIFY hoveredChanged)
33 Q_PROPERTY(bool blocking READ isBlocking WRITE setBlocking NOTIFY blockingChanged REVISION(6, 3))
34 QML_NAMED_ELEMENT(HoverHandler)
35 QML_ADDED_IN_VERSION(2, 12)
36
37public:
38 explicit QQuickHoverHandler(QQuickItem *parent = nullptr);
39 ~QQuickHoverHandler();
40
41 bool event(QEvent *) override;
42
43 bool isHovered() const { return m_hovered; }
44
45 bool isBlocking() const { return m_blocking; }
46 void setBlocking(bool blocking);
47
48Q_SIGNALS:
49 void hoveredChanged();
50 Q_REVISION(6, 3) void blockingChanged();
51
52protected:
53 void componentComplete() override;
54 bool wantsPointerEvent(QPointerEvent *event) override;
55 void handleEventPoint(QPointerEvent *ev, QEventPoint &point) override;
56
57 Q_DECLARE_PRIVATE(QQuickHoverHandler)
58
59private:
60 void setHovered(bool hovered);
61
62private:
63 bool m_hovered = false;
64 bool m_hoveredTablet = false;
65 bool m_blocking = false;
66};
67
68QT_END_NAMESPACE
69
70#endif // QQUICKHOVERHANDLER_H