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. Signal after all changes on QQuickItem
Qt 6.11 is out! See what's new in the release blog

Signal after all changes on QQuickItem

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 217 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.
  • H Offline
    H Offline
    Hasardel
    wrote on last edited by
    #1

    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 ?

    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