moment/src/gui/Base/HButtonBackground.qml

45 lines
1.1 KiB
QML
Raw Normal View History

2019-12-19 22:46:16 +11:00
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Controls 2.12
2019-08-28 12:46:31 +10:00
Rectangle {
property var button
property QtObject buttonTheme
2020-06-23 23:09:30 +10:00
property bool useFocusLine: true
2020-06-23 23:09:30 +10:00
color: buttonTheme.background
opacity:
loading ? theme.loadingElementsOpacity :
enabled ? 1 :
theme.disabledElementsOpacity
2020-06-23 23:09:30 +10:00
Behavior on opacity { HNumberAnimation {} }
2019-08-28 12:46:31 +10:00
Rectangle {
anchors.fill: parent
radius: parent.radius
2020-06-23 23:09:30 +10:00
color:
button.checked ? buttonTheme.checkedOverlay :
button.enabled && button.pressed ? buttonTheme.pressedOverlay :
2020-06-23 23:09:30 +10:00
button.enabled && ! useFocusLine && button.activeFocus ?
buttonTheme.hoveredOverlay :
2020-06-23 23:09:30 +10:00
button.enabled && button.hovered ? buttonTheme.hoveredOverlay :
2020-06-23 23:09:30 +10:00
"transparent"
Behavior on color { HColorAnimation { factor: 0.5 } }
}
2020-06-23 23:09:30 +10:00
HBottomFocusLine {
show: useFocusLine && button.activeFocus
borderHeight: useFocusLine ? buttonTheme.focusedBorderWidth : 0
color: useFocusLine ? button.focusLineColor : "transparent"
}
}