Solved Should I create my own view
-
Say that I have a SQLite database like this
and I want to show them to my user like this
Should I create my own view ? What is the logical way to do it ? I want the data to be shown like this because I find it much prettier than putting them in a QTableView
-
Hi
Since it's a complete custom drawing, then yes, create your own view.After a better second look, I was wrong, all the content coming from the same row, you can use a delegate as @VRonin suggests.
-
With that method will it be possible to open something like a popup to edit the fields when the use double-click on an item of my view ?
-
Yes, you will just be responsible to trigger the editor yourself.
-
In the doc I found this sentence :
The view classes that inherit QAbstractItemView only need to implement their own view-specific functionality, such as drawing items, returning the geometry of items, finding items, etc.
What are those functionnality in term of methods ??? Does it mean I have to reimplement every virtual method in the class for my View ?
-
To me this does not necessarily need a custom view. You just need a proxy model that maps data in the columns to a single column with multiple roles.
ThenQListView
plus a custom delegate should do the trick -