feat(StatusGroupBox): Use StatusIcon to gray out label when disabled

This commit is contained in:
Michał Cieślak 2023-04-04 15:53:37 +02:00 committed by Michał
parent a2f5d81f7f
commit 43196d9e31
2 changed files with 17 additions and 6 deletions

View File

@ -44,6 +44,8 @@ SplitView {
icon: Style.png("tokens/SNT") icon: Style.png("tokens/SNT")
iconSize: iconSizeSlider.value iconSize: iconSizeSlider.value
label.enabled: labelEnabledCheckBox.checked
width: undefinedSizeCheckBox.checked ? undefined width: undefinedSizeCheckBox.checked ? undefined
: widthSlider.value : widthSlider.value
height: undefinedSizeCheckBox.checked ? undefined height: undefinedSizeCheckBox.checked ? undefined
@ -110,10 +112,19 @@ SplitView {
text: "iconSize:" text: "iconSize:"
} }
TextField { RowLayout {
id: titleTextEdit TextField {
id: titleTextEdit
text: "Some title goes here" text: "Some title goes here"
}
CheckBox {
id: labelEnabledCheckBox
checked: true
text: "label enabled"
}
} }
} }
} }

View File

@ -41,15 +41,15 @@ GroupBox {
contentItem: RowLayout { contentItem: RowLayout {
spacing: 8 spacing: 8
Image { StatusIcon {
sourceSize.width: width || undefined sourceSize.width: width || undefined
sourceSize.height: height || undefined sourceSize.height: height || undefined
fillMode: Image.PreserveAspectFit
mipmap: true mipmap: true
antialiasing: true antialiasing: true
width: root.iconSize width: root.iconSize
height: width height: width
source: root.icon source: root.icon
color: enabled ? "transparent" : Theme.palette.baseColor1
} }
StatusBaseText { StatusBaseText {
@ -57,7 +57,7 @@ GroupBox {
Layout.fillWidth: true Layout.fillWidth: true
text: root.title text: root.title
color: Theme.palette.directColor1 color: enabled ? Theme.palette.directColor1 : Theme.palette.baseColor1
font.pixelSize: 17 font.pixelSize: 17
elide: Text.ElideRight elide: Text.ElideRight