SmartLockerTools/Analyser/qml/ConnectionItem.qml

81 lines
2.2 KiB
QML
Raw Normal View History

2024-06-13 15:41:40 +08:00
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Analyser
RowLayout {
GroupBox {
title: "串口设置"
Layout.fillWidth: true
GridLayout {
columns: 2
Text {
text: qsTr("端口")
}
ComboBox {
id: serialPort
enabled: !App.connected
implicitWidth: 100
}
Text {
text: qsTr("波特率")
}
ComboBox {
id: baudrate
enabled: !App.connected
implicitWidth: 110
model: ["2000000", "115200"]
}
Button {
text: "刷新"
enabled: !App.connected
onClicked: {
serialPort.model = App.availableSerialPorts()
}
}
Button {
text: App.connected ? "断开" : "连接"
onClicked: App.connected ? App.close() : App.open(
serialPort.currentText,
parseInt(baudrate.currentText))
}
}
}
GroupBox {
Layout.fillWidth: true
Layout.fillHeight: true
title: "UVC设置"
GridLayout {
columns: 2
Text {
text: qsTr("设备名")
}
ComboBox {
id: uvcs
enabled: !App.uvcOpened
implicitWidth: 150
}
Button {
enabled: !App.uvcOpened
text: "刷新"
onClicked: uvcs.model = App.availableUsbVideoCameras()
}
Button {
text: App.uvcOpened ? "关闭" : "连接"
onClicked: App.uvcOpened ? App.closeUVC() : App.openUVC(
uvcs.currentText)
}
}
}
Component.onCompleted: {
serialPort.model = App.availableSerialPorts()
uvcs.model = App.availableUsbVideoCameras()
}
}