/**************************************************************************** * * (c) 2009-2016 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. * ****************************************************************************/ import QtQuick 2.3 import QtQuick.Controls 1.2 import QGroundControl.ScreenTools 1.0 import QGroundControl.Palette 1.0 Rectangle { id: _root color: qgcPal.window width: ScreenTools.isMobile ? ScreenTools.minTouchPixels : ScreenTools.defaultFontPixelWidth * 6 height: buttonStripColumn.height + (buttonStripColumn.anchors.margins * 2) radius: _radius property string title: "Title" property alias model: repeater.model property var showAlternateIcon ///< List of bool values, one for each button in strip - true: show alternate icon, false: show normal icon property var rotateImage ///< List of bool values, one for each button in strip - true: animation rotation, false: static image property var animateImage ///< List of bool values, one for each button in strip - true: animate image, false: static image property var buttonEnabled ///< List of bool values, one for each button in strip - true: button enabled, false: button disabled property var buttonVisible ///< List of bool values, one for each button in strip - true: button visible, false: button invisible property real maxHeight ///< Maximum height for control, determines whether text is hidden to make control shorter signal clicked(int index, bool checked) readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2 readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _buttonSpacing: ScreenTools.defaultFontPixelWidth // All of the following values, connections and function are to support the ability to determine // whether to show or hide the optional elements on the fly. property bool _showOptionalElements: true property bool _needRecalc: false Component.onCompleted: recalcShowOptionalElements() onMaxHeightChanged: recalcShowOptionalElements() Connections { target: ScreenTools onDefaultFontPixelWidthChanged: recalcShowOptionalElements() onDefaultFontPixelHeightChanged: recalcShowOptionalElements() } onHeightChanged: { if (_needRecalc) { _needRecalc = false if (maxHeight && height > maxHeight) { _showOptionalElements = false } } } function recalcShowOptionalElements() { if (maxHeight > 0) { _needRecalc = false _showOptionalElements = height <= maxHeight _needRecalc = true } } QGCPalette { id: qgcPal } ExclusiveGroup { id: dropButtonsExclusiveGroup } function uncheckAll() { dropButtonsExclusiveGroup.current = null // Signal all toggles as off for (var i=0; i