[SOLVED] Resizing QGraphicRectItems with the QGraphicsView
I have a big amount of QGraphicRectItems inside a QGraphicView. Now I want to change the size of this view. For example: If I let the view grow all the rectangles should grow accordingly in size and position.
but this didnt work, the size of the items stays the same.
If i understand you, you want to zoom in / zoom out your view.
Check following functions in "this":http://doc.qt.digia.com/qt/graphicsview-elasticnodes.html example
void GraphWidget::wheelEvent(QWheelEvent *event)
scaleView(pow((double)2, -event->delta() / 240.0));
void GraphWidget::scaleView(qreal scaleFactor)
qreal factor = transform().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();
if (factor < 0.07 || factor > 100)
Yes i want to zoom in/out.
I dound a solution by myself. Its the fitInView() function of the QGraphicsView.