If I set a pixmap to a QGraphicsScene
that is larger that the window, it will add scrollbars, So is it possible to get what is displayed in the QGraphicsView
?
Also Is there any event raised while scrolling and changeing the displayed area ?
Here is a screen of what I'm talking about:
Thanks
You can determine visible area in the scene coordinates as follows:
QRect viewport_rect(0, 0, view->viewport()->width(), view->viewport()->height());
QRectF visible_scene_rect = view->mapToScene(viewport_rect).boundingRect();
You can use QGraphicsItem::mapFromScene
to convert scene coordinates to item coordinates is necessary.
You can use view->horizontalScrollBar()
and view->verticalScrollBar()
to obtain QScrollBar*
objects. Connect to valueChanged(int)
signal of these objects to track scrolling.