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. QML Loader: Binding loop detected for property "sourceComponent" in ComboBox
Forum Updated to NodeBB v4.3 + New Features

QML Loader: Binding loop detected for property "sourceComponent" in ComboBox

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 1.2k Views 1 Watching
  • 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.
  • V Offline
    V Offline
    Vaclav
    wrote on last edited by Vaclav
    #1

    Hello everyone,
    I have problem with binding loop in ComboBox. When I open popup and the TextInput with focus is loaded, then a get message
    qrc:/qml/main.qml:48:22: QML Loader: Binding loop detected for property "sourceComponent" in Application Output.
    The TextInput and Text change is necessary, because TextInput doesn't have property elide.
    Here is my code:

    import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtQuick.Controls 2.12
    
    ComboBox
        {
            id: cbx
            editable: true
            Component
            {
                id: textInputEditable
                TextInput
                {
                    text: "aaa"
                    horizontalAlignment: Text.AlignLeft
                    verticalAlignment: Text.AlignVCenter
                    focus: true
                    onActiveFocusChanged:
                    {
                        if ( !cbx.popup.opened )
                        {
                           cbx.popup.open()
                        }
                    }
                }
            }
            Component
            {
                id: textRO
                Text
                {
                    text: cbx.currentText
                    horizontalAlignment: Text.AlignLeft
                    verticalAlignment: Text.AlignVCenter
                    elide: Text.ElideMiddle
                }
            }
            contentItem: Loader
            {
                sourceComponent: cbx.popup.opened ? textInputEditable : textRO
            }
            model: ListModel
            {
                id: model
                ListElement { text: "Banana" }
                ListElement { text: "Apple" }
                ListElement { text: "Coconut" }
            }
        }
    

    Do You have any idea how to avoid binding loop?
    Thank You for Your help.
    Vaclav.

    ODБOïO 1 Reply Last reply
    0
    • V Offline
      V Offline
      Vaclav
      wrote on last edited by
      #3

      @LeLev said in QML Loader: Binding loop detected for property "sourceComponent" in ComboBox:

      onDownChanged: loader.sourceComponent = down ? textInputEditable : textRO

      It works. Thanks a lot.
      Vaclav.

      1 Reply Last reply
      0
      • V Vaclav

        Hello everyone,
        I have problem with binding loop in ComboBox. When I open popup and the TextInput with focus is loaded, then a get message
        qrc:/qml/main.qml:48:22: QML Loader: Binding loop detected for property "sourceComponent" in Application Output.
        The TextInput and Text change is necessary, because TextInput doesn't have property elide.
        Here is my code:

        import QtQuick 2.12
        import QtQuick.Window 2.12
        import QtQuick.Controls 2.12
        
        ComboBox
            {
                id: cbx
                editable: true
                Component
                {
                    id: textInputEditable
                    TextInput
                    {
                        text: "aaa"
                        horizontalAlignment: Text.AlignLeft
                        verticalAlignment: Text.AlignVCenter
                        focus: true
                        onActiveFocusChanged:
                        {
                            if ( !cbx.popup.opened )
                            {
                               cbx.popup.open()
                            }
                        }
                    }
                }
                Component
                {
                    id: textRO
                    Text
                    {
                        text: cbx.currentText
                        horizontalAlignment: Text.AlignLeft
                        verticalAlignment: Text.AlignVCenter
                        elide: Text.ElideMiddle
                    }
                }
                contentItem: Loader
                {
                    sourceComponent: cbx.popup.opened ? textInputEditable : textRO
                }
                model: ListModel
                {
                    id: model
                    ListElement { text: "Banana" }
                    ListElement { text: "Apple" }
                    ListElement { text: "Coconut" }
                }
            }
        

        Do You have any idea how to avoid binding loop?
        Thank You for Your help.
        Vaclav.

        ODБOïO Offline
        ODБOïO Offline
        ODБOï
        wrote on last edited by ODБOï
        #2

        @Vaclav hi
        You can do like this

        ComboBox {     
                onDownChanged: loader.sourceComponent = down ?  textInputEditable :  textRO
        }
        
        1 Reply Last reply
        0
        • V Offline
          V Offline
          Vaclav
          wrote on last edited by
          #3

          @LeLev said in QML Loader: Binding loop detected for property "sourceComponent" in ComboBox:

          onDownChanged: loader.sourceComponent = down ? textInputEditable : textRO

          It works. Thanks a lot.
          Vaclav.

          1 Reply Last reply
          0

          • Login

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