aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickitemsmodule.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-06-25 18:12:29 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-07-17 15:11:51 +0000
commit197c22be541e18b3e8db0d259d4a3e7be3030bb9 (patch)
tree0672adcff8038d81188646d498de5eb9deda6ed1 /src/quick/items/qquickitemsmodule.cpp
parentc2004b6a71983ca9f8222875eecd6f7a440f75af (diff)
Get rid of Qt.labs.handlers import, merge into QtQuick 2.12
... and clean up imports in examples, snippets and tests accordingly. Change-Id: I5bbe63afd2614cdc2c1ec7d179c9acd6bc03b167 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/items/qquickitemsmodule.cpp')
-rw-r--r--src/quick/items/qquickitemsmodule.cpp36
1 files changed, 36 insertions, 0 deletions
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");