[Solved] Scroll QGraphicsView when sceneRect resized
Hi I am trying to use the Graphics View Framework to implement a diagram editor. I would like to have a "canvas" area with resize handles. I want this to be centered in the QGraphicsView with a constant margin around it.
For this I've used a custom QGraphicsRectItem class and also added the handles to resize it which seems to work nicely. This is updating the sceneRect to the rectItems size plus the margin. The problem is when I drag one of the handles and the view expands, the view stays centered at the same position when I would like it to scroll with the scrollbars.
!http://s22.postimg.org/5vyohuyup/Screen_Shot_2014_04_20_at_00_37_19.png(Canvas area not scrolling)!
Any idea on how I could achieve this behaviour?
Hi and welcome to Devnet,
Might be what you need.
Thank you! Calling ensureVisible on the handle gets the intended behaviour.
You are welcome.
Please edit the title of your first post and prepend [solved] to it. This informs others about the status of your question.