Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Signal after all changes on QQuickItem



  • Hi,

    Here is a example :

    
    import QtQuick 2.13
    import QtQuick.Controls 2.13
    
    Rectangle {
        anchors.fill: parent
    
        QtObject {
            id: fruitsModel
                
            property string category: "Fruits"
            property var lst: [ "Banane", "Fraise", "Framboise" ]
        }
    
        QtObject {
            id: legumesModel
                
            property string category: "Legumes"
            property var lst: [ "Patate", "Carotte" ]
        }
    
        Column {
            Row {
                Button {
                    text: "Fruits"
    
                    onClicked: {
                        fruitsEtLegumes.model = fruitsModel;
                    }
                }
    
                Button {
                    text: "Legumes"
    
                    onClicked: {
                        fruitsEtLegumes.model = legumesModel;
                    }
                }
            }
    
            Column {
                id: fruitsEtLegumes
    
                property var model: fruitsModel
    
                onModelChanged: {
                    console.log("model changed");
                }
    
                //onUpdated: {
                //    console.log("updated ?");
                //}
    
                Text {
                    text: fruitsEtLegumes.model.category
                    font.underline: true
    
                    onTextChanged: {
                        console.log("category changed");
                    }
                }
    
                Column {
                    Repeater {
                        model: fruitsEtLegumes.model.lst
    
                        onCountChanged: {
                            console.log("list changed")
                        }
    
                        Text {
                            text: modelData
                        }
                    }
                }
            }
        }
    }
    

    What signal is called after all changes ?


Log in to reply