diff options
Diffstat (limited to 'src/quick/items/qquickmultipointtoucharea_p.h')
-rw-r--r-- | src/quick/items/qquickmultipointtoucharea_p.h | 87 |
1 files changed, 32 insertions, 55 deletions
diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h index 7b6426d3ab..51ddb1645c 100644 --- a/src/quick/items/qquickmultipointtoucharea_p.h +++ b/src/quick/items/qquickmultipointtoucharea_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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) 2016 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 QQUICKMULTIPOINTTOUCHAREA_H #define QQUICKMULTIPOINTTOUCHAREA_H @@ -51,19 +15,22 @@ // We mean it. // -#include "qquickitem.h" -#include "qevent.h" +#include <private/qtquickglobal_p.h> -#include <QPointer> -#include <QMap> -#include <QList> +#include <QtQuick/qquickitem.h> + +#include <QtGui/qevent.h> #include <QtGui/qguiapplication.h> #include <QtGui/qstylehints.h> +#include <QtCore/qlist.h> +#include <QtCore/qmap.h> +#include <QtCore/qpointer.h> + QT_BEGIN_NAMESPACE class QQuickMultiPointTouchArea; -class Q_AUTOTEST_EXPORT QQuickTouchPoint : public QObject +class Q_QUICK_EXPORT QQuickTouchPoint : public QObject { Q_OBJECT Q_PROPERTY(int pointId READ pointId NOTIFY pointIdChanged) @@ -185,8 +152,8 @@ private: class QQuickGrabGestureEvent : public QObject { Q_OBJECT - Q_PROPERTY(QQmlListProperty<QObject> touchPoints READ touchPoints CONSTANT) - Q_PROPERTY(qreal dragThreshold READ dragThreshold CONSTANT) + Q_PROPERTY(QQmlListProperty<QObject> touchPoints READ touchPoints CONSTANT FINAL) + Q_PROPERTY(qreal dragThreshold READ dragThreshold CONSTANT FINAL) QML_NAMED_ELEMENT(GestureEvent) QML_ADDED_IN_VERSION(2, 0) QML_UNCREATABLE("GestureEvent is only available in the context of handling the gestureStarted signal from MultiPointTouchArea.") @@ -209,11 +176,12 @@ private: QList<QObject*> _touchPoints; }; -class Q_AUTOTEST_EXPORT QQuickMultiPointTouchArea : public QQuickItem +class Q_QUICK_EXPORT QQuickMultiPointTouchArea : public QQuickItem { Q_OBJECT + Q_DISABLE_COPY_MOVE(QQuickMultiPointTouchArea) - Q_PROPERTY(QQmlListProperty<QQuickTouchPoint> touchPoints READ touchPoints) + Q_PROPERTY(QQmlListProperty<QQuickTouchPoint> touchPoints READ touchPoints CONSTANT) Q_PROPERTY(int minimumTouchPoints READ minimumTouchPoints WRITE setMinimumTouchPoints NOTIFY minimumTouchPointsChanged) Q_PROPERTY(int maximumTouchPoints READ maximumTouchPoints WRITE setMaximumTouchPoints NOTIFY maximumTouchPointsChanged) Q_PROPERTY(bool mouseEnabled READ mouseEnabled WRITE setMouseEnabled NOTIFY mouseEnabledChanged) @@ -242,7 +210,7 @@ public: static qsizetype touchPoint_count(QQmlListProperty<QQuickTouchPoint> *list) { QQuickMultiPointTouchArea *q = static_cast<QQuickMultiPointTouchArea*>(list->object); - return q->_touchPrototypes.count(); + return q->_touchPrototypes.size(); } static QQuickTouchPoint* touchPoint_at(QQmlListProperty<QQuickTouchPoint> *list, qsizetype index) { @@ -251,12 +219,23 @@ public: } Q_SIGNALS: +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) void pressed(const QList<QObject*> &touchPoints); void updated(const QList<QObject*> &touchPoints); void released(const QList<QObject*> &touchPoints); void canceled(const QList<QObject*> &touchPoints); +#else + void pressed(const QList<QObject*> &points); + void updated(const QList<QObject*> &points); + void released(const QList<QObject*> &points); + void canceled(const QList<QObject*> &points); +#endif void gestureStarted(QQuickGrabGestureEvent *gesture); +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) void touchUpdated(const QList<QObject*> &touchPoints); +#else + void touchUpdated(const QList<QObject*> &points); +#endif void minimumTouchPointsChanged(); void maximumTouchPointsChanged(); void mouseEnabledChanged(); @@ -277,16 +256,18 @@ protected: void updateTouchPoint(QQuickTouchPoint*, const QEventPoint*); void updateTouchPoint(QQuickTouchPoint *dtp, const QMouseEvent *e); - void updateTouchData(QEvent*); + enum class RemapEventPoints { No, ToLocal }; + void updateTouchData(QEvent*, RemapEventPoints remap = RemapEventPoints::No); bool sendMouseEvent(QMouseEvent *event); bool shouldFilter(QEvent *event); void grabGesture(QPointingDevice *dev); QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override; -#ifdef Q_OS_OSX +#ifdef Q_OS_MACOS void hoverEnterEvent(QHoverEvent *event) override; void hoverLeaveEvent(QHoverEvent *event) override; void setTouchEventsEnabled(bool enable); + void itemChange(ItemChange change, const ItemChangeData &data) override; #endif private: @@ -309,8 +290,4 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QQuickTouchPoint) -QML_DECLARE_TYPE(QQuickGrabGestureEvent) -QML_DECLARE_TYPE(QQuickMultiPointTouchArea) - #endif // QQUICKMULTIPOINTTOUCHAREA_H |