| 1 | import QtQuick |
| 2 | import QtQuick.Layouts |
| 3 | |
| 4 | RowLayout { |
| 5 | id: r |
| 6 | property string label: "" |
| 7 | property real frac: 0 |
| 8 | property string valueText: "" |
| 9 | property color fill: Theme.accent |
| 10 | Layout.fillWidth: true |
| 11 | spacing: 10 |
| 12 | |
| 13 | Text { |
| 14 | text: r.label |
| 15 | Layout.preferredWidth: 72 |
| 16 | elide: Text.ElideRight |
| 17 | color: Theme.dim |
| 18 | font.family: Theme.font |
| 19 | font.pixelSize: Theme.fontSize - 1 |
| 20 | } |
| 21 | Rectangle { |
| 22 | Layout.fillWidth: true |
| 23 | Layout.preferredHeight: 6 |
| 24 | color: Theme.surfaceHi |
| 25 | Rectangle { |
| 26 | width: parent.width * Math.max(0, Math.min(1, r.frac)) |
| 27 | height: parent.height |
| 28 | color: r.fill |
| 29 | } |
| 30 | } |
| 31 | Text { |
| 32 | text: r.valueText |
| 33 | Layout.preferredWidth: 96 |
| 34 | horizontalAlignment: Text.AlignRight |
| 35 | color: Theme.fg |
| 36 | font.family: Theme.font |
| 37 | font.pixelSize: Theme.fontSize - 1 |
| 38 | } |
| 39 | } |