Qt: Dragging a widget to scroll the widget's parent QScrollArea?
Posted
by samsonite
on Stack Overflow
See other posts from Stack Overflow
or by samsonite
Published on 2009-12-29T10:04:23Z
Indexed on
2010/03/19
8:01 UTC
Read the original article
Hit count: 243
I've got a long horizontal QLabel displaying a png (the image shows a signal/time graph). Under that, I've got a QTableWidget. Both of these are in a QScrollArea because I want them to stay vertically aligned (the cells in the table correspond with the signal seen directly above them). I'm trying to add a handler to the QLabel such that the user can use the picture itself to scroll the scrollarea, rather than having to use the scrollbar. Is there a tried-and-tested way to do this? Directly setting the scrollarea's sliderPosition inside the QLabel's dragMoveEvent doesn't seem smart, because when the scrollarea scrolls it also leads to another dragMoveEvent on the (moving) QLabel.
© Stack Overflow or respective owner