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

Need support for non-uniform positioner transitions

    XMLWordPrintable

Details

    • 79608d6f72ea5963aed2fa161b9ef6781adbc41e

    Description

      The purpose of the code below is to show how the movement of the items in a
      grid could be staggered. There are currently two problems preventing this from working:
      1) the "index" of the item that the Transition is applied to is not available in the scope of the Transition
      2) the Transition is only executed once, rather than once per item that moves

      import QtQuick 2.0
      
      Rectangle {
          width: 320
          height: 480
      
          property int deletedItemIndex: 0
      
          ListModel { id: theModel }
          Component.onCompleted: {
              for(var i = 0; i < 20; i++) {
                  theModel.append( {} );
              }
          }
      
          Grid {
              anchors.centerIn: parent
              spacing: 10
      
              move: Transition {
                  SequentialAnimation {
                      ScriptAction { script: print("#### Grid's move-transition item index: " + index) }
                      NumberAnimation { properties: "x, y"; duration: 300 + Math.max(index-deletedItemIndex, 0)*50 }
                  }
              }
      
              Repeater {
                  model: theModel
                  delegate: Rectangle {
                      width: 60; height: 60;
                      color: "blue"
      
                      MouseArea {
                          anchors.fill: parent
                          onClicked: {
                              deletedItemIndex = index;
                              theModel.remove(index);
                          }
                      }
                  }
              }
          }
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bealam Bea Lam (closed Nokia identity) (Inactive)
            mathiasm Mathias Malmqvist
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes