I'm trying to use model/view architecture in C++ and QT and need to understand, how is the best way to divide one cell in QTableView to more rows or more columns and use different widgets for them and also how to display just some columns from the model.
I want to hold this structure per row:
- int
- MyStruct - int
- QString
- 2ndStruct - double
- double
- QString
What is important:
- Display in 2D table (for example QTableView) - without trees. I can change model, but I need to display it in table.
- Display just some of the data from model.
- According to row index - select some columns from the parent and also some data from child (structs).
I have couple of questions:
- How to implement more rows/columns in one QTableView cell and use different types and different QWidgets for them?
- How to select just some data I want to show in view? When I reimplement "columnCount" in model, I can't put constant there because I want use this model in different view. I read tutorials and I found, that there is no need to reimplement view class. How can I select just data I want to show?
- Is it better to use 3D model (QStandardItemModel with QStandardItems) or 2D model (QAbstractTableModel) for this case?