From fc9b36c23680469bc6ca9f8a220045e67c7fb6c3 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 28 Dec 2017 10:05:36 +0100 Subject: QQuickPointerHandler: add virtual onTargetChanged() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To be overridden in handlers which need to know when this happens, to avoid connecting to the targetChanged() signal. Change-Id: I51432b69d05fd541eb62e0cd01f4019e336816ac Reviewed-by: Jan Arve Sæther --- src/quick/handlers/qquickpointerhandler.cpp | 2 ++ src/quick/handlers/qquickpointerhandler_p.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/quick/handlers/qquickpointerhandler.cpp b/src/quick/handlers/qquickpointerhandler.cpp index 64bf1a8a8b..d6d3a52d95 100644 --- a/src/quick/handlers/qquickpointerhandler.cpp +++ b/src/quick/handlers/qquickpointerhandler.cpp @@ -331,7 +331,9 @@ void QQuickPointerHandler::setTarget(QQuickItem *target) if (m_target == target) return; + QQuickItem *oldTarget = m_target; m_target = target; + onTargetChanged(oldTarget); emit targetChanged(); } diff --git a/src/quick/handlers/qquickpointerhandler_p.h b/src/quick/handlers/qquickpointerhandler_p.h index 9a77dd714a..a601d8a0f6 100644 --- a/src/quick/handlers/qquickpointerhandler_p.h +++ b/src/quick/handlers/qquickpointerhandler_p.h @@ -117,6 +117,7 @@ protected: virtual bool wantsPointerEvent(QQuickPointerEvent *event); virtual void handlePointerEventImpl(QQuickPointerEvent *event); void setActive(bool active); + virtual void onTargetChanged(QQuickItem *oldTarget) { Q_UNUSED(oldTarget); } virtual void onActiveChanged() { } virtual void onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point); virtual bool canGrab(QQuickEventPoint *point); -- cgit v1.2.3 From 020f6b8a9c86c3b02bd77d4dea455f60540d4267 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 10 Jan 2018 13:32:28 +0100 Subject: Qt.labs.handlers: add plugins.qmltyles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was missing in 5.10.0 so Creator didn't recognize the pointer handler types very well. Change-Id: I593625c1629dfffa66421b76038d7a6583bbb72d Reviewed-by: Jan Arve Sæther --- src/imports/handlers/plugins.qmltypes | 308 ++++++++++++++++++++++++++++++++++ 1 file changed, 308 insertions(+) create mode 100644 src/imports/handlers/plugins.qmltypes diff --git a/src/imports/handlers/plugins.qmltypes b/src/imports/handlers/plugins.qmltypes new file mode 100644 index 0000000000..f51e1e4bf3 --- /dev/null +++ b/src/imports/handlers/plugins.qmltypes @@ -0,0 +1,308 @@ +import QtQuick.tooling 1.2 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated by: +// 'qmlplugindump -nonrelocatable Qt.labs.handlers 1.0' + +Module { + dependencies: ["QtQuick 2.8"] + Component { + name: "QQuickDragAxis" + prototype: "QObject" + exports: ["Qt.labs.handlers/DragAxis 1.0"] + isCreatable: false + exportMetaObjectRevisions: [0] + Property { name: "minimum"; type: "double" } + Property { name: "maximum"; type: "double" } + Property { name: "enabled"; type: "bool" } + } + Component { + name: "QQuickDragHandler" + prototype: "QQuickSinglePointHandler" + exports: ["Qt.labs.handlers/DragHandler 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "xAxis"; type: "QQuickDragAxis"; isReadonly: true; isPointer: true } + Property { name: "yAxis"; type: "QQuickDragAxis"; isReadonly: true; isPointer: true } + Property { name: "translation"; type: "QVector2D"; isReadonly: true } + Method { name: "enforceConstraints" } + } + Component { + name: "QQuickEventPoint" + prototype: "QObject" + exports: ["Qt.labs.handlers/EventPoint 1.0"] + isCreatable: false + exportMetaObjectRevisions: [0] + Enum { + name: "States" + values: { + "Pressed": 1, + "Updated": 2, + "Stationary": 4, + "Released": 8 + } + } + Enum { + name: "GrabState" + values: { + "GrabPassive": 1, + "UngrabPassive": 2, + "CancelGrabPassive": 3, + "OverrideGrabPassive": 4, + "GrabExclusive": 16, + "UngrabExclusive": 32, + "CancelGrabExclusive": 48 + } + } + Property { name: "event"; type: "QQuickPointerEvent"; isReadonly: true; isPointer: true } + Property { name: "position"; type: "QPointF"; isReadonly: true } + Property { name: "scenePosition"; type: "QPointF"; isReadonly: true } + Property { name: "scenePressPosition"; type: "QPointF"; isReadonly: true } + Property { name: "sceneGrabPosition"; type: "QPointF"; isReadonly: true } + Property { name: "state"; type: "State"; isReadonly: true } + Property { name: "pointId"; type: "int"; isReadonly: true } + Property { name: "timeHeld"; type: "double"; isReadonly: true } + Property { name: "velocity"; type: "QVector2D"; isReadonly: true } + Property { name: "accepted"; type: "bool" } + Property { name: "exclusiveGrabber"; type: "QObject"; isPointer: true } + } + Component { + name: "QQuickEventTouchPoint" + prototype: "QQuickEventPoint" + exports: ["Qt.labs.handlers/EventTouchPoint 1.0"] + isCreatable: false + exportMetaObjectRevisions: [0] + Property { name: "rotation"; type: "double"; isReadonly: true } + Property { name: "pressure"; type: "double"; isReadonly: true } + Property { name: "ellipseDiameters"; type: "QSizeF"; isReadonly: true } + Property { name: "uniqueId"; type: "QPointingDeviceUniqueId"; isReadonly: true } + } + Component { + name: "QQuickMultiPointHandler" + prototype: "QQuickPointerDeviceHandler" + Property { name: "minimumPointCount"; type: "int" } + Property { name: "maximumPointCount"; type: "int" } + Property { name: "pointDistanceThreshold"; type: "double" } + } + Component { + name: "QQuickPinchHandler" + prototype: "QQuickMultiPointHandler" + exports: ["Qt.labs.handlers/PinchHandler 1.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "PinchOrigin" + values: { + "FirstPoint": 0, + "PinchCenter": 1, + "TargetCenter": 2 + } + } + Property { name: "minimumScale"; type: "double" } + Property { name: "maximumScale"; type: "double" } + Property { name: "minimumRotation"; type: "double" } + Property { name: "maximumRotation"; type: "double" } + Property { name: "pinchOrigin"; type: "PinchOrigin" } + Property { name: "centroid"; type: "QPointF"; isReadonly: true } + Property { name: "centroidVelocity"; type: "QVector2D"; isReadonly: true } + Property { name: "scale"; type: "double"; isReadonly: true } + Property { name: "rotation"; type: "double"; isReadonly: true } + Property { name: "translation"; type: "QVector2D"; isReadonly: true } + Property { name: "minimumX"; type: "double" } + Property { name: "maximumX"; type: "double" } + Property { name: "minimumY"; type: "double" } + Property { name: "maximumY"; type: "double" } + Signal { name: "updated" } + } + Component { + name: "QQuickPointHandler" + prototype: "QQuickSinglePointHandler" + exports: ["Qt.labs.handlers/PointHandler 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "translation"; type: "QVector2D"; isReadonly: true } + } + Component { + name: "QQuickPointerDevice" + prototype: "QObject" + exports: ["Qt.labs.handlers/PointerDevice 1.0"] + isCreatable: false + exportMetaObjectRevisions: [0] + Enum { + name: "DeviceType" + values: { + "UnknownDevice": 0, + "Mouse": 1, + "TouchScreen": 2, + "TouchPad": 4, + "Puck": 8, + "Stylus": 16, + "Airbrush": 32, + "AllDevices": 63 + } + } + Enum { + name: "DeviceTypes" + values: { + "UnknownDevice": 0, + "Mouse": 1, + "TouchScreen": 2, + "TouchPad": 4, + "Puck": 8, + "Stylus": 16, + "Airbrush": 32, + "AllDevices": 63 + } + } + Enum { + name: "PointerType" + values: { + "GenericPointer": 1, + "Finger": 2, + "Pen": 4, + "Eraser": 8, + "Cursor": 16, + "AllPointerTypes": 31 + } + } + Enum { + name: "PointerTypes" + values: { + "GenericPointer": 1, + "Finger": 2, + "Pen": 4, + "Eraser": 8, + "Cursor": 16, + "AllPointerTypes": 31 + } + } + Enum { + name: "CapabilityFlag" + values: { + "Position": 1, + "Area": 2, + "Pressure": 4, + "Velocity": 8, + "Scroll": 256, + "Hover": 512, + "Rotation": 1024, + "XTilt": 2048, + "YTilt": 4096 + } + } + Enum { + name: "Capabilities" + values: { + "Position": 1, + "Area": 2, + "Pressure": 4, + "Velocity": 8, + "Scroll": 256, + "Hover": 512, + "Rotation": 1024, + "XTilt": 2048, + "YTilt": 4096 + } + } + Property { name: "type"; type: "DeviceType"; isReadonly: true } + Property { name: "pointerType"; type: "PointerType"; isReadonly: true } + Property { name: "capabilities"; type: "Capabilities"; isReadonly: true } + Property { name: "maximumTouchPoints"; type: "int"; isReadonly: true } + Property { name: "buttonCount"; type: "int"; isReadonly: true } + Property { name: "name"; type: "string"; isReadonly: true } + Property { name: "uniqueId"; type: "QPointingDeviceUniqueId"; isReadonly: true } + } + Component { + name: "QQuickPointerDeviceHandler" + prototype: "QQuickPointerHandler" + Property { name: "acceptedDevices"; type: "QQuickPointerDevice::DeviceTypes" } + Property { name: "acceptedPointerTypes"; type: "QQuickPointerDevice::PointerTypes" } + Property { name: "acceptedModifiers"; type: "Qt::KeyboardModifiers" } + Method { + name: "setAcceptedDevices" + Parameter { name: "acceptedDevices"; type: "QQuickPointerDevice::DeviceTypes" } + } + Method { + name: "setAcceptedPointerTypes" + Parameter { name: "acceptedPointerTypes"; type: "QQuickPointerDevice::PointerTypes" } + } + Method { + name: "setAcceptedModifiers" + Parameter { name: "acceptedModifiers"; type: "Qt::KeyboardModifiers" } + } + } + Component { + name: "QQuickPointerEvent" + prototype: "QObject" + exports: ["Qt.labs.handlers/PointerEvent 1.0"] + isCreatable: false + exportMetaObjectRevisions: [0] + Property { name: "device"; type: "const QQuickPointerDevice"; isReadonly: true; isPointer: true } + Property { name: "modifiers"; type: "Qt::KeyboardModifiers"; isReadonly: true } + Property { name: "button"; type: "Qt::MouseButtons"; isReadonly: true } + Property { name: "buttons"; type: "Qt::MouseButtons"; isReadonly: true } + } + Component { + name: "QQuickPointerHandler" + prototype: "QObject" + exports: ["Qt.labs.handlers/PointerHandler 1.0"] + isCreatable: false + exportMetaObjectRevisions: [0] + Enum { + name: "GrabPermissions" + values: { + "TakeOverForbidden": 0, + "CanTakeOverFromHandlersOfSameType": 1, + "CanTakeOverFromHandlersOfDifferentType": 2, + "CanTakeOverFromItems": 4, + "CanTakeOverFromAnything": 15, + "ApprovesTakeOverByHandlersOfSameType": 16, + "ApprovesTakeOverByHandlersOfDifferentType": 32, + "ApprovesTakeOverByItems": 64, + "ApprovesCancellation": 128, + "ApprovesTakeOverByAnything": 240 + } + } + Property { name: "enabled"; type: "bool" } + Property { name: "active"; type: "bool"; isReadonly: true } + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "parent"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "grabPermissions"; type: "GrabPermissions" } + Signal { + name: "grabChanged" + Parameter { name: "point"; type: "QQuickEventPoint"; isPointer: true } + } + Signal { name: "grabPermissionChanged" } + Signal { + name: "canceled" + Parameter { name: "point"; type: "QQuickEventPoint"; isPointer: true } + } + } + Component { + name: "QQuickSinglePointHandler" + prototype: "QQuickPointerDeviceHandler" + Property { name: "acceptedButtons"; type: "Qt::MouseButtons" } + Property { name: "point"; type: "QQuickHandlerPoint"; isReadonly: true } + Signal { name: "singlePointGrabChanged" } + } + Component { + name: "QQuickTapHandler" + prototype: "QQuickSinglePointHandler" + exports: ["Qt.labs.handlers/TapHandler 1.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "GesturePolicy" + values: { + "DragThreshold": 0, + "WithinBounds": 1, + "ReleaseWithinBounds": 2 + } + } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "tapCount"; type: "int"; isReadonly: true } + Property { name: "timeHeld"; type: "double"; isReadonly: true } + Property { name: "longPressThreshold"; type: "double" } + Property { name: "gesturePolicy"; type: "GesturePolicy" } + Signal { name: "tapped" } + Signal { name: "longPressed" } + } +} -- cgit v1.2.3 From 1b96186d1418adcba85fdbfd794da2d2f6ea122d Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 16 Jan 2018 16:43:55 +0100 Subject: Create new engine for each benchmark run Otherwise we end up with too many mmap'ed blocks as they appear not to be deallocated until the engine is destroyed. Change-Id: I88b8dd6d570423a492ddc6c7f105d0db97caa72d Task-number: QTBUG-60590 Reviewed-by: Erik Verbruggen Reviewed-by: Simon Hausmann --- tests/benchmarks/qml/holistic/tst_holistic.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/benchmarks/qml/holistic/tst_holistic.cpp b/tests/benchmarks/qml/holistic/tst_holistic.cpp index 791ae6812b..d7e71297f2 100644 --- a/tests/benchmarks/qml/holistic/tst_holistic.cpp +++ b/tests/benchmarks/qml/holistic/tst_holistic.cpp @@ -108,8 +108,6 @@ private slots: void typeResolution_data(); void typeResolution(); -private: - QQmlEngine engine; }; tst_holistic::tst_holistic() @@ -242,6 +240,7 @@ void tst_holistic::compilation_data() void tst_holistic::compilation() { + QQmlEngine engine; // This function benchmarks the cost of loading and compiling specified QML files. // If "repetitions" is non-zero, each file from "files" will be compiled "repetitions" // times, without clearing the engine's component cache between compilations. @@ -263,6 +262,7 @@ void tst_holistic::compilation() void tst_holistic::instantiation() { + QQmlEngine engine; // This function benchmarks the cost of instantiating components compiled from specified QML files. // If "repetitions" is non-zero, each component compiled from "files" will be instantiated "repetitions" // times, without clearing the component's instantiation cache between instantiations. @@ -297,6 +297,7 @@ void tst_holistic::instantiation() void tst_holistic::creation() { + QQmlEngine engine; // This function benchmarks the cost of loading, compiling and instantiating specified QML files. // If "repetitions" is non-zero, each file from "files" will be created "repetitions" // times, without clearing the engine's component cache between component creation. @@ -359,6 +360,7 @@ void tst_holistic::dynamicity_data() void tst_holistic::dynamicity() { + QQmlEngine engine; // This function benchmarks the cost of "continued operation" - signal invocation, // updating bindings, etc. Note that we take two different writeValues in order // to force updates to occur, and we read to force lazy evaluation to occur. @@ -472,6 +474,7 @@ void tst_holistic::cppToJsDirect_data() void tst_holistic::cppToJsDirect() { + QQmlEngine engine; // This function benchmarks the cost of calling from CPP scope to JS scope // (and possibly vice versa, if the invoked js method then calls to cpp). @@ -491,6 +494,7 @@ void tst_holistic::cppToJsDirect() void tst_holistic::cppToJsIndirect() { + QQmlEngine engine; // This function benchmarks the cost of binding scarce resources // to properties of a QML component. The engine should automatically release such // resources when they are no longer used. @@ -544,6 +548,7 @@ void tst_holistic::typeResolution_data() void tst_holistic::typeResolution() { + QQmlEngine engine; // This function benchmarks the cost of "continued operation" (signal invocation, // updating bindings, etc) where the component has lots of nested items with // lots of resolving required. Note that we take two different writeValues in order -- cgit v1.2.3