ToolboxBackColumn.qml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Toolbox 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. Item
  8. {
  9. id: sidebar
  10. height: parent.height
  11. width: UM.Theme.getSize("toolbox_back_column").width
  12. anchors
  13. {
  14. top: parent.top
  15. left: parent.left
  16. topMargin: UM.Theme.getSize("wide_margin").height
  17. leftMargin: UM.Theme.getSize("default_margin").width
  18. rightMargin: UM.Theme.getSize("default_margin").width
  19. }
  20. Button
  21. {
  22. id: button
  23. text: catalog.i18nc("@action:button", "Back")
  24. enabled: !toolbox.isDownloading
  25. UM.RecolorImage
  26. {
  27. id: backArrow
  28. anchors
  29. {
  30. verticalCenter: parent.verticalCenter
  31. left: parent.left
  32. rightMargin: UM.Theme.getSize("default_margin").width
  33. }
  34. width: UM.Theme.getSize("standard_arrow").width
  35. height: UM.Theme.getSize("standard_arrow").height
  36. sourceSize
  37. {
  38. width: width
  39. height: height
  40. }
  41. color: button.enabled ? (button.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("text")) : UM.Theme.getColor("text_inactive")
  42. source: UM.Theme.getIcon("arrow_left")
  43. }
  44. width: UM.Theme.getSize("toolbox_back_button").width
  45. height: UM.Theme.getSize("toolbox_back_button").height
  46. onClicked:
  47. {
  48. toolbox.viewPage = "overview"
  49. toolbox.filterModelByProp("packages", "type", toolbox.viewCategory)
  50. }
  51. style: ButtonStyle
  52. {
  53. background: Rectangle
  54. {
  55. color: "transparent"
  56. }
  57. label: Label
  58. {
  59. id: labelStyle
  60. text: control.text
  61. color: control.enabled ? (control.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("text")) : UM.Theme.getColor("text_inactive")
  62. font: UM.Theme.getFont("medium_bold")
  63. horizontalAlignment: Text.AlignLeft
  64. anchors
  65. {
  66. left: parent.left
  67. leftMargin: UM.Theme.getSize("default_margin").width
  68. }
  69. width: control.width
  70. renderType: Text.NativeRendering
  71. }
  72. }
  73. }
  74. }