奥特QT DDS 插件库
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

74 行
1.9KB

  1. import QtQuick
  2. import QtQuick.Controls
  3. import QtQuick.Layouts
  4. import QtQuick.Window
  5. Window {
  6. id: configWindow
  7. title: "Sample Machine Configuration"
  8. width: 400
  9. height: 300
  10. modality: Qt.ApplicationModal // 设置为模态窗口
  11. ColumnLayout {
  12. anchors.fill: parent
  13. anchors.margins: 10
  14. spacing: 10
  15. GroupBox {
  16. title: "Basic Settings"
  17. Layout.fillWidth: true
  18. ColumnLayout {
  19. anchors.fill: parent
  20. GridLayout {
  21. columns: 2
  22. Layout.fillWidth: true
  23. Label { text: "Machine Name:" }
  24. TextField {
  25. id: machineName
  26. Layout.fillWidth: true
  27. placeholderText: "Enter machine name"
  28. }
  29. Label { text: "IP Address:" }
  30. TextField {
  31. id: ipAddress
  32. Layout.fillWidth: true
  33. placeholderText: "Enter IP address"
  34. }
  35. Label { text: "Port:" }
  36. SpinBox {
  37. id: portNumber
  38. from: 1024
  39. to: 65535
  40. value: 7410
  41. }
  42. }
  43. }
  44. }
  45. Item { Layout.fillHeight: true } // 弹性空间
  46. RowLayout {
  47. Layout.alignment: Qt.AlignRight
  48. spacing: 10
  49. Button {
  50. text: "Cancel"
  51. onClicked: configWindow.close()
  52. }
  53. Button {
  54. text: "Save"
  55. onClicked: {
  56. // 这里可以发送信号到 C++ 保存配置
  57. configWindow.close()
  58. }
  59. }
  60. }
  61. }
  62. }