QTableWidget or QTableView - Presenting many info in one table cell
-
I just downloaded a program to download videos and after seeing this table (image below) I got curious on how I would create something similar in Qt.
I have used
QTableWidget
and I can't think of how to do this using it so I am guessing it'sQTableView
(haven't yet quite understood the model/view concept) but I took a quick look at its doc but couldn't have a idea on how to do that using it. -
You need to set a QStyledItemDelegate for the view.
The delegate will replace the cell in the table showing your custom widget that you can style according to your needs. -
@gde23 I went and searched for it and from I could understand, I could use a
QGridLayout
to achieve something similar to the image in the OP, right? -
@hbatalha
Depends how "similar" you mean by "similar".QStyledItemDelegate
is the right way to go. -
For the layout on the delegate you can use a grid layout or cascaded horizontal/vertical layouts, that really does not matter.
However, if you are not familiar with basic widget layouts I would suggest starting with something more basic than delegates.
E.g. you can first setup the model/view, then make a standalone widget to be used as delegate, and finally setup the delegate.