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

Anchor property changes in states affects other properties in wrong way

    XMLWordPrintable

Details

    Description

      When I define any anchor property changes inside new state definition, the state transition modifies other properties in strange way:

      Example:

      import QtQuick 1.0

      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 }

      PropertyChanges

      { target: myRect color: "green" }

      }

      MouseArea

      { anchors.fill: parent; onClicked: window.state = "reanchored" }

      }

      Based on this code, myRect should change color from "red" to "green", but in console log I get:

      new color: #008000
      new color: #ff0000
      new color: #008000

      why the property is set to previous value during the transition ? It only occurs when I try to modify anchors in states

      Attachments

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

        Activity

          People

            martjone Martin Jones (closed Nokia identity) (Inactive)
            trismer Maciej Kujalowicz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes