ToolboxBackColumn.qml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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("ChevronSingleLeft")
  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. if (toolbox.viewCategory == "material")
  50. {
  51. toolbox.filterModelByProp("authors", "package_types", "material")
  52. }
  53. else if (toolbox.viewCategory == "plugin")
  54. {
  55. toolbox.filterModelByProp("packages", "type", "plugin")
  56. }
  57. }
  58. style: ButtonStyle
  59. {
  60. background: Rectangle
  61. {
  62. color: "transparent"
  63. }
  64. label: Label
  65. {
  66. id: labelStyle
  67. text: control.text
  68. color: control.enabled ? (control.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("text")) : UM.Theme.getColor("text_inactive")
  69. font: UM.Theme.getFont("medium_bold")
  70. horizontalAlignment: Text.AlignLeft
  71. anchors
  72. {
  73. left: parent.left
  74. leftMargin: UM.Theme.getSize("default_margin").width
  75. }
  76. width: control.width
  77. renderType: Text.NativeRendering
  78. }
  79. }
  80. }
  81. }