QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
LogViewerMessagesTab.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4
5import QGroundControl
6import QGroundControl.Controls
7
8/// Messages tab for the Log Viewer.
9ScrollView {
10 id: control
11
12 required property var logParser
13
14 clip: true
15
16 QGCPalette { id: qgcPal }
17
18 ListView {
19 anchors.fill: parent
20 model: logParser.messages
21 spacing: ScreenTools.defaultFontPixelHeight * 0.2
22 clip: true
23 ScrollBar.vertical: ScrollBar { }
24
25 delegate: Rectangle {
26 width: ListView.view.width
27 height: _msgRow.implicitHeight + ScreenTools.defaultFontPixelHeight * 0.4
28 color: index % 2 === 0 ? qgcPal.windowShade : qgcPal.windowShadeDark
29 radius: 2
30
31 RowLayout {
32 id: _msgRow
33 anchors.verticalCenter: parent.verticalCenter
34 anchors.left: parent.left
35 anchors.right: parent.right
36 anchors.margins: ScreenTools.defaultFontPixelWidth * 0.5
37 spacing: ScreenTools.defaultFontPixelWidth * 0.5
38
39 QGCLabel {
40 readonly property double _t: Number(modelData.time)
41 text: {
42 if (isNaN(_t) || _t < 0) return ""
43 const st = logParser.startTime
44 if (st && !isNaN(st.getTime()) && st.getTime() > 0)
45 return Qt.formatDateTime(new Date(st.getTime() + _t * 1000), "yyyy-MM-dd HH:mm:ss.zzz")
46 return _t.toFixed(3) + "s"
47 }
48 color: Qt.rgba(qgcPal.text.r, qgcPal.text.g, qgcPal.text.b, 0.6)
49 Layout.preferredWidth: (logParser.startTime && !isNaN(logParser.startTime.getTime()) && logParser.startTime.getTime() > 0)
50 ? ScreenTools.defaultFontPixelWidth * 20
51 : ScreenTools.defaultFontPixelWidth * 10
52 horizontalAlignment: Text.AlignRight
53 }
54
55 QGCLabel {
56 text: String(modelData.text)
57 Layout.fillWidth: true
58 wrapMode: Text.WordWrap
59 maximumLineCount: 3
60 }
61 }
62 }
63 }
64}