import QtQuick import QtQuick.Controls import QtQuick.Layouts import QtQuick.Window Window { id: configWindow title: "Sample Machine Configuration" width: 400 height: 300 modality: Qt.ApplicationModal // 设置为模态窗口 ColumnLayout { anchors.fill: parent anchors.margins: 10 spacing: 10 GroupBox { title: "Basic Settings" Layout.fillWidth: true ColumnLayout { anchors.fill: parent GridLayout { columns: 2 Layout.fillWidth: true Label { text: "Machine Name:" } TextField { id: machineName Layout.fillWidth: true placeholderText: "Enter machine name" } Label { text: "IP Address:" } TextField { id: ipAddress Layout.fillWidth: true placeholderText: "Enter IP address" } Label { text: "Port:" } SpinBox { id: portNumber from: 1024 to: 65535 value: 7410 } } } } Item { Layout.fillHeight: true } // 弹性空间 RowLayout { Layout.alignment: Qt.AlignRight spacing: 10 Button { text: "Cancel" onClicked: configWindow.close() } Button { text: "Save" onClicked: { // 这里可以发送信号到 C++ 保存配置 configWindow.close() } } } } }