Question

I have a 2D model where each row represents a frame in a video, and each column represents an object. The object can have different states on each frame, and this is stored in the model. Then I have a QTableView that shows this data. The model has header data, so each row has a header like "frame k" and each column has a header like "object n". This table is editable. But I want the user to edit it another way. The other way is a graphics view that shows a single frame. Below the graphics view is a list (oriented horizontally) that represents each frame. This way the user can click on a frame in the list and the graphics view now displays that frame.

The problem is that the list displays the first column of each row in the model. What I want it to do is show the header of each row instead (so the list says "frame 1, frame 2, etc"). Is there a way to do this?

Was it helpful?

Solution

Two possible solutions:

  1. Try to use a proxy model (a subclass of QAbstractProxyModel) which accesses row headers as columns in a single row. Not trivial because the proxy model displays as data what the original model considers to be header.

  2. Display a second 2D view of your model, but hide everything except for the column headers. Since your frames are rows, you'll need a proxy model to transpose between rows and columns.

DISCLAIMER: I did not actually implement any of the solutions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top