From a566125b9fcc023237b442e5b9a838d40455c8fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= Date: Fri, 18 Jan 2019 14:39:00 +0100 Subject: Fix axis constraints API and documentation: This should have been done properly for 5.12. Since this API was introduced in 5.12.0, we simply hide the documentation for the old properties and make sure the properties we want to expose are documented: * Document the xAxis and yAxis properties. * Deprecate the {min,max}imum{X,Y} properties, and hide them in the documentation. Fixes: QTBUG-73137 Change-Id: Ic749bcfec63dc4772f193ccae2a2750c20cb63aa Reviewed-by: Shawn Rutledge --- src/quick/handlers/qquickpinchhandler.cpp | 56 ++++++++++++++++++++----------- src/quick/handlers/qquickpinchhandler_p.h | 22 +++++++----- 2 files changed, 51 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/quick/handlers/qquickpinchhandler.cpp b/src/quick/handlers/qquickpinchhandler.cpp index e6442e7258..95ac0985f0 100644 --- a/src/quick/handlers/qquickpinchhandler.cpp +++ b/src/quick/handlers/qquickpinchhandler.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qquickpinchhandler_p.h" +#include #include #include #include @@ -151,57 +152,48 @@ void QQuickPinchHandler::setMaximumRotation(qreal maximumRotation) emit maximumRotationChanged(); } -/*! - \qmlproperty real QtQuick::PinchHandler::minimumX +#if QT_DEPRECATED_SINCE(5, 12) +void QQuickPinchHandler::warnAboutMinMaxDeprecated() const +{ + qmlWarning(this) << "min and max constraints are now part of the xAxis and yAxis properties"; +} - The minimum acceptable x coordinate of the centroid -*/ void QQuickPinchHandler::setMinimumX(qreal minX) { + warnAboutMinMaxDeprecated(); if (m_minimumX == minX) return; m_minimumX = minX; emit minimumXChanged(); } -/*! - \qmlproperty real QtQuick::PinchHandler::maximumX - - The maximum acceptable x coordinate of the centroid -*/ void QQuickPinchHandler::setMaximumX(qreal maxX) { + warnAboutMinMaxDeprecated(); if (m_maximumX == maxX) return; m_maximumX = maxX; emit maximumXChanged(); } -/*! - \qmlproperty real QtQuick::PinchHandler::minimumY - - The minimum acceptable y coordinate of the centroid -*/ void QQuickPinchHandler::setMinimumY(qreal minY) { + warnAboutMinMaxDeprecated(); if (m_minimumY == minY) return; m_minimumY = minY; emit minimumYChanged(); } -/*! - \qmlproperty real QtQuick::PinchHandler::maximumY - - The maximum acceptable y coordinate of the centroid -*/ void QQuickPinchHandler::setMaximumY(qreal maxY) { + warnAboutMinMaxDeprecated(); if (m_maximumY == maxY) return; m_maximumY = maxY; emit maximumYChanged(); } +#endif bool QQuickPinchHandler::wantsPointerEvent(QQuickPointerEvent *event) { @@ -229,6 +221,32 @@ bool QQuickPinchHandler::wantsPointerEvent(QQuickPointerEvent *event) return true; } +/*! + \qmlpropertygroup QtQuick::PinchHandler::xAxis + \qmlproperty real QtQuick::PinchHandler::xAxis.minimum + \qmlproperty real QtQuick::PinchHandler::xAxis.maximum + \qmlproperty bool QtQuick::PinchHandler::xAxis.enabled + + \c xAxis controls the constraints for horizontal translation of the \l target item. + + \c minimum is the minimum acceptable x coordinate of the translation. + \c maximum is the maximum acceptable x coordinate of the translation. + If \c enabled is true, horizontal dragging is allowed. + */ + +/*! + \qmlpropertygroup QtQuick::PinchHandler::yAxis + \qmlproperty real QtQuick::PinchHandler::yAxis.minimum + \qmlproperty real QtQuick::PinchHandler::yAxis.maximum + \qmlproperty bool QtQuick::PinchHandler::yAxis.enabled + + \c yAxis controls the constraints for vertical translation of the \l target item. + + \c minimum is the minimum acceptable y coordinate of the translation. + \c maximum is the maximum acceptable y coordinate of the translation. + If \c enabled is true, vertical dragging is allowed. + */ + /*! \qmlproperty int QtQuick::PinchHandler::minimumTouchPoints diff --git a/src/quick/handlers/qquickpinchhandler_p.h b/src/quick/handlers/qquickpinchhandler_p.h index 8f24d18166..11d895468c 100644 --- a/src/quick/handlers/qquickpinchhandler_p.h +++ b/src/quick/handlers/qquickpinchhandler_p.h @@ -70,10 +70,12 @@ class Q_AUTOTEST_EXPORT QQuickPinchHandler : public QQuickMultiPointHandler Q_PROPERTY(qreal activeScale READ activeScale NOTIFY updated) Q_PROPERTY(qreal rotation READ rotation NOTIFY updated) Q_PROPERTY(QVector2D translation READ translation NOTIFY updated) - Q_PROPERTY(qreal minimumX READ minimumX WRITE setMinimumX NOTIFY minimumXChanged) - Q_PROPERTY(qreal maximumX READ maximumX WRITE setMaximumX NOTIFY maximumXChanged) - Q_PROPERTY(qreal minimumY READ minimumY WRITE setMinimumY NOTIFY minimumYChanged) - Q_PROPERTY(qreal maximumY READ maximumY WRITE setMaximumY NOTIFY maximumYChanged) +#if QT_DEPRECATED_SINCE(5, 12) + Q_PROPERTY(qreal minimumX READ minimumX WRITE setMinimumX NOTIFY minimumXChanged) // ### Qt 6: remove + Q_PROPERTY(qreal maximumX READ maximumX WRITE setMaximumX NOTIFY maximumXChanged) // ### Qt 6: remove + Q_PROPERTY(qreal minimumY READ minimumY WRITE setMinimumY NOTIFY minimumYChanged) // ### Qt 6: remove + Q_PROPERTY(qreal maximumY READ maximumY WRITE setMaximumY NOTIFY maximumYChanged) // ### Qt 6: remove +#endif Q_PROPERTY(QQuickDragAxis * xAxis READ xAxis CONSTANT) Q_PROPERTY(QQuickDragAxis * yAxis READ yAxis CONSTANT) @@ -96,14 +98,18 @@ public: qreal scale() const { return m_accumulatedScale; } qreal activeScale() const { return m_activeScale; } qreal rotation() const { return m_activeRotation; } - qreal minimumX() const { return m_minimumX; } + +#if QT_DEPRECATED_SINCE(5, 12) + void warnAboutMinMaxDeprecated() const; + qreal minimumX() const { warnAboutMinMaxDeprecated(); return m_minimumX; } void setMinimumX(qreal minX); - qreal maximumX() const { return m_maximumX; } + qreal maximumX() const { warnAboutMinMaxDeprecated(); return m_maximumX; } void setMaximumX(qreal maxX); - qreal minimumY() const { return m_minimumY; } + qreal minimumY() const { warnAboutMinMaxDeprecated(); return m_minimumY; } void setMinimumY(qreal minY); - qreal maximumY() const { return m_maximumY; } + qreal maximumY() const { warnAboutMinMaxDeprecated(); return m_maximumY; } void setMaximumY(qreal maxY); +#endif QQuickDragAxis *xAxis() { return &m_xAxis; } QQuickDragAxis *yAxis() { return &m_yAxis; } -- cgit v1.2.3 From d27d896d8cb9d240138fe8ea69f1051f74ce1945 Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Mon, 21 Jan 2019 10:02:01 +0100 Subject: Improve error message Show more datails about what actually went wrong. Change-Id: I418a4d1f433bd4d440fc34e9a4932a9ea010b174 Reviewed-by: Ulf Hermann --- src/qml/compiler/qqmlpropertyvalidator.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/qml/compiler/qqmlpropertyvalidator.cpp b/src/qml/compiler/qqmlpropertyvalidator.cpp index 4cb922ca8d..25dcaa0c2d 100644 --- a/src/qml/compiler/qqmlpropertyvalidator.cpp +++ b/src/qml/compiler/qqmlpropertyvalidator.cpp @@ -276,7 +276,11 @@ QVector QQmlPropertyValidator::validateObject(int objectIndex, } } else { if (!enginePrivate->propertyCacheForType(pd->propType())) { - return recordError(binding->location, tr("Invalid grouped property access")); + return recordError(binding->location, + tr("Invalid grouped property access: Property \"%1\" with type \"%2\", which is not a value type") + .arg(name) + .arg(QString::fromLatin1(QMetaType::typeName(pd->propType()))) + ); } } } -- cgit v1.2.3 From 5de48ee56a5afb0045d40851a4a1dd79db82c772 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 4 Feb 2019 12:02:01 +0100 Subject: QMLJS: Have ScanFunctions iterate over ArrayPattern nodes Like Codegen, have ScanFunctions iterate over the elements in an ArrayPattern, instead of recursing over the tail of the element list. This prevents running out of (native) stack, or hitting the recursion check limiter. Change-Id: I8203af3119ad50f19000a215af42649d9bcb3784 Fixes: QTBUG-73425 Reviewed-by: Lars Knoll --- src/qml/compiler/qv4compilerscanfunctions.cpp | 8 ++++++++ src/qml/compiler/qv4compilerscanfunctions_p.h | 1 + 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp index fc3ac769ae..e0eaa8867b 100644 --- a/src/qml/compiler/qv4compilerscanfunctions.cpp +++ b/src/qml/compiler/qv4compilerscanfunctions.cpp @@ -481,6 +481,14 @@ bool ScanFunctions::visit(FieldMemberExpression *ast) return true; } +bool ScanFunctions::visit(ArrayPattern *ast) +{ + for (PatternElementList *it = ast->elements; it; it = it->next) + Node::accept(it->element, this); + + return false; +} + bool ScanFunctions::enterFunction(FunctionExpression *ast, bool enterName) { if (_context->isStrict && (ast->name == QLatin1String("eval") || ast->name == QLatin1String("arguments"))) diff --git a/src/qml/compiler/qv4compilerscanfunctions_p.h b/src/qml/compiler/qv4compilerscanfunctions_p.h index 4463a4f4f3..28ad846bcd 100644 --- a/src/qml/compiler/qv4compilerscanfunctions_p.h +++ b/src/qml/compiler/qv4compilerscanfunctions_p.h @@ -120,6 +120,7 @@ protected: bool visit(AST::TemplateLiteral *ast) override; bool visit(AST::SuperLiteral *) override; bool visit(AST::FieldMemberExpression *) override; + bool visit(AST::ArrayPattern *) override; bool enterFunction(AST::FunctionExpression *ast, bool enterName); -- cgit v1.2.3 From 78c1fcbc49f56463064eef738a475d9018357b24 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 1 Feb 2019 17:29:43 +0100 Subject: QQuickWindow: don't give exclusive grab to invisible or disabled Items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An Item might set itself invisible or disabled while handling a mouse press, as an alternative to rejecting the event. In earlier Qt versions (e.g. 5.6) it did not end up with a grab in such a case. Task-number: QTBUG-63271 Change-Id: I12f646e4217d773d396f380672420c85e6adcd52 Reviewed-by: Qt CI Bot Reviewed-by: Mitch Curtis Reviewed-by: Jan Arve Sæther --- src/quick/items/qquickwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index dd5960e925..61c8bcc1e7 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -2623,7 +2623,7 @@ void QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QQuickPo auto mouseGrabber = q->mouseGrabberItem(); if (mouseGrabber && mouseGrabber != item && mouseGrabber != oldMouseGrabber) { item->mouseUngrabEvent(); - } else { + } else if (item->isEnabled() && item->isVisible()) { item->grabMouse(); } point->setAccepted(true); -- cgit v1.2.3 From 8ab6ded97633bf7f74e7ca4de35ed56d07f358d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= Date: Mon, 4 Feb 2019 15:16:45 +0100 Subject: Fix bug where QQMPH kept an exclusive grab when no buttons were pressed This happened if you moved the mouse while doing a multitouch operation. More specifically this caused the bug: 1. Open qtdeclarative/tests/manual/pointer/map.qml 2. Rotate the map with two fingers (Do not release fingers). 3. Move mouse (no buttons pressed). 4. Release both fingers. 5. Move mouse again (error: the draghandler has a grab and thus the map is dragged even if no buttons are down). This happened because if you moved the mouse while having two fingers down, Windows would generate a *mouse*move* event with Left button or Right button pressed (which wasn't the case on the physical device but it's probably because of a bug in how mouse events are synthesized from touch on Windows). This caused the QQuickMultiPointHandler to do a passive grab. Then, when releasing the fingers it would not send a mouse release event (just plain touch release events), so the QQuickMultiPointHandler would keep the passive grab it had. All subsequent mouse move events would then be dispatched to the QQuickMultiPointHandler where it would assume that the button was pressed until it got a release event (but button was never pressed so that wouldn't happen). Eventually it would perform an exclusive grab, and dragging was initiated. Change-Id: I42b3133c5fde93c7f92f1cb28705156a69f9ad1c Reviewed-by: Shawn Rutledge --- src/quick/handlers/qquickmultipointhandler.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/quick/handlers/qquickmultipointhandler.cpp b/src/quick/handlers/qquickmultipointhandler.cpp index 228c99bb12..baa68e5e53 100644 --- a/src/quick/handlers/qquickmultipointhandler.cpp +++ b/src/quick/handlers/qquickmultipointhandler.cpp @@ -162,6 +162,10 @@ QVector QQuickMultiPointHandler::eligiblePoints(QQuickPointe bool stealingAllowed = event->isPressEvent() || event->isReleaseEvent(); for (int i = 0; i < c; ++i) { QQuickEventPoint *p = event->point(i); + if (QQuickPointerMouseEvent *me = event->asPointerMouseEvent()) { + if (me->buttons() == Qt::NoButton) + continue; + } if (!stealingAllowed) { QObject *exclusiveGrabber = p->exclusiveGrabber(); if (exclusiveGrabber && exclusiveGrabber != this && !canGrab(p)) -- cgit v1.2.3