2019-12-19 22:46:16 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-08-22 05:45:13 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
|
2019-08-28 12:46:31 +10:00
|
|
|
Rectangle {
|
2020-03-28 01:36:50 +11:00
|
|
|
property var button
|
2019-08-22 05:45:13 +10:00
|
|
|
property QtObject buttonTheme
|
2020-06-23 23:09:30 +10:00
|
|
|
property bool useFocusLine: true
|
2019-08-22 05:45:13 +10:00
|
|
|
|
|
|
|
|
2020-06-23 23:09:30 +10:00
|
|
|
color: buttonTheme.background
|
|
|
|
opacity:
|
|
|
|
loading ? theme.loadingElementsOpacity :
|
|
|
|
enabled ? 1 :
|
|
|
|
theme.disabledElementsOpacity
|
2019-08-22 05:45:13 +10:00
|
|
|
|
|
|
|
|
2020-06-23 23:09:30 +10:00
|
|
|
Behavior on opacity { HNumberAnimation {} }
|
|
|
|
|
2019-08-28 12:46:31 +10:00
|
|
|
Rectangle {
|
2019-08-22 05:45:13 +10:00
|
|
|
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 :
|
2019-08-22 05:45:13 +10:00
|
|
|
|
2020-06-23 23:09:30 +10:00
|
|
|
button.enabled && ! useFocusLine && button.activeFocus ?
|
|
|
|
buttonTheme.hoveredOverlay :
|
2019-08-22 05:45:13 +10:00
|
|
|
|
2020-06-23 23:09:30 +10:00
|
|
|
button.enabled && button.hovered ? buttonTheme.hoveredOverlay :
|
2019-08-22 05:45:13 +10:00
|
|
|
|
2020-06-23 23:09:30 +10:00
|
|
|
"transparent"
|
2019-08-22 05:45:13 +10:00
|
|
|
|
|
|
|
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"
|
|
|
|
}
|
2019-08-22 05:45:13 +10:00
|
|
|
}
|