-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBrainwaveVisualization.qml
More file actions
168 lines (145 loc) · 5.28 KB
/
BrainwaveVisualization.qml
File metadata and controls
168 lines (145 loc) · 5.28 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import QtQuick 6.5
import QtQuick.Controls 6.4
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick3D 6.7
import QtQuick.Dialogs
import Qt.labs.platform
// Brainwave Visualization
Rectangle {
color: "#718399"
Layout.fillWidth: true
Layout.fillHeight: true
ColumnLayout {
anchors.fill: parent
spacing: 10
// Grid Layout for 6 Graphs (2 Rows × 3 Columns)
GridLayout {
Layout.fillWidth: true
Layout.fillHeight: true
columns: 3
Layout.margins: 10
columnSpacing: 10
rowSpacing: 10
Repeater {
model: imageModel
delegate: Rectangle {
color: "#e6e6f0"
Layout.fillWidth: true
Layout.fillHeight: true
border.color: "#d0d0d8"
border.width: 1
radius: 4
Column {
width: parent.width
height: parent.height
spacing: 0
Rectangle {
width: parent.width
height: 30
color: "#242c4d"
Text {
// Extract just the first word from the title
text: {
var parts = model.graphTitle.split(" ");
return parts[0];
}
color: "white"
font.bold: true
font.pixelSize: 14
x: (parent.width - width) / 2
y: (parent.height - height) / 2
}
}
Rectangle {
width: parent.width
height: parent.height - 30
color: "white"
//Display Image
Image {
x: 8
y: 8
width: parent.width - 16
height: parent.height - 16
source: model.imagePath
fillMode: Image.PreserveAspectFit
}
}
}
}
}
}
// Refresh and Rollback buttons after graphs
RowLayout {
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
Layout.bottomMargin: 20
spacing: 15
// Refresh Button
Button {
text: "Refresh"
font.bold: true
implicitWidth: 120
implicitHeight: 40
property bool isHovering: false
HoverHandler { onHoveredChanged: parent.isHovering = hovered }
background: Rectangle {
// Use the isHovering property to change color
color: parent.isHovering ? "#3e4e7a" : "#2e3a5c"
radius: 4
// Add a smooth color transition
Behavior on color {
ColorAnimation {
duration: 150
}
}
}
contentItem: Text {
text: parent.text
font.pixelSize: 14
font.bold: true
color: "white"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: {
backend.setDataset("refresh")
}
}
// Rollback Button
Button {
text: "Rollback"
font.bold: true
implicitWidth: 120
implicitHeight: 40
// This property allows us to track the hover state
property bool isHovering: false
// Define the hover handler
HoverHandler {
onHoveredChanged: parent.isHovering = hovered
}
background: Rectangle {
// Use the isHovering property to change color
color: parent.isHovering ? "#3e4e7a" : "#2e3a5c"
radius: 4
Behavior on color {
ColorAnimation {
duration: 150
}
}
}
contentItem: Text {
text: parent.text
font.pixelSize: 14
font.bold: true
color: "white"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: {
// Display rollback plots
backend.setDataset("rollback")
}
}
}
}
}