[Interest] How to have 3 QTreeWidgets in a QScrollView share the same set of scroll bars

Andreas Pakulat apaku at gmx.de
Fri May 10 22:53:57 CEST 2013

Hi Michael,

On Fri, May 10, 2013 at 10:14 PM, Michael Jackson <imikejackson at gmail.com>wrote:

> I am redesigning part of my gui to use 3 QTreeWidgets laid out vertically
> embedded in a ScrollView. What I would like to achieve is to have all three
> TreeWidgets share a single unified ScollBar. Currently if any items within
> one of the TreeWidgets is opened then the scrollbars appear but just for
> that widget. I guess I would like to be able to tie the act of the
> QTreeWidget Growing/shrinking to the size of the Encompassing QScrollView
> so that I can turn off the scroll bars for each of the TreeWidgets.
> In effect I need the QTreeWidget to grow to a size that would show all the
> items instead of creating scrollbars. Is this even possible.

If its not sufficient to disable the scrollbars in the treewidgets by
setting the horizontalScrollBarPolicy and verticalScrollBarPolicy to
Qt::ScrollBarAlwaysOff then I'd connect to the expanded/collapsed signals
and enforce the minimum size of the treewidget to be as much as the
viewport() size of it. The viewport of the treewidget should always be as
big as the complete set of items. Alternatively it may be possible to
 install an event filter on the viewport() to capture resize events and
make the treewidget have the new size as minimum size.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130510/2bb659d7/attachment.html>

More information about the Interest mailing list