diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-02-16 14:43:03 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-24 04:51:31 +0100 |
commit | b855240b782395f94315f43ea3e7e182299fac48 (patch) | |
tree | bc594c04449be8cd14cd0ab0bb72dafc2be0ffb2 /tests/auto/quick/qquickrepeater/data | |
parent | 6a42a6e0a9a1abdda0d07a5a20b4ac7e45348684 (diff) |
Rename QDeclarative symbols to QQuick and QQml
Symbols beginning with QDeclarative are already exported
by the quick1 module.
Users can apply the bin/rename-qtdeclarative-symbols.sh
script to modify client code using the previous names of the
renamed symbols.
Task-number: QTBUG-23737
Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquickrepeater/data')
-rw-r--r-- | tests/auto/quick/qquickrepeater/data/asyncloader.qml | 32 | ||||
-rw-r--r-- | tests/auto/quick/qquickrepeater/data/initparent.qml | 12 | ||||
-rw-r--r-- | tests/auto/quick/qquickrepeater/data/intmodel.qml | 29 | ||||
-rw-r--r-- | tests/auto/quick/qquickrepeater/data/itemlist.qml | 68 | ||||
-rw-r--r-- | tests/auto/quick/qquickrepeater/data/modelChanged.qml | 26 | ||||
-rw-r--r-- | tests/auto/quick/qquickrepeater/data/objlist.qml | 21 | ||||
-rw-r--r-- | tests/auto/quick/qquickrepeater/data/properties.qml | 11 | ||||
-rw-r--r-- | tests/auto/quick/qquickrepeater/data/repeater1.qml | 30 | ||||
-rw-r--r-- | tests/auto/quick/qquickrepeater/data/repeater2.qml | 36 |
9 files changed, 265 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickrepeater/data/asyncloader.qml b/tests/auto/quick/qquickrepeater/data/asyncloader.qml new file mode 100644 index 0000000000..82094e2666 --- /dev/null +++ b/tests/auto/quick/qquickrepeater/data/asyncloader.qml @@ -0,0 +1,32 @@ +import QtQuick 2.0 + +Item { + width: 360 + height: 480 + + Loader { + asynchronous: true + sourceComponent: viewComponent + } + + Component { + id: viewComponent + Column { + objectName: "container" + Repeater { + id: repeater + objectName: "repeater" + + model: 10 + + delegate: Rectangle { + objectName: "delegate" + index + color: "red" + width: 360 + height: 50 + Text { text: index } + } + } + } + } +} diff --git a/tests/auto/quick/qquickrepeater/data/initparent.qml b/tests/auto/quick/qquickrepeater/data/initparent.qml new file mode 100644 index 0000000000..e6571f09d3 --- /dev/null +++ b/tests/auto/quick/qquickrepeater/data/initparent.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 + +Item { + id: root + property Item parentItem: null + Repeater { + model: 1 + Item { + Component.onCompleted: root.parentItem = parent + } + } +} diff --git a/tests/auto/quick/qquickrepeater/data/intmodel.qml b/tests/auto/quick/qquickrepeater/data/intmodel.qml new file mode 100644 index 0000000000..30a650dd52 --- /dev/null +++ b/tests/auto/quick/qquickrepeater/data/intmodel.qml @@ -0,0 +1,29 @@ +import QtQuick 2.0 + +Rectangle { + id: container + objectName: "container" + width: 240 + height: 320 + color: "white" + + function checkProperties() { + testObject.error = false; + if (repeater.delegate != comp) { + console.log("delegate property incorrect"); + testObject.error = true; + } + } + + Component { + id: comp + Item{} + } + + Repeater { + id: repeater + objectName: "repeater" + model: testData + delegate: comp + } +} diff --git a/tests/auto/quick/qquickrepeater/data/itemlist.qml b/tests/auto/quick/qquickrepeater/data/itemlist.qml new file mode 100644 index 0000000000..174bfd4d18 --- /dev/null +++ b/tests/auto/quick/qquickrepeater/data/itemlist.qml @@ -0,0 +1,68 @@ +// This example demonstrates placing items in a view using +// a VisualItemModel + +import QtQuick 2.0 + +Rectangle { + id: root + color: "lightgray" + width: 240 + height: 320 + property variant itemModel: itemModel1 + + function checkProperties() { + testObject.error = false; + if (testObject.useModel && view.model != root.itemModel) { + console.log("model property incorrect"); + testObject.error = true; + } + } + + function switchModel() { + root.itemModel = itemModel2 + } + + VisualItemModel { + id: itemModel1 + objectName: "itemModel1" + Rectangle { + objectName: "item1" + height: 50; width: 100; color: "#FFFEF0" + Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + Rectangle { + objectName: "item2" + height: 50; width: 100; color: "#F0FFF7" + Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + Rectangle { + objectName: "item3" + height: 50; width: 100; color: "#F4F0FF" + Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + } + + VisualItemModel { + id: itemModel2 + objectName: "itemModel2" + Rectangle { + objectName: "item4" + height: 50; width: 100; color: "#FFFEF0" + Text { objectName: "text4"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + Rectangle { + objectName: "item5" + height: 50; width: 100; color: "#F0FFF7" + Text { objectName: "text5"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + } + + Column { + objectName: "container" + Repeater { + id: view + objectName: "repeater" + model: testObject.useModel ? root.itemModel : 0 + } + } +} diff --git a/tests/auto/quick/qquickrepeater/data/modelChanged.qml b/tests/auto/quick/qquickrepeater/data/modelChanged.qml new file mode 100644 index 0000000000..23af127e79 --- /dev/null +++ b/tests/auto/quick/qquickrepeater/data/modelChanged.qml @@ -0,0 +1,26 @@ +import QtQuick 2.0 + +Column { + Repeater { + id: repeater + objectName: "repeater" + + property int itemsCount + property variant itemsFound: [] + + delegate: Rectangle { + color: "red" + width: (index+1)*50 + height: 50 + } + + onModelChanged: { + repeater.itemsCount = repeater.count + var items = [] + for (var i=0; i<repeater.count; i++) + items.push(repeater.itemAt(i)) + repeater.itemsFound = items + } + } +} + diff --git a/tests/auto/quick/qquickrepeater/data/objlist.qml b/tests/auto/quick/qquickrepeater/data/objlist.qml new file mode 100644 index 0000000000..c49d5926e5 --- /dev/null +++ b/tests/auto/quick/qquickrepeater/data/objlist.qml @@ -0,0 +1,21 @@ +import QtQuick 2.0 + +Rectangle { + id: container + objectName: "container" + width: 240 + height: 320 + color: "white" + Repeater { + id: repeater + objectName: "repeater" + model: testData + property int errors: 0 + property int instantiated: 0 + Component { + Item{ + Component.onCompleted: {if(index!=modelData.idx) repeater.errors += 1; repeater.instantiated++} + } + } + } +} diff --git a/tests/auto/quick/qquickrepeater/data/properties.qml b/tests/auto/quick/qquickrepeater/data/properties.qml new file mode 100644 index 0000000000..035431c784 --- /dev/null +++ b/tests/auto/quick/qquickrepeater/data/properties.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 + +Row { + Repeater { + objectName: "repeater" + model: 5 + Text { + text: "I'm item " + index + } + } +} diff --git a/tests/auto/quick/qquickrepeater/data/repeater1.qml b/tests/auto/quick/qquickrepeater/data/repeater1.qml new file mode 100644 index 0000000000..3e6f4071ff --- /dev/null +++ b/tests/auto/quick/qquickrepeater/data/repeater1.qml @@ -0,0 +1,30 @@ +import QtQuick 2.0 + +Item { + Rectangle { + id: container + objectName: "container" + width: 240 + height: 320 + color: "white" + Text { + text: "Zero" + } + Repeater { + id: repeater + objectName: "repeater" + width: 240 + height: 320 + model: testData + Component { + Text { + y: index*20 + text: modelData + } + } + } + Text { + text: "Last" + } + } +} diff --git a/tests/auto/quick/qquickrepeater/data/repeater2.qml b/tests/auto/quick/qquickrepeater/data/repeater2.qml new file mode 100644 index 0000000000..691fbda1e5 --- /dev/null +++ b/tests/auto/quick/qquickrepeater/data/repeater2.qml @@ -0,0 +1,36 @@ +import QtQuick 2.0 + +Rectangle { + width: 240 + height: 320 + color: "white" + Component { + id: myDelegate + Item { + objectName: "myDelegate" + height: 20 + width: 240 + Text { + objectName: "myName" + text: name + } + Text { + objectName: "myNumber" + x: 100 + text: number + } + } + } + Column { + id: container + objectName: "container" + Repeater { + id: repeater + objectName: "repeater" + width: 240 + height: 320 + delegate: myDelegate + model: testData + } + } +} |