QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
PlanPanelIconButton.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3
4import QGroundControl
5import QGroundControl.Controls
6
7/// Square icon-only button sized for touch
8AbstractButton {
9 id: control
10
11 property string iconSource
12 property real iconRotation: 0
13 property bool danger: false
14 property string accessibleName ///< Translated action name read by assistive technology
15
16 Accessible.name: accessibleName
17
18 implicitWidth: implicitHeight
19 implicitHeight: ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.implicitButtonHeight
20 padding: ScreenTools.defaultFontPixelHeight * 0.35
21 hoverEnabled: !ScreenTools.isMobile
22 focusPolicy: Qt.ClickFocus
23
24 QGCPalette { id: qgcPal; colorGroupEnabled: control.enabled }
25
26 background: Rectangle {
27 radius: ScreenTools.defaultBorderRadius
28 color: control.pressed ? qgcPal.accentSubtle : qgcPal.windowCard
29 border.color: control.hovered || control.pressed ? qgcPal.accent : qgcPal.borderSubtle
30 }
31
32 contentItem: QGCColoredImage {
33 source: control.iconSource
34 rotation: control.iconRotation
35 color: control.danger ? qgcPal.colorRed : qgcPal.textPrimary
36 fillMode: Image.PreserveAspectFit
37 sourceSize.height: height
38 }
39}