PDA

View Full Version : can we change QPixmap image of Qgraphicsscene dynamically?



sh123
16th March 2009, 07:08
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().

munna
16th March 2009, 07:15
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.

sh123
16th March 2009, 07:24
Thanks a lot.

sh123
16th March 2009, 07:27
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);

ui.BGgraphicsView->setMatrix(matrix);

but not able to move it up and down

I use below code for translating

matrix.translate(50,50);
ui.BGgraphicsView->setMatrix(matrix);

Please help

sh123
16th March 2009, 09:08
SetPixmap does removes the current image from pixmap but not displaying the new pixmap image instead white empty Graphicsview is seen .