aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/data/sectiondelegatechange.qml
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2012-06-26 13:13:11 +1000
committerQt by Nokia <qt-info@nokia.com>2012-06-26 08:08:33 +0200
commit3bb4880d63e0ebc972d500d3c7538127cd709a5d (patch)
tree802038e59bba2d265a57ff18739278a8f64b529b /tests/auto/quick/qquicklistview/data/sectiondelegatechange.qml
parent4089c2bbc51717a642f17c76c17c9ca73e180f00 (diff)
Fix section delegates not updating when changed.
Delete all allocated section items before doing an update when the section delegate is changed. Task-number: QTBUG-24899 Change-Id: I09dc7a1c602a49ad7bb37512a7e5116392259457 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquicklistview/data/sectiondelegatechange.qml')
-rw-r--r--tests/auto/quick/qquicklistview/data/sectiondelegatechange.qml61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/data/sectiondelegatechange.qml b/tests/auto/quick/qquicklistview/data/sectiondelegatechange.qml
new file mode 100644
index 0000000000..eee15ed2e0
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/sectiondelegatechange.qml
@@ -0,0 +1,61 @@
+import QtQuick 2.0
+
+ListView {
+ width: 240
+ height: 320
+
+ function switchDelegates() {
+ section.delegate = section.delegate === delegate1
+ ? delegate2
+ : delegate1
+ }
+
+ Component {
+ id: delegate1
+
+ Rectangle {
+ objectName: "section1"
+ color: "lightsteelblue"
+ border.width: 1;
+ width: 240
+ height: 25
+
+ Text {
+ anchors.centerIn: parent
+ text: section
+ }
+ }
+ }
+ Component {
+ id: delegate2
+
+ Rectangle {
+ objectName: "section2"
+ color: "yellow"
+ border.width: 1;
+ width: 240
+ height: 50
+
+ Text {
+ anchors.centerIn: parent
+ text: section
+ }
+ }
+ }
+
+ section.property: "modelData"
+ section.delegate: delegate1
+
+ model: 20
+ delegate: Rectangle {
+ objectName: "item"
+ border.width: 1
+ width: 240
+ height: 25
+
+ Text {
+ anchors.centerIn: parent
+ text: modelData
+ }
+ }
+}