Problems with QtQuick and sizing



  • Hi people,
    sorry - I have a feeling as if this is trivial... but I am really stuck on this:

    @ Item { <- QML Item: Binding loop detected for property "width"
    id: contentItem
    anchors.left: parent.left
    width: childrenRect.width
    height: childrenRect.height
    }@

    Same message for height on same line...

    This is of course an excerpt of a bigger file -- ao I question myself: is the error message pointing to the right place or does it mean something else? Am I not allowed to define height and width for an Item from the children?

    Thanks for advice -- also for where I can read about it :-/

    The Captain


  • Moderators

    Hi,

    A binding loop means you have circular dependencies. For example,

    @
    Rectangle {
    id: outerRect
    width: innerRect.width

    Rectangle {
        id: innerRect
        width: outerRect.width
    }
    

    }
    @

    If you want to calculate the width of outerRect, you first need to calculate the width of innerRect. But, if you want to calculate the width of innerRect, you first need to calculate the width of outerRect. Thus, it is impossible to find the widths of either rectangle.



  • Hi,
    thanks for the clarification... As far as I see, "width: childrenRect.width" should not be circular?

    Thanks again,
    Tobias


  • Moderators

    You're welcome :)

    [quote author="topse" date="1406810154"]As far as I see, "width: childrenRect.width" should not be circular?[/quote]By itself, it's not circular. However, do any of your children's widths depend on the parent's width? How are each of your children's widths calculated?



  • Thanks again ... I will check it... what a pitty that the debugger does not give more information :-/

    Tobias


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.