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().
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.
Mithin
www.mithin.in
ajo (30th April 2013)
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);
Qt Code:
ui.BGgraphicsView->setMatrix(matrix);To copy to clipboard, switch view to plain text mode
but not able to move it up and down
I use below code for translating
Qt Code:
matrix.translate(50,50); ui.BGgraphicsView->setMatrix(matrix);To copy to clipboard, switch view to plain text mode
Please help
SetPixmap does removes the current image from pixmap but not displaying the new pixmap image instead white empty Graphicsview is seen .
Bookmarks