Multiple views based on same model, with different columns
I have some data stored in a table-like model (a subclass of QAbstractTableModel), but I want to end up displaying this data in several views - with some difference in the way it is displayed, while making sure selection makes sense.
For example, if one of my columns is a 10 character string, I want to have one view where that string is displayed as a single column, but another view where it is displayed as two columns, each one 5 characters long. And another with 5 columns, each one 2 characters long. I also want to make sure that selection works across the different views. Like, if you select a column with a small part of the string, the other views show the relevant cells as selected.
I'm not sure if this calls for use of the proxy model system or if there is some other way to manipulate the views via the selection model. I'd appreciate any input - especially if I'm off and there's a clearer path.
Sad bump - can anyone help out?
If anyone has any thoughts on this - still interested.
You would need one configurable proxy per view e.g. configure the number of colon and in data split the data as needed.
As for you special selection, you might need to combine your selection model with QStyledItemDelegate where you reimplement the paint function and draw the selection rectangle yourself.
Hope it helps
The use of the proxy with modifying the column count is a great pointer.
I may end up resolving the whole issue with a different approach to the UI but great to know and thanks a lot for writing.