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

Add warning when setting parent-relative properties in QML types that create sub-containers

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.15, 6.5
    • None

      This code inside a scroll view is broken in 2 ways, but there are no warnings at all.

      ScrollView {
             id: test2
             clip: false       ColumnLayout {
               // anchors.left: parent.left
               // anchors.right: parent.right
               // anchors.top: parent.top
              width: parent.width
      ..... 

       

      1) Setting anchors in a Scrollview doesn't make sense and should throw a warning.

      2) `width: parent.width` will not give the desired result–it will return test2.contentWidth.
      The desired effect can be achieved with `width: test2.width`, but again, no warning is given.

       

      In the case of a ScrollView, almost any setting referring to "parent" will be wrong, so a warning should be given. I can't think of anything off the top of my head, but I'm sure there are other Types that have similar behavior. (maybe ScrollLayout?)

       

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            mairtin.s Mairtin Steinkamp
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes