MVC Architecture Demo App
import Felgo 4.0
import QtQuick 2.0
AppPage {
id: page
title: qsTr("Todo List")
rightBarItem: NavigationBarRow {
ActivityIndicatorBarItem {
enabled: dataModel.isBusy
visible: enabled
showItem: showItemAlways
}
IconButtonBarItem {
iconType: IconType.plus
showItem: showItemAlways
onClicked: {
var title = qsTr("New Todo")
logic.addTodo(title)
}
}
}
Connections {
target: dataModel
function onTodoStored(todo) {
page.navigationStack.popAllExceptFirstAndPush(detailPageComponent, { todoId: todo.id })
}
}
JsonListModel {
id: listModel
source: dataModel.todos
keyField: "id"
fields: ["id", "title", "completed"]
}
AppListView {
id: listView
anchors.fill: parent
model: listModel
delegate: SimpleRow {
text: viewHelper.formatTitle(model)
onSelected: page.navigationStack.popAllExceptFirstAndPush(detailPageComponent, { todoId: model.id })
}
}
Component {
id: detailPageComponent