diff --git a/src/gui/Base/HButton.qml b/src/gui/Base/HButton.qml index c1deed1d..7915d830 100644 --- a/src/gui/Base/HButton.qml +++ b/src/gui/Base/HButton.qml @@ -50,6 +50,11 @@ Button { readonly property alias label: contentItem.label property color backgroundColor: theme.controls.button.background + property color focusLineColor: + Qt.colorEqual(icon.color, theme.icons.colorize) ? + theme.controls.button.focusedBorder : + icon.color + property bool disableWhileLoading: true property bool loading: false property bool circle: false diff --git a/src/gui/Base/HButtonBackground.qml b/src/gui/Base/HButtonBackground.qml index b1fd4c18..24de2989 100644 --- a/src/gui/Base/HButtonBackground.qml +++ b/src/gui/Base/HButtonBackground.qml @@ -4,30 +4,41 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 Rectangle { - color: buttonTheme.background - opacity: loading ? theme.loadingElementsOpacity : - enabled ? 1 : theme.disabledElementsOpacity - - property var button property QtObject buttonTheme + property bool useFocusLine: true + + + color: buttonTheme.background + opacity: + loading ? theme.loadingElementsOpacity : + enabled ? 1 : + theme.disabledElementsOpacity Behavior on opacity { HNumberAnimation {} } - Rectangle { anchors.fill: parent radius: parent.radius - color: button.checked ? buttonTheme.checkedOverlay : + color: + button.checked ? buttonTheme.checkedOverlay : - button.enabled && button.pressed ? buttonTheme.pressedOverlay : + button.enabled && button.pressed ? buttonTheme.pressedOverlay : - (button.enabled && button.hovered) || button.activeFocus ? - buttonTheme.hoveredOverlay : + button.enabled && ! useFocusLine && button.activeFocus ? + buttonTheme.hoveredOverlay : - "transparent" + button.enabled && button.hovered ? buttonTheme.hoveredOverlay : + + "transparent" Behavior on color { HColorAnimation { factor: 0.5 } } } + + HBottomFocusLine { + show: useFocusLine && button.activeFocus + borderHeight: useFocusLine ? buttonTheme.focusedBorderWidth : 0 + color: useFocusLine ? button.focusLineColor : "transparent" + } } diff --git a/src/gui/Base/HButtonContent.qml b/src/gui/Base/HButtonContent.qml index 0da9fb1f..3dc7a831 100644 --- a/src/gui/Base/HButtonContent.qml +++ b/src/gui/Base/HButtonContent.qml @@ -6,6 +6,7 @@ import QtQuick.Layouts 1.12 HRowLayout { id: buttonContent + implicitHeight: theme.baseElementsHeight spacing: button.spacing opacity: loading ? theme.loadingElementsOpacity : enabled ? 1 : theme.disabledElementsOpacity diff --git a/src/gui/Base/HMenuItem.qml b/src/gui/Base/HMenuItem.qml index 9395d409..57cc670e 100644 --- a/src/gui/Base/HMenuItem.qml +++ b/src/gui/Base/HMenuItem.qml @@ -17,6 +17,7 @@ MenuItem { background: HButtonBackground { button: menuItem buttonTheme: theme.controls.menuItem + useFocusLine: false } contentItem: HButtonContent { diff --git a/src/gui/Base/HTabButton.qml b/src/gui/Base/HTabButton.qml index 7708916a..ab545082 100644 --- a/src/gui/Base/HTabButton.qml +++ b/src/gui/Base/HTabButton.qml @@ -35,6 +35,11 @@ TabButton { TabBar.index % 2 === 0 ? theme.controls.tab.background : theme.controls.tab.alternateBackground + property color focusLineColor: + Qt.colorEqual(icon.color, theme.icons.colorize) ? + theme.controls.tab.focusedBorder : + icon.color + property bool loading: false property HToolTip toolTip: HToolTip { diff --git a/src/themes/Glass.qpl b/src/themes/Glass.qpl index cb8d116b..f2726d1a 100644 --- a/src/themes/Glass.qpl +++ b/src/themes/Glass.qpl @@ -121,8 +121,10 @@ controls: color background: colors.mediumBackground button: - color background: colors.strongBackground - color text: colors.text + color background: colors.strongBackground + color text: colors.text + color focusedBorder: colors.accentElement + int focusedBorderWidth: 1 color hoveredOverlay: hsluv(0, 0, 50, 0.2) color pressedOverlay: hsluv(0, 0, 50, 0.5) @@ -137,7 +139,10 @@ controls: colors.intensity * 4, Math.max(0.6, colors.opacity) ) - color bottomLine: background + + color bottomLine: background + color focusedBorder: colors.accentElement + int focusedBorderWidth: 1 color hoveredOverlay: controls.button.hoveredOverlay color pressedOverlay: controls.button.pressedOverlay diff --git a/src/themes/Midnight.qpl b/src/themes/Midnight.qpl index daa4fd72..8e0ee84c 100644 --- a/src/themes/Midnight.qpl +++ b/src/themes/Midnight.qpl @@ -124,8 +124,10 @@ controls: color background: colors.strongBackground button: - color background: colors.strongBackground - color text: colors.text + color background: colors.strongBackground + color text: colors.text + color focusedBorder: colors.accentElement + int focusedBorderWidth: 1 color hoveredOverlay: hsluv(0, 0, 50, 0.2) color pressedOverlay: hsluv(0, 0, 50, 0.5) @@ -140,7 +142,10 @@ controls: colors.intensity * 4, Math.max(0.6, colors.opacity) ) - color bottomLine: background + + color bottomLine: background + color focusedBorder: colors.accentElement + int focusedBorderWidth: 1 color hoveredOverlay: controls.button.hoveredOverlay color pressedOverlay: controls.button.pressedOverlay