styles.qml 35 KB

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