From b8dfc1e9a57d47227958f37f88b47b6c99a60722 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 4 Jan 2017 14:27:48 +0100 Subject: [PATCH] QmlDesigner: Refactor section We use a property to control the state and ensure the animation is not triggered by the initialization. Change-Id: Icf88e63e6fda34826da6be70369902fa168ea48c Reviewed-by: Tim Jenssen --- .../HelperWidgets/Section.qml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml index 3d185399956..61224501acc 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml @@ -34,7 +34,9 @@ Item { property int topPadding: 4 property int rightPadding: 0 - readonly property int animationDuration: 120 + property int animationDuration: 0 + + property bool expanded: true clip: true @@ -67,6 +69,7 @@ Item { duration: animationDuration } } + } color: creatorTheme.BackgroundColorDark @@ -89,10 +92,8 @@ Item { MouseArea { anchors.fill: parent onClicked: { - if (section.state === "") - section.state = "Collapsed"; - else - section.state = ""; + section.animationDuration = 120 + section.expanded = !section.expanded } } } @@ -123,6 +124,7 @@ Item { states: [ State { name: "Collapsed" + when: !section.expanded PropertyChanges { target: section implicitHeight: header.height