-
Notifications
You must be signed in to change notification settings - Fork 11
/
FrameRateVisualizer.qml
61 lines (56 loc) · 1.22 KB
/
FrameRateVisualizer.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
** Copyright (C) 2023 Victron Energy B.V.
** See LICENSE.txt for license information.
*/
import QtQuick
import QtQuick.Window
import Victron.VenusOS
Loader {
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
// Disable the visualizer and the model while the application isn't visible
active: FrameRateModel.enabled
property bool frameRateModelWasEnabled: false
property bool applicationVisible: BackendConnection.applicationVisible
onApplicationVisibleChanged: {
if (!applicationVisible) {
frameRateModelWasEnabled = FrameRateModel.enabled
FrameRateModel.enabled = false
} else if (frameRateModelWasEnabled) {
FrameRateModel.enabled = true
}
}
sourceComponent: Component {
Item {
Row {
id: fpsRow
anchors {
left: parent.left
bottom: parent.bottom
}
height: 4
Repeater {
height: parent.height
model: FrameRateModel
delegate: Rectangle {
height: parent.height
width: root.width / FrameRateModel.chunkCount
color: model.decoration
}
}
}
Label {
anchors {
right: parent.right
bottom: fpsRow.top
margins: fpsRow.height
}
text: FrameRateModel.frameRate
color: "white"
}
}
}
}