forked from 625781186/QmlSer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQmlSer.qml
186 lines (158 loc) · 3.15 KB
/
QmlSer.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
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtQuick.Controls 1.4
ApplicationWindow {
visible: true
width: 720
height: 560
title: "串口助手"
ColumnLayout {
anchors.fill: parent
anchors.margins: 10
spacing: 10
TextArea {
id: txtMain
objectName: "txtMain"
readOnly: true
Layout.fillWidth: true
Layout.fillHeight: true
}
RowLayout {
spacing: 10
Label {
id: lblSer
text: "串口号:"
}
ComboBox {
id: cmbPort
objectName: "cmbPort"
Layout.minimumWidth: 100 * 2 + 10 * 2 + lblSer.width
model: ports
}
Label {
text: "波特率:"
}
ComboBox {
id: cmbBaud
objectName: "cmbBaud"
Layout.minimumWidth: 100
model: [ "1200", "2400", "4800", "9600", "14400", "19200", "28800", "38400", "57600", "115200" ]
}
Label {
Layout.fillWidth: true
}
Button {
id: btnOpen
objectName: 'btnOpen'
Layout.minimumWidth: 100
text: "打开串口"
onClicked: Ser.on_btnOpen_clicked()
}
CheckBox {
id: chkRHex
objectName: "chkRHex"
Layout.minimumWidth: 80
text: "HEX 显示"
}
}
RowLayout {
spacing: 10
Label {
text: "数据位:"
}
ComboBox {
id: cmbData
objectName: "cmbData"
Layout.minimumWidth: 100
model: [ "8", "6", "7", "8", "9" ]
}
Label {
text: "校验位:"
}
ComboBox {
id: cmbParity
objectName: "cmbParity"
Layout.minimumWidth: 100
model: [ "None", "Odd", "Even", "One", "Zero" ]
}
Label {
text: "停止位:"
}
ComboBox {
id: cmbStop
objectName: "cmbStop"
Layout.minimumWidth: 100
model: [ "1", "2" ]
}
Label {
Layout.fillWidth: true
}
Button {
id: btnClear
Layout.minimumWidth: 100
text: "清除显示"
onClicked: Ser.on_btnClear_clicked()
}
CheckBox {
id: chkWave
objectName: "chkWave"
Layout.minimumWidth: 80
text: "波形显示"
}
}
GridLayout {
rows: 3
columns: 3
rowSpacing: 10
columnSpacing: 10
Layout.topMargin: 5
TextArea {
id: txtSend
objectName: "txtSend"
Layout.row: 0
Layout.column: 0
Layout.rowSpan: 3
Layout.fillWidth: true
Layout.maximumHeight: parent.height
Layout.rightMargin: 10
}
Button {
id: btnSend
Layout.row: 0
Layout.column: 1
Layout.rowSpan: 3
Layout.minimumWidth: 100
Layout.minimumHeight: parent.height
text: "发送"
onClicked: Ser.on_btnSend_clicked()
}
CheckBox {
id: chkTHex
objectName: "chkTHex"
Layout.row: 0
Layout.column: 2
Layout.minimumWidth: 80
text: "HEX 发送"
}
CheckBox {
id: chkLine
objectName: "chkLine"
Layout.row: 1
Layout.column: 2
Layout.minimumWidth: 80
text: "换行发送"
}
CheckBox {
id: chkTime
objectName: "chkTime"
Layout.row: 2
Layout.column: 2
Layout.minimumWidth: 80
text: "定时发送"
}
}
}
onClosing: {
Ser.on_closed()
}
}