1df7cb8014
Copyright notice as per https://reuse.software/spec/#format-of-copyright-notices Fixes #134
45 lines
1.2 KiB
QML
45 lines
1.2 KiB
QML
// Copyright Mirage authors & contributors <https://github.com/mirukana/mirage>
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
import QtQuick 2.12
|
|
import QtQuick.Controls 2.12
|
|
|
|
Rectangle {
|
|
property var button
|
|
property QtObject buttonTheme
|
|
property bool useFocusLine: true
|
|
|
|
|
|
color: buttonTheme.background
|
|
opacity:
|
|
button.loading ? theme.loadingElementsOpacity :
|
|
enabled ? 1 :
|
|
theme.disabledElementsOpacity
|
|
|
|
Behavior on opacity { HNumberAnimation {} }
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
radius: parent.radius
|
|
color:
|
|
button.checked ? buttonTheme.checkedOverlay :
|
|
|
|
button.enabled && button.pressed ? buttonTheme.pressedOverlay :
|
|
|
|
button.enabled && ! useFocusLine && button.activeFocus ?
|
|
buttonTheme.hoveredOverlay :
|
|
|
|
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"
|
|
}
|
|
}
|