|
|
|
@ -163,71 +163,77 @@ Rectangle {
@@ -163,71 +163,77 @@ Rectangle {
|
|
|
|
|
visible: index == 0 ? _showOptionalElements : true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Rectangle { |
|
|
|
|
FocusScope { |
|
|
|
|
id: scope |
|
|
|
|
anchors.left: parent.left |
|
|
|
|
anchors.right: parent.right |
|
|
|
|
height: width |
|
|
|
|
color: checked ? _repeaterPal.buttonHighlight : _repeaterPal.button |
|
|
|
|
|
|
|
|
|
QGCColoredImage { |
|
|
|
|
id: button |
|
|
|
|
anchors.fill: parent |
|
|
|
|
source: _source |
|
|
|
|
sourceSize.height: parent.height |
|
|
|
|
fillMode: Image.PreserveAspectFit |
|
|
|
|
mipmap: true |
|
|
|
|
smooth: true |
|
|
|
|
color: checked ? _repeaterPal.buttonHighlightText : _repeaterPal.buttonText |
|
|
|
|
|
|
|
|
|
RotationAnimation on rotation { |
|
|
|
|
id: imageRotation |
|
|
|
|
loops: Animation.Infinite |
|
|
|
|
from: 0 |
|
|
|
|
to: 360 |
|
|
|
|
duration: 500 |
|
|
|
|
running: false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
NumberAnimation on opacity { |
|
|
|
|
id: opacityAnimation |
|
|
|
|
running: false |
|
|
|
|
from: 0 |
|
|
|
|
to: 1.0 |
|
|
|
|
loops: Animation.Infinite |
|
|
|
|
duration: 2000 |
|
|
|
|
Rectangle { |
|
|
|
|
anchors.fill: parent |
|
|
|
|
color: checked ? _repeaterPal.buttonHighlight : _repeaterPal.button |
|
|
|
|
|
|
|
|
|
QGCColoredImage { |
|
|
|
|
id: button |
|
|
|
|
anchors.fill: parent |
|
|
|
|
source: _source |
|
|
|
|
sourceSize.height: parent.height |
|
|
|
|
fillMode: Image.PreserveAspectFit |
|
|
|
|
mipmap: true |
|
|
|
|
smooth: true |
|
|
|
|
color: checked ? _repeaterPal.buttonHighlightText : _repeaterPal.buttonText |
|
|
|
|
|
|
|
|
|
RotationAnimation on rotation { |
|
|
|
|
id: imageRotation |
|
|
|
|
loops: Animation.Infinite |
|
|
|
|
from: 0 |
|
|
|
|
to: 360 |
|
|
|
|
duration: 500 |
|
|
|
|
running: false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
NumberAnimation on opacity { |
|
|
|
|
id: opacityAnimation |
|
|
|
|
running: false |
|
|
|
|
from: 0 |
|
|
|
|
to: 1.0 |
|
|
|
|
loops: Animation.Infinite |
|
|
|
|
duration: 2000 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QGCMouseArea { |
|
|
|
|
// Size of mouse area is expanded to make touch easier |
|
|
|
|
anchors.leftMargin: -buttonStripColumn.anchors.margins |
|
|
|
|
anchors.rightMargin: -buttonStripColumn.anchors.margins |
|
|
|
|
anchors.left: parent.left |
|
|
|
|
anchors.right: parent.right |
|
|
|
|
anchors.top: parent.top |
|
|
|
|
height: parent.height + (_showOptionalElements? buttonLabel.height + buttonColumn.spacing : 0) |
|
|
|
|
visible: _buttonEnabled |
|
|
|
|
preventStealing: true |
|
|
|
|
|
|
|
|
|
onClicked: { |
|
|
|
|
if (modelData.dropPanelComponent === undefined) { |
|
|
|
|
dropPanel.hide() |
|
|
|
|
if (modelData.toggle === true) { |
|
|
|
|
checked = !checked |
|
|
|
|
} else { |
|
|
|
|
// dropPanel.hide above will close panel, but we need to do this to clear toggles |
|
|
|
|
uncheckAll() |
|
|
|
|
} |
|
|
|
|
_root.clicked(index, checked) |
|
|
|
|
} else { |
|
|
|
|
if (checked) { |
|
|
|
|
dropPanel.hide() // hide affects checked, so this needs to be duplicated inside not outside if |
|
|
|
|
QGCMouseArea { |
|
|
|
|
// Size of mouse area is expanded to make touch easier |
|
|
|
|
anchors.leftMargin: -buttonStripColumn.anchors.margins |
|
|
|
|
anchors.rightMargin: -buttonStripColumn.anchors.margins |
|
|
|
|
anchors.left: parent.left |
|
|
|
|
anchors.right: parent.right |
|
|
|
|
anchors.top: parent.top |
|
|
|
|
height: parent.height + (_showOptionalElements? buttonLabel.height + buttonColumn.spacing : 0) |
|
|
|
|
visible: _buttonEnabled |
|
|
|
|
preventStealing: true |
|
|
|
|
|
|
|
|
|
onClicked: { |
|
|
|
|
scope.focus = true |
|
|
|
|
if (modelData.dropPanelComponent === undefined) { |
|
|
|
|
dropPanel.hide() |
|
|
|
|
if (modelData.toggle === true) { |
|
|
|
|
checked = !checked |
|
|
|
|
} else { |
|
|
|
|
// dropPanel.hide above will close panel, but we need to do this to clear toggles |
|
|
|
|
uncheckAll() |
|
|
|
|
} |
|
|
|
|
_root.clicked(index, checked) |
|
|
|
|
} else { |
|
|
|
|
dropPanel.hide() // hide affects checked, so this needs to be duplicated inside not outside if |
|
|
|
|
uncheckAll() |
|
|
|
|
checked = true |
|
|
|
|
var panelEdgeTopPoint = mapToItem(_root, width, 0) |
|
|
|
|
dropPanel.show(panelEdgeTopPoint, height, modelData.dropPanelComponent) |
|
|
|
|
if (checked) { |
|
|
|
|
dropPanel.hide() // hide affects checked, so this needs to be duplicated inside not outside if |
|
|
|
|
} else { |
|
|
|
|
dropPanel.hide() // hide affects checked, so this needs to be duplicated inside not outside if |
|
|
|
|
uncheckAll() |
|
|
|
|
checked = true |
|
|
|
|
var panelEdgeTopPoint = mapToItem(_root, width, 0) |
|
|
|
|
dropPanel.show(panelEdgeTopPoint, height, modelData.dropPanelComponent) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|