Browse Source

Only show indicator if red

QGC4.4
DonLakeFlyer 4 years ago committed by Don Gagne
parent
commit
c1d948152e
  1. 18
      src/QmlControls/IndicatorButton.qml

18
src/QmlControls/IndicatorButton.qml

@ -1,3 +1,12 @@
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* 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 2.3
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
@ -5,11 +14,9 @@ import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
// An IndicatorButton works just like q QGCButton with the additional support or a red/green /// Works just like a regular button but it can have a red indicator on the right side displayed
// indicator on the right edge.
QGCButton { QGCButton {
property bool indicatorGreen: false property bool indicatorGreen: false ///< true: no indicator shown, false: red indicator shown
Rectangle { Rectangle {
anchors.rightMargin: ScreenTools.defaultFontPixelWidth / 3 anchors.rightMargin: ScreenTools.defaultFontPixelWidth / 3
@ -18,6 +25,7 @@ QGCButton {
width: radius * 2 width: radius * 2
height: width height: width
radius: (ScreenTools.defaultFontPixelHeight * .75) / 2 radius: (ScreenTools.defaultFontPixelHeight * .75) / 2
color: indicatorGreen ? "#00d932" : "red" color: "red"
visible: enabled && !indicatorGreen
} }
} }

Loading…
Cancel
Save