stackView.push(component,{}) property applying order

  • I have tried use new Controls 2 way to manage life of dynamical generated components and catch strange applying order (at least for me). Here is my code:


    import QtQuick 2.7
    Rectangle {
        property alias index: combo1.index
        property string value: ""
        onValueChanged: {
            id: combo1
            anchors.fill: parent
            model: ["zero","one","two","three"]


    import QtQuick 2.7
    import QtQuick.Controls 1.4
    Item {
        property alias index: combo.currentIndex
        onIndexChanged: {
            console.log("index changed")
        property alias model: combo.model
        onModelChanged: {
            console.log("model changed")
            id: combo
            anchors.centerIn: parent
            width: parent.width-10
        function setValue(val){
            var index = model.indexOf(val)
            // HOTFIX: val==="" was added because ComboBox actually don't want to set "" as curretnText from code
            // Reason for this function:
            if (index === -1 || val === ""){
                input.editText = val
                input.currentIndex = index

    How I load:

    var component = Qt.createComponent("Page1.qml")
    // result is good, but I can see that index was applied before model  in console
    //  here catch error qrc:/MyCombo.qml:21: TypeError: Property 'indexOf' of object 1 is not a function

    I am a bit confused this fact. Of course, I have fix it in my code by manual applying model before index, but I don't know does it bug and should I create bug report or it is just sprcific feature

Log in to reply