Qt treeModel View using different types of elements in one model

I want to create a model with a hierarchy as follows (data must be saved)

  • School (name and identifier)
    •                                           year) <st>
    • Students                  
    • Student
    • Student
  • Class
School

I was thinking of creating an element that saves all the information similar to the example of Qt - Editable tree model, and shows some of them, but editing and working with it will be very difficult. Therefore, I tried to find an example of how to implement more than one type of element in the model, but I did not succeed.

Is there a way to do this with 3 types of elements?

If yes, how to do it, if not, how can I store this data?

+4

Source: https://habr.com/ru/post/1618785/


All Articles