PDA

View Full Version : scroll multiple QTextBrowser



dotjan
20th April 2012, 13:11
Hi all, in the same mainwindow I have two QTextBrowser which present a vertical scrollbar when needed. I would need to have a kind of merged view: when I scroll down text in the first QTextBrowser also the second one scroll down automatically and vice versa. I thought there was a signal to use but I could not figure it out. Any help?

TIA,
Jan

Berryblue031
23rd April 2012, 12:28
There is a signal.

QScrollbar has a sliderMoved signal and a setValue slot


QObject::connect(browserOne->verticalScrollBar(), SIGNAL(sliderMoved(int)), browserTwo->verticalScrollBar(), SLOT(setValue(int)));

and vice versa

dotjan
25th April 2012, 12:16
Thanks a lot, it works. I found even better to use the signal valueChanged(int) so that also when the scrollbar is clicked it is emitted.