PDA

View Full Version : Detect changes to the Viewport in QGraphicsView



Casper14
23rd July 2014, 21:30
I have subclassed QGraphicsView, and now I need to respond to events that might change what is currently displayed in the viewport. I am not interested in changes to the scene, I only need to react to events like scrolling, and dragging, i.e., events that would change which part of the scene is currently visible in the QGraphicsView. The reason I need to do this is that these same changes should be applied to another QGraphicsView.

I have not been able to find any help on the internet, so I am not sure if something like this even exists. The only link I could find is dead: http://www.qtforum.org/article/28739/qgraphicsview-viewport-changed-event.html ("QGraphicsView viewport changed event?")

What are my options? Is there any alternative to just manually listening for all different types of events that might change the viewport? Ideally there would be some signal that I could connect to...

anda_skoa
24th July 2014, 12:21
If it is just about movement, you could connect to the vallueChanged signals of the two scrollbars. Maybe even connect to the other view's scrollbars.

Cheers,
_