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

QML Binding Loop on "implicitWidth"

    XMLWordPrintable

Details

    Description

      I have a tabbed qml interface (QtQuick 2.2). In one tab there is a parent groupbox and a child groupbox. The child groupbox contains a text area that should expand to consume all available space. I can get the app to behave the way I want. I don't understand why the nested groupbox generates a qml binding loop error on implicitWidth. I'm attaching the entire project but here's a summary of the QML

      In the main.qml under ApplicationWindow (all import statements elided)

          TabView {
              id:frame
              anchors.fill: parent
              anchors.margins:5
              Tab{
                  id: setupPage
                  //NOTE if I don't mark active as true then this tab doesn't get created
                  //until it is clicked on. Not good for trying to set things up.
                  active:true
                  objectName:"TabParentOfSetup"
                  enabled: true
                  title: "Setup"
                  SetupTab {
                  }
              }
          }
      

      SetupTab.qml looks like this

       
          GroupBox{
             title:qsTr("GroupBoxTitle")
             signal notifyEvent()
             anchors.fill: parent
             anchors.margins: 11
             ColumnLayout{
                anchors.fill: parent
                MyTestRow{
                  Layout.fillHeight: true
                  Layout.fillWidth: true
                }
             }
          }
      

      Then MyTestRow.qml has

          GroupBox{
             anchors.margins: 10
             title:qsTr("Instrument Messages")
             id:myRow
             RowLayout{
                 anchors.fill: parent
                 TextArea {
                     id:msgTextBox
                     Layout.fillWidth: true
                     Layout.fillHeight: true
                 }
             }
            }
      

      The full error message is

      qrc:///SetupTab.qml:14:9: QML GroupBox: Binding loop detected for property "implicitWidth"

      Line 14 is the one where MyTestRow is created.
      In the real app there are two tabs and in main.qml for the second tab I had to add the active:true property or the tab didn't load. Quite by accident while preparing the sample project I discovered that if I comment out the active:true the binding error doesn't happen. Unfortunately this is not an viable work-around for the actual application.

      Attachments

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

        Activity

          People

            mitch_curtis Mitch Curtis
            rolias Tod Gentille
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes