Results 1 to 5 of 5

Thread: can we change QPixmap image of Qgraphicsscene dynamically?

  1. #1
    Join Date
    Nov 2008
    Posts
    52
    Qt products
    Qt4
    Platforms
    Windows

    Default can we change QPixmap image of Qgraphicsscene dynamically?

    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().

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: can we change QPixmap image of Qgraphicsscene dynamically?

    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.

  3. The following user says thank you to munna for this useful post:

    ajo (30th April 2013)

  4. #3
    Join Date
    Nov 2008
    Posts
    52
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: can we change QPixmap image of Qgraphicsscene dynamically?

    Thanks a lot.

  5. #4
    Join Date
    Nov 2008
    Posts
    52
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: can we change QPixmap image of Qgraphicsscene dynamically?

    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:
    1. 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:
    1. matrix.translate(50,50);
    2. ui.BGgraphicsView->setMatrix(matrix);
    To copy to clipboard, switch view to plain text mode 

    Please help

  6. #5
    Join Date
    Nov 2008
    Posts
    52
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: can we change QPixmap image of Qgraphicsscene dynamically?

    SetPixmap does removes the current image from pixmap but not displaying the new pixmap image instead white empty Graphicsview is seen .

Similar Threads

  1. Saving QGraphicsScene with OpenGL to image
    By elbaschid in forum Qt Programming
    Replies: 1
    Last Post: 12th March 2009, 21:32
  2. QPixmap display on QGraphicsScene
    By febil in forum Qt Programming
    Replies: 2
    Last Post: 26th February 2009, 10:27
  3. add(draw) an icon(or image) to a QPixmap?
    By ascii in forum Qt Programming
    Replies: 4
    Last Post: 20th November 2008, 13:44
  4. Replies: 2
    Last Post: 29th September 2008, 01:08
  5. Loading a custom image into a QPixmap
    By KShots in forum Qt Programming
    Replies: 12
    Last Post: 5th August 2006, 01:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.