diff --git a/ui/StatusQ/sandbox/controls/Buttons.qml b/ui/StatusQ/sandbox/controls/Buttons.qml index db743d6ef3..021994102d 100644 --- a/ui/StatusQ/sandbox/controls/Buttons.qml +++ b/ui/StatusQ/sandbox/controls/Buttons.qml @@ -4,6 +4,7 @@ import QtQuick.Dialogs 1.3 import StatusQ.Controls 0.1 import StatusQ.Popups 0.1 +import StatusQ.Core 0.1 import StatusQ.Core.Theme 0.1 Column { @@ -317,4 +318,5 @@ Column { colorSelected = true; } } + } diff --git a/ui/StatusQ/src/StatusQ/Controls/StatusBaseButton.qml b/ui/StatusQ/src/StatusQ/Controls/StatusBaseButton.qml index f231e3e638..79a6bb2a64 100644 --- a/ui/StatusQ/src/StatusQ/Controls/StatusBaseButton.qml +++ b/ui/StatusQ/src/StatusQ/Controls/StatusBaseButton.qml @@ -86,14 +86,16 @@ Rectangle { radius: size !== StatusBaseButton.Size.Tiny ? 8 : 6 color: { - if (statusBaseButton.enabled) { + if (statusBaseButton.enabled) return sensor.containsMouse || highlighted ? hoverColor - : normalColor - } else { - return disaledColor - } + : normalColor; + return disaledColor } + QtObject { + id: d + readonly property color textColor: statusBaseButton.enabled ? statusBaseButton.textColor : statusBaseButton.disabledTextColor + } MouseArea { id: sensor @@ -102,17 +104,16 @@ Rectangle { cursorShape: loading ? Qt.ArrowCursor : Qt.PointingHandCursor - hoverEnabled: !loading - enabled: !loading + hoverEnabled: true + enabled: !loading && statusBaseButton.enabled Loader { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter active: loading sourceComponent: StatusLoadingIndicator { - color: statusBaseButton.enabled ? textColor - : disabledTextColor + color: d.textColor } // Indicator } // Loader @@ -130,8 +131,7 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter opacity: !loading && statusBaseButton.icon.name !== "" visible: statusBaseButton.icon.name !== "" - color: statusBaseButton.enabled ? textColor - : disabledTextColor + color: d.textColor } // Icon StatusBaseText { id: label @@ -139,8 +139,7 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter font.pixelSize: size === StatusBaseButton.Size.Large ? 15 : 13 // by design - color: statusBaseButton.enabled ? textColor - : disabledTextColor + color: d.textColor } // Text } // Ro diff --git a/ui/StatusQ/src/StatusQ/Controls/StatusRoundButton.qml b/ui/StatusQ/src/StatusQ/Controls/StatusRoundButton.qml index e8a0bb7ce2..7c3cb120d9 100644 --- a/ui/StatusQ/src/StatusQ/Controls/StatusRoundButton.qml +++ b/ui/StatusQ/src/StatusQ/Controls/StatusRoundButton.qml @@ -48,9 +48,6 @@ Rectangle { Primary, Secondary } - - - /// Implementation QtObject { @@ -84,27 +81,31 @@ Rectangle { } } + QtObject { + id: d + readonly property color iconColor: statusRoundButton.enabled ? statusRoundButton.icon.color : statusRoundButton.icon.disabledColor + } + implicitWidth: 44 implicitHeight: 44 radius: width / 2; color: { - if (statusRoundButton.enabled) { + if (statusRoundButton.enabled) return sensor.containsMouse || highlighted ? backgroundSettings.hoverColor - : backgroundSettings.color - } else { - return backgroundSettings.disabledColor - } + : backgroundSettings.color; + return backgroundSettings.disabledColor } + MouseArea { id: sensor anchors.fill: parent cursorShape: loading ? Qt.ArrowCursor : Qt.PointingHandCursor - hoverEnabled: !loading - enabled: !loading + hoverEnabled: true + enabled: !loading && statusRoundButton.enabled StatusIcon { id: statusIcon @@ -117,25 +118,13 @@ Rectangle { width: statusRoundButton.icon.width height: statusRoundButton.icon.height - color: { - if (statusRoundButton.enabled) { - return statusRoundButton.icon.color - } else { - return statusRoundButton.icon.disabledColor - } - } + color: d.iconColor } // Icon Loader { active: loading anchors.centerIn: parent sourceComponent: StatusLoadingIndicator { - color: { - if (statusRoundButton.enabled) { - return statusRoundButton.icon.color - } else { - return statusRoundButton.icon.disabledColor - } - } + color: d.iconColor } // Indicator } // Loader