From b88396da59d6dd578a63f6360987825657fa3cb5 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 30 Oct 2020 13:21:18 +0100 Subject: [PATCH] Align params and state delegates better --- nymea-app/ui/delegates/ParamDelegate.qml | 6 ++++-- .../ui/delegates/statedelegates/LedDelegate.qml | 13 +++++++++++-- nymea-app/ui/devicepages/GenericDevicePage.qml | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/nymea-app/ui/delegates/ParamDelegate.qml b/nymea-app/ui/delegates/ParamDelegate.qml index bf205c0a..5fe0cf74 100644 --- a/nymea-app/ui/delegates/ParamDelegate.qml +++ b/nymea-app/ui/delegates/ParamDelegate.qml @@ -55,16 +55,18 @@ ItemDelegate { id: contentItemColumn RowLayout { spacing: app.margins + property bool labelFillsWidth: loader.sourceComponent !== textFieldComponent + && loader.sourceComponent !== stringComponent Label { id: nameLabel -// Layout.fillWidth: true + Layout.fillWidth: parent.labelFillsWidth // Layout.minimumWidth: parent.width / 2 text: root.paramType.displayName elide: Text.ElideRight } Loader { id: loader - Layout.fillWidth: true// sourceComponent === textFieldComponent || sourceComponent === stringComponent + Layout.fillWidth: !parent.labelFillsWidth sourceComponent: { print("Loading ParamDelegate"); print("Writable:", root.writable, "type:", root.paramType.type, "min:", root.paramType.minValue, "max:", root.paramType.maxValue, "value:", root.param.value) diff --git a/nymea-app/ui/delegates/statedelegates/LedDelegate.qml b/nymea-app/ui/delegates/statedelegates/LedDelegate.qml index d899ab3a..32ca0e11 100644 --- a/nymea-app/ui/delegates/statedelegates/LedDelegate.qml +++ b/nymea-app/ui/delegates/statedelegates/LedDelegate.qml @@ -35,7 +35,16 @@ import QtQuick.Layouts 1.1 import Nymea 1.0 import "../../components" -Led { +Item { property bool value - state: value === true ? "on" : "off" + implicitHeight: led.implicitHeight + implicitWidth: led.implicitWidth + + Led { + id: led + anchors { top: parent.top; right: parent.right; bottom: parent.bottom } + width: height + state: parent.value === true ? "on" : "off" + } } + diff --git a/nymea-app/ui/devicepages/GenericDevicePage.qml b/nymea-app/ui/devicepages/GenericDevicePage.qml index 3f814233..4b9a7e0a 100644 --- a/nymea-app/ui/devicepages/GenericDevicePage.qml +++ b/nymea-app/ui/devicepages/GenericDevicePage.qml @@ -155,7 +155,7 @@ DevicePageBase { Layout.fillWidth: true } Label { - visible: stateDelegate.stateType.unit !== Types.UnitUnixTime && stateDelegate.stateType.unit !== Types.UnitUnixTime + visible: text.length > 0 && stateDelegate.stateType.unit !== Types.UnitUnixTime && stateDelegate.stateType.unit !== Types.UnitUnixTime text: Types.toUiUnit(stateDelegate.stateType.unit) }