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

QML: State is not reset to default when using AnchorChanges

    XMLWordPrintable

Details

    • 8ab760b70e13318749bcc83e33b9a9b9a849a892

    Description

      In the following example, when selecting the text and set it to an empty string, the black rectangle falls to the bottom as expected. But when writing some text back in, the location of the rectangle is not restored. It will work if I choose to use PropertyChanges instead, which reveals that either this is a bug or an inconsistency in QML.

      import Qt 4.7
      
      Rectangle {
          id: root
          width:300; height:400
      
          TextEdit {
              id: e1
              anchors.horizontalCenter: root.horizontalCenter
              text: "<clear this text to move rectangle>"
          }
      
          Rectangle {
              id: rectangle
              color: "black"
              width:50; height:50
              y: 50
      
              states: [
                  State {
                      when: e1.text == ""
                      AnchorChanges {
                          target: rectangle
                          anchors.bottom: root.bottom
                      }
      //                PropertyChanges {
      //                    target: rectangle
      //                    y: 200
      //                }
                  }
              ]
           }    
      }
      

      Attachments

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

        Activity

          People

            brasser Michael Brasser (closed Nokia identity) (Inactive)
            richard Richard Moe Gustavsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes