aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickevents_p_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/items/qquickevents_p_p.h')
-rw-r--r--src/quick/items/qquickevents_p_p.h156
1 files changed, 61 insertions, 95 deletions
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index 91f6c5de23..f82905333b 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQuick module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKEVENTS_P_P_H
#define QQUICKEVENTS_P_P_H
@@ -72,17 +36,18 @@ class QPointerEvent;
class QMouseEvent;
class QQuickPointerHandler;
-class QQuickKeyEvent : public QObject
+class Q_QUICK_EXPORT QQuickKeyEvent : public QObject
{
Q_OBJECT
- Q_PROPERTY(int key READ key CONSTANT)
- Q_PROPERTY(QString text READ text CONSTANT)
- Q_PROPERTY(int modifiers READ modifiers CONSTANT)
- Q_PROPERTY(bool isAutoRepeat READ isAutoRepeat CONSTANT)
- Q_PROPERTY(int count READ count CONSTANT)
- Q_PROPERTY(quint32 nativeScanCode READ nativeScanCode CONSTANT)
- Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
- QML_ANONYMOUS
+ Q_PROPERTY(int key READ key CONSTANT FINAL)
+ Q_PROPERTY(QString text READ text CONSTANT FINAL)
+ Q_PROPERTY(int modifiers READ modifiers CONSTANT FINAL)
+ Q_PROPERTY(bool isAutoRepeat READ isAutoRepeat CONSTANT FINAL)
+ Q_PROPERTY(int count READ count CONSTANT FINAL)
+ Q_PROPERTY(quint32 nativeScanCode READ nativeScanCode CONSTANT FINAL)
+ Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL)
+ QML_NAMED_ELEMENT(KeyEvent)
+ QML_UNCREATABLE("Should only be used by signal handlers in the Keys attached property")
QML_ADDED_IN_VERSION(2, 0)
public:
@@ -129,36 +94,37 @@ public:
private:
QString m_text;
- quint32 m_nativeScanCode;
- QEvent::Type m_type;
- int m_key;
- int m_modifiers;
- int m_count;
- bool m_accepted;
- bool m_autoRepeat;
+ quint32 m_nativeScanCode = 0;
+ QEvent::Type m_type = QEvent::None;
+ int m_key = 0;
+ int m_modifiers = 0;
+ int m_count = 0;
+ bool m_accepted = false;
+ bool m_autoRepeat = false;
};
-// used in Qt Location
-class Q_QUICK_PRIVATE_EXPORT QQuickMouseEvent : public QObject
+class Q_QUICK_EXPORT QQuickMouseEvent : public QObject
{
Q_OBJECT
- Q_PROPERTY(qreal x READ x CONSTANT)
- Q_PROPERTY(qreal y READ y CONSTANT)
- Q_PROPERTY(int button READ button CONSTANT)
- Q_PROPERTY(int buttons READ buttons CONSTANT)
- Q_PROPERTY(int modifiers READ modifiers CONSTANT)
- Q_PROPERTY(int source READ source CONSTANT REVISION(2, 7))
- Q_PROPERTY(bool wasHeld READ wasHeld CONSTANT)
- Q_PROPERTY(bool isClick READ isClick CONSTANT)
- Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
- Q_PROPERTY(int flags READ flags CONSTANT REVISION(2, 11))
- QML_ANONYMOUS
+ Q_PROPERTY(qreal x READ x CONSTANT FINAL)
+ Q_PROPERTY(qreal y READ y CONSTANT FINAL)
+ Q_PROPERTY(int button READ button CONSTANT FINAL)
+ Q_PROPERTY(int buttons READ buttons CONSTANT FINAL)
+ Q_PROPERTY(int modifiers READ modifiers CONSTANT FINAL)
+#if QT_DEPRECATED_SINCE(6, 6)
+ Q_PROPERTY(int source READ source CONSTANT REVISION(2, 7) FINAL)
+#endif
+ Q_PROPERTY(bool isClick READ isClick CONSTANT FINAL)
+ Q_PROPERTY(bool wasHeld READ wasHeld CONSTANT FINAL)
+ Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL)
+ Q_PROPERTY(int flags READ flags CONSTANT REVISION(2, 11) FINAL)
+ QML_NAMED_ELEMENT(MouseEvent)
+ QML_UNCREATABLE("Should only be used by mouse event signal handlers, for example in MouseArea")
QML_ADDED_IN_VERSION(2, 0)
public:
QQuickMouseEvent()
- : _buttons(Qt::NoButton), _modifiers(Qt::NoModifier)
- , _wasHeld(false), _isClick(false), _accepted(false)
+ : _wasHeld(false), _isClick(false), _accepted(false)
{}
void reset(qreal x, qreal y, Qt::MouseButton button, Qt::MouseButtons buttons,
@@ -182,7 +148,9 @@ public:
int button() const { return _button; }
int buttons() const { return _buttons; }
int modifiers() const { return _modifiers; }
+#if QT_DEPRECATED_SINCE(6, 6)
int source() const { return _source; }
+#endif
bool wasHeld() const { return _wasHeld; }
bool isClick() const { return _isClick; }
@@ -190,7 +158,9 @@ public:
void setX(qreal x) { _x = x; }
void setY(qreal y) { _y = y; }
void setPosition(const QPointF &point) { _x = point.x(); _y = point.y(); }
+#if QT_DEPRECATED_SINCE(6, 6)
void setSource(Qt::MouseEventSource s) { _source = s; }
+#endif
bool isAccepted() { return _accepted; }
void setAccepted(bool accepted) { _accepted = accepted; }
@@ -199,29 +169,31 @@ private:
qreal _x = 0;
qreal _y = 0;
Qt::MouseButton _button = Qt::NoButton;
- Qt::MouseButtons _buttons;
- Qt::KeyboardModifiers _modifiers;
+ Qt::MouseButtons _buttons = Qt::NoButton;
+ Qt::KeyboardModifiers _modifiers = Qt::NoModifier;
Qt::MouseEventSource _source = Qt::MouseEventNotSynthesized;
bool _wasHeld : 1;
bool _isClick : 1;
bool _accepted : 1;
- Qt::MouseEventFlags _flags;
+ Qt::MouseEventFlags _flags = Qt::NoMouseEventFlag;
};
-class QQuickWheelEvent : public QObject
+#if QT_CONFIG(wheelevent)
+class Q_QUICK_EXPORT QQuickWheelEvent : public QObject
{
Q_OBJECT
- Q_PROPERTY(const QPointingDevice *device READ pointingDevice CONSTANT)
- Q_PROPERTY(qreal x READ x CONSTANT)
- Q_PROPERTY(qreal y READ y CONSTANT)
- Q_PROPERTY(QPoint angleDelta READ angleDelta CONSTANT)
- Q_PROPERTY(QPoint pixelDelta READ pixelDelta CONSTANT)
- Q_PROPERTY(Qt::ScrollPhase phase READ phase CONSTANT)
- Q_PROPERTY(int buttons READ buttons CONSTANT)
- Q_PROPERTY(int modifiers READ modifiers CONSTANT)
- Q_PROPERTY(bool inverted READ inverted CONSTANT)
- Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
- QML_ANONYMOUS
+ Q_PROPERTY(const QPointingDevice *device READ pointingDevice CONSTANT FINAL)
+ Q_PROPERTY(qreal x READ x CONSTANT FINAL)
+ Q_PROPERTY(qreal y READ y CONSTANT FINAL)
+ Q_PROPERTY(QPoint angleDelta READ angleDelta CONSTANT FINAL)
+ Q_PROPERTY(QPoint pixelDelta READ pixelDelta CONSTANT FINAL)
+ Q_PROPERTY(Qt::ScrollPhase phase READ phase CONSTANT FINAL)
+ Q_PROPERTY(int buttons READ buttons CONSTANT FINAL)
+ Q_PROPERTY(int modifiers READ modifiers CONSTANT FINAL)
+ Q_PROPERTY(bool inverted READ inverted CONSTANT FINAL)
+ Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL)
+ QML_NAMED_ELEMENT(WheelEvent)
+ QML_UNCREATABLE("Should only be used by wheel event signal handlers, for example in MouseArea")
QML_ADDED_IN_VERSION(2, 0)
public:
@@ -265,12 +237,14 @@ private:
bool _inverted = false;
bool _accepted = false;
};
+#endif
-class Q_QUICK_PRIVATE_EXPORT QQuickCloseEvent : public QObject
+class Q_QUICK_EXPORT QQuickCloseEvent : public QObject
{
Q_OBJECT
- Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
- QML_ANONYMOUS
+ Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL)
+ QML_NAMED_ELEMENT(CloseEvent)
+ QML_UNCREATABLE("Should only be used by Window's closing signal")
QML_ADDED_IN_VERSION(2, 0)
public:
@@ -285,12 +259,4 @@ private:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QQuickKeyEvent)
-QML_DECLARE_TYPE(QQuickMouseEvent)
-QML_DECLARE_TYPE(QQuickWheelEvent)
-QML_DECLARE_TYPE(QQuickCloseEvent)
-QML_DECLARE_TYPE(QPointingDevice)
-QML_DECLARE_TYPE(QPointingDeviceUniqueId)
-QML_DECLARE_TYPE(QPointerEvent)
-
#endif // QQUICKEVENTS_P_P_H