Commit b2635848 authored by Don Gagne's avatar Don Gagne

Small screen support

parent 6dce17ee
...@@ -25,16 +25,17 @@ Rectangle { ...@@ -25,16 +25,17 @@ Rectangle {
property var showAlternateIcon property var showAlternateIcon
property var rotateImage property var rotateImage
property var buttonEnabled property var buttonEnabled
property var buttonVisible
signal clicked(int index, bool checked) signal clicked(int index, bool checked)
readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2 readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
readonly property real _buttonSpacing: ScreenTools.defaultFontPixelWidth readonly property real _buttonSpacing: ScreenTools.defaultFontPixelWidth
readonly property bool _showOptionalElements: !ScreenTools.isShortScreen
ExclusiveGroup { QGCPalette { id: qgcPal }
id: dropButtonsExclusiveGroup ExclusiveGroup { id: dropButtonsExclusiveGroup }
}
function uncheckAll() { function uncheckAll() {
dropButtonsExclusiveGroup.current = null dropButtonsExclusiveGroup.current = null
...@@ -65,31 +66,34 @@ Rectangle { ...@@ -65,31 +66,34 @@ Rectangle {
QGCLabel { QGCLabel {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
text: title text: title
visible: _showOptionalElements
} }
Item { width: 1; height: _buttonSpacing } Item { width: 1; height: _buttonSpacing; visible: _showOptionalElements }
Rectangle { Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: 1 height: 1
color: qgcPal.text color: qgcPal.text
visible: _showOptionalElements
} }
Repeater { Repeater {
id: repeater id: repeater
delegate: Column { delegate: Column {
id: buttonColumn id: buttonColumn
width: buttonStripColumn.width width: buttonStripColumn.width
visible: _root.buttonVisible ? _root.buttonVisible[index] : true
property bool checked: false property bool checked: false
property ExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup property ExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup
property var _iconSource: modelData.iconSource property var _iconSource: modelData.iconSource
property var _alternateIconSource: modelData.alternateIconSource property var _alternateIconSource: modelData.alternateIconSource
property var _source: _root.showAlternateIcon[index] ? _alternateIconSource : _iconSource property var _source: (_root.showAlternateIcon && _root.showAlternateIcon[index]) ? _alternateIconSource : _iconSource
property bool rotateImage: _root.rotateImage[index] property bool rotateImage: _root.rotateImage ? _root.rotateImage[index] : false
onExclusiveGroupChanged: { onExclusiveGroupChanged: {
if (exclusiveGroup) { if (exclusiveGroup) {
...@@ -106,7 +110,11 @@ Rectangle { ...@@ -106,7 +110,11 @@ Rectangle {
} }
} }
Item { width: 1; height: _buttonSpacing } Item {
width: 1
height: _buttonSpacing
visible: index == 0 ? _showOptionalElements : true
}
Rectangle { Rectangle {
anchors.left: parent.left anchors.left: parent.left
...@@ -139,8 +147,8 @@ Rectangle { ...@@ -139,8 +147,8 @@ Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
height: parent.height + buttonLabel.height + buttonColumn.spacing height: parent.height + (_showOptionalElements? buttonLabel.height + buttonColumn.spacing : 0)
visible: _root.buttonEnabled[index] visible: _root.buttonEnabled ? _root.buttonEnabled[index] : true
onClicked: { onClicked: {
if (modelData.dropPanelComponent === undefined) { if (modelData.dropPanelComponent === undefined) {
...@@ -171,6 +179,7 @@ Rectangle { ...@@ -171,6 +179,7 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: ScreenTools.smallFontPointSize font.pointSize: ScreenTools.smallFontPointSize
text: modelData.name text: modelData.name
visible: _showOptionalElements
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment