Important: Please read the Qt Code of Conduct -

Help in software design and coding

  • I'm developing a software and I need your help to design something with me as I'm a beginner in a few things (read beginner in model-view-delegate). In order to simplify things here I'm going to be using not real classes but metaphorical ones.
    The reason is that I haven't coded yet the thing I have in mind and I need help understanding a few things.


    The base idea: create a tree view based on the output from the class C.

    The class C is a kind of manager that calls a method from A and B, the A has a list of D and B has a list of E, where E is a kind of a container just like A and B but holds a list of D.

    And above that is the three how it would look like.

    The question is: what would be the best way to do that?

    1º - Using an interface for D and E so I can return a list of a certain interface on C to the model.
    2º - Use QVariant to return either D or E as a list from C to the model.

    I don't know what would be the best option.

    I would probably need to create a custom model to handle the QVariant or Interface right?


  • Is there anyone to help me with that?

  • Lifetime Qt Champion


    First thing: Introduction to Model/View Programming. This is a mandatory read when you want to get started with model view programming with Qt.

    From what you describe the model you would need to implement would be a wrapper around your structure of data. So basically you must first ensure that said structure is coherent and that you can manipulate it the way you need it. Once that done you can put a model on top of it.

  • Lifetime Qt Champion

    On a side note, please be patient. Allow up to 24 hours before bumping your own thread. People answering do it on their own time and they don't live necessarily in the same timezone as you. Furthermore, it's the weekend.

Log in to reply