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

Rebinding of property alias does not work for some aliases that refer to certain (grouped) properties

    XMLWordPrintable

Details

    • 0fdf9042c (dev), 3ea55bf39 (dev), c07f63d06 (6.6), 7326d41be (6.6), dc4bd4fb3 (tqtc/lts-6.5), 11045230c (tqtc/lts-6.5), 6b43739ad (tqtc/lts-6.2), c850ac5cc (tqtc/lts-6.2)

    Description

      A sample is attached. Basically, a Rectangle defined in SubItem1.qml is instantiated in main.qml. There are 2 aliases 'fillColor' and 'borderColor' defined inside Rectangle, referring to color and border.color which are further bound to 'trueFillColor' and 'trueBorderColor' respectively. Both aliases are rebound in main.qml, but the behavior is not as expected.

      5 observations:
      1. Rebinding of alias 'fillColor' at the time of instantiation using colon ':' works. But rebinding of alias 'borderColor' in the same way fails. That is, 'myItem' is instantiated as a light grey Rectangle without visible border at the first place.
      2. Rebinding of both aliases later using Qt.binding work, i.e. clicking 'Rebind' button makes Rectangle filled in red with blue border.
      3. Reassigning of aliases later using equal sign '=' work too.
      4. The output from onColorChanged and border.onColorChanged goes like following. So color looks OK, that it changes to grey once and emits signal. But border.color emits singal twice and neither is black. border.color is changed to transparent twice.
      5. Modify SubItem1 a little. Let color and border.color be bound directly to value, e.g. "transparent", instead of to other properties, and then relaunch the application. This time, rectangle looks correct at the first place, i.e. a rectangle filled in grey with black border.

      Attachments

        1. Sample.zip
          4 kB
          Luqiao Chen

        Issue Links

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

          Activity

            People

              ulherman Ulf Hermann
              luqiaochen Luqiao Chen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: