更好采集数据选择文件夹方式。

This commit is contained in:
luocai 2024-08-29 18:34:10 +08:00
parent 72cdbd8d98
commit e3d599fdf7
2 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(AntiClipSettings VERSION 1.1 LANGUAGES C CXX) project(AntiClipSettings VERSION 1.2 LANGUAGES C CXX)
set(APPLICATION_NAME "视觉防夹设备上位机工具") set(APPLICATION_NAME "视觉防夹设备上位机工具")
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)

View File

@ -21,6 +21,8 @@ ApplicationWindow {
onClicked: { onClicked: {
deviceList.currentIndex = -1 deviceList.currentIndex = -1
App.startSearchDevice() App.startSearchDevice()
App.collector.stop() //
App.collector.path=""
} }
} }
Label { Label {
@ -87,8 +89,9 @@ ApplicationWindow {
} }
} }
onCurrentIndexChanged: { onCurrentIndexChanged: {
// deviceVersion.text = App.devices.get(deviceList.currentIndex).softwareVersion;
App.connectToDevice(deviceList.currentIndex) App.connectToDevice(deviceList.currentIndex)
App.collector.stop() //
App.collector.path=""
} }
ProgressBar { ProgressBar {
anchors.left: parent.left anchors.left: parent.left
@ -213,14 +216,16 @@ ApplicationWindow {
function showFolderDialog(onSelected) { function showFolderDialog(onSelected) {
let dialog = null let dialog = null
if (isQt5) { if (isQt5) {
dialog = Qt.createQmlObject("import Qt.labs.platform 1.1; FolderDialog {}", window, "myDynamicSnippet") dialog = Qt.createQmlObject("import QtQuick.Dialogs 1.3; FileDialog {}", window, "myDynamicSnippet")
dialog.selectExisting = true
dialog.selectFolder = true
} else { } else {
dialog = Qt.createQmlObject("import QtQuick.Dialogs; FolderDialog {}", window, "myDynamicSnippet") dialog = Qt.createQmlObject("import QtQuick.Dialogs; FolderDialog {}", window, "myDynamicSnippet")
} }
if (dialog) { if (dialog) {
dialog.visible = true dialog.visible = true
dialog.accepted.connect(function () { dialog.accepted.connect(function () {
onSelected(isQt5 ? dialog.folder : dialog.selectedFolder) onSelected(isQt5 ? dialog.fileUrl : dialog.selectedFolder)
dialog.destroy() dialog.destroy()
}) })
dialog.rejected.connect(function () { dialog.rejected.connect(function () {