From 2ed89fec3cde4ba29328b62288b9fd8bb3c8e477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Fri, 7 Jul 2023 07:53:34 -0400 Subject: [PATCH] materialbutton: group hoverEnabled and enabled The hover animation was shown on disabled buttons Change-Id: I2d8579a1d712e785b8edc82472df6ac798f1b523 GitLab: #1247 --- src/app/commoncomponents/MaterialButton.qml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/app/commoncomponents/MaterialButton.qml b/src/app/commoncomponents/MaterialButton.qml index e7fc23033..d1867c9f6 100644 --- a/src/app/commoncomponents/MaterialButton.qml +++ b/src/app/commoncomponents/MaterialButton.qml @@ -66,7 +66,6 @@ AbstractButton { value: height } - hoverEnabled: true focusPolicy: Qt.StrongFocus Accessible.role: Accessible.Button @@ -168,7 +167,7 @@ AbstractButton { leftPadding: root.primary ? JamiTheme.buttontextWizzardPadding : textLeftPadding rightPadding: root.primary ? JamiTheme.buttontextWizzardPadding : textRightPadding text: root.text - font.weight: (root.hovered && root.hoverEnabled) || boldFont ? Font.Bold : Font.Medium + font.weight: (root.hovered && root.enabled) || boldFont ? Font.Bold : Font.Medium elide: Text.ElideRight verticalAlignment: Text.AlignVCenter horizontalAlignment: root.textAlignment @@ -183,18 +182,18 @@ AbstractButton { color: { var baseColor = root.color; if (root.primary) { - if (root.hovered && root.hoverEnabled) + if (root.hovered && root.enabled) return root.hoveredColor; return baseColor; } if (root.secondary || root.tertiary) { - if (root.hovered && root.hoverEnabled) + if (root.hovered && root.enabled) return root.secHoveredColor; return JamiTheme.transparentColor; } if (root.down) return root.pressedColor; - if (root.hovered && root.hoverEnabled) + if (root.hovered && root.enabled) return root.hoveredColor; return baseColor; } @@ -202,7 +201,7 @@ AbstractButton { border.color: { if (root.primary || root.tertiary) return JamiTheme.transparentColor; - if (root.secondary && root.hovered && root.hoverEnabled) + if (root.secondary && root.hovered && root.enabled) return JamiTheme.secondaryButtonHoveredBorderColor; if (root.secondary) return JamiTheme.secondaryButtonBorderColor; @@ -226,7 +225,7 @@ AbstractButton { // We don't want to eat clicks on the Text. acceptedButtons: Qt.NoButton - cursorShape: (root.hovered && root.hoverEnabled) ? Qt.PointingHandCursor : Qt.ArrowCursor + cursorShape: (root.hovered && root.enabled) ? Qt.PointingHandCursor : Qt.ArrowCursor } Shortcut { -- GitLab