[Qt-interest] Add margin around viewport of QListView
Andre Somers
andre at familiesomers.nl
Tue Dec 1 10:08:41 CET 2009
Jugdish wrote:
> How do I add a margin outside the viewport scrollbars of a QListView?
>
> I'm subclassing QListView and want to make an empty space below the
> bottom scrollbar so that I can insert widgets down there (in other
> words, "extend" the layout of QListView). I'll manually move the extra
> widgets into the proper location within the resizeEvent, but first I
> need to "shift" the bottom scrollbar up to make room for them. I tried
> a call to QAbstractScrollArea::setViewportMargins(), but that created
> a margin *inside* the scrollbars. Also QWidget::setContentsMargins()
> didn't appear to have any effect.
>
> Any ideas?
Perhaps you can look into the source of QAbstractScrollArea to see how
the layout of the widget is managed. That might give you some ideas. As
you have access to the separate widgets that make up the scroll area,
you may be able to manipulate the layout manually.
Note: I did not try this myself.
Regards,
André
More information about the Qt-interest-old
mailing list