Clean up some list views
This commit is contained in:
parent
a1550d6bf7
commit
0c4be855d5
@ -47,20 +47,22 @@ DeviceListPageBase {
|
||||
Flickable {
|
||||
anchors.fill: parent
|
||||
contentHeight: contentGrid.implicitHeight
|
||||
topMargin: app.margins / 2
|
||||
|
||||
GridLayout {
|
||||
id: contentGrid
|
||||
width: parent.width
|
||||
columns: Math.ceil(width / 500)
|
||||
width: parent.width - app.margins
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
columns: Math.ceil(width / 600)
|
||||
rowSpacing: 0
|
||||
columnSpacing: 0
|
||||
|
||||
Repeater {
|
||||
model: root.devicesProxy
|
||||
|
||||
delegate: ItemDelegate {
|
||||
delegate: Item {
|
||||
id: itemDelegate
|
||||
Layout.preferredWidth: contentGrid.width / contentGrid.columns
|
||||
height: contentItem.implicitHeight + app.margins
|
||||
|
||||
property bool inline: width > 500
|
||||
|
||||
@ -72,9 +74,10 @@ DeviceListPageBase {
|
||||
readonly property StateType playerTypeStateType: thing.thingClass.stateTypes.findByName("playerType")
|
||||
readonly property State playerTypeState: thing.stateByName("playerType")
|
||||
|
||||
bottomPadding: index === root.devicesProxy.count - 1 ? topPadding : 0
|
||||
contentItem: Pane {
|
||||
Pane {
|
||||
id: contentItem
|
||||
width: parent.width - app.margins
|
||||
anchors.centerIn: parent
|
||||
Material.elevation: 2
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
|
||||
@ -39,25 +39,29 @@ DeviceListPageBase {
|
||||
id: root
|
||||
|
||||
header: NymeaHeader {
|
||||
text: qsTr("Sensors")
|
||||
text: root.shownInterfaces.indexOf("heating") >= 0 ? qsTr("Heating") : qsTr("Sensors")
|
||||
onBackPressed: pageStack.pop()
|
||||
}
|
||||
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
model: root.thingsProxy
|
||||
topMargin: app.margins / 2
|
||||
|
||||
delegate: ItemDelegate {
|
||||
delegate: Item {
|
||||
id: itemDelegate
|
||||
width: parent.width
|
||||
width: parent.width - app.margins
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
height: contentItem.implicitHeight + app.margins
|
||||
|
||||
property bool inline: width > 500
|
||||
|
||||
property Thing thing: thingsProxy.getThing(model.id)
|
||||
|
||||
bottomPadding: index === ListView.view.count - 1 ? topPadding : 0
|
||||
contentItem: Pane {
|
||||
Pane {
|
||||
id: contentItem
|
||||
width: parent.width - app.margins
|
||||
anchors.centerIn: parent
|
||||
Material.elevation: 2
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
@ -173,7 +177,7 @@ DeviceListPageBase {
|
||||
}
|
||||
Led {
|
||||
id: led
|
||||
visible: ["presencesensor", "daylightsensor"].indexOf(model.interfaceName) >= 0
|
||||
visible: ["presencesensor", "daylightsensor", "heating"].indexOf(model.interfaceName) >= 0
|
||||
state: visible && sensorValueDelegate.stateValue.value === true ? "on" : "off"
|
||||
}
|
||||
Item {
|
||||
|
||||
@ -46,18 +46,22 @@ DeviceListPageBase {
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
model: root.devicesProxy
|
||||
topMargin: app.margins / 2
|
||||
|
||||
delegate: ItemDelegate {
|
||||
delegate: Item {
|
||||
id: itemDelegate
|
||||
width: parent.width
|
||||
width: parent.width - app.margins
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
height: contentItem.height + app.margins
|
||||
|
||||
property bool inline: width > 500
|
||||
|
||||
property Thing thing: thingsProxy.getThing(model.id)
|
||||
|
||||
bottomPadding: index === ListView.view.count - 1 ? topPadding : 0
|
||||
contentItem: Pane {
|
||||
Pane {
|
||||
id: contentItem
|
||||
width: parent.width - app.margins
|
||||
anchors.centerIn: parent
|
||||
Material.elevation: 2
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
|
||||
@ -47,19 +47,23 @@ DeviceListPageBase {
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
model: root.devicesProxy
|
||||
topMargin: app.margins / 2
|
||||
|
||||
delegate: ItemDelegate {
|
||||
delegate: Item {
|
||||
id: itemDelegate
|
||||
width: parent.width
|
||||
width: parent.width - app.margins
|
||||
height: contentItem.height + app.margins
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
property bool inline: width > 500
|
||||
|
||||
property Device device: devicesProxy.getDevice(model.id)
|
||||
property DeviceClass deviceClass: device.deviceClass
|
||||
|
||||
bottomPadding: index === ListView.view.count - 1 ? topPadding : 0
|
||||
contentItem: Pane {
|
||||
Pane {
|
||||
id: contentItem
|
||||
width: parent.width - app.margins
|
||||
anchors.centerIn: parent
|
||||
Material.elevation: 2
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
|
||||
Reference in New Issue
Block a user