diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index a9eb157f48..9dc3b67658 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -16,7 +16,7 @@ Cura.ExpandableComponent id: base width: UM.Theme.getSize("layerview_menu_size").width - iconSource: UM.Theme.getIcon("pencil") + contentType: Cura.ExpandableComponent.ContentType.Fixed Connections { diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 89f6cf9f25..f6e340c4ea 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -30,7 +30,7 @@ Item property alias headerItem: headerItemLoader.sourceComponent // The contentItem holds the QML item that is shown when the "open" button is pressed - property alias contentItem: content.contentItem + property var contentItem: content.contentItem // Defines the type of the contents property int contentType: ExpandableComponent.ContentType.Floating @@ -38,6 +38,7 @@ Item property color contentBackgroundColor: UM.Theme.getColor("action_button") property color headerBackgroundColor: UM.Theme.getColor("action_button") + property color headerActiveColor: UM.Theme.getColor("secondary") property color headerHoverColor: UM.Theme.getColor("action_button_hovered") // Defines the alignment of the content with respect of the headerItem, by default to the right @@ -123,7 +124,7 @@ Item width: parent.width height: UM.Theme.getSize("thick_lining").height color: UM.Theme.getColor("primary") - visible: expanded + visible: contentType == ExpandableComponent.ContentType.Floating && expanded anchors.bottom: parent.bottom } @@ -138,6 +139,9 @@ Item } sourceSize.width: width sourceSize.height: height + source: contentType == ExpandableComponent.ContentType.Floating ? + (expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")) : + UM.Theme.getIcon("pencil") visible: source != "" width: UM.Theme.getSize("standard_arrow").width height: UM.Theme.getSize("standard_arrow").height @@ -151,7 +155,8 @@ Item onClicked: toggleContent() hoverEnabled: true onEntered: background.color = headerHoverColor - onExited: background.color = headerBackgroundColor + onExited: background.color = (contentType == ExpandableComponent.ContentType.Fixed && expanded) ? + headerActiveColor : headerBackgroundColor } } @@ -190,16 +195,15 @@ Item border.color: UM.Theme.getColor("lining") radius: UM.Theme.getSize("default_radius").width } + } - contentItem: Item { } - - onContentItemChanged: - { - // Since we want the size of the content to be set by the size of the content, - // we need to do it like this. - content.width = contentItem.width + 2 * content.padding - content.height = contentItem.height + 2 * content.padding - } + onContentItemChanged: + { + // Since we want the size of the content to be set by the size of the content, + // we need to do it like this. + content.width = contentItem.width + 2 * content.padding + content.height = contentItem.height + 2 * content.padding + content.contentItem = contentItem } // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item. diff --git a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml index de92161bbb..ea82f4fe13 100644 --- a/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml +++ b/resources/qml/Menus/ConfigurationMenu/QuickConfigurationSelector.qml @@ -27,7 +27,6 @@ Cura.ExpandableComponent name: "cura" } - iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") headerItem: Item { // Horizontal list that shows the extruders diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index 78bdbde542..0eea697950 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -14,7 +14,7 @@ Cura.ExpandableComponent property string enabledText: catalog.i18nc("@label:Should be short", "On") property string disabledText: catalog.i18nc("@label:Should be short", "Off") - iconSource: UM.Theme.getIcon("pencil") + contentType: Cura.ExpandableComponent.ContentType.Fixed contentPadding: UM.Theme.getSize("default_lining").width contentSpacingY: UM.Theme.getSize("narrow_margin").width diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 49b4f87267..69a1ac899c 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -17,7 +17,6 @@ Cura.ExpandableComponent contentPadding: UM.Theme.getSize("default_lining").width contentAlignment: Cura.ExpandableComponent.ContentAlignment.AlignLeft - iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") UM.I18nCatalog { diff --git a/resources/qml/ViewsSelector.qml b/resources/qml/ViewsSelector.qml index 71a29e4949..d469202606 100644 --- a/resources/qml/ViewsSelector.qml +++ b/resources/qml/ViewsSelector.qml @@ -13,7 +13,6 @@ Cura.ExpandableComponent contentPadding: UM.Theme.getSize("default_lining").width contentAlignment: Cura.ExpandableComponent.ContentAlignment.AlignLeft - iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") property var viewModel: UM.ViewModel { }