styles.qml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  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 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 UM.Theme.getColor("setting_validation_error_background");
  22. }
  23. else if(control.valueWarning)
  24. {
  25. return UM.Theme.getColor("setting_validation_warning_background");
  26. }
  27. else
  28. {
  29. return UM.Theme.getColor("setting_control");
  30. }
  31. }
  32. else
  33. {
  34. return UM.Theme.getColor("setting_control_disabled");
  35. }
  36. }
  37. radius: UM.Theme.getSize("setting_control_radius").width
  38. border.width: UM.Theme.getSize("default_lining").width
  39. border.color:
  40. {
  41. if (control.enabled)
  42. {
  43. if (control.valueError)
  44. {
  45. return UM.Theme.getColor("setting_validation_error");
  46. }
  47. else if (control.valueWarning)
  48. {
  49. return UM.Theme.getColor("setting_validation_warning");
  50. }
  51. else if (control.hovered)
  52. {
  53. return UM.Theme.getColor("setting_control_border_highlight");
  54. }
  55. else
  56. {
  57. return UM.Theme.getColor("setting_control_border");
  58. }
  59. }
  60. else
  61. {
  62. return UM.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: UM.Theme.getSize("default_margin").width
  71. width: UM.Theme.getSize("standard_arrow").width
  72. height: UM.Theme.getSize("standard_arrow").height
  73. sourceSize.height: width
  74. color: control.enabled ? UM.Theme.getColor("setting_control_button") : UM.Theme.getColor("setting_category_disabled_text")
  75. source: UM.Theme.getIcon("ChevronSingleDown")
  76. }
  77. Label
  78. {
  79. id: printSetupComboBoxLabel
  80. color: control.enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
  81. text: control.text;
  82. elide: Text.ElideRight;
  83. anchors.left: parent.left;
  84. anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
  85. anchors.right: downArrow.left;
  86. anchors.rightMargin: control.rightMargin;
  87. anchors.verticalCenter: parent.verticalCenter;
  88. font: UM.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: UM.Theme.getSize("button").width
  166. implicitHeight: UM.Theme.getSize("button").height
  167. UM.PointingRectangle
  168. {
  169. id: button_tooltip
  170. anchors.left: parent.right
  171. anchors.leftMargin: UM.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: UM.Theme.getSize("button_tooltip_arrow").width
  175. color: UM.Theme.getColor("button_tooltip")
  176. opacity: control.hovered ? 1.0 : 0.0;
  177. visible: control.text != ""
  178. width: control.hovered ? button_tip.width + UM.Theme.getSize("button_tooltip").width : 0
  179. height: UM.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: UM.Theme.getFont("default")
  189. color: UM.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 UM.Theme.getColor("toolbar_button_active_hover")
  206. }
  207. else if(control.pressed || (control.checkable && control.checked))
  208. {
  209. return UM.Theme.getColor("toolbar_button_active")
  210. }
  211. else if(control.hovered)
  212. {
  213. return UM.Theme.getColor("toolbar_button_hover")
  214. }
  215. return UM.Theme.getColor("toolbar_background")
  216. }
  217. Behavior on color { ColorAnimation { duration: 50; } }
  218. border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? UM.Theme.getSize("default_lining").width : 0
  219. border.color: control.checked ? UM.Theme.getColor("icon") : UM.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: UM.Theme.getSize("medium_button_icon").width
  230. height: UM.Theme.getSize("medium_button_icon").height
  231. color: UM.Theme.getColor("icon")
  232. sourceSize: UM.Theme.getSize("medium_button_icon")
  233. }
  234. }
  235. }
  236. }
  237. property Component progressbar: Component
  238. {
  239. ProgressBarStyle
  240. {
  241. background: Rectangle
  242. {
  243. implicitWidth: UM.Theme.getSize("message").width - (UM.Theme.getSize("default_margin").width * 2)
  244. implicitHeight: UM.Theme.getSize("progressbar").height
  245. color: control.hasOwnProperty("backgroundColor") ? control.backgroundColor : UM.Theme.getColor("progressbar_background")
  246. radius: UM.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 UM.Theme.getColor("progressbar_control");
  263. }
  264. }
  265. radius: UM.Theme.getSize("progressbar_radius").width
  266. Rectangle
  267. {
  268. radius: UM.Theme.getSize("progressbar_radius").width
  269. color: control.hasOwnProperty("controlColor") ? control.controlColor : UM.Theme.getColor("progressbar_control")
  270. width: UM.Theme.getSize("progressbar_control").width
  271. height: UM.Theme.getSize("progressbar_control").height
  272. visible: control.indeterminate
  273. SequentialAnimation on x
  274. {
  275. id: xAnim
  276. property int animEndPoint: UM.Theme.getSize("message").width - Math.round((UM.Theme.getSize("default_margin").width * 2.5)) - UM.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: UM.Theme.getSize("scrollbar").width
  296. radius: Math.round(implicitWidth / 2)
  297. color: UM.Theme.getColor("scrollbar_background")
  298. }
  299. handle: Rectangle
  300. {
  301. id: scrollViewHandle
  302. implicitWidth: UM.Theme.getSize("scrollbar").width
  303. radius: Math.round(implicitWidth / 2)
  304. color: styleData.pressed ? UM.Theme.getColor("scrollbar_handle_down") : styleData.hovered ? UM.Theme.getColor("scrollbar_handle_hover") : UM.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: UM.Theme.getSize("setting_control").height;
  316. implicitWidth: UM.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: UM.Theme.getSize("default_lining").width;
  320. border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.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: UM.Theme.getSize("default_lining").width
  329. anchors.right: downArrow.left
  330. anchors.rightMargin: UM.Theme.getSize("default_lining").width
  331. anchors.verticalCenter: parent.verticalCenter
  332. text: control.currentText
  333. font: UM.Theme.getFont("default");
  334. color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.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: UM.Theme.getSize("default_lining").width * 2
  343. anchors.verticalCenter: parent.verticalCenter
  344. source: UM.Theme.getIcon("ChevronSingleDown")
  345. width: UM.Theme.getSize("standard_arrow").width
  346. height: UM.Theme.getSize("standard_arrow").height
  347. sourceSize.width: width + 5 * screenScaleFactor
  348. sourceSize.height: width + 5 * screenScaleFactor
  349. color: UM.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: UM.Theme.getSize("checkbox").width
  362. implicitHeight: UM.Theme.getSize("checkbox").height
  363. color: (control.hovered || control._hovered) ? UM.Theme.getColor("checkbox_hover") : (control.enabled ? UM.Theme.getColor("checkbox") : UM.Theme.getColor("checkbox_disabled"))
  364. Behavior on color { ColorAnimation { duration: 50; } }
  365. anchors.verticalCenter: parent.verticalCenter
  366. radius: control.exclusiveGroup ? Math.round(UM.Theme.getSize("checkbox").width / 2) : UM.Theme.getSize("checkbox_radius").width
  367. border.width: UM.Theme.getSize("default_lining").width
  368. border.color: (control.hovered || control._hovered) ? UM.Theme.getColor("checkbox_border_hover") : UM.Theme.getColor("checkbox_border")
  369. UM.RecolorImage
  370. {
  371. anchors.verticalCenter: parent.verticalCenter
  372. anchors.horizontalCenter: parent.horizontalCenter
  373. height: UM.Theme.getSize("checkbox_mark").height
  374. width: UM.Theme.getSize("checkbox_mark").width
  375. sourceSize.height: width
  376. color: UM.Theme.getColor("checkbox_mark")
  377. source: control.exclusiveGroup ? UM.Theme.getIcon("Dot") : UM.Theme.getIcon("Check", "low")
  378. opacity: control.checked
  379. Behavior on opacity { NumberAnimation { duration: 100; } }
  380. }
  381. }
  382. label: Label
  383. {
  384. text: control.text
  385. color: UM.Theme.getColor("checkbox_text")
  386. font: UM.Theme.getFont("default")
  387. elide: Text.ElideRight
  388. renderType: Text.NativeRendering
  389. }
  390. }
  391. }
  392. property Component partially_checkbox: Component
  393. {
  394. CheckBoxStyle
  395. {
  396. background: Item { }
  397. indicator: Rectangle
  398. {
  399. implicitWidth: UM.Theme.getSize("checkbox").width
  400. implicitHeight: UM.Theme.getSize("checkbox").height
  401. color: (control.hovered || control._hovered) ? UM.Theme.getColor("checkbox_hover") : UM.Theme.getColor("checkbox");
  402. Behavior on color { ColorAnimation { duration: 50; } }
  403. radius: control.exclusiveGroup ? Math.round(UM.Theme.getSize("checkbox").width / 2) : UM.Theme.getSize("checkbox_radius").width
  404. border.width: UM.Theme.getSize("default_lining").width;
  405. border.color: (control.hovered || control._hovered) ? UM.Theme.getColor("checkbox_border_hover") : UM.Theme.getColor("checkbox_border");
  406. UM.RecolorImage
  407. {
  408. anchors.verticalCenter: parent.verticalCenter
  409. anchors.horizontalCenter: parent.horizontalCenter
  410. height: UM.Theme.getSize("checkbox_mark").height
  411. width: UM.Theme.getSize("checkbox_mark").width
  412. sourceSize.height: width
  413. color: UM.Theme.getColor("checkbox_mark")
  414. source:
  415. {
  416. if (control.checkbox_state == 2)
  417. {
  418. return UM.Theme.getIcon("Solid");
  419. }
  420. else
  421. {
  422. return control.exclusiveGroup ? UM.Theme.getIcon("Dot", "low") : UM.Theme.getIcon("Check", "low");
  423. }
  424. }
  425. opacity: control.checked
  426. Behavior on opacity { NumberAnimation { duration: 100; } }
  427. }
  428. }
  429. label: Label
  430. {
  431. text: control.text
  432. color: UM.Theme.getColor("checkbox_text")
  433. font: UM.Theme.getFont("default")
  434. }
  435. }
  436. }
  437. property Component text_field: Component
  438. {
  439. TextFieldStyle
  440. {
  441. textColor: UM.Theme.getColor("setting_control_text")
  442. placeholderTextColor: UM.Theme.getColor("setting_control_text")
  443. font: UM.Theme.getFont("default")
  444. background: Rectangle
  445. {
  446. implicitHeight: control.height;
  447. implicitWidth: control.width;
  448. border.width: UM.Theme.getSize("default_lining").width;
  449. border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border");
  450. radius: UM.Theme.getSize("setting_control_radius").width
  451. color: UM.Theme.getColor("setting_validation_ok");
  452. Label
  453. {
  454. anchors.right: parent.right;
  455. anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width;
  456. anchors.verticalCenter: parent.verticalCenter;
  457. text: control.unit ? control.unit : ""
  458. color: UM.Theme.getColor("setting_unit");
  459. font: UM.Theme.getFont("default");
  460. renderType: Text.NativeRendering
  461. }
  462. }
  463. }
  464. }
  465. property Component print_setup_action_button: Component
  466. {
  467. ButtonStyle
  468. {
  469. background: Rectangle
  470. {
  471. border.width: UM.Theme.getSize("default_lining").width
  472. border.color:
  473. {
  474. if(!control.enabled)
  475. {
  476. return UM.Theme.getColor("action_button_disabled_border");
  477. }
  478. else if(control.pressed)
  479. {
  480. return UM.Theme.getColor("action_button_active_border");
  481. }
  482. else if(control.hovered)
  483. {
  484. return UM.Theme.getColor("action_button_hovered_border");
  485. }
  486. else
  487. {
  488. return UM.Theme.getColor("action_button_border");
  489. }
  490. }
  491. color:
  492. {
  493. if(!control.enabled)
  494. {
  495. return UM.Theme.getColor("action_button_disabled");
  496. }
  497. else if(control.pressed)
  498. {
  499. return UM.Theme.getColor("action_button_active");
  500. }
  501. else if(control.hovered)
  502. {
  503. return UM.Theme.getColor("action_button_hovered");
  504. }
  505. else
  506. {
  507. return UM.Theme.getColor("action_button");
  508. }
  509. }
  510. Behavior on color { ColorAnimation { duration: 50 } }
  511. implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("thick_margin").width * 2)
  512. Label
  513. {
  514. id: actualLabel
  515. anchors.centerIn: parent
  516. color:
  517. {
  518. if(!control.enabled)
  519. {
  520. return UM.Theme.getColor("action_button_disabled_text");
  521. }
  522. else if(control.pressed)
  523. {
  524. return UM.Theme.getColor("action_button_active_text");
  525. }
  526. else if(control.hovered)
  527. {
  528. return UM.Theme.getColor("action_button_hovered_text");
  529. }
  530. else
  531. {
  532. return UM.Theme.getColor("action_button_text");
  533. }
  534. }
  535. font: UM.Theme.getFont("medium")
  536. text: control.text
  537. }
  538. }
  539. label: Item { }
  540. }
  541. }
  542. property Component monitor_button_style: Component
  543. {
  544. ButtonStyle
  545. {
  546. background: Rectangle
  547. {
  548. border.width: UM.Theme.getSize("default_lining").width
  549. border.color:
  550. {
  551. if(!control.enabled)
  552. {
  553. return UM.Theme.getColor("action_button_disabled_border");
  554. }
  555. else if(control.pressed)
  556. {
  557. return UM.Theme.getColor("action_button_active_border");
  558. }
  559. else if(control.hovered)
  560. {
  561. return UM.Theme.getColor("action_button_hovered_border");
  562. }
  563. return UM.Theme.getColor("action_button_border");
  564. }
  565. color:
  566. {
  567. if(!control.enabled)
  568. {
  569. return UM.Theme.getColor("action_button_disabled");
  570. }
  571. else if(control.pressed)
  572. {
  573. return UM.Theme.getColor("action_button_active");
  574. }
  575. else if(control.hovered)
  576. {
  577. return UM.Theme.getColor("action_button_hovered");
  578. }
  579. return UM.Theme.getColor("action_button");
  580. }
  581. Behavior on color
  582. {
  583. ColorAnimation
  584. {
  585. duration: 50
  586. }
  587. }
  588. }
  589. label: Item
  590. {
  591. UM.RecolorImage
  592. {
  593. anchors.verticalCenter: parent.verticalCenter
  594. anchors.horizontalCenter: parent.horizontalCenter
  595. width: Math.floor(control.width / 2)
  596. height: Math.floor(control.height / 2)
  597. sourceSize.height: width
  598. color:
  599. {
  600. if(!control.enabled)
  601. {
  602. return UM.Theme.getColor("action_button_disabled_text");
  603. }
  604. else if(control.pressed)
  605. {
  606. return UM.Theme.getColor("action_button_active_text");
  607. }
  608. else if(control.hovered)
  609. {
  610. return UM.Theme.getColor("action_button_hovered_text");
  611. }
  612. return UM.Theme.getColor("action_button_text");
  613. }
  614. source: control.iconSource
  615. }
  616. }
  617. }
  618. }
  619. property Component monitor_checkable_button_style: Component
  620. {
  621. ButtonStyle {
  622. background: Rectangle {
  623. border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width
  624. border.color:
  625. {
  626. if(!control.enabled)
  627. {
  628. return UM.Theme.getColor("action_button_disabled_border");
  629. }
  630. else if (control.checked || control.pressed)
  631. {
  632. return UM.Theme.getColor("action_button_active_border");
  633. }
  634. else if(control.hovered)
  635. {
  636. return UM.Theme.getColor("action_button_hovered_border");
  637. }
  638. return UM.Theme.getColor("action_button_border");
  639. }
  640. color:
  641. {
  642. if(!control.enabled)
  643. {
  644. return UM.Theme.getColor("action_button_disabled");
  645. }
  646. else if (control.checked || control.pressed)
  647. {
  648. return UM.Theme.getColor("action_button_active");
  649. }
  650. else if (control.hovered)
  651. {
  652. return UM.Theme.getColor("action_button_hovered");
  653. }
  654. return UM.Theme.getColor("action_button");
  655. }
  656. Behavior on color { ColorAnimation { duration: 50; } }
  657. Label {
  658. anchors.left: parent.left
  659. anchors.right: parent.right
  660. anchors.verticalCenter: parent.verticalCenter
  661. anchors.leftMargin: UM.Theme.getSize("default_lining").width * 2
  662. anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2
  663. color:
  664. {
  665. if(!control.enabled)
  666. {
  667. return UM.Theme.getColor("action_button_disabled_text");
  668. }
  669. else if (control.checked || control.pressed)
  670. {
  671. return UM.Theme.getColor("action_button_active_text");
  672. }
  673. else if (control.hovered)
  674. {
  675. return UM.Theme.getColor("action_button_hovered_text");
  676. }
  677. return UM.Theme.getColor("action_button_text");
  678. }
  679. font: UM.Theme.getFont("default")
  680. text: control.text
  681. horizontalAlignment: Text.AlignHCenter
  682. elide: Text.ElideMiddle
  683. }
  684. }
  685. label: Item { }
  686. }
  687. }
  688. }