Weird ComboBox behavior



  • Hello everyone,

    I just stumbled on some weird behavior from the QML ComboBox. As soon as a ComboBox is located inside an asynchronous loaded component (It doesn't even have to be the Component top Item) the order of the ComboBox content is incorrect.
    The style of the popup menu when opening the ComboBox also differs from a synchronously loaded ComboBox
    The workaround I found is to to wrap the ComboBox inside a synchronous Loader.

    Is this the intended behavior ?

    Here is some sample code to illustrate this behavior

    import QtQuick 2.4
    import QtQuick.Controls 1.3
    import QtQuick.Window 2.2
    import QtQuick.Dialogs 1.2
    
    Window {
        id: win
        title: qsTr("Hello World")
        width: 640
        height: 480
        visible: true
    
        property var model: ["item 1", "item 2", "item 3", "item 4", "item 5", "item 6", "item 7", "item 8"]
    
        Component {
            id: comboCompo
            Column {
                ComboBox {
                    id: combo
                    model: win.model
                }
            }
        }
    
        Component {
            id: wrappedCompo
            Loader {
                sourceComponent: comboCompo
                asynchronous: false
            }
        }
    
        Grid {
            columns: 3
            anchors.fill: parent
            GroupBox {
                // [1]
                title: "Synchronous"
                Loader {
                    sourceComponent: comboCompo
                    asynchronous: false
                }
            }
    
            GroupBox {
                // [2]
                title: "Asynchronous"
                Loader {
                    sourceComponent: comboCompo
                    asynchronous: true
                }
            }
    
            GroupBox {
                // [3]
                title: "Wrapped Asynchronous"
                Loader {
                    sourceComponent: wrappedCompo
                    asynchronous: true
                }
            }
        }
    }


  • i already reported this bug.

    The problem is with the instantiator element.
    When it runs async, it doesnt respect the order.
    search for the bug and vote up...
    by the moment, just dont use async, and care, because if a parent is loading a component async, and that component contains an instantiator (or a Combobox) your will get the same problem



  • Thank you for your reply.

    I searched for the bug reports and only found reports about a crash when using Instantiator in an asynchronous Loader.
    I will upvote your bug report if I can find it.

    As for your suggestion to avoid async loader entirely it seems you are right. The workaround I talked about works in the simple example I gave but fails in more elaborate situations.




Log in to reply
 

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