Skip to content

Commit 7faf7da

Browse files
committed
Format QML files
1 parent 50ff730 commit 7faf7da

File tree

6 files changed

+260
-133
lines changed

6 files changed

+260
-133
lines changed

resources/ContactModel.qml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ ListModel {
55
name: "Bill Smith"
66
number: "555 3264"
77
}
8+
89
ListElement {
910
name: "John Brown"
1011
number: "555 8426"
1112
}
13+
1214
ListElement {
1315
name: "Sam Wise"
1416
number: "555 0473"
1517
}
18+
1619
}

resources/SolutionTab.qml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,89 @@
1+
import QtCharts 2.2
12
import QtQuick 2.5
23
import QtQuick.Controls 2.12
3-
import QtCharts 2.2
4-
import QtQuick.Layouts 1.15
54
import QtQuick.Controls 1.4
6-
5+
import QtQuick.Layouts 1.15
76
import "SolutionTabComponents" as SolutionTabComponents
87

9-
Item{
8+
Item {
109
id: solutionTab
10+
1111
width: parent.width
1212
height: parent.height
13+
1314
SplitView {
1415
id: solutionSplitView
16+
1517
anchors.fill: parent
1618
orientation: Qt.Horizontal
1719
width: parent.width
1820
height: parent.height
21+
1922
Rectangle {
2023
id: solutionTable
24+
2125
width: 200
2226
color: "lightblue"
27+
2328
Text {
2429
text: "View 1"
2530
anchors.centerIn: parent
2631
}
32+
2733
}
34+
2835
Rectangle {
2936
id: solutionPlots
37+
3038
Layout.minimumWidth: 200
3139
Layout.fillWidth: true
3240

3341
TabBar {
3442
id: solutionBar
43+
3544
z: 100
45+
3646
Repeater {
3747
model: ["Position", "Velocity"]
48+
3849
TabButton {
3950
text: modelData
4051
width: implicitWidth
4152
}
53+
4254
}
55+
4356
}
57+
4458
Rectangle {
4559
id: solutionTabBackground
60+
4661
width: parent.width
4762
height: parent.height
4863
anchors.top: solutionBar.bottom
64+
Component.onCompleted: {
65+
}
66+
4967
StackLayout {
5068
id: solutionBarLayout
69+
5170
width: parent.width
5271
height: parent.height
5372
currentIndex: solutionBar.currentIndex
73+
5474
Item {
5575
id: solutionPositionTab
5676
}
57-
SolutionTabComponents.SolutionVelocityTab{}
5877

59-
}
60-
Component.onCompleted: {
78+
SolutionTabComponents.SolutionVelocityTab {
79+
}
80+
6181
}
82+
6283
}
6384

6485
}
6586

66-
67-
}
87+
}
88+
6889
}
Lines changed: 85 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,157 +1,194 @@
1-
1+
import QtCharts 2.2
22
import QtQuick 2.6
33
import QtQuick.Controls 2.12
4-
import QtCharts 2.2
54
import QtQuick.Layouts 1.15
6-
75
import SwiftConsole 1.0
86

