mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
NSlider/NValueSlider: support for enabled: false greyed out display
This commit is contained in:
+6
-4
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user