styles.qml 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  1. // Copyright (c) 2021 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 2.2
  5. //import QtQuick.Controls.Styles 2.2
  6. import UM 1.1 as UM
  7. QtObject
  8. {
  9. property Component print_setup_header_button: Component
  10. {
  11. /*
  12. ButtonStyle
  13. {
  14. background: Rectangle
  15. {
  16. color:
  17. {
  18. if(control.enabled)
  19. {
  20. if(control.valueError)
  21. {
  22. return UM.Theme.getColor("setting_validation_error_background");
  23. }
  24. else if(control.valueWarning)
  25. {
  26. return UM.Theme.getColor("setting_validation_warning_background");
  27. }
  28. else
  29. {
  30. return UM.Theme.getColor("setting_control");
  31. }
  32. }
  33. else
  34. {
  35. return UM.Theme.getColor("setting_control_disabled");
  36. }
  37. }
  38. radius: UM.Theme.getSize("setting_control_radius").width
  39. border.width: UM.Theme.getSize("default_lining").width
  40. border.color:
  41. {
  42. if (control.enabled)
  43. {
  44. if (control.valueError)
  45. {
  46. return UM.Theme.getColor("setting_validation_error");
  47. }
  48. else if (control.valueWarning)
  49. {
  50. return UM.Theme.getColor("setting_validation_warning");
  51. }
  52. else if (control.hovered)
  53. {
  54. return UM.Theme.getColor("setting_control_border_highlight");
  55. }
  56. else
  57. {
  58. return UM.Theme.getColor("setting_control_border");
  59. }
  60. }
  61. else
  62. {
  63. return UM.Theme.getColor("setting_control_disabled_border");
  64. }
  65. }
  66. UM.RecolorImage
  67. {
  68. id: downArrow
  69. anchors.verticalCenter: parent.verticalCenter
  70. anchors.right: parent.right
  71. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  72. width: UM.Theme.getSize("standard_arrow").width
  73. height: UM.Theme.getSize("standard_arrow").height
  74. sourceSize.height: width
  75. color: control.enabled ? UM.Theme.getColor("setting_control_button") : UM.Theme.getColor("setting_category_disabled_text")
  76. source: UM.Theme.getIcon("ChevronSingleDown")
  77. }
  78. Label
  79. {
  80. id: printSetupComboBoxLabel
  81. color: control.enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
  82. text: control.text;
  83. elide: Text.ElideRight;
  84. anchors.left: parent.left;
  85. anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
  86. anchors.right: downArrow.left;
  87. anchors.rightMargin: control.rightMargin;
  88. anchors.verticalCenter: parent.verticalCenter;
  89. font: UM.Theme.getFont("default")
  90. }
  91. }
  92. label: Label{}
  93. }
  94. */
  95. }
  96. property Component main_window_header_tab: Component
  97. {
  98. /*
  99. ButtonStyle
  100. {
  101. // This property will be back-propagated when the width of the label is calculated
  102. property var buttonWidth: 0
  103. background: Rectangle
  104. {
  105. id: backgroundRectangle
  106. implicitHeight: control.height
  107. implicitWidth: buttonWidth
  108. radius: UM.Theme.getSize("action_button_radius").width
  109. color:
  110. {
  111. if (control.checked)
  112. {
  113. return UM.Theme.getColor("main_window_header_button_background_active")
  114. }
  115. else
  116. {
  117. if (control.hovered)
  118. {
  119. return UM.Theme.getColor("main_window_header_button_background_hovered")
  120. }
  121. return UM.Theme.getColor("main_window_header_button_background_inactive")
  122. }
  123. }
  124. }
  125. label: Item
  126. {
  127. id: contents
  128. anchors.horizontalCenter: parent.horizontalCenter
  129. anchors.verticalCenter: parent.verticalCenter
  130. height: control.height
  131. width: buttonLabel.width + 4 * UM.Theme.getSize("default_margin").width
  132. Label
  133. {
  134. id: buttonLabel
  135. text: control.text
  136. anchors.verticalCenter: parent.verticalCenter
  137. anchors.horizontalCenter: parent.horizontalCenter
  138. font: UM.Theme.getFont("medium")
  139. color:
  140. {
  141. if (control.checked)
  142. {
  143. return UM.Theme.getColor("main_window_header_button_text_active")
  144. }
  145. else
  146. {
  147. if (control.hovered)
  148. {
  149. return UM.Theme.getColor("main_window_header_button_text_hovered")
  150. }
  151. return UM.Theme.getColor("main_window_header_button_text_inactive")
  152. }
  153. }
  154. }
  155. Component.onCompleted:
  156. {
  157. buttonWidth = width
  158. }
  159. }
  160. }
  161. */
  162. }
  163. property Component tool_button: Component
  164. {
  165. /*
  166. ButtonStyle
  167. {
  168. background: Item
  169. {
  170. implicitWidth: UM.Theme.getSize("button").width
  171. implicitHeight: UM.Theme.getSize("button").height
  172. UM.PointingRectangle
  173. {
  174. id: button_tooltip
  175. anchors.left: parent.right
  176. anchors.leftMargin: UM.Theme.getSize("button_tooltip_arrow").width * 2
  177. anchors.verticalCenter: parent.verticalCenter
  178. target: Qt.point(parent.x, y + Math.round(height/2))
  179. arrowSize: UM.Theme.getSize("button_tooltip_arrow").width
  180. color: UM.Theme.getColor("button_tooltip")
  181. opacity: control.hovered ? 1.0 : 0.0;
  182. visible: control.text != ""
  183. width: control.hovered ? button_tip.width + UM.Theme.getSize("button_tooltip").width : 0
  184. height: UM.Theme.getSize("button_tooltip").height
  185. Behavior on width { NumberAnimation { duration: 100; } }
  186. Behavior on opacity { NumberAnimation { duration: 100; } }
  187. Label
  188. {
  189. id: button_tip
  190. anchors.horizontalCenter: parent.horizontalCenter
  191. anchors.verticalCenter: parent.verticalCenter
  192. text: control.text
  193. font: UM.Theme.getFont("default")
  194. color: UM.Theme.getColor("tooltip_text")
  195. }
  196. }
  197. Rectangle
  198. {
  199. id: buttonFace
  200. anchors.fill: parent
  201. property bool down: control.pressed || (control.checkable && control.checked)
  202. color:
  203. {
  204. if(control.customColor !== undefined && control.customColor !== null)
  205. {
  206. return control.customColor
  207. }
  208. else if(control.checkable && control.checked && control.hovered)
  209. {
  210. return UM.Theme.getColor("toolbar_button_active_hover")
  211. }
  212. else if(control.pressed || (control.checkable && control.checked))
  213. {
  214. return UM.Theme.getColor("toolbar_button_active")
  215. }
  216. else if(control.hovered)
  217. {
  218. return UM.Theme.getColor("toolbar_button_hover")
  219. }
  220. return UM.Theme.getColor("toolbar_background")
  221. }
  222. Behavior on color { ColorAnimation { duration: 50; } }
  223. border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? UM.Theme.getSize("default_lining").width : 0
  224. border.color: control.checked ? UM.Theme.getColor("icon") : UM.Theme.getColor("lining")
  225. }
  226. }
  227. label: Item
  228. {
  229. UM.RecolorImage
  230. {
  231. anchors.centerIn: parent
  232. opacity: control.enabled ? 1.0 : 0.2
  233. source: control.iconSource
  234. width: UM.Theme.getSize("medium_button_icon").width
  235. height: UM.Theme.getSize("medium_button_icon").height
  236. color: UM.Theme.getColor("icon")
  237. sourceSize: UM.Theme.getSize("medium_button_icon")
  238. }
  239. }
  240. }
  241. */
  242. }
  243. property Component progressbar: Component
  244. {
  245. /*
  246. ProgressBarStyle
  247. {
  248. background: Rectangle
  249. {
  250. implicitWidth: UM.Theme.getSize("message").width - (UM.Theme.getSize("default_margin").width * 2)
  251. implicitHeight: UM.Theme.getSize("progressbar").height
  252. color: control.hasOwnProperty("backgroundColor") ? control.backgroundColor : UM.Theme.getColor("progressbar_background")
  253. radius: UM.Theme.getSize("progressbar_radius").width
  254. }
  255. progress: Rectangle
  256. {
  257. color:
  258. {
  259. if(control.indeterminate)
  260. {
  261. return "transparent";
  262. }
  263. else if(control.hasOwnProperty("controlColor"))
  264. {
  265. return control.controlColor;
  266. }
  267. else
  268. {
  269. return UM.Theme.getColor("progressbar_control");
  270. }
  271. }
  272. radius: UM.Theme.getSize("progressbar_radius").width
  273. Rectangle
  274. {
  275. radius: UM.Theme.getSize("progressbar_radius").width
  276. color: control.hasOwnProperty("controlColor") ? control.controlColor : UM.Theme.getColor("progressbar_control")
  277. width: UM.Theme.getSize("progressbar_control").width
  278. height: UM.Theme.getSize("progressbar_control").height
  279. visible: control.indeterminate
  280. SequentialAnimation on x
  281. {
  282. id: xAnim
  283. property int animEndPoint: UM.Theme.getSize("message").width - Math.round((UM.Theme.getSize("default_margin").width * 2.5)) - UM.Theme.getSize("progressbar_control").width
  284. running: control.indeterminate && control.visible
  285. loops: Animation.Infinite
  286. NumberAnimation { from: 0; to: xAnim.animEndPoint; duration: 2000;}
  287. NumberAnimation { from: xAnim.animEndPoint; to: 0; duration: 2000;}
  288. }
  289. }
  290. }
  291. }
  292. */
  293. }
  294. property Component scrollview: Component
  295. {
  296. /*
  297. ScrollViewStyle
  298. {
  299. decrementControl: Item { }
  300. incrementControl: Item { }
  301. transientScrollBars: false
  302. scrollBarBackground: Rectangle
  303. {
  304. implicitWidth: UM.Theme.getSize("scrollbar").width
  305. radius: Math.round(implicitWidth / 2)
  306. color: UM.Theme.getColor("scrollbar_background")
  307. }
  308. handle: Rectangle
  309. {
  310. id: scrollViewHandle
  311. implicitWidth: UM.Theme.getSize("scrollbar").width
  312. radius: Math.round(implicitWidth / 2)
  313. color: styleData.pressed ? UM.Theme.getColor("scrollbar_handle_down") : styleData.hovered ? UM.Theme.getColor("scrollbar_handle_hover") : UM.Theme.getColor("scrollbar_handle")
  314. Behavior on color { ColorAnimation { duration: 50; } }
  315. }
  316. }
  317. */
  318. }
  319. property Component combobox: Component
  320. {
  321. /*
  322. ComboBoxStyle
  323. {
  324. background: Rectangle
  325. {
  326. implicitHeight: UM.Theme.getSize("setting_control").height;
  327. implicitWidth: UM.Theme.getSize("setting_control").width;
  328. color: control.hovered ? UM.Theme.getColor("setting_control_highlight") : UM.Theme.getColor("setting_control")
  329. Behavior on color { ColorAnimation { duration: 50; } }
  330. border.width: UM.Theme.getSize("default_lining").width;
  331. border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border");
  332. radius: UM.Theme.getSize("setting_control_radius").width
  333. }
  334. label: Item
  335. {
  336. Label
  337. {
  338. anchors.left: parent.left
  339. anchors.leftMargin: UM.Theme.getSize("default_lining").width
  340. anchors.right: downArrow.left
  341. anchors.rightMargin: UM.Theme.getSize("default_lining").width
  342. anchors.verticalCenter: parent.verticalCenter
  343. text: control.currentText
  344. font: UM.Theme.getFont("default");
  345. color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
  346. elide: Text.ElideRight
  347. verticalAlignment: Text.AlignVCenter
  348. }
  349. UM.RecolorImage
  350. {
  351. id: downArrow
  352. anchors.right: parent.right
  353. anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2
  354. anchors.verticalCenter: parent.verticalCenter
  355. source: UM.Theme.getIcon("ChevronSingleDown")
  356. width: UM.Theme.getSize("standard_arrow").width
  357. height: UM.Theme.getSize("standard_arrow").height
  358. sourceSize.width: width + 5 * screenScaleFactor
  359. sourceSize.height: width + 5 * screenScaleFactor
  360. color: UM.Theme.getColor("setting_control_button");
  361. }
  362. }
  363. }
  364. */
  365. }
  366. property Component checkbox: Component
  367. {
  368. /*
  369. CheckBoxStyle
  370. {
  371. background: Item { }
  372. indicator: Rectangle
  373. {
  374. implicitWidth: UM.Theme.getSize("checkbox").width
  375. implicitHeight: UM.Theme.getSize("checkbox").height
  376. color: (control.hovered || control._hovered) ? UM.Theme.getColor("checkbox_hover") : (control.enabled ? UM.Theme.getColor("checkbox") : UM.Theme.getColor("checkbox_disabled"))
  377. Behavior on color { ColorAnimation { duration: 50; } }
  378. radius: control.exclusiveGroup ? Math.round(UM.Theme.getSize("checkbox").width / 2) : UM.Theme.getSize("checkbox_radius").width
  379. border.width: UM.Theme.getSize("default_lining").width
  380. border.color: (control.hovered || control._hovered) ? UM.Theme.getColor("checkbox_border_hover") : UM.Theme.getColor("checkbox_border")
  381. UM.RecolorImage
  382. {
  383. anchors.verticalCenter: parent.verticalCenter
  384. anchors.horizontalCenter: parent.horizontalCenter
  385. width: Math.round(parent.width / 2.5)
  386. height: Math.round(parent.height / 2.5)
  387. sourceSize.height: width
  388. color: UM.Theme.getColor("checkbox_mark")
  389. source: control.exclusiveGroup ? UM.Theme.getIcon("Dot") : UM.Theme.getIcon("Check")
  390. opacity: control.checked
  391. Behavior on opacity { NumberAnimation { duration: 100; } }
  392. }
  393. }
  394. label: Label
  395. {
  396. text: control.text
  397. color: UM.Theme.getColor("checkbox_text")
  398. font: UM.Theme.getFont("default")
  399. elide: Text.ElideRight
  400. renderType: Text.NativeRendering
  401. }
  402. }
  403. */
  404. }
  405. property Component partially_checkbox: Component
  406. {
  407. /*
  408. CheckBoxStyle
  409. {
  410. background: Item { }
  411. indicator: Rectangle
  412. {
  413. implicitWidth: UM.Theme.getSize("checkbox").width
  414. implicitHeight: UM.Theme.getSize("checkbox").height
  415. color: (control.hovered || control._hovered) ? UM.Theme.getColor("checkbox_hover") : UM.Theme.getColor("checkbox");
  416. Behavior on color { ColorAnimation { duration: 50; } }
  417. radius: control.exclusiveGroup ? Math.round(UM.Theme.getSize("checkbox").width / 2) : UM.Theme.getSize("checkbox_radius").width
  418. border.width: UM.Theme.getSize("default_lining").width;
  419. border.color: (control.hovered || control._hovered) ? UM.Theme.getColor("checkbox_border_hover") : UM.Theme.getColor("checkbox_border");
  420. UM.RecolorImage
  421. {
  422. anchors.verticalCenter: parent.verticalCenter
  423. anchors.horizontalCenter: parent.horizontalCenter
  424. width: Math.round(parent.width / 2.5)
  425. height: Math.round(parent.height / 2.5)
  426. sourceSize.height: width
  427. color: UM.Theme.getColor("checkbox_mark")
  428. source:
  429. {
  430. if (control.checkbox_state == 2)
  431. {
  432. return UM.Theme.getIcon("Solid");
  433. }
  434. else
  435. {
  436. return control.exclusiveGroup ? UM.Theme.getIcon("Dot", "low") : UM.Theme.getIcon("Check");
  437. }
  438. }
  439. opacity: control.checked
  440. Behavior on opacity { NumberAnimation { duration: 100; } }
  441. }
  442. }
  443. label: Label
  444. {
  445. text: control.text
  446. color: UM.Theme.getColor("checkbox_text")
  447. font: UM.Theme.getFont("default")
  448. }
  449. }
  450. */
  451. }
  452. property Component text_field: Component
  453. {
  454. /*
  455. TextFieldStyle
  456. {
  457. textColor: UM.Theme.getColor("setting_control_text")
  458. placeholderTextColor: UM.Theme.getColor("setting_control_text")
  459. font: UM.Theme.getFont("default")
  460. background: Rectangle
  461. {
  462. implicitHeight: control.height;
  463. implicitWidth: control.width;
  464. border.width: UM.Theme.getSize("default_lining").width;
  465. border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border");
  466. radius: UM.Theme.getSize("setting_control_radius").width
  467. color: UM.Theme.getColor("setting_validation_ok");
  468. Label
  469. {
  470. anchors.right: parent.right;
  471. anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width;
  472. anchors.verticalCenter: parent.verticalCenter;
  473. text: control.unit ? control.unit : ""
  474. color: UM.Theme.getColor("setting_unit");
  475. font: UM.Theme.getFont("default");
  476. renderType: Text.NativeRendering
  477. }
  478. }
  479. }
  480. */
  481. }
  482. property Component print_setup_action_button: Component
  483. {
  484. /*
  485. ButtonStyle
  486. {
  487. background: Rectangle
  488. {
  489. border.width: UM.Theme.getSize("default_lining").width
  490. border.color:
  491. {
  492. if(!control.enabled)
  493. {
  494. return UM.Theme.getColor("action_button_disabled_border");
  495. }
  496. else if(control.pressed)
  497. {
  498. return UM.Theme.getColor("action_button_active_border");
  499. }
  500. else if(control.hovered)
  501. {
  502. return UM.Theme.getColor("action_button_hovered_border");
  503. }
  504. else
  505. {
  506. return UM.Theme.getColor("action_button_border");
  507. }
  508. }
  509. color:
  510. {
  511. if(!control.enabled)
  512. {
  513. return UM.Theme.getColor("action_button_disabled");
  514. }
  515. else if(control.pressed)
  516. {
  517. return UM.Theme.getColor("action_button_active");
  518. }
  519. else if(control.hovered)
  520. {
  521. return UM.Theme.getColor("action_button_hovered");
  522. }
  523. else
  524. {
  525. return UM.Theme.getColor("action_button");
  526. }
  527. }
  528. Behavior on color { ColorAnimation { duration: 50 } }
  529. implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2)
  530. Label
  531. {
  532. id: actualLabel
  533. anchors.centerIn: parent
  534. color:
  535. {
  536. if(!control.enabled)
  537. {
  538. return UM.Theme.getColor("action_button_disabled_text");
  539. }
  540. else if(control.pressed)
  541. {
  542. return UM.Theme.getColor("action_button_active_text");
  543. }
  544. else if(control.hovered)
  545. {
  546. return UM.Theme.getColor("action_button_hovered_text");
  547. }
  548. else
  549. {
  550. return UM.Theme.getColor("action_button_text");
  551. }
  552. }
  553. font: UM.Theme.getFont("medium")
  554. text: control.text
  555. }
  556. }
  557. label: Item { }
  558. }
  559. */
  560. }
  561. property Component toolbox_action_button: Component
  562. {
  563. /*
  564. ButtonStyle
  565. {
  566. background: Rectangle
  567. {
  568. implicitWidth: UM.Theme.getSize("toolbox_action_button").width
  569. implicitHeight: UM.Theme.getSize("toolbox_action_button").height
  570. color:
  571. {
  572. if (control.installed)
  573. {
  574. return UM.Theme.getColor("action_button_disabled");
  575. }
  576. else
  577. {
  578. if (control.hovered)
  579. {
  580. return UM.Theme.getColor("primary_hover");
  581. }
  582. else
  583. {
  584. return UM.Theme.getColor("primary");
  585. }
  586. }
  587. }
  588. }
  589. label: Label
  590. {
  591. text: control.text
  592. color:
  593. {
  594. if (control.installed)
  595. {
  596. return UM.Theme.getColor("action_button_disabled_text");
  597. }
  598. else
  599. {
  600. if (control.hovered)
  601. {
  602. return UM.Theme.getColor("button_text_hover");
  603. }
  604. else
  605. {
  606. return UM.Theme.getColor("button_text");
  607. }
  608. }
  609. }
  610. verticalAlignment: Text.AlignVCenter
  611. horizontalAlignment: Text.AlignHCenter
  612. font: UM.Theme.getFont("default_bold")
  613. }
  614. }
  615. */
  616. }
  617. property Component monitor_button_style: Component
  618. {
  619. /*
  620. ButtonStyle
  621. {
  622. background: Rectangle
  623. {
  624. border.width: UM.Theme.getSize("default_lining").width
  625. border.color:
  626. {
  627. if(!control.enabled)
  628. {
  629. return UM.Theme.getColor("action_button_disabled_border");
  630. }
  631. else if(control.pressed)
  632. {
  633. return UM.Theme.getColor("action_button_active_border");
  634. }
  635. else if(control.hovered)
  636. {
  637. return UM.Theme.getColor("action_button_hovered_border");
  638. }
  639. return UM.Theme.getColor("action_button_border");
  640. }
  641. color:
  642. {
  643. if(!control.enabled)
  644. {
  645. return UM.Theme.getColor("action_button_disabled");
  646. }
  647. else if(control.pressed)
  648. {
  649. return UM.Theme.getColor("action_button_active");
  650. }
  651. else if(control.hovered)
  652. {
  653. return UM.Theme.getColor("action_button_hovered");
  654. }
  655. return UM.Theme.getColor("action_button");
  656. }
  657. Behavior on color
  658. {
  659. ColorAnimation
  660. {
  661. duration: 50
  662. }
  663. }
  664. }
  665. label: Item
  666. {
  667. UM.RecolorImage
  668. {
  669. anchors.verticalCenter: parent.verticalCenter
  670. anchors.horizontalCenter: parent.horizontalCenter
  671. width: Math.floor(control.width / 2)
  672. height: Math.floor(control.height / 2)
  673. sourceSize.height: width
  674. color:
  675. {
  676. if(!control.enabled)
  677. {
  678. return UM.Theme.getColor("action_button_disabled_text");
  679. }
  680. else if(control.pressed)
  681. {
  682. return UM.Theme.getColor("action_button_active_text");
  683. }
  684. else if(control.hovered)
  685. {
  686. return UM.Theme.getColor("action_button_hovered_text");
  687. }
  688. return UM.Theme.getColor("action_button_text");
  689. }
  690. source: control.iconSource
  691. }
  692. }
  693. }
  694. */
  695. }
  696. property Component monitor_checkable_button_style: Component
  697. {
  698. /*
  699. ButtonStyle {
  700. background: Rectangle {
  701. border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width
  702. border.color:
  703. {
  704. if(!control.enabled)
  705. {
  706. return UM.Theme.getColor("action_button_disabled_border");
  707. }
  708. else if (control.checked || control.pressed)
  709. {
  710. return UM.Theme.getColor("action_button_active_border");
  711. }
  712. else if(control.hovered)
  713. {
  714. return UM.Theme.getColor("action_button_hovered_border");
  715. }
  716. return UM.Theme.getColor("action_button_border");
  717. }
  718. color:
  719. {
  720. if(!control.enabled)
  721. {
  722. return UM.Theme.getColor("action_button_disabled");
  723. }
  724. else if (control.checked || control.pressed)
  725. {
  726. return UM.Theme.getColor("action_button_active");
  727. }
  728. else if (control.hovered)
  729. {
  730. return UM.Theme.getColor("action_button_hovered");
  731. }
  732. return UM.Theme.getColor("action_button");
  733. }
  734. Behavior on color { ColorAnimation { duration: 50; } }
  735. Label {
  736. anchors.left: parent.left
  737. anchors.right: parent.right
  738. anchors.verticalCenter: parent.verticalCenter
  739. anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2
  740. anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2
  741. color:
  742. {
  743. if(!control.enabled)
  744. {
  745. return UM.Theme.getColor("action_button_disabled_text");
  746. }
  747. else if (control.checked || control.pressed)
  748. {
  749. return UM.Theme.getColor("action_button_active_text");
  750. }
  751. else if (control.hovered)
  752. {
  753. return UM.Theme.getColor("action_button_hovered_text");
  754. }
  755. return UM.Theme.getColor("action_button_text");
  756. }
  757. font: UM.Theme.getFont("default")
  758. text: control.text
  759. horizontalAlignment: Text.AlignHCenter
  760. elide: Text.ElideMiddle
  761. }
  762. }
  763. label: Item { }
  764. }
  765. */
  766. }
  767. }