Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Binding Loop Width/Height
Forum Updated to NodeBB v4.3 + New Features

Binding Loop Width/Height

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 215 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Redman
    wrote on last edited by
    #1

    Hello,

    DeviceFactory.qml

    import QtQuick 6.0
    import QtQuick.Layouts 6.0
    import QtQuick.Controls 6.0
    
    
    Item {
        id: root
    
        Component.onCompleted: {
            console.log("ITEM WIDTH " + width)
            console.log("ITEM HEIGHT " + height)
        }
    
        width: childrenRect.width
        height: childrenRect.height
    
        Repeater {
            model: privateProperties.devicesPopulated ? privateProperties.devices.length : 0
    
            Label {
                anchors.centerIn: parent
                text:"TEST"
            }
        }
    
        QtObject {
            id: privateProperties
    
            property bool devicesPopulated: false
    
            property var devices: {
                let list = []
                for (var i = 0; i < 5; i++) {
                    list.push(1)
                }
                devicesPopulated = true
                return list
            }
        }
    }
    
    

    QML DeviceFactory: Binding loop detected for property "width"
    QML DeviceFactory: Binding loop detected for property "height"

    Why is that a binding loop?

    I use the DeviceFactories width/height in the parent component of DeviceFactory. If I do not set width/height like in my example, the parent component always ready width/height = 0.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Redman
      wrote on last edited by
      #3

      After removing anchors.centerIn: parent from the Label and changed it to anchors.fill: parent the problem was fixed.

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #2

        From the above code it does not seem like a binding loop. Show us the code where you are using this.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Redman
          wrote on last edited by
          #3

          After removing anchors.centerIn: parent from the Label and changed it to anchors.fill: parent the problem was fixed.

          1 Reply Last reply
          0
          • R Redman has marked this topic as solved on

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved