summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-02-07 01:01:54 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-02-07 01:01:55 +0100
commite04e5db13d2a1d03e4afe139fcc29e0ed5b1edab (patch)
treeca450c633cbce2c86293b302d6e448e652e0136b
parent6a7c8749712c33e27cdbc93efdf54eddf8e7631f (diff)
parent895302829b46e00cde8eef13eb7c630af5d771e2 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-alpha1
-rw-r--r--dist/changes-5.12.13
-rw-r--r--src/qml/compiler/qqmlpropertyvalidator.cpp6
-rw-r--r--src/qml/compiler/qv4compilerscanfunctions.cpp8
-rw-r--r--src/qml/compiler/qv4compilerscanfunctions_p.h1
-rw-r--r--src/quick/handlers/qquickmultipointhandler.cpp4
-rw-r--r--src/quick/handlers/qquickpinchhandler.cpp56
-rw-r--r--src/quick/handlers/qquickpinchhandler_p.h22
-rw-r--r--src/quick/items/qquickwindow.cpp2
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.errors.txt2
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.errors.txt2
-rw-r--r--tests/auto/quick/pointerhandlers/qquickdraghandler/data/draghandler_and_pinchhandler.qml61
-rw-r--r--tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp46
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp6
13 files changed, 186 insertions, 33 deletions
diff --git a/dist/changes-5.12.1 b/dist/changes-5.12.1
index 36fbdb6a72..39767ade87 100644
--- a/dist/changes-5.12.1
+++ b/dist/changes-5.12.1
@@ -66,6 +66,9 @@ information about a particular change.
- [QTBUG-71955] TapHandler ignores scroll events and native gestures.
- [QTBUG-71317] Event Handlers can now be used in Windows and Dialogs.
- [QTBUG-71427] Event Handlers now function properly when created dynamically.
+ - [QTBUG-73137] The PinchHandler {min,max}imum{X,Y} properties that were
+ unintentionally included in the 5.12.0 release have now been deprecated.
+ Please use the xAxis and yAxis properties instead.
- [QTBUG-72376] In Text with StyledText textFormat, <s></s> and <del></del>
tags will now be interpreted as strikethrough style.
- [QTBUG-59310] Fixed vertical alignment of images in a text document.
diff --git a/src/qml/compiler/qqmlpropertyvalidator.cpp b/src/qml/compiler/qqmlpropertyvalidator.cpp
index 746f68369f..b1865121d3 100644
--- a/src/qml/compiler/qqmlpropertyvalidator.cpp
+++ b/src/qml/compiler/qqmlpropertyvalidator.cpp
@@ -276,7 +276,11 @@ QVector<QQmlCompileError> 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())))
+ );
}
}
}
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);
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<QQuickEventPoint *> 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))
diff --git a/src/quick/handlers/qquickpinchhandler.cpp b/src/quick/handlers/qquickpinchhandler.cpp
index a0fec37443..9ae2116d39 100644
--- a/src/quick/handlers/qquickpinchhandler.cpp
+++ b/src/quick/handlers/qquickpinchhandler.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qquickpinchhandler_p.h"
+#include <QtQml/qqmlinfo.h>
#include <QtQuick/qquickwindow.h>
#include <private/qsgadaptationlayer_p.h>
#include <private/qquickitem_p.h>
@@ -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 (qFuzzyCompare(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 (qFuzzyCompare(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 (qFuzzyCompare(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 (qFuzzyCompare(m_maximumY, maxY))
return;
m_maximumY = maxY;
emit maximumYChanged();
}
+#endif
bool QQuickPinchHandler::wantsPointerEvent(QQuickPointerEvent *event)
{
@@ -230,6 +222,32 @@ bool QQuickPinchHandler::wantsPointerEvent(QQuickPointerEvent *event)
}
/*!
+ \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
The pinch begins when this number of fingers are pressed.
diff --git a/src/quick/handlers/qquickpinchhandler_p.h b/src/quick/handlers/qquickpinchhandler_p.h
index b9e2cbf48f..1afc028758 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; }
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index b5a68a2283..f517b5b3e9 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);
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.errors.txt
index 810fd31b41..d76f18ba89 100644
--- a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.errors.txt
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.1.errors.txt
@@ -1 +1 @@
-5:5:Invalid grouped property access
+5:5:Invalid grouped property access: Property "o" with type "QVariant", which is not a value type
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.errors.txt
index f6d6f29fbf..9a0422753f 100644
--- a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.errors.txt
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.3.errors.txt
@@ -1 +1 @@
-4:5:Invalid grouped property access
+4:5:Invalid grouped property access: Property "customType" with type "MyCustomVariantType", which is not a value type
diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/data/draghandler_and_pinchhandler.qml b/tests/auto/quick/pointerhandlers/qquickdraghandler/data/draghandler_and_pinchhandler.qml
new file mode 100644
index 0000000000..08b85aef50
--- /dev/null
+++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/data/draghandler_and_pinchhandler.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the manual tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.12
+
+Item {
+ id: root
+ objectName: "DragHandler_and_PinchHandler"
+ width: 640
+ height: 480
+
+ Rectangle {
+ id: rect
+ objectName: "Rect"
+ color: dragHandler.active ? "blue" : (pinchHandler.active ? "magenta" : "grey")
+ width: 200; height: 200; x: 100; y: 100
+
+ PinchHandler {
+ id: pinchHandler
+ objectName: "PinchHandler"
+ }
+ DragHandler {
+ id: dragHandler
+ objectName: "DragHandler"
+ }
+
+ Text {
+ color: "white"
+ anchors.centerIn: parent
+ horizontalAlignment: Text.AlignHCenter
+ text: rect.objectName + "\n"
+ + "rotation:" + rect.rotation + "\n"
+ + dragHandler.centroid.position.x.toFixed(1) + "," + dragHandler.centroid.position.y.toFixed(1)
+ }
+ }
+}
diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
index 0c544ef484..eb210c2112 100644
--- a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
@@ -60,6 +60,7 @@ private slots:
void touchDragMultiSliders();
void touchPassiveGrabbers_data();
void touchPassiveGrabbers();
+ void touchPinchAndMouseMove();
private:
void createView(QScopedPointer<QQuickView> &window, const char *fileName);
@@ -521,6 +522,51 @@ void tst_DragHandler::touchPassiveGrabbers()
QQuickTouchUtils::flush(window);
}
+void tst_DragHandler::touchPinchAndMouseMove()
+{
+ QScopedPointer<QQuickView> windowPtr;
+ createView(windowPtr, "draghandler_and_pinchhandler.qml");
+ QQuickView *window = windowPtr.data();
+ QQuickItem *rect = window->rootObject()->findChild<QQuickItem*>(QLatin1String("Rect"));
+ QQuickPointerHandler *pinchHandler = window->rootObject()->findChild<QQuickPointerHandler*>(QLatin1String("PinchHandler"));
+
+ QPoint p1(150,200);
+ QPoint p2(250,200);
+
+ // Trigger a scale pinch, PinchHandler should activate
+ QTest::QTouchEventSequence touch = QTest::touchEvent(window, touchDevice);
+ touch.press(1, p1).press(2, p2).commit();
+ QQuickTouchUtils::flush(window);
+ QPoint delta(10,0);
+ for (int i = 0; i < 10 && !pinchHandler->active(); ++i) {
+ p1-=delta;
+ p2+=delta;
+ touch.move(1, p1).move(2, p2).commit();
+ QQuickTouchUtils::flush(window);
+ }
+ QCOMPARE(pinchHandler->active(), true);
+
+ // While having the touch points pressed, send wrong mouse event as MS Windows did:
+ // * A MoveMove with LeftButton down
+ // (in order to synthesize that, qtestMouseButtons needs to be modified)
+ // (This will make the DragHandler do a passive grab)
+ QTestPrivate::qtestMouseButtons = Qt::LeftButton;
+ QTest::mouseMove(window, p1 + delta);
+
+ touch.release(1, p1).release(2, p2).commit();
+ QQuickTouchUtils::flush(window);
+
+ // Now move the mouse with no buttons down and check if the rect did not move
+ // At this point, no touch points are pressed and no mouse buttons are pressed.
+ QTestPrivate::qtestMouseButtons = Qt::NoButton;
+ QSignalSpy rectMovedSpy(rect, SIGNAL(xChanged()));
+ for (int i = 0; i < 10; ++i) {
+ p1 += delta;
+ QTest::mouseMove(window, p1);
+ QCOMPARE(rectMovedSpy.count(), 0);
+ }
+}
+
QTEST_MAIN(tst_DragHandler)
#include "tst_qquickdraghandler.moc"
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index ab101dc1be..a862604fc1 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -2350,8 +2350,10 @@ void tst_qquickwindow::defaultSurfaceFormat()
// Depth and stencil should be >= what has been requested. For real. But use
// the context since the window's surface format is only partially updated
// on most platforms.
- QVERIFY(window.openglContext()->format().depthBufferSize() >= 16);
- QVERIFY(window.openglContext()->format().stencilBufferSize() >= 8);
+ const QOpenGLContext *openglContext = nullptr;
+ QTRY_VERIFY((openglContext = window.openglContext()) != nullptr);
+ QVERIFY(openglContext->format().depthBufferSize() >= 16);
+ QVERIFY(openglContext->format().stencilBufferSize() >= 8);
#endif
QSurfaceFormat::setDefaultFormat(savedDefaultFormat);
}