K
K
Kalombyr2018-10-11 17:19:12
Qt
Kalombyr, 2018-10-11 17:19:12

QML how to make animation for Layout.fillHeight?

Good day!
It is necessary to animate the folding of the rectangle, all the markup on Layouts.
For example:

Rectangle {
 id: contentWrapper
 Layout.fillWidth: true
 Layout.fillHeight: true

 Behavior on height {
   NumberAnimation { duration: 500; }
 }

 states: [
   State {
      name: "hidded"
      when: label.hide
      PropertyChanges {
            target: contentWrapper
            Layout.fillHeight: false
            height: 0 
         }
      }
 ]
}

In this way, only the contents are smoothly folded, the occupied space remains unchanged. It unfolds back in a jerk (logically, because of Layout.fillHeight), if you change the state during the animation, it will not unfold at all and freeze in place.
I tried setting Layout.preferredHeight: 0 and Behavior on Layout.preferredHeight, but then the same jerk without animation at all (but the space occupied is already decreasing).
So, how do I make smooth folding/expanding when using Layout ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question