Qt-interest Archive, April 2008
Model/View design choices
Message 1 in thread
Hi,
I am a new user of QT. I am trying to make a dragable one dimension list
which contains complex widget (multiple icons, multiple texts and drop boxes
etc) as items. My understanding is that I can't use convenience class
(QListWidget) as they only support one text and one icon and doesn't have a
provision for editable complex widgets. I did go through Model/View
programming guide. As the examples are for simple data (not for complex
widgets), I am not sure of few things.
I need to pick up View/Model and delegate that best suits my needs. I am
thinking on the following lines:
1. View : QListView, as I am using a one dimensional list. Also I want to
use the List/Icon and dragable view feature.
2. Model: Not sure which one of
QStandardListModel/QStandardItemModel/QAbstractItemModel is the best choice.
Probably QStandardListModel. I am not clear that data() returns a QVariant
but my items are complex widgets. Qvariants should be assembled in paint()
of the delegate?
3. Delegate: QListItemDelegate with custom paint that lays out the items
(which are complex widgets)
Can you please suggest what are the best choices for my problem. I am using
QT 4.3.3. Is there any example for what I am trying to do?
Thanks,
Andy