Unsolved drawing dense items in graphics scene
-
i have a lot of coordinates like these: (-0.45, -3.1), (-0.14, -1.8) etc. and i need to draw polygons using these.
as you can see the values are so close to each other that when i draw the items now, they overlap, and look very small in the center of the view.
how can i draw so that all drawn items occupy all visible area of the view? should i do something like multiplying the values of coordinates? or what?thanks.
-
Hi,
Frome QGraphicsView's documentation:
QGraphicsView can be used to visualize a whole scene, or only parts of it. The visualized area is by default detected automatically when the view is displayed for the first time (by calling QGraphicsScene::itemsBoundingRect()). To set the visualized area rectangle yourself, you can call setSceneRect(). This will adjust the scroll bars' ranges appropriately. Note that although the scene supports a virtually unlimited size, the range of the scroll bars will never exceed the range of an integer (INT_MIN, INT_MAX).
-
@user4592357
Why don't you put your QGraphicsScene to QGraphicsView by
void QGraphicsView::setScene(QGraphicsScene *scene)
and use
void QGraphicsView::scale(qreal sx, qreal sy) ?
You may also use mousewheel to zoom in/out.
See this