PDA

View Full Version : Widgets in TableView



boonie
6th January 2006, 18:25
I've read several ways of going about this, and I was wondering what might be the best. Currently I have a table view/model and would like to place widgets in the cells of the table, such as a progress bar, and image, etc. Someone mentioned I might be better off just making a custom table using the grid layout. I can't seem to find any great documentation on how to do this, I would love to see an example of this somewhere.

jacek
6th January 2006, 18:55
Currently I have a table view/model and would like to place widgets in the cells of the table, such as a progress bar, and image, etc.
For images and progress bar a custom QItemDelegate might be a good solution.

boonie
6th January 2006, 20:20
it seems like the delegate is only shown when you want to edit the cell though, or am I missing something from the model/view docs on trolltech site. Reading the api isn't helping me.

jacek
6th January 2006, 23:28
it seems like the delegate is only shown when you want to edit the cell though, or am I missing something from the model/view docs on trolltech site.
Actually item delegate is also responsible for drawing. See QItemDelegate::paint () (http://doc.trolltech.com/4.1/qitemdelegate.html#paint) method and pixelator example.


Reading the api isn't helping me.
It's a bit complicated. I guess there should be more examples and tutorials.

Maybe these will help:
http://scottcollins.net/blog/2005/09/model-view-controller-mvc-in-qt.html
http://scottcollins.net/blog/2005/09/more-on-mvc.html

Otto Meijer
21st February 2006, 20:55
Hi Guys,

I think I wouldbe realy interested in such example(s).
I'm trying to come up with a layer selection widget that shows
a QCheckBox, QLabel and QPushButton for each of such layer.
All of this is achievable via a QGridLayout but it seems rather slow.
QTableView seems a lot faster but I can't seem to view these
three widgets types all the time.