diff options
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 +} |