fix(widgets): improves disable states by avoiding stacking opacities

This commit is contained in:
Lemmy
2026-03-29 10:52:58 -04:00
parent c2a2a44378
commit c942c10f8a
8 changed files with 10 additions and 12 deletions
+2 -2
View File
@@ -140,9 +140,9 @@ Rectangle {
cursorShape: root.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onEntered: {
root.hovered = true;
root.hovered = root.enabled ? true : false;
root.entered();
if (tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
if (hovered && tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
TooltipService.show(root, root.tooltipText);
}
}
+1 -1
View File
@@ -23,7 +23,6 @@ RowLayout {
signal exited
Layout.fillWidth: true
opacity: enabled ? 1.0 : 0.6
NLabel {
label: root.label
@@ -40,6 +39,7 @@ RowLayout {
Rectangle {
id: box
opacity: enabled ? 1.0 : 0.6
Layout.margins: Style.borderS
implicitWidth: Style.toOdd(root.baseSize)
implicitHeight: Style.toOdd(root.baseSize)
+1 -1
View File
@@ -27,7 +27,6 @@ RowLayout {
signal selected(string key)
spacing: Style.marginL
opacity: enabled ? 1.0 : 0.6
// Less strict comparison with != (instead of !==) so it can properly compare int vs string (ex for FPS: 30 and "30")
readonly property bool isValueChanged: (defaultValue !== undefined) && (currentKey != defaultValue)
@@ -136,6 +135,7 @@ RowLayout {
ComboBox {
id: combo
opacity: enabled ? 1.0 : 0.6
Layout.margins: Style.borderS
Layout.minimumWidth: Math.round(root.minimumWidth * Style.uiScaleRatio)
Layout.preferredHeight: Math.round(root.preferredHeight * Style.uiScaleRatio)
+2 -2
View File
@@ -45,7 +45,7 @@ Item {
implicitWidth: buttonSize
implicitHeight: buttonSize
opacity: root.enabled ? Style.opacityFull : Style.opacityMedium
opacity: enabled ? 1.0 : 0.6
// Visual button - stays at buttonSize, centered in parent
Rectangle {
@@ -96,7 +96,7 @@ Item {
hoverEnabled: true
onEntered: {
hovering = root.enabled ? true : false;
if (tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
if (hovering && tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
TooltipService.show(root, tooltipText, tooltipDirection);
}
root.entered();
+2 -2
View File
@@ -45,7 +45,7 @@ Rectangle {
implicitHeight: applyUiScale ? Math.round(baseSize * Style.uiScaleRatio) : Math.round(baseSize)
// Appearance
opacity: root.enabled ? Style.opacityFull : Style.opacityMedium
opacity: enabled ? 1.0 : 0.6
color: {
if (root.enabled && root.hovering || pressed) {
return colorBgHover;
@@ -106,7 +106,7 @@ Rectangle {
onEntered: {
hovering = root.enabled ? true : false;
if (tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
if (hovering && tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
TooltipService.show(parent, tooltipText, tooltipDirection);
}
root.entered();
+1
View File
@@ -172,6 +172,7 @@ RowLayout {
ComboBox {
id: combo
opacity: enabled ? 1.0 : 0.6
Layout.margins: Style.borderS
Layout.minimumWidth: Math.round(root.minimumWidth * Style.uiScaleRatio)
Layout.preferredHeight: Math.round(root.preferredHeight * Style.uiScaleRatio)
-1
View File
@@ -120,7 +120,6 @@ NBox {
signal openPluginSettingsRequested(var pluginManifest)
color: Color.mSurface
opacity: enabled ? 1.0 : 0.6
Layout.fillWidth: true
z: flowDragArea.dragStarted ? 5000 : 0
+1 -3
View File
@@ -21,8 +21,6 @@ RowLayout {
signal exited
Layout.fillWidth: true
opacity: enabled ? 1.0 : 0.6
spacing: Style.marginM
readonly property bool isValueChanged: (defaultValue !== undefined) && (checked !== defaultValue)
@@ -44,9 +42,9 @@ RowLayout {
Rectangle {
id: switcher
opacity: enabled ? 1.0 : 0.6
Layout.alignment: Qt.AlignVCenter
Layout.margins: Style.borderS
implicitWidth: Math.round(root.baseSize * .85) * 2
implicitHeight: Math.round(root.baseSize * .5) * 2
radius: Math.min(Style.iRadiusL, height / 2)