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

How can I bind properties of select Listview delegate with other component properties?



  • Hi. I have some doubts about how it is the best approach to the next situation:

    I have a dynamic model C++ that inherits from QAbstractItemModel as usual.

    {
    name: item1
    myproperty1: 42
    myproperty2: 50
    myproperty3: 42
    myproperty4: 50
    }
    ...
    {
    name: item2
    ...
    }
    

    I represent this model in a Listview in qml. In the Delegate, I just only represent the name of the item.

    I also have a component named OtherComponent that shows the properties of the delegate when I click on it. This mechanism is implemented using a signal. The OtherComponent component is the same for all items, just change the value of the respective item.

    The problem is the binding of the properties. When I click item1, the property1 stays in 42 and never update it, and so on. If I clicked the item2, for example, and return to item1, the property1 changed from 42 to another number.

    How I can bind the properties of the selected delegate with the OtherComponent properties?

    da6c0232-cef6-4aad-bbd8-49acf3ffe223-image.png


Log in to reply