PDA

View Full Version : Subclassing QTableView



T4ng10r
13th August 2008, 07:33
I've created my own model with 10 roles to store data.
Now I need to create view where each cell would be filled with my widget. This widget is build with other widget (like Labels, spins, etc).
I've created my own view class based od QTableView - which methods I need to overload?
I want to show all data from model at once, so ItemDelegate won't work.

I know that I could use QTableWidget and setCellWidget() to set my own widgets inside each cell. I don't wont to do that.

spirit
13th August 2008, 08:00
use


void QAbstractItemView::openPersistentEditor ( const QModelIndex & index )


but performance of your app will decrease.

wysota
13th August 2008, 09:31
I want to show all data from model at once, so ItemDelegate won't work.

Sure it will. I don't know what exactly you want to do but either you want to implement a custom item delegate or you want to avoid using QTableView :) If you really, really, really need real widgets, then use QScrollArea instead of QTableView. Otherwise if you just want the looks and/or a limited amount of user interaction (like clicking here and there), implement a custom delegate that will use QStyle primitives to draw the looks of widgets.