Skip to content
Snippets Groups Projects
Commit 2ed89fec authored by Sébastien Blin's avatar Sébastien Blin
Browse files

materialbutton: group hoverEnabled and enabled

The hover animation was shown on disabled buttons

Change-Id: I2d8579a1d712e785b8edc82472df6ac798f1b523
GitLab: #1247
parent 28151682
No related branches found
No related tags found
No related merge requests found
...@@ -66,7 +66,6 @@ AbstractButton { ...@@ -66,7 +66,6 @@ AbstractButton {
value: height value: height
} }
hoverEnabled: true
focusPolicy: Qt.StrongFocus focusPolicy: Qt.StrongFocus
Accessible.role: Accessible.Button Accessible.role: Accessible.Button
...@@ -168,7 +167,7 @@ AbstractButton { ...@@ -168,7 +167,7 @@ AbstractButton {
leftPadding: root.primary ? JamiTheme.buttontextWizzardPadding : textLeftPadding leftPadding: root.primary ? JamiTheme.buttontextWizzardPadding : textLeftPadding
rightPadding: root.primary ? JamiTheme.buttontextWizzardPadding : textRightPadding rightPadding: root.primary ? JamiTheme.buttontextWizzardPadding : textRightPadding
text: root.text 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 elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: root.textAlignment horizontalAlignment: root.textAlignment
...@@ -183,18 +182,18 @@ AbstractButton { ...@@ -183,18 +182,18 @@ AbstractButton {
color: { color: {
var baseColor = root.color; var baseColor = root.color;
if (root.primary) { if (root.primary) {
if (root.hovered && root.hoverEnabled) if (root.hovered && root.enabled)
return root.hoveredColor; return root.hoveredColor;
return baseColor; return baseColor;
} }
if (root.secondary || root.tertiary) { if (root.secondary || root.tertiary) {
if (root.hovered && root.hoverEnabled) if (root.hovered && root.enabled)
return root.secHoveredColor; return root.secHoveredColor;
return JamiTheme.transparentColor; return JamiTheme.transparentColor;
} }
if (root.down) if (root.down)
return root.pressedColor; return root.pressedColor;
if (root.hovered && root.hoverEnabled) if (root.hovered && root.enabled)
return root.hoveredColor; return root.hoveredColor;
return baseColor; return baseColor;
} }
...@@ -202,7 +201,7 @@ AbstractButton { ...@@ -202,7 +201,7 @@ AbstractButton {
border.color: { border.color: {
if (root.primary || root.tertiary) if (root.primary || root.tertiary)
return JamiTheme.transparentColor; return JamiTheme.transparentColor;
if (root.secondary && root.hovered && root.hoverEnabled) if (root.secondary && root.hovered && root.enabled)
return JamiTheme.secondaryButtonHoveredBorderColor; return JamiTheme.secondaryButtonHoveredBorderColor;
if (root.secondary) if (root.secondary)
return JamiTheme.secondaryButtonBorderColor; return JamiTheme.secondaryButtonBorderColor;
...@@ -226,7 +225,7 @@ AbstractButton { ...@@ -226,7 +225,7 @@ AbstractButton {
// We don't want to eat clicks on the Text. // We don't want to eat clicks on the Text.
acceptedButtons: Qt.NoButton acceptedButtons: Qt.NoButton
cursorShape: (root.hovered && root.hoverEnabled) ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: (root.hovered && root.enabled) ? Qt.PointingHandCursor : Qt.ArrowCursor
} }
Shortcut { Shortcut {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment