PackageDetails.qml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // Copyright (c) 2021 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.15
  4. import QtQuick.Controls 2.15
  5. import QtQuick.Layouts 1.3
  6. import Cura 1.0 as Cura
  7. import UM 1.5 as UM
  8. Item
  9. {
  10. id: detailPage
  11. property var packageData: packages.selectedPackage
  12. property string title: catalog.i18nc("@header", "Package details")
  13. RowLayout
  14. {
  15. id: header
  16. anchors
  17. {
  18. top: parent.top
  19. topMargin: UM.Theme.getSize("default_margin").height
  20. left: parent.left
  21. leftMargin: UM.Theme.getSize("default_margin").width
  22. right: parent.right
  23. rightMargin: anchors.leftMargin
  24. }
  25. spacing: UM.Theme.getSize("default_margin").width
  26. Cura.SecondaryButton
  27. {
  28. Layout.alignment: Qt.AlignmentFlag.AlignVCenter
  29. Layout.preferredHeight: UM.Theme.getSize("action_button").height
  30. Layout.preferredWidth: height
  31. onClicked: contextStack.pop() //Remove this page, returning to the main package list or whichever thing is beneath it.
  32. tooltip: catalog.i18nc("@button:tooltip", "Back")
  33. toolTipContentAlignment: UM.Enums.ContentAlignment.AlignRight
  34. leftPadding: UM.Theme.getSize("narrow_margin").width
  35. rightPadding: leftPadding
  36. iconSource: UM.Theme.getIcon("ArrowLeft")
  37. iconSize: height - leftPadding * 2
  38. }
  39. Label
  40. {
  41. Layout.alignment: Qt.AlignmentFlag.AlignVCenter
  42. Layout.fillWidth: true
  43. text: detailPage.title
  44. font: UM.Theme.getFont("large")
  45. color: UM.Theme.getColor("text")
  46. }
  47. }
  48. Rectangle
  49. {
  50. anchors
  51. {
  52. top: header.bottom
  53. topMargin: UM.Theme.getSize("default_margin").height
  54. left: parent.left
  55. right: parent.right
  56. bottom: parent.bottom
  57. }
  58. color: UM.Theme.getColor("detail_background")
  59. ScrollView
  60. {
  61. anchors.fill: parent
  62. clip: true //Need to clip, not for the bottom (which is off the window) but for the top (which would overlap the header).
  63. ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
  64. contentHeight: packagePage.height + UM.Theme.getSize("default_margin").height * 2
  65. PackagePage
  66. {
  67. id: packagePage
  68. anchors
  69. {
  70. left: parent.left
  71. leftMargin: UM.Theme.getSize("default_margin").width
  72. right: parent.right
  73. rightMargin: anchors.leftMargin
  74. top: parent.top
  75. topMargin: UM.Theme.getSize("default_margin").height
  76. }
  77. packageData: detailPage.packageData
  78. }
  79. }
  80. }
  81. }