[Qt-interest] [Fwd: Re: Display list of arbitrary widgets ?]
Sean Harmer
sean.harmer at maps-technology.com
Fri Dec 11 11:53:15 CET 2009
Hi,
On Friday 11 Dec 2009 10:19:28 Stephen Collyer wrote:
> 2009/12/10 Sean Harmer <sean.harmer at maps-technology.com>
>
> > QListWidget::setItemWidget( QListWidgetItem*, QWidget* )
> >
> > http://doc.trolltech.com/4.6/qlistwidget.html#setItemWidget
>
> Thanks. I seem to have overlooked that. However, I note that it says that
> it is restricted to the display of "static" content; what counts as static
> content in this context ? My custom widget will contain a QLCDNumber,
> displaying a time ticking away, so in some sense it won't be "static".
>
> Will I have to go the QListView/QItemDelegate route ? (which seem to
> overcomplicate the whole requirement - I'll presumably have to screw around
> with QModelIndex'es etc instead of the currentRowChanged() stuff ...)
>
I am not sure without trying it but I will leave that for you ;-)
Another possible approach would be to make a simple list-like widget based on
QGraphicsView that embeds your widgets using QGraphicsProxyWidget, this should
be relatively easy to do and avoids the headaches of the model view stuff.
Just layout your widget-items into a QGraphicsLinearLayout add them to the
scene and you are done. QGraphicsView will provide scrolling for you.
HTH,
Sean
More information about the Qt-interest-old
mailing list