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. How can I bind properties of select Listview delegate with other component properties?

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

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 277 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.
  • oria66O Offline
    oria66O Offline
    oria66
    wrote on last edited by
    #1

    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

    The truth is out there

    1 Reply Last reply
    0
    • oria66O Offline
      oria66O Offline
      oria66
      wrote on last edited by
      #2

      For the record, I used custom getters of the model, with the current index of the Listmodel.

      The truth is out there

      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