diff options
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | src/3rdparty/masm/wtf/PageBlock.cpp | 2 | ||||
-rw-r--r-- | src/3rdparty/masm/wtf/PageBlock.h | 5 | ||||
-rw-r--r-- | src/qml/qml/qqmlproperty.cpp | 4 | ||||
-rw-r--r-- | src/quick/handlers/qquickpinchhandler.cpp | 24 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 12 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 5 | ||||
-rw-r--r-- | tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp | 10 | ||||
-rw-r--r-- | tests/auto/quick/qquickitem2/data/keynavigationtest_repeater.qml | 37 | ||||
-rw-r--r-- | tests/auto/quick/qquickitem2/tst_qquickitem.cpp | 19 | ||||
-rw-r--r-- | tests/auto/quick/qquicktextinput/data/checkCursorDelegateWhenPaddingChanged.qml | 16 | ||||
-rw-r--r-- | tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp | 30 |
12 files changed, 147 insertions, 19 deletions
diff --git a/.qmake.conf b/.qmake.conf index b31e00f4cc..4feec109d3 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,4 +1,4 @@ load(qt_build_config) CONFIG += warning_clean -MODULE_VERSION = 5.12.11 +MODULE_VERSION = 5.12.12 diff --git a/src/3rdparty/masm/wtf/PageBlock.cpp b/src/3rdparty/masm/wtf/PageBlock.cpp index e715ed262a..bc0e8d6f2d 100644 --- a/src/3rdparty/masm/wtf/PageBlock.cpp +++ b/src/3rdparty/masm/wtf/PageBlock.cpp @@ -64,6 +64,7 @@ inline size_t systemPageSize() #endif +inline namespace hidden { size_t pageSize() { if (!s_pageSize) @@ -78,5 +79,6 @@ size_t pageMask() s_pageMask = ~(pageSize() - 1); return s_pageMask; } +} } // namespace WTF diff --git a/src/3rdparty/masm/wtf/PageBlock.h b/src/3rdparty/masm/wtf/PageBlock.h index 4d408e1c91..9e2e561073 100644 --- a/src/3rdparty/masm/wtf/PageBlock.h +++ b/src/3rdparty/masm/wtf/PageBlock.h @@ -28,8 +28,13 @@ namespace WTF { +// avoid false positive detection by apple +// by putting the function inside an inline namespace +// to obtain different name mangling +inline namespace hidden { WTF_EXPORT_PRIVATE size_t pageSize(); WTF_EXPORT_PRIVATE size_t pageMask(); +} inline bool isPageAligned(void* address) { return !(reinterpret_cast<intptr_t>(address) & (pageSize() - 1)); } inline bool isPageAligned(size_t size) { return !(size & (pageSize() - 1)); } inline bool isPowerOfTwo(size_t size) { return !(size & (size - 1)); } diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index c8166695ba..6f1994bfce 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -907,6 +907,8 @@ QQmlPropertyPrivate::signalExpression(const QQmlProperty &that) if (!(that.type() & QQmlProperty::SignalProperty)) return nullptr; + if (!that.d->object) + return nullptr; QQmlData *data = QQmlData::get(that.d->object); if (!data) return nullptr; @@ -946,6 +948,8 @@ void QQmlPropertyPrivate::takeSignalExpression(const QQmlProperty &that, return; } + if (!that.d->object) + return; QQmlData *data = QQmlData::get(that.d->object, nullptr != expr); if (!data) return; diff --git a/src/quick/handlers/qquickpinchhandler.cpp b/src/quick/handlers/qquickpinchhandler.cpp index dc1a9a92f9..186ee06b28 100644 --- a/src/quick/handlers/qquickpinchhandler.cpp +++ b/src/quick/handlers/qquickpinchhandler.cpp @@ -84,7 +84,14 @@ Q_LOGGING_CATEGORY(lcPinchHandler, "qt.quick.handler.pinch") \image touchpoints-pinchhandler.png - \sa PinchArea + \note The pinch begins when the number of fingers pressed is between + \l {MultiPointHandler::minimumPointCount}{minimumPointCount} and + \l {MultiPointHandler::maximumPointCount}{maximumPointCount}, inclusive. + Until then, PinchHandler tracks the positions of any pressed fingers, + but if it's a disallowed number, it does not scale or rotate + its \l target, and the \l active property remains \c false. + + \sa PinchArea, QPointerEvent::pointCount() */ QQuickPinchHandler::QQuickPinchHandler(QQuickItem *parent) @@ -248,19 +255,12 @@ bool QQuickPinchHandler::wantsPointerEvent(QQuickPointerEvent *event) */ /*! - \qmlproperty int QtQuick::PinchHandler::minimumTouchPoints - - The pinch begins when this number of fingers are pressed. - Until then, PinchHandler tracks the positions of any pressed fingers, - but if it's an insufficient number, it does not scale or rotate - its \l target, and the \l active property will remain false. -*/ - -/*! \qmlproperty bool QtQuick::PinchHandler::active - This property is true when all the constraints (epecially \l minimumTouchPoints) - are satisfied and the \l target, if any, is being manipulated. + This property is \c true when all the constraints (epecially + \l {MultiPointHandler::minimumPointCount}{minimumPointCount} and + \l {MultiPointHandler::maximumPointCount}{maximumPointCount}) are satisfied + and the \l target, if any, is being manipulated. */ void QQuickPinchHandler::onActiveChanged() diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 2645ce97a6..a403b393a3 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -464,8 +464,8 @@ void QQuickKeyNavigationAttached::setLeft(QQuickItem *i) Q_D(QQuickKeyNavigationAttached); if (d->leftSet && d->left == i) return; + d->leftSet = d->left != i; d->left = i; - d->leftSet = true; QQuickKeyNavigationAttached* other = qobject_cast<QQuickKeyNavigationAttached*>(qmlAttachedPropertiesObject<QQuickKeyNavigationAttached>(i)); if (other && !other->d_func()->rightSet){ @@ -486,8 +486,8 @@ void QQuickKeyNavigationAttached::setRight(QQuickItem *i) Q_D(QQuickKeyNavigationAttached); if (d->rightSet && d->right == i) return; + d->rightSet = d->right != i; d->right = i; - d->rightSet = true; QQuickKeyNavigationAttached* other = qobject_cast<QQuickKeyNavigationAttached*>(qmlAttachedPropertiesObject<QQuickKeyNavigationAttached>(i)); if (other && !other->d_func()->leftSet){ @@ -508,8 +508,8 @@ void QQuickKeyNavigationAttached::setUp(QQuickItem *i) Q_D(QQuickKeyNavigationAttached); if (d->upSet && d->up == i) return; + d->upSet = d->up != i; d->up = i; - d->upSet = true; QQuickKeyNavigationAttached* other = qobject_cast<QQuickKeyNavigationAttached*>(qmlAttachedPropertiesObject<QQuickKeyNavigationAttached>(i)); if (other && !other->d_func()->downSet){ @@ -530,8 +530,8 @@ void QQuickKeyNavigationAttached::setDown(QQuickItem *i) Q_D(QQuickKeyNavigationAttached); if (d->downSet && d->down == i) return; + d->downSet = d->down != i; d->down = i; - d->downSet = true; QQuickKeyNavigationAttached* other = qobject_cast<QQuickKeyNavigationAttached*>(qmlAttachedPropertiesObject<QQuickKeyNavigationAttached>(i)); if (other && !other->d_func()->upSet) { @@ -552,8 +552,8 @@ void QQuickKeyNavigationAttached::setTab(QQuickItem *i) Q_D(QQuickKeyNavigationAttached); if (d->tabSet && d->tab == i) return; + d->tabSet = d->tab != i; d->tab = i; - d->tabSet = true; QQuickKeyNavigationAttached* other = qobject_cast<QQuickKeyNavigationAttached*>(qmlAttachedPropertiesObject<QQuickKeyNavigationAttached>(i)); if (other && !other->d_func()->backtabSet) { @@ -574,8 +574,8 @@ void QQuickKeyNavigationAttached::setBacktab(QQuickItem *i) Q_D(QQuickKeyNavigationAttached); if (d->backtabSet && d->backtab == i) return; + d->backtabSet = d->backtab != i; d->backtab = i; - d->backtabSet = true; QQuickKeyNavigationAttached* other = qobject_cast<QQuickKeyNavigationAttached*>(qmlAttachedPropertiesObject<QQuickKeyNavigationAttached>(i)); if (other && !other->d_func()->tabSet) { diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index aac7137ff3..56ce752987 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -2954,6 +2954,7 @@ void QQuickTextInputPrivate::setTopPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->topPaddingChanged(); } } @@ -2968,6 +2969,7 @@ void QQuickTextInputPrivate::setLeftPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->leftPaddingChanged(); } } @@ -2982,6 +2984,7 @@ void QQuickTextInputPrivate::setRightPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->rightPaddingChanged(); } } @@ -2996,6 +2999,7 @@ void QQuickTextInputPrivate::setBottomPadding(qreal value, bool reset) } if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding()))) { updateLayout(); + q->updateCursorRectangle(); emit q->bottomPaddingChanged(); } } @@ -4705,6 +4709,7 @@ void QQuickTextInput::setPadding(qreal padding) d->extra.value().padding = padding; d->updateLayout(); + updateCursorRectangle(); emit paddingChanged(); if (!d->extra.isAllocated() || !d->extra->explicitTopPadding) emit topPaddingChanged(); diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index 27e06c6f67..1bf044ec32 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -149,6 +149,8 @@ private slots: void floatToStringPrecision(); void copy(); + + void signalExpressionWithoutObject(); private: QQmlEngine engine; }; @@ -2106,6 +2108,14 @@ void tst_qqmlproperty::initTestCase() qmlRegisterType<MyContainer>("Test",1,0,"MyContainer"); } +void tst_qqmlproperty::signalExpressionWithoutObject() +{ + QQmlProperty invalid; + QQmlPropertyPrivate::setSignalExpression(invalid, nullptr); + QQmlBoundSignalExpression *expr = QQmlPropertyPrivate::signalExpression(invalid); + QVERIFY(!expr); +} + QTEST_MAIN(tst_qqmlproperty) #include "tst_qqmlproperty.moc" diff --git a/tests/auto/quick/qquickitem2/data/keynavigationtest_repeater.qml b/tests/auto/quick/qquickitem2/data/keynavigationtest_repeater.qml new file mode 100644 index 0000000000..12ce10e139 --- /dev/null +++ b/tests/auto/quick/qquickitem2/data/keynavigationtest_repeater.qml @@ -0,0 +1,37 @@ +import QtQuick 2.0 + +Grid { + property var textModel: ["1", "2", "3", "4", "5"] + columns: 5 + width: 50*textModel.length + + Repeater { + id: repeater + model: textModel.length + Rectangle { + width: 50 + height: 50 + color: focus ? "red" : "lightgrey" + focus: index == 2 + Text { + id: t + text: textModel[index] + } + KeyNavigation.left: repeater.itemAt(index - 1) + KeyNavigation.right: repeater.itemAt(index + 1) + } + } + + function verify() { + for (var i = 0; i < repeater.count; i++) { + var item = repeater.itemAt(i); + var prev = repeater.itemAt(i - 1); + var next = repeater.itemAt(i + 1); + if (item.KeyNavigation.left != prev || item.KeyNavigation.right != next) + return false; + } + + return true; + } +} + diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index 399535cfa6..db473d1ea1 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -89,6 +89,7 @@ private slots: void keyNavigation_implicitDestroy(); void keyNavigation_focusReason(); void keyNavigation_loop(); + void keyNavigation_repeater(); void layoutMirroring(); void layoutMirroringWindow(); void layoutMirroringIllegalParent(); @@ -2273,6 +2274,24 @@ void tst_QQuickItem::keyNavigation_loop() delete window; } +void tst_QQuickItem::keyNavigation_repeater() +{ + // QTBUG-83356 + QQuickView *window = new QQuickView(nullptr); + window->setBaseSize(QSize(240,320)); + + window->setSource(testFileUrl("keynavigationtest_repeater.qml")); + window->show(); + window->requestActivate(); + + QVariant result; + QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "verify", + Q_RETURN_ARG(QVariant, result))); + QVERIFY(result.toBool()); + + delete window; +} + void tst_QQuickItem::smooth() { QQmlComponent component(&engine); diff --git a/tests/auto/quick/qquicktextinput/data/checkCursorDelegateWhenPaddingChanged.qml b/tests/auto/quick/qquicktextinput/data/checkCursorDelegateWhenPaddingChanged.qml new file mode 100644 index 0000000000..e6f07b4687 --- /dev/null +++ b/tests/auto/quick/qquicktextinput/data/checkCursorDelegateWhenPaddingChanged.qml @@ -0,0 +1,16 @@ +import QtQuick 2.12 + +Rectangle { + width: 200 + height: 200 + TextInput { + objectName: "textInput" + leftPadding: 10 + focus: true + cursorDelegate: Rectangle { + objectName: "cursorDelegate" + width: 5 + color: "red" + } + } +} diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index ed2d535fda..f736d0a873 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -231,6 +231,7 @@ private slots: void QTBUG_51115_readOnlyResetsSelection(); + void checkCursorDelegateWhenPaddingChanged(); private: void simulateKey(QWindow *, int key); @@ -7003,6 +7004,35 @@ void tst_qquicktextinput::QTBUG_51115_readOnlyResetsSelection() QCOMPARE(obj->selectedText(), QString()); } +void tst_qquicktextinput::checkCursorDelegateWhenPaddingChanged() +{ + QQuickView view; + view.setSource(testFileUrl("checkCursorDelegateWhenPaddingChanged.qml")); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + + QQuickTextInput *textInput = view.rootObject()->findChild<QQuickTextInput *>("textInput"); + QVERIFY(textInput); + + QQuickItem *cursorDelegate = textInput->findChild<QQuickItem *>("cursorDelegate"); + QVERIFY(cursorDelegate); + + QCOMPARE(cursorDelegate->x(), textInput->leftPadding()); + QCOMPARE(cursorDelegate->y(), textInput->topPadding()); + + textInput->setPadding(5); + QCOMPARE(cursorDelegate->x(), textInput->leftPadding()); + QCOMPARE(cursorDelegate->y(), textInput->topPadding()); + + textInput->setTopPadding(10); + QCOMPARE(cursorDelegate->x(), textInput->leftPadding()); + QCOMPARE(cursorDelegate->y(), textInput->topPadding()); + + textInput->setLeftPadding(10); + QCOMPARE(cursorDelegate->x(), textInput->leftPadding()); + QCOMPARE(cursorDelegate->y(), textInput->topPadding()); +} + QTEST_MAIN(tst_qquicktextinput) #include "tst_qquicktextinput.moc" |