From 0944ff26223bd2c809025c9f42bc9935213f0d43 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 25 Jul 2019 16:37:43 +0200 Subject: Doc: Fix QtQuick.Shapes::ShapePath::strokeWidth property type Fixes: QTBUG-73541 Change-Id: Icb15cee3c49f142ef3634e35427dbbc0b9a2183e Reviewed-by: Laszlo Agocs --- src/quickshapes/qquickshape.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quickshapes/qquickshape.cpp b/src/quickshapes/qquickshape.cpp index 74cbf52a95..0ae16313ca 100644 --- a/src/quickshapes/qquickshape.cpp +++ b/src/quickshapes/qquickshape.cpp @@ -200,7 +200,7 @@ void QQuickShapePath::setStrokeColor(const QColor &color) } /*! - \qmlproperty color QtQuick.Shapes::ShapePath::strokeWidth + \qmlproperty real QtQuick.Shapes::ShapePath::strokeWidth This property holds the stroke width. -- cgit v1.2.3 From dfc6dc1d94a729f701172861a196b4b34bcd7518 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 30 Jul 2019 14:14:50 +0200 Subject: Fix possible crash with top/bottom aligned images An image inside at the end of a text block which did not start at text position 0 would resolve to an invalid QTextLine, since we passed the document position to lineForTextPosition(), which expects the relative block position. If the image was aligned to top or bottom, so that the extracted QTextLine was actually accessed, this would cause a crash. [ChangeLog][QtQuick][Text] Fixed a bug where aligning an image to "top" or "bottom" could cause a crash under certain circumstances. Task-number: QTBUG-77217 Change-Id: Iaa239ba482f2a765703656e4116cbebb8435a66e Reviewed-by: Simon Hausmann --- src/quick/items/qquicktextnodeengine.cpp | 2 +- .../qquicktext/data/verticallyAlignedImageInTable.qml | 14 ++++++++++++++ tests/auto/quick/qquicktext/tst_qquicktext.cpp | 14 ++++++++++++++ .../data/text/text_table_vertically_aligned_image.qml | 14 ++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 tests/auto/quick/qquicktext/data/verticallyAlignedImageInTable.qml create mode 100644 tests/manual/scenegraph_lancelot/data/text/text_table_vertically_aligned_image.qml diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp index 36fc168ec2..5a4ef2b686 100644 --- a/src/quick/items/qquicktextnodeengine.cpp +++ b/src/quick/items/qquicktextnodeengine.cpp @@ -477,7 +477,7 @@ void QQuickTextNodeEngine::addTextObject(const QTextBlock &block, const QPointF } qreal ascent; - QTextLine line = block.layout()->lineForTextPosition(pos); + QTextLine line = block.layout()->lineForTextPosition(pos - block.position()); switch (format.verticalAlignment()) { case QTextCharFormat::AlignTop: diff --git a/tests/auto/quick/qquicktext/data/verticallyAlignedImageInTable.qml b/tests/auto/quick/qquicktext/data/verticallyAlignedImageInTable.qml new file mode 100644 index 0000000000..4c00362d15 --- /dev/null +++ b/tests/auto/quick/qquicktext/data/verticallyAlignedImageInTable.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +Item { + width: 320 + height: 480 + + Text { + anchors.centerIn: parent + font.family: "Arial" + font.pixelSize: 16 + textFormat: Text.RichText + text: "
" + } +} diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index a9c35e0cc4..eafa6cb052 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -161,6 +161,8 @@ private slots: void initialContentHeight(); + void verticallyAlignedImageInTable(); + private: QStringList standard; QStringList richText; @@ -4414,6 +4416,18 @@ void tst_qquicktext::implicitSizeChangeRewrap() QVERIFY(text->contentWidth() < window->width()); } +void tst_qquicktext::verticallyAlignedImageInTable() +{ + QScopedPointer window(new QQuickView); + window->setSource(testFileUrl("verticallyAlignedImageInTable.qml")); + QTRY_COMPARE(window->status(), QQuickView::Ready); + + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); + + // Don't crash +} + QTEST_MAIN(tst_qquicktext) #include "tst_qquicktext.moc" diff --git a/tests/manual/scenegraph_lancelot/data/text/text_table_vertically_aligned_image.qml b/tests/manual/scenegraph_lancelot/data/text/text_table_vertically_aligned_image.qml new file mode 100644 index 0000000000..d712f94572 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/text_table_vertically_aligned_image.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +Item { + width: 320 + height: 480 + + Text { + anchors.centerIn: parent + font.family: "Arial" + font.pixelSize: 16 + textFormat: Text.RichText + text: "
" + } +} -- cgit v1.2.3 From 0647df8c88d4eaeedd19456b6e382308208e2be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Bornemann?= Date: Fri, 2 Aug 2019 11:03:06 +0000 Subject: Revert "Yield error if qtquickcompiler is used in non-QML projects" This reverts commit c5578b16d6454e708c8ce12661a85d41eeaaa758, because it prevents enabling the qtquickcompiler feature globally. Fixes: QTBUG-77277 Change-Id: Ic80835c462570a67ae3105bb3d1b6452800d2c94 Reviewed-by: Kai Koehne --- tools/qmlcachegen/qtquickcompiler.prf | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tools/qmlcachegen/qtquickcompiler.prf b/tools/qmlcachegen/qtquickcompiler.prf index 967d55a5bd..b98d8a0198 100644 --- a/tools/qmlcachegen/qtquickcompiler.prf +++ b/tools/qmlcachegen/qtquickcompiler.prf @@ -1,15 +1,5 @@ if(qtc_run|lupdate_run): return() -!contains(QT, qml) { - qt_modules = \ - $$replace(QT, -private$, _private) \ - $$replace(QT_PRIVATE, -private$, _private) - qt_modules = $$resolve_depends(qt_modules, "QT.", ".depends" ".run_depends") - !contains(qt_modules, qml): \ - error("The qtquickcompiler feature cannot be used without the QML module.") - unset(qt_modules) -} - qtPrepareTool(QML_CACHEGEN, qmlcachegen, _FILTER) qtPrepareTool(QMAKE_RCC, rcc, _DEP) -- cgit v1.2.3 From ffda7180f3c11c35699ba8aa1a16efc6ee962e02 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Tue, 6 Aug 2019 09:51:02 +0200 Subject: tst_qquicklistview: make addOnCompleted more robust + sanity check Check that after we could not find an element, we do not suddenly find one afterwards. Moreover, disable the cacheBuffer as the asynchronous creation might cause issues, leading to the flakyness observed in QTBUG-77330 Task-number: QTBUG-77330 Change-Id: I444eede16a99a75340a0b7ccf17193298730a675 Reviewed-by: Simon Hausmann --- tests/auto/quick/qquicklistview/data/addoncompleted.qml | 3 +++ tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/tests/auto/quick/qquicklistview/data/addoncompleted.qml b/tests/auto/quick/qquicklistview/data/addoncompleted.qml index 57265cb2c0..2341295868 100644 --- a/tests/auto/quick/qquicklistview/data/addoncompleted.qml +++ b/tests/auto/quick/qquicklistview/data/addoncompleted.qml @@ -73,6 +73,9 @@ Rectangle { anchors.fill: parent model: listModel objectName: "view" + // buffered delegates are created asynchronously + // therefore we disable buffering + cacheBuffer: 0 delegate: Rectangle { height: 15 diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 127c873bbb..b896418de0 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -8956,6 +8956,7 @@ void tst_QQuickListView::addOnCompleted() y = 9999999; } else { const qreal newY = item->y(); + QVERIFY(newY != 9999999); // once we could not find an item, we shouldn' find any further ones QVERIFY2(newY > y, objName.toUtf8().constData()); y = newY; } -- cgit v1.2.3 From f9eedc501d02a3d856c0502c06daef273a2935ca Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 1 Aug 2019 16:36:10 +0200 Subject: Doc: Correct wrong code in qml snippet Replace QT_TRANSLATE_NOOP with equiv. qStr statement Task-number: QTBUG-56875 Change-Id: I80581ecf05a25e0c69da434d3e548261eac5811e Reviewed-by: Frederik Schwarzer Reviewed-by: Venugopal Shivashankar --- src/quick/doc/src/concepts/positioning/righttoleft.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/doc/src/concepts/positioning/righttoleft.qdoc b/src/quick/doc/src/concepts/positioning/righttoleft.qdoc index 7c8cd735b3..1f3602cde1 100644 --- a/src/quick/doc/src/concepts/positioning/righttoleft.qdoc +++ b/src/quick/doc/src/concepts/positioning/righttoleft.qdoc @@ -148,7 +148,7 @@ To define the layout direction for a particular locale, declare the dedicated st You can do this by first introducing this line \code -QT_TRANSLATE_NOOP("QGuiApplication", "QT_LAYOUT_DIRECTION"); +qsTr("QT_LAYOUT_DIRECTION","QGuiApplication"); \endcode somewhere in your QML source code and calling \c lupdate to generate the translation source file. -- cgit v1.2.3 From 1535c36a4728b3355ebe8abba4a9966eb2169d27 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 22 Jul 2019 15:58:17 +0200 Subject: Doc: Correct error in doc Transition QML Type - corrected reference to non-existing state - added example with multiple states Fixes: QTBUG-73982 Change-Id: I7c815cb706f1ad1b8035f136448b75dce8eb9bfe Reviewed-by: Paul Wicking --- src/quick/doc/images/declarative-qtlogo.png | Bin 3436 -> 1214 bytes src/quick/doc/snippets/qml/transitions-list.qml | 135 +++++++++++++++++------- src/quick/util/qquicktransition.cpp | 20 ++-- 3 files changed, 106 insertions(+), 49 deletions(-) diff --git a/src/quick/doc/images/declarative-qtlogo.png b/src/quick/doc/images/declarative-qtlogo.png index 940d159ae4..b63f1384b1 100644 Binary files a/src/quick/doc/images/declarative-qtlogo.png and b/src/quick/doc/images/declarative-qtlogo.png differ diff --git a/src/quick/doc/snippets/qml/transitions-list.qml b/src/quick/doc/snippets/qml/transitions-list.qml index 06b9e39cc8..972d3ee14e 100644 --- a/src/quick/doc/snippets/qml/transitions-list.qml +++ b/src/quick/doc/snippets/qml/transitions-list.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -48,52 +48,105 @@ ** ****************************************************************************/ -import QtQuick 2.0 +import QtQuick 2.13 Rectangle { - width: 150; height: 250 + id: page + width: 640 + height: 500 - Rectangle { - id: stopLight - x: 25; y: 15; width: 100; height: 100 - } - Rectangle { - id: goLight - x: 25; y: 135; width: 100; height: 100 - } + Image { + id: userIcon + x: topLeftRect.x + y: topLeftRect.y - states: [ - State { - name: "stop" - PropertyChanges { target: stopLight; color: "red" } - PropertyChanges { target: goLight; color: "black" } - }, - State { - name: "go" - PropertyChanges { target: stopLight; color: "black" } - PropertyChanges { target: goLight; color: "green" } + source: "../../images/declarative-qtlogo.png" } - ] - state: "stop" + Rectangle { + id: topLeftRect + anchors { left: parent.left; top: parent.top; leftMargin: 10; topMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + // Clicking here sets state to default state, returning image to initial position + TapHandler { onTapped: page.state = 'start' } + } + + Rectangle { + id: middleRightRect + anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + // Clicking in here sets the state to 'middleRight' + TapHandler { onTapped: page.state = 'middleRight' } + } - MouseArea { - anchors.fill: parent - onClicked: parent.state == "stop" ? - parent.state = "go" : parent.state = "stop" - } + Rectangle { + id: bottomLeftRect + anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + // Clicking in here sets the state to 'bottomLeft' + TapHandler { onTapped: page.state = 'bottomLeft' } + } - //! [list of transitions] - transitions: [ - Transition { - from: "stop"; to: "go" - PropertyAnimation { target: stopLight - properties: "color"; duration: 1000 } - }, - Transition { - from: "go"; to: "stop" - PropertyAnimation { target: goLight - properties: "color"; duration: 1000 } - } ] - //! [list of transitions] + states: [ + State { + name: "start" + PropertyChanges { + target: userIcon + explicit: true + x: topLeftRect.x + y: topLeftRect.y + } + }, + State { + name: "middleRight" + PropertyChanges { + target: userIcon + explicit: true + x: middleRightRect.x + y: middleRightRect.y + } + }, + State { + name: "bottomLeft" + PropertyChanges { + target: userIcon + explicit: true + x: bottomLeftRect.x + y: bottomLeftRect.y + } + } + ] +//! [list of transitions] + transitions: [ + Transition { + from: "*"; to: "middleRight" + NumberAnimation { + properties: "x,y"; + easing.type: Easing.InOutQuad; + duration: 2000; + } + }, + Transition { + from: "*"; to: "bottomLeft"; + NumberAnimation { + properties: "x,y"; + easing.type: Easing.InOutQuad; + duration: 200; + } + }, + //If any other rectangle is clicked, the icon will return + //to the start position at a slow speed and bounce. + Transition { + from: "*"; to: "*"; + NumberAnimation { + easing.type: Easing.OutBounce; + properties: "x,y"; + duration: 4000; + } + } + ] +//! [list of transitions] } diff --git a/src/quick/util/qquicktransition.cpp b/src/quick/util/qquicktransition.cpp index c8699426f2..b973309212 100644 --- a/src/quick/util/qquicktransition.cpp +++ b/src/quick/util/qquicktransition.cpp @@ -82,13 +82,15 @@ QT_BEGIN_NAMESPACE values can be set to restrict the animations to only be applied when changing from one particular state to another. - To define multiple transitions, specify \l Item::transitions as a list: + To define multiple Transitions, specify \l Item::transitions as a list: \snippet qml/transitions-list.qml list of transitions - If multiple Transitions are specified, only a single (best-matching) Transition will be applied for any particular - state change. In the example above, when changing to \c state1, the first transition will be used, rather - than the more generic second transition. + If multiple Transitions are specified, only a single (best-matching) + Transition will be applied for any particular state change. In the + example above, if the Rectangle enters a state other than \c "middleRight" + or \c "bottomLeft", the third Transition will be carried out, meaning the + icon will be moved to the starting point. If a state change has a Transition that matches the same property as a \l Behavior, the Transition animation overrides the \l Behavior for that @@ -298,10 +300,11 @@ QQuickTransitionInstance *QQuickTransition::prepare(QQuickStateOperation::Action \snippet qml/transition-from-to-modified.qml modified transition - The animation would only be applied when changing from the default state to - the "brighter" state (i.e. when the mouse is pressed, but not on release). + The animation would only be applied when changing from the default state + to the "brighter" state (i.e. when the mouse is pressed, but not on release). - Multiple \c to and \c from values can be set by using a comma-separated string. + Multiple \c to and \c from values can be set by using a comma-separated + string. \sa reversible */ @@ -323,7 +326,8 @@ void QQuickTransition::setFromState(const QString &f) /*! \qmlproperty bool QtQuick::Transition::reversible - This property holds whether the transition should be automatically reversed when the conditions that triggered this transition are reversed. + This property holds whether the transition should be automatically + reversed when the conditions that triggered this transition are reversed. The default value is false. -- cgit v1.2.3