diff options
Diffstat (limited to 'src/quick')
11 files changed, 43 insertions, 192 deletions
diff --git a/src/quick/doc/snippets/pointerHandlers/dragHandler.qml b/src/quick/doc/snippets/pointerHandlers/dragHandler.qml index 78a7db5b0c..04ea3967a0 100644 --- a/src/quick/doc/snippets/pointerHandlers/dragHandler.qml +++ b/src/quick/doc/snippets/pointerHandlers/dragHandler.qml @@ -48,8 +48,7 @@ ** ****************************************************************************/ //![0] -import QtQuick 2.10 -import Qt.labs.handlers 1.0 +import QtQuick 2.12 Rectangle { width: 100 diff --git a/src/quick/doc/snippets/pointerHandlers/dragHandlerDifferentTarget.qml b/src/quick/doc/snippets/pointerHandlers/dragHandlerDifferentTarget.qml index 4c4168de83..a21ea1b39d 100644 --- a/src/quick/doc/snippets/pointerHandlers/dragHandlerDifferentTarget.qml +++ b/src/quick/doc/snippets/pointerHandlers/dragHandlerDifferentTarget.qml @@ -48,8 +48,7 @@ ** ****************************************************************************/ //![0] -import QtQuick 2.10 -import Qt.labs.handlers 1.0 +import QtQuick 2.12 Item { width: 640 diff --git a/src/quick/doc/snippets/pointerHandlers/dragHandlerNullTarget.qml b/src/quick/doc/snippets/pointerHandlers/dragHandlerNullTarget.qml index 09429ec1d2..d418e04731 100644 --- a/src/quick/doc/snippets/pointerHandlers/dragHandlerNullTarget.qml +++ b/src/quick/doc/snippets/pointerHandlers/dragHandlerNullTarget.qml @@ -48,8 +48,7 @@ ** ****************************************************************************/ //![0] -import QtQuick 2.10 -import Qt.labs.handlers 1.0 +import QtQuick 2.12 Item { width: 640 diff --git a/src/quick/doc/snippets/pointerHandlers/pinchHandler.qml b/src/quick/doc/snippets/pointerHandlers/pinchHandler.qml index 955047d115..dd0542a953 100644 --- a/src/quick/doc/snippets/pointerHandlers/pinchHandler.qml +++ b/src/quick/doc/snippets/pointerHandlers/pinchHandler.qml @@ -48,8 +48,7 @@ ** ****************************************************************************/ //![0] -import QtQuick 2.8 -import Qt.labs.handlers 1.0 +import QtQuick 2.12 Rectangle { width: 400 diff --git a/src/quick/doc/snippets/pointerHandlers/pinchHandlerDifferentTarget.qml b/src/quick/doc/snippets/pointerHandlers/pinchHandlerDifferentTarget.qml index a5255a64e3..b071e294af 100644 --- a/src/quick/doc/snippets/pointerHandlers/pinchHandlerDifferentTarget.qml +++ b/src/quick/doc/snippets/pointerHandlers/pinchHandlerDifferentTarget.qml @@ -48,8 +48,7 @@ ** ****************************************************************************/ //![0] -import QtQuick 2.8 -import Qt.labs.handlers 1.0 +import QtQuick 2.12 Item { width: 640 diff --git a/src/quick/doc/snippets/pointerHandlers/pinchHandlerNullTarget.qml b/src/quick/doc/snippets/pointerHandlers/pinchHandlerNullTarget.qml index 7d21efcb84..ade59d29f0 100644 --- a/src/quick/doc/snippets/pointerHandlers/pinchHandlerNullTarget.qml +++ b/src/quick/doc/snippets/pointerHandlers/pinchHandlerNullTarget.qml @@ -48,8 +48,7 @@ ** ****************************************************************************/ //![0] -import QtQuick 2.8 -import Qt.labs.handlers 1.0 +import QtQuick 2.12 Item { width: 640 diff --git a/src/quick/doc/snippets/pointerHandlers/pointHandler.qml b/src/quick/doc/snippets/pointerHandlers/pointHandler.qml index 262eb607b6..20be120120 100644 --- a/src/quick/doc/snippets/pointerHandlers/pointHandler.qml +++ b/src/quick/doc/snippets/pointerHandlers/pointHandler.qml @@ -48,9 +48,8 @@ ** ****************************************************************************/ //![0] -import QtQuick 2.10 +import QtQuick 2.12 import QtQuick.Window 2.2 -import Qt.labs.handlers 1.0 Window { width: 480 diff --git a/src/quick/handlers/handlers.pri b/src/quick/handlers/handlers.pri index 111a526ce2..1258822f40 100644 --- a/src/quick/handlers/handlers.pri +++ b/src/quick/handlers/handlers.pri @@ -1,7 +1,6 @@ HEADERS += \ $$PWD/qquickdraghandler_p.h \ $$PWD/qquickhandlerpoint_p.h \ - $$PWD/qquickhandlersmodule_p.h \ $$PWD/qquickhoverhandler_p.h \ $$PWD/qquickmultipointhandler_p.h \ $$PWD/qquickpinchhandler_p.h \ @@ -17,7 +16,6 @@ HEADERS += \ SOURCES += \ $$PWD/qquickdraghandler.cpp \ $$PWD/qquickhandlerpoint.cpp \ - $$PWD/qquickhandlersmodule.cpp \ $$PWD/qquickhoverhandler.cpp \ $$PWD/qquickmultipointhandler.cpp \ $$PWD/qquickpinchhandler.cpp \ diff --git a/src/quick/handlers/qquickhandlersmodule.cpp b/src/quick/handlers/qquickhandlersmodule.cpp deleted file mode 100644 index 814602c0bd..0000000000 --- a/src/quick/handlers/qquickhandlersmodule.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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$ -** -****************************************************************************/ - -#include "qquickhandlersmodule_p.h" -#include "qquickpointerhandler_p.h" -#include "qquickdraghandler_p.h" -#include "qquickhoverhandler_p.h" -#include "qquickpinchhandler_p.h" -#include "qquickpointhandler_p.h" -#include "qquicktaphandler_p.h" - -static void initResources() -{ -#ifdef QT_STATIC - Q_INIT_RESOURCE(qmake_Qt_labs_handlers); -#endif -} - -QT_BEGIN_NAMESPACE - -static QQmlPrivate::AutoParentResult handler_autoParent(QObject *obj, QObject *parent) -{ - if (qmlobject_cast<QQuickItem *>(parent)) { - QQuickPointerHandler *handler = qmlobject_cast<QQuickPointerHandler *>(obj); - if (handler) { - handler->setParent(parent); - return QQmlPrivate::Parented; - } - } - return QQmlPrivate::IncompatibleObject; -} - -static void qt_quickhandlers_defineModule(const char *uri, int major, int minor) -{ - QQmlPrivate::RegisterAutoParent autoparent = { 0, &handler_autoParent }; - QQmlPrivate::qmlregister(QQmlPrivate::AutoParentRegistration, &autoparent); - qmlRegisterUncreatableType<QQuickPointerEvent>(uri, major, minor, "PointerEvent", - QQuickPointerHandler::tr("PointerEvent is only available as a parameter of several signals in PointerHandler")); - qmlRegisterUncreatableType<QQuickEventPoint>(uri, major, minor, "EventPoint", - QQuickPointerHandler::tr("EventPoint is only available as a member of PointerEvent")); - qmlRegisterUncreatableType<QQuickEventTouchPoint>(uri, major, minor, "EventTouchPoint", - QQuickPointerHandler::tr("EventTouchPoint is only available as a member of PointerEvent")); - qmlRegisterUncreatableType<QQuickPointerDevice>(uri, major, minor, "PointerDevice", - QQuickPointerHandler::tr("PointerDevice is only available as a property of PointerEvent")); - qRegisterMetaType<QPointingDeviceUniqueId>("QPointingDeviceUniqueId"); - qmlRegisterUncreatableType<QPointingDeviceUniqueId>(uri, major, minor, "PointingDeviceUniqueId", - QQuickPointerHandler::tr("PointingDeviceUniqueId is only available as a property of PointerEvent")); - - qmlRegisterUncreatableType<QQuickPointerHandler>(uri,major,minor,"PointerHandler", - QQuickPointerHandler::tr("PointerHandler is an abstract base class")); - qmlRegisterType<QQuickPointHandler>(uri,major,minor,"PointHandler"); - qmlRegisterType<QQuickDragHandler>(uri,major,minor,"DragHandler"); - qmlRegisterUncreatableType<QQuickDragAxis>(uri, major, minor, "DragAxis", - QQuickDragHandler::tr("DragAxis is only available as a grouped property of DragHandler")); - qmlRegisterType<QQuickHoverHandler>(uri,major,minor,"HoverHandler"); - qmlRegisterType<QQuickPinchHandler>(uri,major,minor,"PinchHandler"); - qmlRegisterType<QQuickTapHandler>(uri,major,minor,"TapHandler"); - qRegisterMetaType<QQuickHandlerPoint>(); -} - -void QQuickHandlersModule::defineModule() -{ - initResources(); - - const char uri[] = "Qt.labs.handlers"; - int majorVersion = 1; - int minorVersion = 0; - - qt_quickhandlers_defineModule(uri, majorVersion, minorVersion); -} - -QT_END_NAMESPACE diff --git a/src/quick/handlers/qquickhandlersmodule_p.h b/src/quick/handlers/qquickhandlersmodule_p.h deleted file mode 100644 index 7eb8d39b98..0000000000 --- a/src/quick/handlers/qquickhandlersmodule_p.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -#ifndef QQUICKHANDLERSMODULE_P_H -#define QQUICKHANDLERSMODULE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qqml.h> -#include <private/qtquickglobal_p.h> - -QT_BEGIN_NAMESPACE - -class Q_QUICK_PRIVATE_EXPORT QQuickHandlersModule -{ -public: - static void defineModule(); -}; - -QT_END_NAMESPACE - -#endif // QQUICKHANDLERSMODULE_P_H - diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index 806fd9e465..3a42766667 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -113,6 +113,12 @@ #include <private/qqmlmetatype_p.h> #include <QtQuick/private/qquickaccessibleattached_p.h> +#include "handlers/qquickdraghandler_p.h" +#include "handlers/qquickhoverhandler_p.h" +#include "handlers/qquickpinchhandler_p.h" +#include "handlers/qquickpointhandler_p.h" +#include "handlers/qquicktaphandler_p.h" + QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcTransient) QT_END_NAMESPACE @@ -135,6 +141,9 @@ static QQmlPrivate::AutoParentResult qquickitem_autoParent(QObject *obj, QObject win->setTransientParent(parentItem->window()); return QQmlPrivate::Parented; } + } else if (QQuickPointerHandler *handler = qmlobject_cast<QQuickPointerHandler *>(obj)) { + handler->setParent(parent); + return QQmlPrivate::Parented; } return QQmlPrivate::IncompatibleObject; } else if (QQuickWindow *parentWindow = qmlobject_cast<QQuickWindow *>(parent)) { @@ -423,6 +432,33 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) #endif qmlRegisterType<QQuickItem, 11>(uri, 2, 11,"Item"); + // classes related to Input Handlers which are newly exposed since 5.12 + qmlRegisterUncreatableType<QQuickPointerEvent>(uri, 2, 12, "PointerEvent", + QQuickPointerHandler::tr("PointerEvent is only available as a parameter of several signals in PointerHandler")); + qmlRegisterUncreatableType<QQuickPointerMouseEvent>(uri, 2, 12, "PointerMouseEvent", + QQuickPointerHandler::tr("PointerMouseEvent is only available as a parameter of several signals in PointerHandler")); + qmlRegisterUncreatableType<QQuickPointerTouchEvent>(uri, 2, 12, "PointerTouchEvent", + QQuickPointerHandler::tr("PointerTouchEvent is only available as a parameter of several signals in PointerHandler")); + qmlRegisterUncreatableType<QQuickEventPoint>(uri, 2, 12, "EventPoint", + QQuickPointerHandler::tr("EventPoint is only available as a member of PointerEvent")); + qmlRegisterUncreatableType<QQuickEventTouchPoint>(uri, 2, 12, "EventTouchPoint", + QQuickPointerHandler::tr("EventTouchPoint is only available as a member of PointerEvent")); + qmlRegisterUncreatableType<QQuickPointerDevice>(uri, 2, 12, "PointerDevice", + QQuickPointerHandler::tr("PointerDevice is only available as a property of PointerEvent")); + + // Input Handlers are part of QtQuick, not a separate module, since 5.12 + qmlRegisterUncreatableType<QQuickPointerHandler>(uri, 2, 12, "PointerHandler", + QQuickPointerHandler::tr("PointerHandler is an abstract base class")); + qmlRegisterType<QQuickPointHandler>(uri, 2, 12, "PointHandler"); + qmlRegisterType<QQuickDragHandler>(uri, 2, 12, "DragHandler"); + qmlRegisterUncreatableType<QQuickDragAxis>(uri, 2, 12, "DragAxis", + QQuickDragHandler::tr("DragAxis is only available as a grouped property of DragHandler")); + qmlRegisterType<QQuickHoverHandler>(uri, 2, 12, "HoverHandler"); + qmlRegisterType<QQuickPinchHandler>(uri, 2, 12, "PinchHandler"); + qmlRegisterType<QQuickTapHandler>(uri, 2, 12, "TapHandler"); + qRegisterMetaType<QQuickHandlerPoint>(); + + // The rest of the 5.12 revisions qmlRegisterType<QQuickAnimatedSprite, 12>("QtQuick", 2, 12, "AnimatedSprite"); qmlRegisterType<QQuickGradient, 12>(uri, 2, 12, "Gradient"); qmlRegisterType<QQuickFlickable, 12>(uri, 2, 12, "Flickable"); |