Some fixes in the energy view

This commit is contained in:
Michael Zanetti 2021-01-18 20:49:17 +01:00
parent 553717a37e
commit ddbde5130e
3 changed files with 15 additions and 5 deletions

View File

@ -262,6 +262,7 @@ void LogsModel::logsReply(int /*commandId*/, const QVariantMap &data)
m_busyInternal = false; m_busyInternal = false;
if (m_viewStartTime.isValid() && m_list.count() > 0 && m_list.last()->timestamp() > m_viewStartTime && m_canFetchMore) { if (m_viewStartTime.isValid() && m_list.count() > 0 && m_list.last()->timestamp() > m_viewStartTime && m_canFetchMore) {
// qDebug() << "Fetching more because of viewStartTime" << m_viewStartTime.toString() << "last" << m_list.last()->timestamp().toString();
fetchMore(); fetchMore();
} else { } else {
m_busy = false; m_busy = false;

View File

@ -53,7 +53,7 @@ MainViewBase {
Flickable { Flickable {
anchors.fill: parent anchors.fill: parent
topMargin: app.margins anchors.margins: app.margins / 2
contentHeight: energyGrid.childrenRect.height contentHeight: energyGrid.childrenRect.height
GridLayout { GridLayout {
@ -62,9 +62,11 @@ MainViewBase {
visible: consumers.count > 0 visible: consumers.count > 0
columns: root.width > 600 ? 2 : 1 columns: root.width > 600 ? 2 : 1
rowSpacing: 0 rowSpacing: 0
columnSpacing: 0
SmartMeterChart { SmartMeterChart {
Layout.preferredWidth: energyGrid.width / energyGrid.columns Layout.fillWidth: true
// Layout.preferredWidth: energyGrid.width / energyGrid.columns
Layout.preferredHeight: width * .7 Layout.preferredHeight: width * .7
meters: consumers meters: consumers
title: qsTr("Total consumed energy") title: qsTr("Total consumed energy")
@ -75,7 +77,8 @@ MainViewBase {
ChartView { ChartView {
id: chartView id: chartView
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: width * .75 // Layout.preferredWidth: energyGrid.width / energyGrid.columns
Layout.preferredHeight: width * .7
legend.alignment: Qt.AlignBottom legend.alignment: Qt.AlignBottom
legend.font.pixelSize: app.smallFont legend.font.pixelSize: app.smallFont
legend.visible: false legend.visible: false

View File

@ -57,12 +57,15 @@ MainViewBase {
cellWidth: gridView.width / tilesPerRow cellWidth: gridView.width / tilesPerRow
cellHeight: cellWidth cellHeight: cellWidth
moveDisplaced: Transition { NumberAnimation { properties: "x,y"; duration: 150; easing.type: Easing.InOutQuad } }
model: tagsProxy model: tagsProxy
delegate: ThingTile { delegate: ThingTile {
id: delegateRoot id: delegateRoot
width: gridView.cellWidth width: gridView.cellWidth
height: gridView.cellHeight height: gridView.cellHeight
device: engine.deviceManager.devices.getDevice(deviceId) device: engine.deviceManager.devices.getDevice(deviceId)
visible: thingId !== fakeDragItem.deviceId
onClicked: pageStack.push(Qt.resolvedUrl("../devicepages/" + NymeaUtils.interfaceListToDevicePage(deviceClass.interfaces)), {device: device}) onClicked: pageStack.push(Qt.resolvedUrl("../devicepages/" + NymeaUtils.interfaceListToDevicePage(deviceClass.interfaces)), {device: device})
@ -76,6 +79,8 @@ MainViewBase {
NumberAnimation { from: 3; to: -3; target: delegateRoot; duration: 150; property: "rotation" } NumberAnimation { from: 3; to: -3; target: delegateRoot; duration: 150; property: "rotation" }
NumberAnimation { from: -3; to: 0; target: delegateRoot; duration: 75; property: "rotation" } NumberAnimation { from: -3; to: 0; target: delegateRoot; duration: 75; property: "rotation" }
} }
} }
MouseArea { MouseArea {
@ -103,6 +108,7 @@ MainViewBase {
onReleased: { onReleased: {
drag.target = null drag.target = null
draggedItem = null draggedItem = null
fakeDragItem.deviceId = ""
} }
onClicked: { onClicked: {
@ -115,8 +121,8 @@ MainViewBase {
width: gridView.cellWidth width: gridView.cellWidth
height: gridView.cellHeight height: gridView.cellHeight
Drag.active: dragArea.drag.active Drag.active: dragArea.drag.active
visible: Drag.active visible: deviceId !== ""
property var deviceId property var deviceId: ""
} }
DropArea { DropArea {