Surface3DSpecifics.qml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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 QtQuick.Controls as Controls
  7. Column {
  8. anchors.left: parent.left
  9. anchors.right: parent.right
  10. Section {
  11. anchors.left: parent.left
  12. anchors.right: parent.right
  13. caption: qsTr("Surface")
  14. SectionLayout {
  15. PropertyLabel {
  16. text: qsTr("Flip Grid")
  17. tooltip: qsTr("Flip horizontal grid")
  18. Layout.fillWidth: true
  19. }
  20. SecondColumnLayout {
  21. CheckBox {
  22. backendValue: backendValues.flipHorizontalGrid
  23. Layout.fillWidth: true
  24. }
  25. }
  26. PropertyLabel {
  27. text: qsTr("Polar Coordinates")
  28. tooltip: qsTr("Use polar coordinates")
  29. Layout.fillWidth: true
  30. }
  31. SecondColumnLayout {
  32. CheckBox {
  33. id: polarCheckbox
  34. backendValue: backendValues.polar
  35. Layout.fillWidth: true
  36. }
  37. }
  38. PropertyLabel {
  39. text: qsTr("Label Offset")
  40. tooltip: qsTr("Normalized horizontal radial label offset")
  41. Layout.fillWidth: true
  42. visible: polarCheckbox.checked
  43. }
  44. SecondColumnLayout {
  45. visible: polarCheckbox.checked
  46. SpinBox {
  47. backendValue: backendValues.radialLabelOffset
  48. minimumValue: 0.0
  49. maximumValue: 1.0
  50. stepSize: 0.01
  51. decimals: 2
  52. Layout.fillWidth: true
  53. }
  54. }
  55. PropertyLabel {
  56. text: qsTr("Selection Mode")
  57. tooltip: qsTr("Surface point selection mode")
  58. Layout.fillWidth: true
  59. }
  60. SecondColumnLayout {
  61. id: selectionLayout
  62. property bool isInModel: backendValue.isInModel;
  63. property bool isInSubState: backendValue.isInSubState;
  64. property bool selectionChangedFlag: selectionChanged
  65. property variant backendValue: backendValues.selectionMode
  66. property variant valueFromBackend: backendValue.value
  67. property string enumScope: "Graphs3D.SelectionFlag"
  68. property string enumSeparator: " | "
  69. property int checkedCount: 0
  70. property bool item: false
  71. property bool row: false
  72. property bool column: false
  73. property bool slice: false
  74. property bool multi: false
  75. function checkValue(checkedVariable, variableText, expressionBase) {
  76. var expressionStr = expressionBase
  77. if (checkedVariable) {
  78. if (expressionStr !== "") {
  79. expressionStr += enumSeparator
  80. }
  81. expressionStr += enumScope
  82. expressionStr += "."
  83. expressionStr += variableText
  84. checkedCount++
  85. }
  86. return expressionStr
  87. }
  88. function composeSelectionMode() {
  89. var expressionStr = ""
  90. checkedCount = 0
  91. expressionStr = checkValue(item, "Item", expressionStr)
  92. expressionStr = checkValue(row, "Row", expressionStr)
  93. expressionStr = checkValue(column, "Column", expressionStr)
  94. expressionStr = checkValue(slice, "Slice", expressionStr)
  95. expressionStr = checkValue(multi, "MultiSeries", expressionStr)
  96. if (checkedCount === 0)
  97. backendValue.expression = enumScope + ".None"
  98. else
  99. backendValue.expression = expressionStr
  100. }
  101. function evaluate() {
  102. if (backendValue.value === undefined)
  103. return
  104. item = (backendValue.expression.indexOf("Item") !== -1)
  105. row = (backendValue.expression.indexOf("Row") !== -1)
  106. column = (backendValue.expression.indexOf("Column") !== -1)
  107. slice = (backendValue.expression.indexOf("Slice") !== -1)
  108. multi = (backendValue.expression.indexOf("MultiSeries") !== -1)
  109. itemBox.checked = item
  110. rowBox.checked = row
  111. columnBox.checked = column
  112. sliceBox.checked = slice
  113. multiSeriesBox.checked = multi
  114. }
  115. onSelectionChangedFlagChanged: evaluate()
  116. onIsInModelChanged: evaluate()
  117. onIsInSubStateChanged: evaluate()
  118. onBackendValueChanged: evaluate()
  119. onValueFromBackendChanged: evaluate()
  120. ColumnLayout {
  121. anchors.fill: parent
  122. Controls.CheckBox {
  123. id: itemBox
  124. text: "Item"
  125. Layout.fillWidth: true
  126. onClicked: {
  127. selectionLayout.item = checked
  128. selectionLayout.composeSelectionMode()
  129. }
  130. }
  131. Controls.CheckBox {
  132. id: rowBox
  133. text: "Row"
  134. Layout.fillWidth: true
  135. onClicked: {
  136. selectionLayout.row = checked
  137. selectionLayout.composeSelectionMode()
  138. }
  139. }
  140. Controls.CheckBox {
  141. id: columnBox
  142. text: "Column"
  143. Layout.fillWidth: true
  144. onClicked: {
  145. selectionLayout.column = checked
  146. selectionLayout.composeSelectionMode()
  147. }
  148. }
  149. Controls.CheckBox {
  150. id: sliceBox
  151. text: "Slice"
  152. Layout.fillWidth: true
  153. onClicked: {
  154. selectionLayout.slice = checked
  155. selectionLayout.composeSelectionMode()
  156. }
  157. }
  158. Controls.CheckBox {
  159. id: multiSeriesBox
  160. text: "MultiSeries"
  161. Layout.fillWidth: true
  162. onClicked: {
  163. selectionLayout.multi = checked
  164. selectionLayout.composeSelectionMode()
  165. }
  166. }
  167. }
  168. }
  169. }
  170. }
  171. GraphsSection {}
  172. GraphsCameraSection {}
  173. }