[Qt-interest] ISO Model/View Solution for scrolling list of widgets

KC Jones kc at asperasoft.com
Wed Oct 28 20:46:15 CET 2009


I'm struggling with an implementation problem that I hope someone here
can help me with.

I have an application that needs to implement something like the
FireFox Downloads window.  Behind this is a model that describes the
items with various strings, files paths, progress data.  The number of
items and their data vary in real time, all captured in a
QSqlTabelModel.  Through this UI I need to provide controls very
similar to the stop/start/cancel controls on the FF download window.

Using QListView + QStyledItemDelegate + custom editor widget seems
natural.  I have this sketched in.  (QTreeView is out since the custom
widget cannot live with a simple column oriented layout.)  The
selected/edited item represented by my custom editor widget looks
good.  My problem is that every item in the list really wants to be an
instance of that widget.  Selected or not, I want every item to
display the same data in the same way.  I could live with requiring
the user to select an item for the "editor" widget to be enabled.  But
I want all rows to use the same custom widget definition to display
itself.

So is there a way in QStyledItemDelegate::paint() to leverage my
custom widget's paint impelementation directly?  Or else make use of
the custom widget's layout to at least simplify my paint() method?
I've also looked at writing my own ScrollingWidgetList widget derived
from QScrollArea, but that seems like a major project.  I'm hoping
there are simpler solutions.

This seems like a fairly generic problem.  If this is in some docs or
tutorials or samples, please clue me in.



More information about the Qt-interest-old mailing list