Display image in QT
-
Dear All,
I am new in QT programming and working of the project related to camera and images.
I want to display the camera captured images in QT main window.
So I use QGraphicsView. My queries are
(1) Is that right approach using QGraphicsView to display images?
(2) What is the best approach to display images in QGraphicsView in terms of processing time?I need to display real time images.
Thanks -
Depends on the use case, but in many cases it is sufficient to use QLabel.
-
Hi, it's Qt :)
QGraphicsView + QGraphicsScene is the best choice.
You will use the QGraphicsScene::addPixmap() function to add the image to the scene and to display it.
For the best performance you have to set some flags and properties (bspTreeDepth, QGraphicsView::OptimizationFlag, QGraphicsItem::GraphicsItemFlags).good luck !
-
Here a simple example code:
@
QGraphicsScene scene;
QLabel *gif_anim = ui->lbIcone;
QMovie *movie = new QMovie(":/imagens/32/loading_2.gif");
gif_anim->setMovie(movie);
movie->start();
@It's works fine to me, and show some animated GIFs!