aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2025-03-30 14:49:49 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2025-03-30 14:49:49 +0300
commit4b265e42c09c547291bd18e5cc699d193375df5c (patch)
tree15c1cb94b2ff992b1a10c5d6782623085cd1cce1
parentb59cc643e4234f84ba7785c3f96a4394bcdc0995 (diff)
parentaed9b6cb78435f77b0ce72665b33c53c413d43fb (diff)
Merge tag 'v5.15.18-lts' into tqtc/lts-5.15-opensourcev5.15.18-lts-lgpl5.15
Qt 5.15.18-lts release Change-Id: I832ae35e0d368725a9f6ef09eee6892e61f2bd00
-rw-r--r--.qmake.conf2
-rw-r--r--src/quicktemplates2/qquickswipeview.cpp5
-rw-r--r--tests/auto/controls/data/tst_swipeview.qml30
3 files changed, 33 insertions, 4 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 83a3e4c7..bff38399 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -5,4 +5,4 @@ DEFINES += QT_NO_FOREACH QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST
QQC2_SOURCE_TREE = $$PWD
-MODULE_VERSION = 5.15.17
+MODULE_VERSION = 5.15.18
diff --git a/src/quicktemplates2/qquickswipeview.cpp b/src/quicktemplates2/qquickswipeview.cpp
index 98d4d22b..06242f59 100644
--- a/src/quicktemplates2/qquickswipeview.cpp
+++ b/src/quicktemplates2/qquickswipeview.cpp
@@ -155,11 +155,10 @@ void QQuickSwipeViewPrivate::resizeItems()
qmlWarning(item) << "SwipeView has detected conflicting anchors. Unable to layout the item.";
item->setProperty("_q_QQuickSwipeView_warned", true);
}
-
if (orientation == Qt::Horizontal)
- item->setY(0);
+ item->setPosition({i * (contentItem->width() + spacing), 0});
else
- item->setX(0);
+ item->setPosition({0, i * (contentItem->height() + spacing)});
item->setSize(QSizeF(contentItem->width(), contentItem->height()));
}
}
diff --git a/tests/auto/controls/data/tst_swipeview.qml b/tests/auto/controls/data/tst_swipeview.qml
index 07d0cc0c..55096169 100644
--- a/tests/auto/controls/data/tst_swipeview.qml
+++ b/tests/auto/controls/data/tst_swipeview.qml
@@ -686,4 +686,34 @@ TestCase {
var image = grabImage(control)
compare(image.pixel(3, 3), "#ffff00")
}
+
+ Component {
+ id: translucentPages
+ SwipeView {
+ spacing: 10
+ padding: 10
+ Text { text: "page 0" }
+ Text { text: "page 1"; font.pointSize: 16 }
+ Text { text: "page 2"; font.pointSize: 24 }
+ Text { text: "page 3"; font.pointSize: 32 }
+ }
+ }
+
+ function test_initialPositions() { // QTBUG-102487
+ const control = createTemporaryObject(translucentPages, testCase, {width: 320, height: 200})
+ verify(control)
+ compare(control.orientation, Qt.Horizontal)
+ for (var i = 0; i < control.count; ++i) {
+ const page = control.itemAt(i)
+ // control.contentItem.width + control.spacing == 310; except Imagine style has contentItem.width == 320
+ compare(page.x, i * 310)
+ compare(page.y, 0)
+ }
+ control.orientation = Qt.Vertical
+ for (var i = 0; i < control.count; ++i) {
+ const page = control.itemAt(i)
+ compare(page.y, i * (control.contentItem.height + control.spacing))
+ compare(page.x, 0)
+ }
+ }
}