[Interest] QTreeWidget Auto Scroll
Tony Rietwyk
tony at rightsoft.com.au
Fri Aug 16 03:08:31 CEST 2013
> Sent: Thursday, 15 August 2013 5:00 PM
>
> Hello all,
>
> I have three QTreeWidgets in a dialog. They all have an equal number of
> items.
>
> When the user scrolls one of the QTreeWidgets, I wonder how I can scroll
the
> other 2?
>
> I have looked through the docs and cannot see any auto scroll feature.
>
> Thanks,
> Josh.
Hi Josh,
Basically, you can connect the valueChange signal of one scroll bar to the
setValue of the other two. But this is usually not enough - people want
changes to any of the 3 scroll bars to be reflected in the other two. The
hard part is preventing signals from continually firing (signal ping-pong).
This is best done by using an intermediate QObject based controller
connected to all 3 scroll bars. The tree widgets will also need to be
exactly the same size (as well as number of items) - otherwise you need to
take the different range values into consideration.
Regards,
Tony
More information about the Interest
mailing list