can we change QPixmap image of Qgraphicsscene dynamically or at runtime ?
I have included timer ,and need to change image of scene as the timer gives signal timeout().
Printable View
can we change QPixmap image of Qgraphicsscene dynamically or at runtime ?
I have included timer ,and need to change image of scene as the timer gives signal timeout().
When you add the pixmap item for the first time using QGraphicsScene::addPixmap save the pointer to QGraphicsPixmpaItem returned by the function. Then, everytime the timeout signal is emitted using QGraphicsPixmapItem::setPixmap change the pixmap.
Hope this helps.
Thanks a lot.
1 another query.
I have added QGraphicsview in Vertical Layout to view an image.
Now I want to rotate this image as well as move it vertically up and down.
I am able to rotate it using code
matrix.rotate(i);
Code:
ui.BGgraphicsView->setMatrix(matrix);
but not able to move it up and down
I use below code for translating
Code:
matrix.translate(50,50); ui.BGgraphicsView->setMatrix(matrix);
Please help
SetPixmap does removes the current image from pixmap but not displaying the new pixmap image instead white empty Graphicsview is seen .