mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-12-11 16:00:47 -07:00
Collapse the setting section when the switch for the section is disabled.
Add collapse animation for setting items and setting section. Swap out ColumnLayout for Layout. Animating the Layouts does not seem to be possible. I had to put spacer back into the Column but it is the lesser of two evils. CURA-9793
This commit is contained in:
parent
574b1000f6
commit
62bae7df19
5 changed files with 118 additions and 27 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Copyright (c) 2022 UltiMaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
|
|
@ -11,14 +11,15 @@ import Cura 1.7 as Cura
|
|||
|
||||
Item
|
||||
{
|
||||
id: settingItem
|
||||
width: parent.width
|
||||
Layout.preferredHeight: childrenRect.height
|
||||
Layout.minimumHeight: UM.Theme.getSize("section_header").height
|
||||
Layout.fillWidth: true
|
||||
|
||||
property alias settingControl: settingContainer.children
|
||||
property alias settingName: settingLabel.text
|
||||
property string tooltipText: ""
|
||||
property bool isCompressed: false
|
||||
|
||||
UM.Label
|
||||
{
|
||||
|
|
@ -49,4 +50,42 @@ Item
|
|||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
states:
|
||||
[
|
||||
State
|
||||
{
|
||||
name: "sectionClosed" // Section is hidden when the switch in parent is off
|
||||
when: isCompressed
|
||||
PropertyChanges
|
||||
{
|
||||
target: settingItem;
|
||||
opacity: 0
|
||||
height: 0
|
||||
implicitHeight: 0
|
||||
Layout.preferredHeight: 0
|
||||
Layout.minimumHeight: 0
|
||||
}
|
||||
},
|
||||
State
|
||||
{
|
||||
// All values are default. This state is only here for the animation.
|
||||
name: "sectionOpened"
|
||||
when: !isCompressed
|
||||
}
|
||||
]
|
||||
|
||||
transitions: Transition
|
||||
{
|
||||
from: "sectionOpened"; to: "sectionClosed"
|
||||
reversible: true
|
||||
ParallelAnimation
|
||||
{
|
||||
// Animate section compressing as it closes
|
||||
NumberAnimation { property: "Layout.minimumHeight"; duration: 100; }
|
||||
// Animate section dissapearring as it closes
|
||||
NumberAnimation { property: "opacity"; duration: 100; }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue