123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- import QtQuick 2.10
- import QtQuick.Controls 2.3
- import UM 1.5 as UM
- import Cura 1.1 as Cura
- Item
- {
- UM.I18nCatalog { id: catalog; name: "cura" }
- id: base
- implicitWidth: 200 * screenScaleFactor
- height: header.contentShown ? (header.height + contentRectangle.height) : header.height
- property var contentComponent: null
- property alias contentItem: contentLoader.item
- property alias title: header.title
- property bool contentShown: false
- signal clicked()
- Connections
- {
- target: header
- function onClicked()
- {
- base.contentShown = !base.contentShown
- clicked()
- }
- }
- DropDownHeader
- {
- id: header
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.right: parent.right
- height: UM.Theme.getSize("expandable_component_content_header").height
- rightIconSource: contentShown ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleLeft")
- contentShown: base.contentShown
- }
- Cura.RoundedRectangle
- {
- id: contentRectangle
-
- y: header.height - UM.Theme.getSize("default_lining").width
- anchors.left: header.left
- anchors.right: header.right
-
- height: contentLoader.item ? contentLoader.item.height + 2 * UM.Theme.getSize("thick_lining").height : 0
- border.width: UM.Theme.getSize("default_lining").width
- border.color: UM.Theme.getColor("lining")
- color: UM.Theme.getColor("main_background")
- radius: UM.Theme.getSize("default_radius").width
- visible: base.contentShown
- cornerSide: Cura.RoundedRectangle.Direction.Down
- Loader
- {
- id: contentLoader
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.right: parent.right
-
-
- anchors.margins: UM.Theme.getSize("default_lining").width
- sourceComponent: base.contentComponent != null ? base.contentComponent : emptyComponent
- }
-
-
- Component
- {
- id: emptyComponent
- UM.Label
- {
- text: catalog.i18nc("@label", "Empty")
- height: UM.Theme.getSize("action_button").height
- horizontalAlignment: Text.AlignHCenter
- font: UM.Theme.getFont("medium")
- }
- }
- }
- }
|