Merge PR #458: Align param and state delegates better
This commit is contained in:
commit
41ac7a30b9
@ -55,16 +55,18 @@ ItemDelegate {
|
|||||||
id: contentItemColumn
|
id: contentItemColumn
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: app.margins
|
spacing: app.margins
|
||||||
|
property bool labelFillsWidth: loader.sourceComponent !== textFieldComponent
|
||||||
|
&& loader.sourceComponent !== stringComponent
|
||||||
Label {
|
Label {
|
||||||
id: nameLabel
|
id: nameLabel
|
||||||
// Layout.fillWidth: true
|
Layout.fillWidth: parent.labelFillsWidth
|
||||||
// Layout.minimumWidth: parent.width / 2
|
// Layout.minimumWidth: parent.width / 2
|
||||||
text: root.paramType.displayName
|
text: root.paramType.displayName
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
Loader {
|
Loader {
|
||||||
id: loader
|
id: loader
|
||||||
Layout.fillWidth: true// sourceComponent === textFieldComponent || sourceComponent === stringComponent
|
Layout.fillWidth: !parent.labelFillsWidth
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
print("Loading ParamDelegate");
|
print("Loading ParamDelegate");
|
||||||
print("Writable:", root.writable, "type:", root.paramType.type, "min:", root.paramType.minValue, "max:", root.paramType.maxValue, "value:", root.param.value)
|
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 Nymea 1.0
|
||||||
import "../../components"
|
import "../../components"
|
||||||
|
|
||||||
Led {
|
Item {
|
||||||
property bool value
|
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
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
Label {
|
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)
|
text: Types.toUiUnit(stateDelegate.stateType.unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user