Bars3DSpecifics.qml 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. // Copyright (C) 2023 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
  3. import QtQuick
  4. import HelperWidgets
  5. import QtQuick.Layouts
  6. import StudioTheme 1.0 as StudioTheme
  7. import QtQuick.Controls as Controls
  8. Column {
  9. anchors.left: parent.left
  10. anchors.right: parent.right
  11. Section {
  12. anchors.left: parent.left
  13. anchors.right: parent.right
  14. caption: qsTr("Bars")
  15. SectionLayout {
  16. PropertyLabel {
  17. text: qsTr("Uniform Scaling")
  18. tooltip: qsTr("Proportionally scale multiple series")
  19. Layout.fillWidth: true
  20. }
  21. SecondColumnLayout {
  22. CheckBox {
  23. backendValue: backendValues.multiSeriesUniform
  24. Layout.fillWidth: true
  25. }
  26. }
  27. PropertyLabel {
  28. text: qsTr("Thickness")
  29. tooltip: qsTr("Thickness ratio between X and Z dimension")
  30. Layout.fillWidth: true
  31. }
  32. SecondColumnLayout {
  33. SpinBox {
  34. backendValue: backendValues.barThickness
  35. minimumValue: 0.01
  36. maximumValue: 100.0
  37. stepSize: 0.01
  38. decimals: 2
  39. Layout.fillWidth: true
  40. }
  41. }
  42. PropertyLabel {
  43. text: qsTr("Spacing")
  44. tooltip: qsTr("Bar spacing in the X and Z dimensions")
  45. Layout.fillWidth: true
  46. }
  47. SecondColumnLayout {
  48. SpinBox {
  49. backendValue: backendValues.barSpacing_width
  50. minimumValue: 0.0
  51. maximumValue: 10.0
  52. stepSize: 0.01
  53. decimals: 2
  54. Layout.fillWidth: true
  55. }
  56. ControlLabel {
  57. text: qsTr("col")
  58. width: StudioTheme.Values.actionIndicatorWidth
  59. }
  60. SpinBox {
  61. backendValue: backendValues.barSpacing_height
  62. minimumValue: 0.0
  63. maximumValue: 10.0
  64. stepSize: 0.01
  65. decimals: 2
  66. Layout.fillWidth: true
  67. }
  68. ControlLabel {
  69. text: qsTr("row")
  70. width: StudioTheme.Values.actionIndicatorWidth
  71. }
  72. }
  73. PropertyLabel {
  74. text: qsTr("Relative Spacing")
  75. tooltip: qsTr("Set bar spacing relative to thickness")
  76. Layout.fillWidth: true
  77. }
  78. SecondColumnLayout {
  79. CheckBox {
  80. backendValue: backendValues.barSpacingRelative
  81. Layout.fillWidth: true
  82. }
  83. }
  84. PropertyLabel {
  85. text: qsTr("Series Margin")
  86. tooltip: qsTr("Margin between series columns in X and Z dimensions")
  87. Layout.fillWidth: true
  88. }
  89. SecondColumnLayout {
  90. SpinBox {
  91. backendValue: backendValues.barSeriesMargin_width
  92. minimumValue: 0.0
  93. maximumValue: 1.0
  94. stepSize: 0.01
  95. decimals: 2
  96. Layout.fillWidth: true
  97. }
  98. ControlLabel {
  99. text: qsTr("col")
  100. width: StudioTheme.Values.actionIndicatorWidth
  101. }
  102. SpinBox {
  103. backendValue: backendValues.barSeriesMargin_height
  104. minimumValue: 0.0
  105. maximumValue: 1.0
  106. stepSize: 0.01
  107. decimals: 2
  108. Layout.fillWidth: true
  109. }
  110. ControlLabel {
  111. text: qsTr("row")
  112. width: StudioTheme.Values.actionIndicatorWidth
  113. }
  114. }
  115. PropertyLabel {
  116. text: qsTr("Floor Level")
  117. tooltip: qsTr("Floor level in Y-axis data coordinates")
  118. Layout.fillWidth: true
  119. }
  120. SecondColumnLayout {
  121. LineEdit {
  122. backendValue: backendValues.floorLevel
  123. inputMethodHints: Qt.ImhFormattedNumbersOnly
  124. Layout.fillWidth: true
  125. }
  126. }
  127. PropertyLabel {
  128. text: qsTr("Selection Mode")
  129. tooltip: qsTr("Bar selection mode")
  130. Layout.fillWidth: true
  131. }
  132. SecondColumnLayout {
  133. id: selectionLayout
  134. property bool isInModel: backendValue.isInModel;
  135. property bool isInSubState: backendValue.isInSubState;
  136. property bool selectionChangedFlag: selectionChanged
  137. property variant backendValue: backendValues.selectionMode
  138. property variant valueFromBackend: backendValue.value
  139. property string enumScope: "Graphs3D.SelectionFlag"
  140. property string enumSeparator: " | "
  141. property int checkedCount: 0
  142. property bool item: false
  143. property bool row: false
  144. property bool column: false
  145. property bool slice: false
  146. property bool multi: false
  147. function checkValue(checkedVariable, variableText, expressionBase) {
  148. var expressionStr = expressionBase
  149. if (checkedVariable) {
  150. if (expressionStr !== "") {
  151. expressionStr += enumSeparator
  152. }
  153. expressionStr += enumScope
  154. expressionStr += "."
  155. expressionStr += variableText
  156. checkedCount++
  157. }
  158. return expressionStr
  159. }
  160. function composeSelectionMode() {
  161. var expressionStr = ""
  162. checkedCount = 0
  163. expressionStr = checkValue(item, "Item", expressionStr)
  164. expressionStr = checkValue(row, "Row", expressionStr)
  165. expressionStr = checkValue(column, "Column", expressionStr)
  166. expressionStr = checkValue(slice, "Slice", expressionStr)
  167. expressionStr = checkValue(multi, "MultiSeries", expressionStr)
  168. if (checkedCount === 0)
  169. backendValue.expression = enumScope + ".None"
  170. else
  171. backendValue.expression = expressionStr
  172. }
  173. function evaluate() {
  174. if (backendValue.value === undefined)
  175. return
  176. item = (backendValue.expression.indexOf("Item") !== -1)
  177. row = (backendValue.expression.indexOf("Row") !== -1)
  178. column = (backendValue.expression.indexOf("Column") !== -1)
  179. slice = (backendValue.expression.indexOf("Slice") !== -1)
  180. multi = (backendValue.expression.indexOf("MultiSeries") !== -1)
  181. itemBox.checked = item
  182. rowBox.checked = row
  183. columnBox.checked = column
  184. sliceBox.checked = slice
  185. multiSeriesBox.checked = multi
  186. }
  187. onSelectionChangedFlagChanged: evaluate()
  188. onIsInModelChanged: evaluate()
  189. onIsInSubStateChanged: evaluate()
  190. onBackendValueChanged: evaluate()
  191. onValueFromBackendChanged: evaluate()
  192. ColumnLayout {
  193. anchors.fill: parent
  194. Controls.CheckBox {
  195. id: itemBox
  196. text: "Item"
  197. Layout.fillWidth: true
  198. onClicked: {
  199. selectionLayout.item = checked
  200. selectionLayout.composeSelectionMode()
  201. }
  202. }
  203. Controls.CheckBox {
  204. id: rowBox
  205. text: "Row"
  206. Layout.fillWidth: true
  207. onClicked: {
  208. selectionLayout.row = checked
  209. selectionLayout.composeSelectionMode()
  210. }
  211. }
  212. Controls.CheckBox {
  213. id: columnBox
  214. text: "Column"
  215. Layout.fillWidth: true
  216. onClicked: {
  217. selectionLayout.column = checked
  218. selectionLayout.composeSelectionMode()
  219. }
  220. }
  221. Controls.CheckBox {
  222. id: sliceBox
  223. text: "Slice"
  224. Layout.fillWidth: true
  225. onClicked: {
  226. selectionLayout.slice = checked
  227. selectionLayout.composeSelectionMode()
  228. }
  229. }
  230. Controls.CheckBox {
  231. id: multiSeriesBox
  232. text: "MultiSeries"
  233. Layout.fillWidth: true
  234. onClicked: {
  235. selectionLayout.multi = checked
  236. selectionLayout.composeSelectionMode()
  237. }
  238. }
  239. }
  240. }
  241. }
  242. }
  243. GraphsSection {}
  244. GraphsCameraSection {}
  245. }