[Qt4-preview-feedback] Zooming with a rubber band
sergio cavalcante
sergio.cavalcante at gmail.com
Fri Mar 20 00:38:24 CET 2009
People,
I have a widget with a QGraphicsView where I load an image using these
comands:
QGraphicsScene* scene = new QGraphicsScene;
scene->addPixmap(QPixmap(strPath));
ui.graphicsView_2->setScene(scene);
ui.graphicsView_2->setInteractive(true);
I need to make a zoom tool which, using a ruber band, I could zoom the
selected area.
so I set the QGraphicsView this way:
ui.graphicsView_2->setDragMode(QGraphicsView::RubberBandDrag);
And the band appears automatically, whithout subclassing the GraphicsView
and handling mouse events.
So I Googled a lot, and I've found a way to zoom the rubber band selected
area:
QPolygonF selectionPoly = mapToScene(selectionRect);
fitInView(QRectF(selectionPoly.boundingRect());
It really works? If yes, where do I need to put this code to work correctly?
Thanks for any help!
Best Regards,
------------------------------
Sérgio Cavalcante
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt4-feedback/attachments/20090319/d6a06882/attachment.html
More information about the Qt4-feedback
mailing list