styles.qml 30 KB

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