-
Notifications
You must be signed in to change notification settings - Fork 28
/
ChannelRow.qml
85 lines (72 loc) · 1.98 KB
/
ChannelRow.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import QtQuick 2.1
import QtQuick.Window 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.1
Rectangle {
id: channelBlock
property var channel
property alias signalRepeater:signalRepeater
color: '#333'
Button {
anchors.top: parent.top
anchors.left: parent.left
width: timelinePane.spacing
height: timelinePane.spacing
property var icons: [
'mv',
'svmi',
'simv',
]
iconSource: 'qrc:/icons/' + icons[channel.mode] + '.png'
style: ButtonStyle {
background: Rectangle {
opacity: control.pressed ? 0.3 : control.checked ? 0.2 : 0.1
color: 'black'
}
}
function updateMode() {
var chIdx = {A: 0, B: 1}[channel.label];
var devIdx = parent.parent.parent.currentIndex * 2;
var xyPlot = xyPane.devRep.itemAt(parent.parent.parent.currentIndex).itemAt(chIdx);
xyPlot.ysignal = (channel.mode == 1) ? xyPlot.isignal : xyPlot.vsignal;
xyPlot.xsignal = (channel.mode == 1) ? xyPlot.vsignal : xyPlot.isignal;
}
menu: Menu {
MenuItem { text: "Measure Voltage"
onTriggered: channel.mode = 0
}
MenuItem { text: "Source Voltage, Measure Current"
onTriggered: channel.mode = 1
}
MenuItem { text: "Source Current, Measure Voltage"
onTriggered: channel.mode = 2
}
}
}
Text {
text: "Channel " + channel.label
color: 'white'
rotation: -90
transformOrigin: Item.TopLeft
font.pixelSize: 18 / session.devices.length
y: width + timelinePane.spacing + 8
x: (timelinePane.spacing - height) / 2
}
ColumnLayout {
anchors.fill: parent
anchors.leftMargin: timelinePane.spacing
spacing: 0
Repeater {
id: signalRepeater
model: modelData.signals
SignalRow {
Layout.fillHeight: true
Layout.fillWidth: true
Layout.minimumHeight: channelBlock.height / 2
signal: model
xaxis: timeline_xaxis
}
}
}
}