2019-07-13 07:06:37 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
|
2019-08-28 12:46:31 +10:00
|
|
|
Rectangle {
|
2019-08-21 04:29:03 +10:00
|
|
|
id: rectangle
|
|
|
|
|
2019-07-13 07:06:37 +10:00
|
|
|
property bool checkable: false // TODO
|
|
|
|
property bool checked: false
|
2019-08-21 04:29:03 +10:00
|
|
|
property bool hovered: false
|
|
|
|
readonly property alias pressed: tap.pressed
|
2019-07-13 07:06:37 +10:00
|
|
|
|
2019-07-18 15:56:58 +10:00
|
|
|
readonly property QtObject _ir: theme.controls.interactiveRectangle
|
2019-07-24 16:14:34 +10:00
|
|
|
color: _ir.background
|
2019-07-18 15:56:58 +10:00
|
|
|
|
2019-08-28 12:46:31 +10:00
|
|
|
Rectangle {
|
2019-07-24 16:14:34 +10:00
|
|
|
anchors.fill: parent
|
2019-07-13 07:06:37 +10:00
|
|
|
|
2019-08-18 07:05:24 +10:00
|
|
|
visible: opacity > 0
|
|
|
|
Behavior on opacity { HNumberAnimation { factor: 0.5 } }
|
2019-07-13 07:06:37 +10:00
|
|
|
|
2019-08-18 07:05:24 +10:00
|
|
|
opacity: pressed ? _ir.pressedOpacity :
|
|
|
|
checked ? _ir.checkedOpacity :
|
|
|
|
hovered ? _ir.hoveredOpacity :
|
2019-07-24 16:14:34 +10:00
|
|
|
0
|
|
|
|
|
2019-08-18 07:05:24 +10:00
|
|
|
color: pressed ? _ir.pressedOverlay :
|
|
|
|
checked ? _ir.checkedOverlay :
|
|
|
|
hovered ? _ir.hoveredOverlay :
|
|
|
|
"transparent"
|
2019-07-24 16:14:34 +10:00
|
|
|
}
|
2019-07-13 07:06:37 +10:00
|
|
|
|
2019-08-21 04:29:03 +10:00
|
|
|
HoverHandler {
|
|
|
|
id: hover
|
|
|
|
onHoveredChanged: rectangle.hovered = hovered
|
|
|
|
}
|
|
|
|
|
2019-07-13 07:06:37 +10:00
|
|
|
TapHandler { id: tap }
|
|
|
|
}
|