Is there a (quick?) way to render only a subset of GraphicsScene items according to View zoom level? I'm having a big scene with many grid lines and i want to hide/show some of them, when the zoom changes to avoid the 'grid completely fills the scene'-effect.
Grid lines are drawn using addLine method of GraphicsScene.
P.S. Maybe, the easiest way is to draw grid somewhere else (on view or smth like that), because logically they aren't a part of my scene, they are only guide-lines? But i don't know which way is more effective.
It's not advised to create the grid like that because you will be making many objects that will affect the scenes BSP tree, so it will get slow quickly. It will also make having an LOD zoom like you describe more difficult.
I would overwrite QGraphicsView::drawBackground(QPainter* painter, const QRectF& rect)
, and use the view's bounds in scene coordinates to calculate how many grid lines you want and where they are. Then just paint as normal painting operation.
You will have to set the update mode to QGraphicsView::FullViewportUpdate
otherwise you will get artefacts in the grid render.