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

QML: AnchorChanges with Transitions makes PropertiesChanges to be triggered multiple times

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 5.15.12
    • None
    • Windows

    Description

      When using AnchorChanges with a Transition my application makes the PropertyChanges to be triggered more than once. 

      I am able to reproduce the issue with this simple example: 

      import QtQuick 2.15
      
      Rectangle {
          id: window
          width: 120; height: 120
          color: "black"
      
          Rectangle { 
              id: myRect; width: 50; height: 50; color: "red" 
              
              onColorChanged: {
                  console.log("new color: " + color)
              }
          }
      
          states: State {
              name: "reanchored"
      
              AnchorChanges {
                  target: myRect
                  anchors.top: window.top
                  anchors.bottom: window.bottom
              }
              
              PropertyChanges {
                  target: myRect
                  anchors.topMargin: 10
                  anchors.bottomMargin: 10
                  color: "blue"
              }
          }
          
          MouseArea { anchors.fill: parent; onClicked: window.state = "reanchored" }
      
          //add this
          transitions: [Transition{}]
      }
      

      where the output is
      > new color: #0000ff
      > new color: #ff0000
      > new color: #0000ff

      but if I comment out either the AchorChanges or the transitions, the output would be
      > new color: #0000ff

      I was expecting the color to be changed only once in both cases, is this expected?

      Attachments

        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
            arthur_so Arthur Riuiti Pinheiro So
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes