PDA

View Full Version : QListVew or QAbstactItemView: how to show Qt widgets in the view?



bjilly
2nd February 2010, 09:44
Have a model which contains a list of MyStruct.


stryct MyStruct
{
QString value;
bool enabled;
int level;
};


I want the following:

All items in the view should be shown in the list way (like QListView): each item follows the next one.
Each item should be represented as QGroupBox with several widgets: QLineEdit for 'QString', QCheckBox for 'bool' and SpinBox for 'level' (i.e. I want a list of widgets)
The list of such represented items should be scrollable


I have tried QListView + my own QItemDelegate, but it didn't work. Is there any way to implement this with minimum efforts? Examples are welcome. Thanks!

P.S. Took a look to QListView implementation (had an idea about implementing my view using QAbstractItemView from the scratch, but it requires writing a LOT of code).