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

property initialization order incorrect

    XMLWordPrintable

Details

    • 312604c85b1e6a6fc6de505bac86848936f81edd

    Description

      Let's assume we want to use the Button component in an application as:

      Button.qml:
      Item {
          property string text: "A"
       
          Component.onCompleted: {
              console.log( "Button::onCompleted " + text )
          }
      }
       
      MyApp.qml:
      Window {
          Button {
              text: "B"
          }
      }
      

      This prints out "B" as expected. But when I change the property initialization in button.qml to

      property string text: {"A"} // or
      property string text: getInitialValue() // which returns "A"
      

      Expected initial value is "B" in all cases. This is very concrete example in QML components when the initial value is fetched from platform theme or from localization data.

      Attachments

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

        Activity

          People

            aakenned Aaron Kennedy
            pekjokel Pekka Jokela
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes