PackageDetails.qml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. UM.Label
  40. {
  41. Layout.alignment: Qt.AlignmentFlag.AlignVCenter
  42. Layout.fillWidth: true
  43. text: detailPage.title
  44. font: UM.Theme.getFont("large")
  45. }
  46. }
  47. Rectangle
  48. {
  49. anchors
  50. {
  51. top: header.bottom
  52. topMargin: UM.Theme.getSize("default_margin").height
  53. left: parent.left
  54. right: parent.right
  55. bottom: parent.bottom
  56. }
  57. color: UM.Theme.getColor("detail_background")
  58. ScrollView
  59. {
  60. anchors.fill: parent
  61. clip: true //Need to clip, not for the bottom (which is off the window) but for the top (which would overlap the header).
  62. ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
  63. contentHeight: packagePage.height + UM.Theme.getSize("default_margin").height * 2
  64. PackagePage
  65. {
  66. id: packagePage
  67. anchors
  68. {
  69. left: parent.left
  70. leftMargin: UM.Theme.getSize("default_margin").width
  71. right: parent.right
  72. rightMargin: anchors.leftMargin
  73. top: parent.top
  74. topMargin: UM.Theme.getSize("default_margin").height
  75. }
  76. packageData: detailPage.packageData
  77. }
  78. }
  79. }
  80. }