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

Width property binding with anchors

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 4.7.1
    • None
    • PC Ubuntu

    Description

      After a component's width attribute has been overwritten with an anchors definition, the width still continues to be bind and causes useless bindings.

      After starting the test.qml file in attachment, click on the text field, the following text outputs in the console:

      text clicked
      black width res=30
      purple width res=20
      purple width res=20
      

      We can see that the width is still bound to the "testVal" property but the value returned for the width property is not saved because of the anchors definition.
      The width property of the purple rectangle is then called twice, which is useless because the width value of the parent has not been updated.

      I suggest to remove the binding to other properties when overwritten with anchors.
      This behavior may be wanted if the user wish to restore the property binding later, like this:

      testCompo.anchors.right = undefined;
      testCompo.testVal++;
      testCompo.testVal--;
      

      The aim of the ugly increment/decrement of the "testCompo.testVal" is to force the update of the width of the black and purple rectangles.

      Attachments

        Issue Links

          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)
              agroyer Anthony Groyer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes