NSlider/NValueSlider: support for enabled: false greyed out display

This commit is contained in:
Lemmy
2026-01-02 13:47:44 -05:00
parent 79c3799e8b
commit 0a6e5430a8
2 changed files with 8 additions and 4 deletions
+6 -4
View File
@@ -15,6 +15,8 @@ Slider {
property string tooltipDirection: "auto"
property bool hovering: false
readonly property color effectiveFillColor: enabled ? fillColor : Color.mOutline
readonly property real knobDiameter: Math.round((Style.baseWidgetSize * heightRatio * Style.uiScaleRatio) / 2) * 2
readonly property real trackHeight: Math.round((knobDiameter * 0.4 * Style.uiScaleRatio) / 2) * 2
readonly property real cutoutExtra: Math.round((Style.baseWidgetSize * 0.1 * Style.uiScaleRatio) / 2) * 2
@@ -47,7 +49,7 @@ Slider {
width: parent.height
height: parent.height
radius: Math.min(Style.iRadiusL, width / 2)
color: Qt.darker(fillColor, 1.2) //starting color of gradient
color: Qt.darker(effectiveFillColor, 1.2) //starting color of gradient
}
// The main rectangle
@@ -61,11 +63,11 @@ Slider {
orientation: Gradient.Horizontal
GradientStop {
position: 0.0
color: Qt.darker(fillColor, 1.2)
color: Qt.darker(effectiveFillColor, 1.2)
}
GradientStop {
position: 1.0
color: fillColor
color: effectiveFillColor
}
}
}
@@ -95,7 +97,7 @@ Slider {
implicitHeight: knobDiameter
radius: Math.min(Style.iRadiusL, width / 2)
color: root.pressed ? Color.mHover : Color.mSurface
border.color: fillColor
border.color: effectiveFillColor
border.width: Style.borderL
anchors.centerIn: parent
+2
View File
@@ -57,6 +57,7 @@ ColumnLayout {
visible: root.label !== "" || root.description !== ""
showIndicator: root.isSettings && root.isValueChanged
indicatorTooltip: root.indicatorTooltip
opacity: root.enabled ? 1.0 : 0.6
Layout.fillWidth: true
}
@@ -83,6 +84,7 @@ ColumnLayout {
text: root.text
pointSize: root.textSize
family: Settings.data.ui.fontFixed
opacity: root.enabled ? 1.0 : 0.6
Layout.alignment: Qt.AlignVCenter
Layout.preferredWidth: 45 * Style.uiScaleRatio
horizontalAlignment: Text.AlignRight