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

Inline component state issue

    XMLWordPrintable

    Details

    • Platform/s:
      Windows
    • Commits:
      2425cd478138c52694aaa20b7f7eb4a91d97b51c (qt/qtdeclarative/dev) 5652923d99166e942385eb35b778d26b55ab4b0a (qt/qtdeclarative/5.15) cdfb593985496f70b33e295f35b84c8dcf494cc2 (qt/qtdeclarative/5.15.2)

      Description

      When properties of inline components are changed using states, the property does not appear to change.

      In the following example there are two rectangles. One of them is an inline component, the other is not. The rectangle instantiated by the loader gets the correct color (green), but the rectangle of the inline component does not.

      import QtQuick 2.15
      import QtQuick.Controls 2.15
      import QtQuick.Layouts 1.15
      
      ApplicationWindow {
          id: root
      
          visible: true
          width: 800
          height: 600
      
          ColumnLayout {
              component RectComponent: Rectangle {
                  id: myRect2
      
                  implicitWidth: 10
                  implicitHeight: 10
                  color: "red"
                  states: [
                      State {
                          name: "myState"
                          PropertyChanges {
                              target: myRect2
                              color: "green"
                          }
                      }
                  ]
                  Component.onCompleted: state = "myState"
              }
              Component {
                  id: rectComponent
                  Rectangle {
                      id: myRect1
      
                      implicitWidth: 10
                      implicitHeight: 10
                      color: "red"
                      states: [
                          State {
                              name: "myState"
                              PropertyChanges {
                                  target: myRect1
                                  color: "green"
                              }
                          }
                      ]
                      Component.onCompleted: state = "myState"
                  }
              }
              Loader { sourceComponent: rectComponent }
              RectComponent {}
          }
      }
      
      

        Attachments

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

          Activity

            People

            Assignee:
            fabiankosmale Fabian Kosmale
            Reporter:
            dmartin Daniel Martin
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes