Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-114535

time-based size animation not working

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.5.1
    • None
    • Windows

    Description

      Collapse doesn't observed animation time.

      // Main.qml
      import QtQuick
      import QtQuick.Controls
      import QtQuick.Layouts
      
      ApplicationWindow {
          id: mainWindow
      
          visible: true
          width: 800
          height: 480
      
          ColumnLayout {
              anchors.fill: parent
              spacing: 0
      
              CollapsibleBar {
                  id: collapsibleBar
                  Layout.alignment: Qt.AlignVCenter | Qt.AlignTop
                  contents: Rectangle {
                      implicitHeight: 300 // this is causing the problem.
                      width: mainWindow.width
                      color: 'lightgray'
                      Text {
                          anchors.centerIn: parent
                          text: 'this light gray bar should appear below the light blue bar.'
                      }
                  }
              }
              Rectangle {
                  y: collapsibleBar.height
                  Layout.preferredHeight: 100
                  Layout.fillWidth: true
                  color: 'lightgreen'
                  Text {
                      anchors.centerIn: parent
                      text: "this light green bar should appear below everything else."
                  }
              }
          }
      }
      
      // CollapsibleBar.qml
      import QtQuick
      import QtQuick.Controls
      import QtQuick.Layouts
      
      Rectangle {
          id: bar
          color: "lightblue"
      
          default property alias contents: contentItem.children
          property bool collapsed: true
      
          height: contentsArea.height
          width: mainWindow.width
      
          Column {
              id: contentsArea
      
              RowLayout {
                  id: barHeader
      
                  width: mainWindow.width
                  height: 32
      
                  RoundButton {
                      implicitWidth: 24
                      implicitHeight: 24
      
                      onClicked: {
                          bar.collapsed = !bar.collapsed;
                      }
                  }
      
                  Text {
      //                Layout.Alignment: Qt.AlignHCenter // BTW: this line doesn't compile.
                      text: "this light blue bar should appear above everything."
                  }
              }
      
              Column {
                  id: contentItem
                  clip: true
                  height: bar.collapsed ? 0 : implicitHeight
      
                  Behavior on height {
                      NumberAnimation {
                          duration: 500
                      }
                  }
              }
          }
      

      Attachments

        1. collapsed.JPG
          collapsed.JPG
          48 kB
        2. open.JPG
          open.JPG
          49 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            mzimmers Michael Zimmers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes