This repository has been archived on 2022-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
fanny-app/qml/Components/FoodPlanDisplay.qml
dorian c6e1e12cfe Finished up foodplan Display:
- now using QAbstractItem model
- added error handling so the app doesn't crash anymore when the data is invalid
2018-12-23 21:07:10 +01:00

156 lines
4.5 KiB
QML

import QtQuick 2.9
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
import Backend 1.0
Item {
id: control
ListView {
id: foodList
anchors.fill: parent
anchors.margins: 10
model: FoodPlanModel {
id: foodPlanModel
}
delegate: Button {
width: foodList.width
id: delegate
height: visible ? cookteamLa.height + dateLa.height + mainDishLa.height + mainDishVegLa.height + garnishLa.height + dessertLa.height + spacer.height + cust_spacing*9 + 5:0
visible: true//listView.isDayVisible(index)
property int cust_spacing: 5
Label {
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: parent.top
anchors.topMargin: 10
font.bold: true
id: cookteamLa
text: cookteam
width: parent.width - 10
wrapMode: Label.Wrap
height: text!=""? undefined:0
}
Label {
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: cookteamLa.bottom
font.bold: true
id: dateLa
text: date
width: parent.width - 10
wrapMode: Label.Wrap
}
Rectangle {
anchors.top: dateLa.bottom
anchors.topMargin: cust_spacing
anchors.left: parent.left
anchors.leftMargin: 10
anchors.right: parent.right
anchors.rightMargin: 10
height: 2
color: "grey"
}
Label {
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: dateLa.bottom
anchors.topMargin: cust_spacing * 2
width: parent.width - 10
wrapMode: Label.Wrap
id: mainDishLa
text: mainDish
height: text!=""? undefined:0
}
Rectangle {
anchors.top: mainDishLa.bottom
anchors.topMargin: cust_spacing
anchors.left: parent.left
anchors.leftMargin: 10
width: parent.width / 10
height: mainDishVegLa.text!=""? 1:0
color: "grey"
}
Label {
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: mainDishLa.bottom
anchors.topMargin: cust_spacing * 2
id: mainDishVegLa
text: mainDishVeg
width: parent.width - 10
wrapMode: Label.Wrap
height: text!=""? undefined:0
}
Rectangle {
anchors.top: mainDishVegLa.bottom
anchors.topMargin: cust_spacing
anchors.left: parent.left
anchors.leftMargin: 10
width: parent.width / 10
height: garnishLa.text!=""? 1:0
color: "grey"
}
Label {
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: mainDishVegLa.bottom
anchors.topMargin: cust_spacing * 2
id: garnishLa
text: garnish
width: parent.width - 10
wrapMode: Label.Wrap
height: text!=""? undefined:0
}
Rectangle {
anchors.top: garnishLa.bottom
anchors.topMargin: cust_spacing
anchors.left: parent.left
anchors.leftMargin: 10
width: parent.width / 10
height: dessertLa.text!=""? 1:0
color: "grey"
}
Label {
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: garnishLa.bottom
anchors.topMargin: cust_spacing * 2
id: dessertLa
text: dessert
width: parent.width - 10
wrapMode: Label.Wrap
height: text!=""? undefined:0
}
Label {
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: dessertLa.bottom
anchors.topMargin: cust_spacing
id: spacer
text: ""
}
}
}
}