97
Item {
10-
11-
SolutionVelocityPoints {
12-
id: solutionVelocityPoints
13-
}
14-
158
id: solutionVelocityTab
16-
width: parent.width
17-
height: parent.height
9+
1810
property variant labels: ["Horizontal", "Vertical"]
1911
property variant lines: []
2012
property variant colors: []
2113
property variant available_units: []
2214
property variant unit: ""
15+
16+
width: parent.width
17+
height: parent.height
18+
Component.onCompleted: {
19+
}
20+
21+
SolutionVelocityPoints {
22+
id: solutionVelocityPoints
23+
}
24+
2325
Rectangle {
2426
id: solutionVelocityArea
27+
2528
width: parent.width
2629
height: parent.height
30+
2731
ColumnLayout {
2832
id: solutionVelocityAreaRowLayout
33+
2934
anchors.fill: parent
3035
width: parent.width
3136
height: parent.height
3237
spacing: 0
3338

3439
ComboBox {
3540
id: solutionVelocitySelectedUnit
41+
3642
Layout.alignment: Qt.AlignCenter
3743
width: 100
3844
model: available_units
3945
onCurrentIndexChanged: {
40-
if (!available_units){
41-
return;
42-
}
46+
if (!available_units)
47+
return ;
48+
4349
data_model.solution_velocity_unit(available_units[currentIndex]);
4450
}
4551
}
52+
4653
ChartView {
4754
id: solutionVelocityChart
55+
4856
Layout.preferredWidth: parent.width
4957
Layout.preferredHeight: parent.height - 100
5058
Layout.alignment: Qt.AlignBottom
5159
Layout.bottomMargin: 20
5260
Layout.fillHeight: true
5361
backgroundColor: "#CDC9C9"
54-
plotAreaColor: "#FFFFFF"
62+
plotAreaColor: "#FFFFFF"
5563
legend.visible: false
5664
antialiasing: true
65+
Component.onCompleted: {
66+
}
67+
5768
Rectangle {
5869
id: lineLegend
70+
5971
border.color: "#000000"
6072
border.width: 1
61-
6273
anchors.bottom: solutionVelocityChart.bottom
6374
anchors.left: solutionVelocityChart.left
6475
anchors.bottomMargin: 120
6576
anchors.leftMargin: 80
6677
implicitHeight: lineLegendRepeater.height
6778
width: lineLegendRepeater.width
68-
6979

7080
Column {
7181
id: lineLegendRepeater
82+
7283
spacing: -1
7384
padding: 10
7485
anchors.bottom: lineLegend.bottom
86+
7587
Repeater {
76-
model: labels
7788
id: lineLegendRepeaterRows
89+
90+
model: labels
91+
7892
Row {
93+
Component.onCompleted: {
94+
for (var idx in colors) {
95+
if (lineLegendRepeaterRows.itemAt(idx))
96+
lineLegendRepeaterRows.itemAt(idx).children[0].color = colors[idx];
97+
98+
}
99+
}
100+
79101
Rectangle {
80102
id: marker
103+
81104
width: 20
82105
height: 3
83106
color: "#000000"
84107
anchors.verticalCenter: parent.verticalCenter
85108
}
86-
Text {
109+
110+
Text {
87111
id: label
112+
88113
text: modelData
89114
font.pointSize: 9
90115
anchors.verticalCenter: parent.verticalCenter
91116
anchors.verticalCenterOffset: -1
92117
}
93-
Component.onCompleted: {
94-
for (var idx in colors) {
95-
if (lineLegendRepeaterRows.itemAt(idx)){
96-
lineLegendRepeaterRows.itemAt(idx).children[0].color = colors[idx];
97-
}
98-
}
99-
}
118+
100119
}
120+
101121
}
102-
122+
103123
}
124+
104125
}
126+
105127
ValueAxis {
128+
// useOpenGL: true // [CPP-93] Invesigate usage of `useOpenGL` in plots
129+
106130
id: solutionVelocityXAxis
107-
labelsFont { pointSize: 10; bold: true }
131+
108132
labelsAngle: 45
109133
titleText: "GPS Time of Week"
110134
gridVisible: true
111135
lineVisible: true
112136
minorGridVisible: true
113137
minorGridLineColor: "#CDC9C9"
114138
visible: true
115-
// useOpenGL: true // [CPP-93] Invesigate usage of `useOpenGL` in plots
139+
140+
labelsFont {
141+
pointSize: 10
142+
bold: true
143+
}
144+
116145
}
146+
117147
ValueAxis {
148+
// useOpenGL: true // [CPP-93] Invesigate usage of `useOpenGL` in plots
149+
118150
id: solutionVelocityYAxis
151+
119152
titleText: solutionVelocitySelectedUnit.currentText
120153
min: 0
121154
max: 1
122-
labelsFont { pointSize: 10; bold: true }
123155
gridVisible: true
124156
lineVisible: true
125157
minorGridVisible: true
126158
minorGridLineColor: "#CDC9C9"
127159
visible: true
128-
// useOpenGL: true // [CPP-93] Invesigate usage of `useOpenGL` in plots
160+
161+
labelsFont {
162+
pointSize: 10
163+
bold: true
164+
}
165+
129166
}
167+
130168
Timer {
131-
interval: 1000/5 // 5 Hz refresh
169+
interval: 1000 / 5 // 5 Hz refresh
132170
running: true
133171
repeat: true
134172
onTriggered: {
135-
if (!solutionTab.visible) {
136-
return;
137-
}
173+
if (!solutionTab.visible)
174+
return ;
175+
138176
solution_velocity_model.fill_console_points(solutionVelocityPoints);
139-
if (!solutionVelocityPoints.points.length) {
140-
return;
141-
}
177+
if (!solutionVelocityPoints.points.length)
178+
return ;
179+
142180
var points = solutionVelocityPoints.points;
143181
if (colors != solutionVelocityPoints.colors) {
144182
colors = solutionVelocityPoints.colors;
145183
for (var idx in colors) {
146-
if (lineLegendRepeaterRows.itemAt(idx)){
184+
if (lineLegendRepeaterRows.itemAt(idx))
147185
lineLegendRepeaterRows.itemAt(idx).children[0].color = colors[idx];
148-
}
186+
149187
}
150188
}
151-
if (available_units != solutionVelocityPoints.available_units) {
189+
if (available_units != solutionVelocityPoints.available_units)
152190
available_units = solutionVelocityPoints.available_units;
153-
}
154-
191+
155192
if (!lines.length) {
156193
for (var idx in labels) {
157194
var line = solutionVelocityChart.createSeries(ChartView.SeriesTypeLine, labels[idx], solutionVelocityXAxis);
@@ -162,22 +199,20 @@ Item {
162199
}
163200
}
164201
solutionVelocityPoints.fill_series(lines);
165-
166202
var last = points[0][points[0].length - 1];
167-
solutionVelocityXAxis.min = last.x-20;
203+
solutionVelocityXAxis.min = last.x - 20;
168204
solutionVelocityXAxis.max = last.x;
169-
170-
if (solutionVelocityYAxis.min!=solutionVelocityPoints.min_ || solutionVelocityYAxis.max!=solutionVelocityPoints.max_){
205+
if (solutionVelocityYAxis.min != solutionVelocityPoints.min_ || solutionVelocityYAxis.max != solutionVelocityPoints.max_) {
171206
solutionVelocityYAxis.min = solutionVelocityPoints.min_;
172207
solutionVelocityYAxis.max = solutionVelocityPoints.max_;
173208
}
174209
}
175210
}
176-
Component.onCompleted: {
177-
}
211+
178212
}
213+
179214
}
215+
180216
}
181-
Component.onCompleted: {
182-
}
217+
183218
}

0 commit comments

Comments
 (0)