Displaying the same QML Item multiple times

  • Hi,

    is it possible to multiple instances of the same object in QML? I would like to display it multiple times and when I interact with one instance, it updates all the other instances.

    Thanks for any help.
    Best regards.

  • Have a look at Repeater

    Can you elaborate on what you want to achieve?

  • The idea is to have small unique "process blocks" available to the user. Then, he can arrange instances of them as he wants in several graphs. When he launched one processing block instance, it should visually update all instances of the same processing block.

    Best regards.

  • What do you have already?

  • Hi, I don't think you can display the "same" item multiple times, that doesn't work in any GUI app as far as I know (i mean really the same item not a copy or identical looking).
    You can of course display multiply objects of the same type and either save a list of the ID's or if you need to change all items of the same type iterate through your item list or tree and find the same items dynamically.
    In your case you should have a list of your "process blocks" somewhere and have access to the type?

  • Hi,

    thanks all for your answers.

    @eddy: I have the C++ objects made available to QML + my QML file with multiple "independent" objects (those I would be the same instance).

    @Xander84: I see. So I would need somehow to ensure that when I modify one of them, they are all resynchronized together?

  • yeah I think you have to "sync them together", but that should be fairly easy with QML I think? You could use property bindings but without any specifics how your app works it's hard to say.

  • Yes, indeed. With property binding it should quite straightforward I believe. I will try this and see how it works. Thanks a lot!

    Best regards.

Log in to reply