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
qquickmousearea_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 QQUICKMOUSEAREA_P_H
6#define QQUICKMOUSEAREA_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 "qquickitem.h"
20#include <private/qtquickglobal_p.h>
21#include <QtCore/qstringlist.h>
22
23QT_BEGIN_NAMESPACE
24
25class QQuickMouseEvent;
26class QQuickDrag;
28class QQuickWheelEvent;
29
30class Q_QUICK_EXPORT QQuickMouseArea : public QQuickItem
31{
32 Q_OBJECT
33
34 Q_PROPERTY(qreal mouseX READ mouseX NOTIFY mouseXChanged)
35 Q_PROPERTY(qreal mouseY READ mouseY NOTIFY mouseYChanged)
36 Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged)
37 Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged)
38 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
39 Q_PROPERTY(bool scrollGestureEnabled READ isScrollGestureEnabled WRITE setScrollGestureEnabled NOTIFY scrollGestureEnabledChanged REVISION(2, 5))
40 Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons NOTIFY pressedButtonsChanged)
41 Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged)
42 Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged)
43#if QT_CONFIG(quick_draganddrop)
44 Q_PROPERTY(QQuickDrag *drag READ drag CONSTANT) //### add flicking to QQuickDrag or add a QQuickFlick ???
45#endif
46 Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged)
47 Q_PROPERTY(bool propagateComposedEvents READ propagateComposedEvents WRITE setPropagateComposedEvents NOTIFY propagateComposedEventsChanged)
48#if QT_CONFIG(cursor)
49 Q_PROPERTY(Qt::CursorShape cursorShape READ cursorShape WRITE setCursorShape RESET unsetCursor NOTIFY cursorShapeChanged)
50#endif
51 Q_PROPERTY(bool containsPress READ containsPress NOTIFY containsPressChanged REVISION(2, 4))
52 Q_PROPERTY(int pressAndHoldInterval READ pressAndHoldInterval WRITE setPressAndHoldInterval NOTIFY pressAndHoldIntervalChanged RESET resetPressAndHoldInterval REVISION(2, 9))
53 QML_NAMED_ELEMENT(MouseArea)
54 QML_ADDED_IN_VERSION(2, 0)
55
56public:
57 QQuickMouseArea(QQuickItem *parent=nullptr);
58 ~QQuickMouseArea();
59
60 qreal mouseX() const;
61 qreal mouseY() const;
62
63 bool isEnabled() const;
64 void setEnabled(bool);
65
66 bool isScrollGestureEnabled() const;
67 void setScrollGestureEnabled(bool);
68
69 bool hovered() const;
70 bool isPressed() const;
71 bool containsPress() const;
72
73 Qt::MouseButtons pressedButtons() const;
74
75 Qt::MouseButtons acceptedButtons() const;
76 void setAcceptedButtons(Qt::MouseButtons buttons);
77
78 bool hoverEnabled() const;
79 void setHoverEnabled(bool h);
80
81#if QT_CONFIG(quick_draganddrop)
82 QQuickDrag *drag();
83#endif
84
85 bool preventStealing() const;
86 void setPreventStealing(bool prevent);
87
88 bool propagateComposedEvents() const;
89 void setPropagateComposedEvents(bool propagate);
90
91#if QT_CONFIG(cursor)
92 Qt::CursorShape cursorShape() const;
93 void setCursorShape(Qt::CursorShape shape);
94#endif
95
96 int pressAndHoldInterval() const;
97 void setPressAndHoldInterval(int interval);
98 void resetPressAndHoldInterval();
99
100Q_SIGNALS:
101 void hoveredChanged();
102 void pressedChanged();
103 void enabledChanged();
104 Q_REVISION(2, 5) void scrollGestureEnabledChanged();
105 void pressedButtonsChanged();
106 void acceptedButtonsChanged();
107 void hoverEnabledChanged();
108#if QT_CONFIG(cursor)
109 void cursorShapeChanged();
110#endif
111 void positionChanged(QQuickMouseEvent *mouse);
112 void mouseXChanged(QQuickMouseEvent *mouse);
113 void mouseYChanged(QQuickMouseEvent *mouse);
114 void preventStealingChanged();
115 void propagateComposedEventsChanged();
116
117 void pressed(QQuickMouseEvent *mouse);
118 void pressAndHold(QQuickMouseEvent *mouse);
119 void released(QQuickMouseEvent *mouse);
120 void clicked(QQuickMouseEvent *mouse);
121 void doubleClicked(QQuickMouseEvent *mouse);
122#if QT_CONFIG(wheelevent)
123 void wheel(QQuickWheelEvent *wheel);
124#endif
125 void entered();
126 void exited();
127 void canceled();
128 Q_REVISION(2, 4) void containsPressChanged();
129 Q_REVISION(2, 9) void pressAndHoldIntervalChanged();
130
131protected:
132 void setHovered(bool);
133 bool setPressed(Qt::MouseButton button, bool p, Qt::MouseEventSource source);
134 bool sendMouseEvent(QMouseEvent *event);
135
136 void mousePressEvent(QMouseEvent *event) override;
137 void mouseReleaseEvent(QMouseEvent *event) override;
138 void mouseDoubleClickEvent(QMouseEvent *event) override;
139 void mouseMoveEvent(QMouseEvent *event) override;
140 void mouseUngrabEvent() override;
141 void touchUngrabEvent() override;
142 void hoverEnterEvent(QHoverEvent *event) override;
143 void hoverMoveEvent(QHoverEvent *event) override;
144 void hoverLeaveEvent(QHoverEvent *event) override;
145#if QT_CONFIG(wheelevent)
146 void wheelEvent(QWheelEvent *event) override;
147#endif
148 bool childMouseEventFilter(QQuickItem *i, QEvent *e) override;
149 void timerEvent(QTimerEvent *event) override;
150
151 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
152 void itemChange(ItemChange change, const ItemChangeData& value) override;
153 QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
154
155private:
156 void handlePress();
157 void handleRelease();
158 void ungrabMouse();
159
160private:
161 Q_DISABLE_COPY(QQuickMouseArea)
162 Q_DECLARE_PRIVATE(QQuickMouseArea)
163};
164
165QT_END_NAMESPACE
166
167#endif // QQUICKMOUSEAREA_P_H
bool contains(const QPointF &point) const override
bool startTransition(QQuickFlickablePrivate::AxisData *data, qreal toPos)
QQuickFlickableReboundTransition(QQuickFlickable *f, const QString &name)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:64
void run() override
Implement this pure virtual function in your subclass.
static void schedule(QQuickWindow *window, QObject *object)
\qmltype Window \nativetype QQuickWindow \inqmlmodule QtQuick
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")
QDebug operator<<(QDebug dbg, const NSObject *nsObject)
Definition qcore_mac.mm:201
static bool fuzzyLessThanOrEqualTo(qreal a, qreal b)
static qreal EaseOvershoot(qreal t)
const qreal _q_MaximumWheelDeceleration
#define QML_FLICK_SAMPLEBUFFER
#define QML_FLICK_OVERSHOOT
#define QML_FLICK_MULTIFLICK_MAXBOOST
#define QML_FLICK_MULTIFLICK_THRESHOLD
#define QML_FLICK_OVERSHOOTFRICTION
#define QML_FLICK_DISCARDSAMPLES
#define QML_FLICK_MULTIFLICK_RATIO
QDebug Q_QUICK_EXPORT operator<<(QDebug debug, const QQuickWindow *item)
QRhiRenderPassDescriptor * rpDesc
QRhiRenderBuffer * renderBuffer
QRhiRenderTarget * renderTarget