diff options
author | Alan Alpert <aalpert@rim.com> | 2013-01-10 14:07:37 -0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-24 17:14:12 +0100 |
commit | bbb3d5b403511f6e0bc1966835983b2574596e25 (patch) | |
tree | 18af25145c1eb0474f0bac6531d9ec8ae4361c3b /tests/auto/qml/qqmllistmodel/data | |
parent | eab53ad9fe0aa9664702d446a704256f46106c56 (diff) |
Move ListModel and ListElement to the QtQml import
They're already in the QtQml module, but were left in the QtQuick import
because they were considered to be of minimal use without QtQuick types.
QtQml types are being developed would could make ListModel useful
without QtQuick, indicating that they should no longer be considered
QtQuick depedent.
Change-Id: I31499f2cc23baf4bc70fb451ba164408bed89ff6
Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
Diffstat (limited to 'tests/auto/qml/qqmllistmodel/data')
4 files changed, 77 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllistmodel/data/enumerate.qml b/tests/auto/qml/qqmllistmodel/data/enumerate.qml new file mode 100644 index 0000000000..f73d66b318 --- /dev/null +++ b/tests/auto/qml/qqmllistmodel/data/enumerate.qml @@ -0,0 +1,24 @@ +import QtQuick 2.0 + +Item { + property string result + + ListModel { + id: model + + ListElement { + val1: 1 + val2: 2 + val3: "str" + val4: false + val5: true + } + } + + Component.onCompleted: { + var element = model.get(0); + + for (var i in element) + result += i+"="+element[i]+(element[i] ? "Y" : "N")+":"; + } +} diff --git a/tests/auto/qml/qqmllistmodel/data/multipleroles.qml b/tests/auto/qml/qqmllistmodel/data/multipleroles.qml new file mode 100644 index 0000000000..4a331e2b3e --- /dev/null +++ b/tests/auto/qml/qqmllistmodel/data/multipleroles.qml @@ -0,0 +1,25 @@ +import QtQuick 2.0 +ListView { + width: 100 + height: 250 + delegate: Rectangle { + width: 100 + height: 50 + color: black ? "black": "white" + } + model: ListModel { + objectName: "listModel" + ListElement { + black: false + rounded: false + } + ListElement { + black: true + rounded: false + } + ListElement { + black: true + rounded: false + } + } +} diff --git a/tests/auto/qml/qqmllistmodel/data/setmodelcachelist.qml b/tests/auto/qml/qqmllistmodel/data/setmodelcachelist.qml new file mode 100644 index 0000000000..58bf1ccd04 --- /dev/null +++ b/tests/auto/qml/qqmllistmodel/data/setmodelcachelist.qml @@ -0,0 +1,20 @@ +import QtQuick 2.0 + +ListModel { + id: model + property bool ok : false + + Component.onCompleted: { + model.append({"attrs": []}) + model.get(0) + model.set(0, {"attrs": [{'abc': 123, 'def': 456}] } ) + ok = ( model.get(0).attrs.get(0).abc == 123 + && model.get(0).attrs.get(0).def == 456 ) + + model.set(0, {"attrs": [{'abc': 789, 'def': 101}] } ) + ok = ( model.get(0).attrs.get(0).abc == 789 + && model.get(0).attrs.get(0).def == 101 ) + + } +} + diff --git a/tests/auto/qml/qqmllistmodel/data/signalhandlers.qml b/tests/auto/qml/qqmllistmodel/data/signalhandlers.qml new file mode 100644 index 0000000000..750d99c5a3 --- /dev/null +++ b/tests/auto/qml/qqmllistmodel/data/signalhandlers.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +ListModel{ + property bool ok: false + property int foo: 5 + onFooChanged: ok = true + Component.onCompleted: foo = 6 +} |