View Full Version : QGraphicsView pan
Talei
6th April 2014, 07:51
Hello,
Any idea how to pan viewport regardless of scene size?
What I want is to pan around scene ignoring scene "size". So that way I could pan for example to left few hundreds unit.
Regards
PS: What I want to achieve is similar to the functionality of setDragMode(ScrollHandDrag); but with arbitrary view transformation (scene rect smaller then view one).
anda_skoa
7th April 2014, 10:55
Doesn't QGraphicsView::translate() do that?
Cheers,
_
Talei
8th April 2014, 02:07
I'm already using translate and no it does not do what I want.
With translate it moves scene inside sceneRect().
Scene do expand when new items are created to accommodate them, but what I want is to move in "infinite scape" so the sceneRect() is not taken into accound while moving in pan mode.
Example:
Scene rect is i.e. 800x800 I do pan to position -1600 units and create item. Item is created on mouse position with will be offset by pan position, i.e. -1600 + mapToScene(cursorpos).
But now I cant move with translate to -1600 units.
Another problem is that I do define size of the scene to view rect, because without this when I do create item near edge then scene center moves to item center.
So bottom line is that I would like to freely pan around scene ignoring scene size and when item is created scene size is of course resized.
Talei
10th April 2014, 11:11
Something that is puzzling me is this:
when newly created scene is put on view sceneRect is 0 and View display (in default case) white background and user can create object anywhere on that 0,0 scene.
I'm looking how it's done in that case.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.