Hi everyone,
I want to ask, how to insert an image to QGraphicView from file? I already have the file path, but I don't know how to insert it actually.
Could you please help me?
Thank you!
Best regards!
Hi everyone,
I want to ask, how to insert an image to QGraphicView from file? I already have the file path, but I don't know how to insert it actually.
Could you please help me?
Thank you!
Best regards!
use graphicspixmapitem
QGraphicsScene scene;
scene.setSceneRect( x, y, z, z );
QGraphicsPixmapItem *item = new QGraphicsPixmapItem(QPixmap("mine.png"), &scene);
QGraphicsView view( &scene );
"Behind every great fortune lies a crime" - Balzac
You can create QPixmap, then load it from file, and then create QGraphicsPixmapItem with this pixmap and add it to your scene.
http://qt-project.org/doc/qt-4.8/qpixmap.html
http://qt-project.org/doc/qt-4.8/qgr...ixmapitem.html
Bookmarks