QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
SeverityPill.qml
Go to the documentation of this file.
1import QtQuick
2
3import QGroundControl
4
5/// Pill showing the most severe level: Error, then Warning, then Info
6StatusPill {
7 text: _style ? _style.text : ""
8 color: _style ? _style.color : "transparent"
9
10 property int errorCount: 0
11 property int warningCount: 0
12 property int unreadCount: 0
13 property string warningLabel: qsTr("Warning")
14
15 readonly property string severity: {
16 if (errorCount > 0) {
17 return "error"
18 }
19 if (warningCount > 0) {
20 return "warning"
21 }
22 if (unreadCount > 0) {
23 return "info"
24 }
25 return ""
26 }
27
28 readonly property var _palette: QGroundControl.globalPalette
29 readonly property var _styles: ({
30 error: { text: qsTr("Error"), color: _palette.errorIndicator },
31 warning: { text: warningLabel, color: _palette.warningIndicator },
32 info: { text: qsTr("Info"), color: _palette.colorBlue }
33 })
34 readonly property var _style: _styles[severity]
35}