I use QGraphicsiew and QGraphicsScene in order to draw graphics. How can I organize zoom-in and zoom-out (during zooming in scrolls should appear and while zooming out scrolls should disappear)?
+3
A:
QGraphicsView::scale(qreal, qreal)
e.g. QGraphicsView * view = new QGraphicsView (parent); QGraphicsScene *scene = new QGraphicsScene(); scene->addText("Hello World"); view->setScene(scene); view->show(); view->resize(100,100);
// coll from some slot to see the effect view->scale(2,2); //zoom in view->scale(.5,.5); //zoom out
Scroll-bars will disappear automatically if scene fits into the size of view.
Regards, Valentin
Valentin Heinitz
2010-07-23 11:41:20