[Qt-interest] QraphicsView fitInView
caius ligarius
caius9090 at gmail.com
Tue May 18 08:34:03 CEST 2010
Hi,
I am tryin to scale down a 1024x800 QImage so that it fits into a 100x100
QGraphicsView widget. I try to use the fitInView function but the image
does not fit exactly in the QGraphicsView widget. Code-
QGraphicsScene* scene= new QGraphicsScene;
QPixmap np;
np = QPixmap::fromImage(*qImageData);
QGraphicsPixmapItem* qpitem = new QGraphicsPixmapItem;
qpitem->setPixmap(np);
scene->addItem(qpitem);
ui.graphicsView->setScene(scene);
ui.graphicsView->fitInView(scene->sceneRect(),Qt::IgnoreAspectRatio);
ui.graphicsView->show();
With this code the image shrinks completely and appears to be much smaller
than the widget instead I want the image to fit perfectly into the 100x100
widget (without scrolling)
Thanks,
Caius
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100517/4d606b35/attachment.html
More information about the Qt-interest-old
mailing list