25개 이상의 토픽을 선택하실 수 없습니다.
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- import QtQuick
- import QtQuick.Controls
- import QtQuick.Dialogs
- import QtQuick.Layouts
-
- Window {
- width: 640
- height: 480
- visible: true
- title: qsTr("AuseftDDSPlugTest")
-
- property var currentPlugin: null
-
- ColumnLayout {
- anchors.centerIn: parent
- spacing: 20
-
- // Load Plugin Button
- Button {
- text: "Load Plugin"
- onClicked: fileDialog.open()
- }
-
- // Configure Plugin Button
- Button {
- text: "Configure Plugin"
- enabled: currentPlugin !== null
- onClicked: {
- if (currentPlugin) {
- currentPlugin.config()
- }
- }
- }
-
- // Send Data Button
- Button {
- text: "Send Data"
- onClicked: {
- if (currentPlugin) {
- currentPlugin.publishOnce()
- } else {
- statusText.text = "No plugin loaded"
- }
- }
- }
-
- // 显示状态信息
- Text {
- id: statusText
- text: "Ready"
- color: "black"
- }
- }
-
- FileDialog {
- id: fileDialog
- title: "选择插件文件"
- nameFilters: ["插件文件 (*.dll *.so)"]
-
- onAccepted: {
- var filePath = decodeURIComponent(selectedFile)
- currentPlugin = pluginLoader.loadPlugin(filePath)
- if (currentPlugin) {
- if (currentPlugin.init()) {
- statusText.text = "Plugin loaded: " + filePath
- } else {
- statusText.text = "Failed to initialize plugin"
- }
- }
- }
- }
-
- // 处理插件加载错误
- Connections {
- target: pluginLoader
- function onMessagePublished(message, index) {
- statusText.text = "Message #" + index + ": " + message
- }
- }
- }
|