SimulationViewMenuComponent.qml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. // Copyright (c) 2022 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.15
  4. import QtQuick.Layouts 1.1
  5. import QtQuick.Controls 2.1
  6. import UM 1.5 as UM
  7. import Cura 1.0 as Cura
  8. Rectangle
  9. {
  10. Cura.ExpandableComponent
  11. {
  12. id: cutPlaneBase
  13. dragPreferencesNamePrefix: "view/cutplane"
  14. contentHeaderTitle: catalog.i18nc("@label", "Cut plane")
  15. anchors
  16. {
  17. top: parent.top
  18. left: parent.horizontalCenter
  19. right: parent.right
  20. bottom: parent.bottom
  21. }
  22. headerItem: Item
  23. {
  24. UM.Label
  25. {
  26. id: cutPlaneLabel
  27. text: catalog.i18nc("@label", "Cut plane")
  28. height: parent.height
  29. elide: Text.ElideRight
  30. font: UM.Theme.getFont("medium")
  31. color: UM.Theme.getColor("text_medium")
  32. }
  33. UM.Label
  34. {
  35. text: cutPlaneOff.checked ? cutPlaneOff.text : (cutPlaneXAxis.checked ? cutPlaneXAxis.text : cutPlaneYAxis.text)
  36. anchors
  37. {
  38. left: cutPlaneLabel.right
  39. leftMargin: UM.Theme.getSize("default_margin").width
  40. right: parent.right
  41. }
  42. height: parent.height
  43. elide: Text.ElideRight
  44. font: UM.Theme.getFont("medium")
  45. }
  46. }
  47. contentItem: Column
  48. {
  49. id: cutPlaneSettings
  50. width: UM.Theme.getSize("layerview_menu_size").width - 2 * UM.Theme.getSize("default_margin").width
  51. height: implicitHeight
  52. ColumnLayout
  53. {
  54. spacing: UM.Theme.getSize("default_margin").width
  55. RowLayout
  56. {
  57. spacing: UM.Theme.getSize("default_margin").width
  58. ButtonGroup
  59. {
  60. id: cutPlaneAxisButtons
  61. exclusive: true
  62. buttons: [cutPlaneOff, cutPlaneXAxis, cutPlaneYAxis]
  63. }
  64. Cura.RadioButton
  65. {
  66. id: cutPlaneOff
  67. text: catalog.i18nc("@label cut-plane off", "Off")
  68. checked: true
  69. onCheckedChanged: UM.SimulationView.setCutPlaneOff()
  70. }
  71. Cura.RadioButton
  72. {
  73. id: cutPlaneXAxis
  74. text: catalog.i18nc("@label cut-plane on x-axis", "X-Axis")
  75. onCheckedChanged: UM.SimulationView.setCutPlaneX()
  76. }
  77. Cura.RadioButton
  78. {
  79. id: cutPlaneYAxis
  80. text: catalog.i18nc("@label cut-plane on y-axis", "Y-Axis")
  81. onCheckedChanged: UM.SimulationView.setCutPlaneY()
  82. }
  83. UM.CheckBox
  84. {
  85. id: cutPlaneFlip
  86. enabled: ! cutPlaneOff.checked
  87. text: catalog.i18nc("@label cut-plane reversed", "Flipped")
  88. onClicked: UM.SimulationView.flipCutPlane()
  89. }
  90. }
  91. Slider
  92. {
  93. id: cutPlaneSlider
  94. Layout.alignment: Qt.AlignCenter
  95. Layout.preferredWidth: parent.width
  96. enabled: ! cutPlaneOff.checked
  97. from: (cutPlaneXAxis.checked ? UM.SimulationView.buildVolumeWidth : UM.SimulationView.buildVolumeDepth) / -2
  98. value: 0
  99. to: (cutPlaneXAxis.checked ? UM.SimulationView.buildVolumeWidth : UM.SimulationView.buildVolumeDepth) / 2
  100. onPositionChanged: UM.SimulationView.setCutPlaneSlider(value)
  101. }
  102. }
  103. }
  104. }
  105. Cura.ExpandableComponent
  106. {
  107. id: colorSchemeBase
  108. dragPreferencesNamePrefix: "view/colorscheme"
  109. contentHeaderTitle: catalog.i18nc("@label", "Color scheme")
  110. anchors
  111. {
  112. top: parent.top
  113. left: parent.left
  114. right: parent.horizontalCenter
  115. bottom: parent.bottom
  116. }
  117. Connections
  118. {
  119. target: UM.Preferences
  120. function onPreferenceChanged(preference)
  121. {
  122. if (preference !== "view/only_show_top_layers" && preference !== "view/top_layer_count" && ! preference.match("layerview/"))
  123. {
  124. return;
  125. }
  126. layerTypeCombobox.currentIndex = UM.SimulationView.compatibilityMode ? 1 : UM.Preferences.getValue("layerview/layer_view_type")
  127. layerTypeCombobox.updateLegends(layerTypeCombobox.currentIndex)
  128. viewSettings.extruder_opacities = UM.Preferences.getValue("layerview/extruder_opacities").split("|")
  129. viewSettings.show_travel_moves = UM.Preferences.getValue("layerview/show_travel_moves")
  130. viewSettings.show_helpers = UM.Preferences.getValue("layerview/show_helpers")
  131. viewSettings.show_skin = UM.Preferences.getValue("layerview/show_skin")
  132. viewSettings.show_infill = UM.Preferences.getValue("layerview/show_infill")
  133. viewSettings.only_show_top_layers = UM.Preferences.getValue("view/only_show_top_layers")
  134. viewSettings.top_layer_count = UM.Preferences.getValue("view/top_layer_count")
  135. }
  136. }
  137. headerItem: Item
  138. {
  139. UM.Label
  140. {
  141. id: colorSchemeLabel
  142. text: catalog.i18nc("@label", "Color scheme")
  143. height: parent.height
  144. elide: Text.ElideRight
  145. font: UM.Theme.getFont("medium")
  146. color: UM.Theme.getColor("text_medium")
  147. }
  148. UM.Label
  149. {
  150. text: layerTypeCombobox.currentText
  151. anchors
  152. {
  153. left: colorSchemeLabel.right
  154. leftMargin: UM.Theme.getSize("default_margin").width
  155. right: parent.right
  156. }
  157. height: parent.height
  158. elide: Text.ElideRight
  159. font: UM.Theme.getFont("medium")
  160. }
  161. }
  162. contentItem: Column
  163. {
  164. id: viewSettings
  165. property var extruder_opacities: UM.Preferences.getValue("layerview/extruder_opacities").split("|")
  166. property bool show_travel_moves: UM.Preferences.getValue("layerview/show_travel_moves")
  167. property bool show_helpers: UM.Preferences.getValue("layerview/show_helpers")
  168. property bool show_skin: UM.Preferences.getValue("layerview/show_skin")
  169. property bool show_infill: UM.Preferences.getValue("layerview/show_infill")
  170. property bool show_starts: UM.Preferences.getValue("layerview/show_starts")
  171. // If we are in compatibility mode, we only show the "line type"
  172. property bool show_legend: UM.SimulationView.compatibilityMode ? true : UM.Preferences.getValue("layerview/layer_view_type") == 1
  173. property bool show_gradient: UM.SimulationView.compatibilityMode ? false : UM.Preferences.getValue("layerview/layer_view_type") == 2 || UM.Preferences.getValue("layerview/layer_view_type") == 3
  174. property bool show_feedrate_gradient: show_gradient && UM.Preferences.getValue("layerview/layer_view_type") == 2
  175. property bool show_thickness_gradient: show_gradient && UM.Preferences.getValue("layerview/layer_view_type") == 3
  176. property bool show_line_width_gradient: show_gradient && UM.Preferences.getValue("layerview/layer_view_type") == 4
  177. property bool show_flow_rate_gradient: show_gradient && UM.Preferences.getValue("layerview/layer_view_type") == 5
  178. property bool only_show_top_layers: UM.Preferences.getValue("view/only_show_top_layers")
  179. property int top_layer_count: UM.Preferences.getValue("view/top_layer_count")
  180. width: UM.Theme.getSize("layerview_menu_size").width - 2 * UM.Theme.getSize("default_margin").width
  181. height: implicitHeight
  182. spacing: UM.Theme.getSize("layerview_row_spacing").height
  183. // matches SimulationView.py
  184. ListModel
  185. {
  186. id: layerViewTypes
  187. }
  188. Component.onCompleted:
  189. {
  190. layerViewTypes.append({
  191. text: catalog.i18nc("@label:listbox", "Material Color"),
  192. type_id: 0
  193. })
  194. layerViewTypes.append({
  195. text: catalog.i18nc("@label:listbox", "Line Type"),
  196. type_id: 1
  197. })
  198. layerViewTypes.append({
  199. text: catalog.i18nc("@label:listbox", "Speed"),
  200. type_id: 2
  201. })
  202. layerViewTypes.append({
  203. text: catalog.i18nc("@label:listbox", "Layer Thickness"),
  204. type_id: 3 // these ids match the switching in the shader
  205. })
  206. layerViewTypes.append({
  207. text: catalog.i18nc("@label:listbox", "Line Width"),
  208. type_id: 4
  209. })
  210. layerViewTypes.append({
  211. text: catalog.i18nc("@label:listbox", "Flow"),
  212. type_id: 5
  213. })
  214. }
  215. Cura.ComboBox
  216. {
  217. id: layerTypeCombobox
  218. textRole: "text"
  219. valueRole: "type_id"
  220. width: parent.width
  221. implicitHeight: UM.Theme.getSize("setting_control").height
  222. model: layerViewTypes
  223. visible: !UM.SimulationView.compatibilityMode
  224. onActivated: (index) => {UM.Preferences.setValue("layerview/layer_view_type", index)}
  225. Component.onCompleted:
  226. {
  227. currentIndex = UM.SimulationView.compatibilityMode ? 1 : UM.Preferences.getValue("layerview/layer_view_type");
  228. updateLegends(currentIndex);
  229. }
  230. function updateLegends(type_id)
  231. {
  232. // Update the visibility of the legends.
  233. viewSettings.show_legend = UM.SimulationView.compatibilityMode || (type_id == 1);
  234. viewSettings.show_gradient = !UM.SimulationView.compatibilityMode &&
  235. (type_id == 2 || type_id == 3 || type_id == 4 || type_id == 5) ;
  236. viewSettings.show_feedrate_gradient = viewSettings.show_gradient && (type_id == 2);
  237. viewSettings.show_thickness_gradient = viewSettings.show_gradient && (type_id == 3);
  238. viewSettings.show_line_width_gradient = viewSettings.show_gradient && (type_id == 4);
  239. viewSettings.show_flow_rate_gradient = viewSettings.show_gradient && (type_id == 5);
  240. }
  241. }
  242. UM.Label
  243. {
  244. id: compatibilityModeLabel
  245. text: catalog.i18nc("@label", "Compatibility Mode")
  246. visible: UM.SimulationView.compatibilityMode
  247. height: UM.Theme.getSize("layerview_row").height
  248. width: parent.width
  249. }
  250. Item // Spacer
  251. {
  252. height: UM.Theme.getSize("narrow_margin").width
  253. width: width
  254. }
  255. Repeater
  256. {
  257. model: CuraApplication.getExtrudersModel()
  258. UM.CheckBox
  259. {
  260. id: extrudersModelCheckBox
  261. checked: viewSettings.extruder_opacities[index] > 0.5 || viewSettings.extruder_opacities[index] == undefined || viewSettings.extruder_opacities[index] == ""
  262. height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height
  263. width: parent.width
  264. visible: !UM.SimulationView.compatibilityMode
  265. onClicked:
  266. {
  267. viewSettings.extruder_opacities[index] = checked ? 1.0 : 0.0
  268. UM.Preferences.setValue("layerview/extruder_opacities", viewSettings.extruder_opacities.join("|"));
  269. }
  270. Rectangle
  271. {
  272. id: swatch
  273. anchors.verticalCenter: parent.verticalCenter
  274. anchors.right: extrudersModelCheckBox.right
  275. width: UM.Theme.getSize("layerview_legend_size").width
  276. height: UM.Theme.getSize("layerview_legend_size").height
  277. color: model.color
  278. border.width: UM.Theme.getSize("default_lining").width
  279. border.color: UM.Theme.getColor("lining")
  280. }
  281. UM.Label
  282. {
  283. text: model.name
  284. elide: Text.ElideRight
  285. color: UM.Theme.getColor("setting_control_text")
  286. anchors
  287. {
  288. verticalCenter: parent.verticalCenter
  289. left: extrudersModelCheckBox.left
  290. right: extrudersModelCheckBox.right
  291. leftMargin: UM.Theme.getSize("checkbox").width + Math.round(UM.Theme.getSize("default_margin").width / 2)
  292. rightMargin: UM.Theme.getSize("default_margin").width * 2
  293. }
  294. }
  295. }
  296. }
  297. Repeater
  298. {
  299. model: ListModel
  300. {
  301. id: typesLegendModel
  302. Component.onCompleted:
  303. {
  304. typesLegendModel.append({
  305. label: catalog.i18nc("@label", "Travels"),
  306. initialValue: viewSettings.show_travel_moves,
  307. preference: "layerview/show_travel_moves",
  308. colorId: "layerview_move_combing"
  309. });
  310. typesLegendModel.append({
  311. label: catalog.i18nc("@label", "Helpers"),
  312. initialValue: viewSettings.show_helpers,
  313. preference: "layerview/show_helpers",
  314. colorId: "layerview_support"
  315. });
  316. typesLegendModel.append({
  317. label: catalog.i18nc("@label", "Shell"),
  318. initialValue: viewSettings.show_skin,
  319. preference: "layerview/show_skin",
  320. colorId: "layerview_inset_0"
  321. });
  322. typesLegendModel.append({
  323. label: catalog.i18nc("@label", "Infill"),
  324. initialValue: viewSettings.show_infill,
  325. preference: "layerview/show_infill",
  326. colorId: "layerview_infill"
  327. });
  328. if (! UM.SimulationView.compatibilityMode)
  329. {
  330. typesLegendModel.append({
  331. label: catalog.i18nc("@label", "Starts"),
  332. initialValue: viewSettings.show_starts,
  333. preference: "layerview/show_starts",
  334. colorId: "layerview_starts"
  335. });
  336. }
  337. }
  338. }
  339. UM.CheckBox
  340. {
  341. id: legendModelCheckBox
  342. checked: model.initialValue
  343. onClicked: UM.Preferences.setValue(model.preference, checked)
  344. height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height
  345. width: parent.width
  346. Rectangle
  347. {
  348. anchors.verticalCenter: parent.verticalCenter
  349. anchors.right: legendModelCheckBox.right
  350. width: UM.Theme.getSize("layerview_legend_size").width
  351. height: UM.Theme.getSize("layerview_legend_size").height
  352. color: UM.Theme.getColor(model.colorId)
  353. border.width: UM.Theme.getSize("default_lining").width
  354. border.color: UM.Theme.getColor("lining")
  355. visible: viewSettings.show_legend
  356. }
  357. UM.Label
  358. {
  359. text: label
  360. font: UM.Theme.getFont("default")
  361. elide: Text.ElideRight
  362. renderType: Text.NativeRendering
  363. color: UM.Theme.getColor("setting_control_text")
  364. anchors.verticalCenter: parent.verticalCenter
  365. anchors.left: legendModelCheckBox.left
  366. anchors.right: legendModelCheckBox.right
  367. anchors.leftMargin: UM.Theme.getSize("checkbox").width + Math.round(UM.Theme.getSize("default_margin").width / 2)
  368. anchors.rightMargin: UM.Theme.getSize("default_margin").width * 2
  369. }
  370. }
  371. }
  372. UM.CheckBox
  373. {
  374. checked: viewSettings.only_show_top_layers
  375. onClicked: UM.Preferences.setValue("view/only_show_top_layers", checked ? 1.0 : 0.0)
  376. text: catalog.i18nc("@label", "Only Show Top Layers")
  377. visible: UM.SimulationView.compatibilityMode
  378. width: parent.width
  379. }
  380. UM.CheckBox
  381. {
  382. checked: viewSettings.top_layer_count == 5
  383. onClicked: UM.Preferences.setValue("view/top_layer_count", checked ? 5 : 1)
  384. text: catalog.i18nc("@label", "Show 5 Detailed Layers On Top")
  385. width: parent.width
  386. visible: UM.SimulationView.compatibilityMode
  387. }
  388. Repeater
  389. {
  390. model: ListModel
  391. {
  392. id: typesLegendModelNoCheck
  393. Component.onCompleted:
  394. {
  395. typesLegendModelNoCheck.append({
  396. label: catalog.i18nc("@label", "Top / Bottom"),
  397. colorId: "layerview_skin",
  398. });
  399. typesLegendModelNoCheck.append({
  400. label: catalog.i18nc("@label", "Inner Wall"),
  401. colorId: "layerview_inset_x",
  402. });
  403. }
  404. }
  405. UM.Label
  406. {
  407. text: label
  408. visible: viewSettings.show_legend
  409. id: typesLegendModelLabel
  410. height: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height
  411. width: parent.width
  412. color: UM.Theme.getColor("setting_control_text")
  413. Rectangle
  414. {
  415. anchors.verticalCenter: parent.verticalCenter
  416. anchors.right: typesLegendModelLabel.right
  417. width: UM.Theme.getSize("layerview_legend_size").width
  418. height: UM.Theme.getSize("layerview_legend_size").height
  419. color: UM.Theme.getColor(model.colorId)
  420. border.width: UM.Theme.getSize("default_lining").width
  421. border.color: UM.Theme.getColor("lining")
  422. }
  423. }
  424. }
  425. // Text for the minimum, maximum and units for the feedrates and layer thickness
  426. Item
  427. {
  428. id: gradientLegend
  429. visible: viewSettings.show_gradient
  430. width: parent.width
  431. height: UM.Theme.getSize("layerview_row").height
  432. UM.Label //Minimum value.
  433. {
  434. text:
  435. {
  436. if (UM.SimulationView.layerActivity && CuraApplication.platformActivity)
  437. {
  438. // Feedrate selected
  439. if (UM.Preferences.getValue("layerview/layer_view_type") == 2)
  440. {
  441. return parseFloat(UM.SimulationView.minFeedrate).toFixed(2)
  442. }
  443. // Layer thickness selected
  444. if (UM.Preferences.getValue("layerview/layer_view_type") == 3)
  445. {
  446. return parseFloat(UM.SimulationView.minThickness).toFixed(2)
  447. }
  448. // Line width selected
  449. if(UM.Preferences.getValue("layerview/layer_view_type") == 4)
  450. {
  451. return parseFloat(UM.SimulationView.minLineWidth).toFixed(2);
  452. }
  453. // Flow Rate selected
  454. if(UM.Preferences.getValue("layerview/layer_view_type") == 5)
  455. {
  456. return parseFloat(UM.SimulationView.minFlowRate).toFixed(2);
  457. }
  458. }
  459. return catalog.i18nc("@label","min")
  460. }
  461. anchors.left: parent.left
  462. }
  463. UM.Label //Unit in the middle.
  464. {
  465. text:
  466. {
  467. if (UM.SimulationView.layerActivity && CuraApplication.platformActivity)
  468. {
  469. // Feedrate selected
  470. if (UM.Preferences.getValue("layerview/layer_view_type") == 2)
  471. {
  472. return "mm/s"
  473. }
  474. // Layer thickness selected
  475. if (UM.Preferences.getValue("layerview/layer_view_type") == 3)
  476. {
  477. return "mm"
  478. }
  479. //Line width selected
  480. if(UM.Preferences.getValue("layerview/layer_view_type") == 4)
  481. {
  482. return "mm"
  483. }
  484. // Flow Rate selected
  485. if (UM.Preferences.getValue("layerview/layer_view_type") == 5)
  486. {
  487. return "mm³/s"
  488. }
  489. }
  490. return ""
  491. }
  492. anchors.horizontalCenter: parent.horizontalCenter
  493. color: UM.Theme.getColor("setting_control_text")
  494. }
  495. UM.Label //Maximum value.
  496. {
  497. text: {
  498. if (UM.SimulationView.layerActivity && CuraApplication.platformActivity)
  499. {
  500. // Feedrate selected
  501. if (UM.Preferences.getValue("layerview/layer_view_type") == 2)
  502. {
  503. return parseFloat(UM.SimulationView.maxFeedrate).toFixed(2)
  504. }
  505. // Layer thickness selected
  506. if (UM.Preferences.getValue("layerview/layer_view_type") == 3)
  507. {
  508. return parseFloat(UM.SimulationView.maxThickness).toFixed(2)
  509. }
  510. //Line width selected
  511. if(UM.Preferences.getValue("layerview/layer_view_type") == 4)
  512. {
  513. return parseFloat(UM.SimulationView.maxLineWidth).toFixed(2);
  514. }
  515. // Flow rate selected
  516. if(UM.Preferences.getValue("layerview/layer_view_type") == 5)
  517. {
  518. return parseFloat(UM.SimulationView.maxFlowRate).toFixed(2);
  519. }
  520. }
  521. return catalog.i18nc("@label","max")
  522. }
  523. anchors.right: parent.right
  524. color: UM.Theme.getColor("setting_control_text")
  525. }
  526. }
  527. // Gradient colors for feedrate
  528. Rectangle
  529. {
  530. id: feedrateGradient
  531. visible: (
  532. viewSettings.show_feedrate_gradient ||
  533. viewSettings.show_line_width_gradient
  534. )
  535. anchors.left: parent.left
  536. anchors.right: parent.right
  537. height: Math.round(UM.Theme.getSize("layerview_row").height * 1.5)
  538. border.width: UM.Theme.getSize("default_lining").width
  539. border.color: UM.Theme.getColor("lining")
  540. gradient: Gradient
  541. {
  542. orientation: Gradient.Horizontal
  543. GradientStop
  544. {
  545. position: 0.000
  546. color: Qt.rgba(0, 0, 1, 1)
  547. }
  548. GradientStop
  549. {
  550. position: 0.25
  551. color: Qt.rgba(0.25, 1, 0, 1)
  552. }
  553. GradientStop
  554. {
  555. position: 0.375
  556. color: Qt.rgba(0.375, 0.5, 0, 1)
  557. }
  558. GradientStop
  559. {
  560. position: 1.0
  561. color: Qt.rgba(1, 0.5, 0, 1)
  562. }
  563. }
  564. }
  565. // Gradient colors for layer thickness (similar to parula colormap)
  566. Rectangle
  567. {
  568. id: thicknessGradient
  569. visible: (
  570. viewSettings.show_thickness_gradient
  571. )
  572. anchors.left: parent.left
  573. anchors.right: parent.right
  574. height: Math.round(UM.Theme.getSize("layerview_row").height * 1.5)
  575. border.width: UM.Theme.getSize("default_lining").width
  576. border.color: UM.Theme.getColor("lining")
  577. gradient: Gradient
  578. {
  579. orientation: Gradient.Horizontal
  580. GradientStop
  581. {
  582. position: 0.000
  583. color: Qt.rgba(0, 0, 0.5, 1)
  584. }
  585. GradientStop
  586. {
  587. position: 0.25
  588. color: Qt.rgba(0, 0.375, 0.75, 1)
  589. }
  590. GradientStop
  591. {
  592. position: 0.5
  593. color: Qt.rgba(0, 0.75, 0.5, 1)
  594. }
  595. GradientStop
  596. {
  597. position: 0.75
  598. color: Qt.rgba(1, 0.75, 0.25, 1)
  599. }
  600. GradientStop
  601. {
  602. position: 1.0
  603. color: Qt.rgba(1, 1, 0, 1)
  604. }
  605. }
  606. }
  607. // Gradient colors for flow (similar to jet colormap)
  608. Rectangle
  609. {
  610. id: jetGradient
  611. visible: (
  612. viewSettings.show_flow_rate_gradient
  613. )
  614. anchors.left: parent.left
  615. anchors.right: parent.right
  616. height: Math.round(UM.Theme.getSize("layerview_row").height * 1.5)
  617. border.width: UM.Theme.getSize("default_lining").width
  618. border.color: UM.Theme.getColor("lining")
  619. gradient: Gradient
  620. {
  621. orientation: Gradient.Horizontal
  622. GradientStop
  623. {
  624. position: 0.0
  625. color: Qt.rgba(0, 0, 0.5, 1)
  626. }
  627. GradientStop
  628. {
  629. position: 0.125
  630. color: Qt.rgba(0, 0.0, 1.0, 1)
  631. }
  632. GradientStop
  633. {
  634. position: 0.25
  635. color: Qt.rgba(0, 0.5, 1.0, 1)
  636. }
  637. GradientStop
  638. {
  639. position: 0.375
  640. color: Qt.rgba(0.0, 1.0, 1.0, 1)
  641. }
  642. GradientStop
  643. {
  644. position: 0.5
  645. color: Qt.rgba(0.5, 1.0, 0.5, 1)
  646. }
  647. GradientStop
  648. {
  649. position: 0.625
  650. color: Qt.rgba(1.0, 1.0, 0.0, 1)
  651. }
  652. GradientStop
  653. {
  654. position: 0.75
  655. color: Qt.rgba(1.0, 0.5, 0, 1)
  656. }
  657. GradientStop
  658. {
  659. position: 0.875
  660. color: Qt.rgba(1.0, 0.0, 0, 1)
  661. }
  662. GradientStop
  663. {
  664. position: 1.0
  665. color: Qt.rgba(0.5, 0, 0, 1)
  666. }
  667. }
  668. }
  669. }
  670. }
  671. FontMetrics
  672. {
  673. id: fontMetrics
  674. font: UM.Theme.getFont("default")
  675. }
  676. }