Merge PR #458: Align param and state delegates better
This commit is contained in:
commit
41ac7a30b9
@ -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)
|
||||
|
||||
@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user