Args.qml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. import QtQuick
  2. import QtQuick.Controls
  3. import FluentUI
  4. import "./ModelParse.js" as MP
  5. Item {
  6. property string argsData: ""
  7. property string valueData: ""
  8. signal updataData
  9. FluText{
  10. text: 'this args '
  11. }
  12. FluScrollablePage{
  13. id: contentScrollable
  14. width: 700
  15. height: parent.height
  16. anchors.horizontalCenter: parent.horizontalCenter
  17. }
  18. Component{
  19. id: group_item
  20. property string groupName: ""
  21. property string groupTitle: ""
  22. property var argumentValue: {""}
  23. FluExpander{
  24. headerText: group_item.groupTitle
  25. width: contentScrollable.width
  26. Column{
  27. id: group_column
  28. anchors.fill: parent
  29. spacing: 4
  30. FluTextBox{
  31. placeholderText:"单行输入框"
  32. }
  33. FluTextBox{
  34. placeholderText:"单行输入框"
  35. }
  36. FluTextBox{
  37. placeholderText:"单行输入框"
  38. }
  39. }
  40. }
  41. }
  42. // Component{
  43. // id: string_item
  44. // property var modelData: {""}
  45. // Item{
  46. // width: contentScrollable.width
  47. // FluTextBox{
  48. // id: string_text
  49. // anchors{
  50. // top: parent.top
  51. // right: parent.right
  52. // }
  53. // placeholderText: modelData.default
  54. // }
  55. // FluText{
  56. // id: string_title
  57. // anchors{
  58. // top: parent.top
  59. // left: parent.left
  60. // right: string_text.left
  61. // }
  62. // text: modelData.title
  63. // font: FluTextStyle.BodyStrong
  64. // wrapMode: Text.WrapAnywhere
  65. // padding: 6
  66. // }
  67. // FluText{
  68. // id: string_description
  69. // anchors{
  70. // top: string_title.bottom
  71. // }
  72. // width: string_title.width
  73. // text: modelData.description
  74. // font: FluTextStyle.Caption
  75. // wrapMode: Text.WrapAnywhere
  76. // padding: 6
  77. // }
  78. // }
  79. // }
  80. // Component{
  81. // id: int_item
  82. // }
  83. // Component{
  84. // id: float_item
  85. // }
  86. // Component{
  87. // id: bool_item
  88. // }
  89. // Compoenent{
  90. // id: enum_item
  91. // }
  92. onArgsDataChanged: {
  93. }
  94. onValueDataChanged: {
  95. }
  96. onUpdataData: {
  97. if(argsData === ""){
  98. console.error("解析 顺序出问题了")
  99. return
  100. }
  101. if(valueData === ""){
  102. console.debug("没有数据")
  103. }
  104. var args = JSON.parse(argsData)
  105. var values = JSON.parse(valueData)
  106. var group = MP.parseGroup(args["properties"])
  107. var groups = MP.parseGroups(args["properties"])
  108. for(let task in group){
  109. var argument = MP.parseArgument(args.definitions, group[task])
  110. const groupLetter = groups[group[task]]
  111. var argumentVuale = MP.mergeArgument(argument, values[groupLetter])
  112. console.debug(JSON.stringify( argumentVuale ))
  113. console.debug("---------------------------------------------------------------")
  114. // createGroup(groupLetter, group[task], argumentVuale)
  115. }
  116. }
  117. /**
  118. * 创建某个组 的显示组件并显示
  119. * @param {Object} groupName 变量的名字 是小写的
  120. * @param {Object} groupTitle 用于向用户显示的名字 大写的
  121. * @param {Object} argumentVaule 总的显示的参数
  122. * @returns {Object}
  123. */
  124. // function createGroup(groupName, groupTitle, argumentValue){
  125. // var object = group_item.createObject(contentScrollable)
  126. // if(object !== null){
  127. // object.groupName = groupName
  128. // object.groupTitle = groupTitle
  129. // object.argumentVale = argumentValue
  130. // }
  131. // }
  132. }