TreeModelView with (Realtime) Options

  • Hey dear Qt users,
    I'm starting a big events router app and I figured the Qt Model/View could be usefull.

    The first step I want to achieve is to design the applications's architecture I want to control, mostly by OSC.
    To do that, I want to use a TreeModelView which store the app hierarchy which represent each Osc control I want to use. But I'm not very familiar (yet) with the Model workflow.
    My problem is for each node, I want options like Osc Path, the actual value. And I don't know wich solution is best.

    The way I see it I have multiple choices.

    • Options as Children Items of the node

    Pros : Updated by Viewer

    Cons : Seems difficult to get track of Parents/Children. Do I need to define a new Item class for each options?

    • Options as Q_Property of the Node

    Pros :/

    Cons : Loosing the AutoView Update

    • Options as a ItemData class

    Pros : kind of an interface to put all options in one place

    Cons : Loosing the AutoView Update

    • Options as CustomRoles

    Pros : All data in one place

    Cons : Editing may be a problem

    I can't figure which is best. Maybe I missed a solution there.

    The secondary question is the Realtime side of this application.
    If I store the actual values of each controls as a TreeItem, can the Model/View system handle all these changing values laglessly?

    Thanks in advance for any help.

  • try to see here:
    if you have other questions let me know

  • Thanks but I know about this example.
    That's would be my solution 1.
    Are you saying I should use this one?
    If that so, is it possible to store the realtime value in a children?

  • yes, is possible to store the realtime value in a fhater and children

  • Thanks for the input.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.