Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Component {
- id: someComponent
- ListModel {
- }
- }
- function createModel(parent) {
- var newModel = someComponent.createObject(parent);
- return newModel;
- }
- function createNewList() {
- var newListModel = Qt.createQmlObject('import QtQuick 2.2;
- ListModel {}', parent);
- return newListModel;
- }
- property ListModel items: ListModel {}
- function addComplexItem() {
- items.append({
- "key": "People",
- "arr": [
- {
- "arrItemName": "John",
- "arrItemValue": 18,
- },
- {
- "arrItemName": "Kerry",
- "arrItemValue": 21,
- },
- {
- "arrItemName": "Mike",
- "arrItemValue": 19,
- }
- ]});
- }
- // Usage
- Component {
- id: viewDelegate
- Item {
- Text {
- text: "List of " + key
- }
- ListView {
- model: arr
- delegate: Rectangle {
- Text {
- text: arrItemName
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment