aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-08-20 01:00:06 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-08-20 01:00:07 +0200
commitb94b547ad2608cf989f25841360b20082337a8dc (patch)
tree1e494d82d215da9707716f5265479b53edb3ab17
parent1c59558b03715c6be46650489547c5f9d60d3464 (diff)
parent1535c36a4728b3355ebe8abba4a9966eb2169d27 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
-rw-r--r--src/quick/doc/images/declarative-qtlogo.pngbin3436 -> 1214 bytes
-rw-r--r--src/quick/doc/snippets/qml/transitions-list.qml135
-rw-r--r--src/quick/doc/src/concepts/positioning/righttoleft.qdoc2
-rw-r--r--src/quick/items/qquicktextnodeengine.cpp2
-rw-r--r--src/quick/util/qquicktransition.cpp20
-rw-r--r--src/quickshapes/qquickshape.cpp2
-rw-r--r--tests/auto/quick/qquicklistview/data/addoncompleted.qml3
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp1
-rw-r--r--tests/auto/quick/qquicktext/data/verticallyAlignedImageInTable.qml14
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp14
-rw-r--r--tests/manual/scenegraph_lancelot/data/text/text_table_vertically_aligned_image.qml14
-rw-r--r--tools/qmlcachegen/qtquickcompiler.prf10
12 files changed, 155 insertions, 62 deletions
diff --git a/src/quick/doc/images/declarative-qtlogo.png b/src/quick/doc/images/declarative-qtlogo.png
index 940d159ae4..b63f1384b1 100644
--- a/src/quick/doc/images/declarative-qtlogo.png
+++ b/src/quick/doc/images/declarative-qtlogo.png
Binary files 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/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.
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp
index 32478ba375..c4a8370f34 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/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.
diff --git a/src/quickshapes/qquickshape.cpp b/src/quickshapes/qquickshape.cpp
index 04e8de5aa0..c1deb0dced 100644
--- a/src/quickshapes/qquickshape.cpp
+++ b/src/quickshapes/qquickshape.cpp
@@ -201,7 +201,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.
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 bab2ec34f8..08149a1786 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -8958,6 +8958,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;
}
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: "<table><tr><td/><td valign=\"top\"><img src=\"images/face-sad.png\"></td></tr></table>"
+ }
+}
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
index fd0ba0f49b..97107694bd 100644
--- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -162,6 +162,8 @@ private slots:
void initialContentHeight();
+ void verticallyAlignedImageInTable();
+
private:
QStringList standard;
QStringList richText;
@@ -4415,6 +4417,18 @@ void tst_qquicktext::implicitSizeChangeRewrap()
QVERIFY(text->contentWidth() < window->width());
}
+void tst_qquicktext::verticallyAlignedImageInTable()
+{
+ QScopedPointer<QQuickView> 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: "<table><tr><td/><td valign=\"top\"><img src=\"data/logo.png\"></td></tr></table>"
+ }
+}
diff --git a/tools/qmlcachegen/qtquickcompiler.prf b/tools/qmlcachegen/qtquickcompiler.prf
index 24cbe7f2e5..2f98aadefe 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)