Results 1 to 7 of 7

Thread: Get a QGraphicsPixmapItem from a Scene and modify(change the image).

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2014
    Posts
    27
    Thanks
    9
    Qt products
    Qt5
    Platforms
    Windows

    Default Get a QGraphicsPixmapItem from a Scene and modify(change the image).

    Hi, I have to update every second (QTimer) the QGraphicsView, the QGraphicsView only have QGraphicsPixmapItems at specific positions in the whole frame.

    I have to modify every time like five or seven images on this QGraphicsView, but I don't know how to do it.

    Here's an example of my main code.
    Qt Code:
    1. scene->setSceneRect(0.0,0.0,400.0,400.0);
    2. for(int i=0;i<5;i++){
    3. image->setPixmap(icon);
    4. scene->addItem(image);
    5. image->setPos(i*icon.width(),0);
    6. }
    7. QGraphicsPixmapItem *image2 = new QGraphicsItem(); // with this default QGraphicsPixmapItem I'm trying to get the item at specific position, and set to this value (image2).
    8. //I know I'm not doing anything now, I just deleted the things I tried to do before posting this thread.
    9.  
    10. view->setScene(scene);
    11. view->show();
    To copy to clipboard, switch view to plain text mode 

    I want to change the image located in a specific position for another one, and move this image to the next position (left,right,top,bot).
    I tried using QGraphicsScene::itemat(); But I think Dont work with QGraphicsPixmapItem.

    If my question is vague, please let me know, I can explain it better, just that I don't have time right now.
    Thanks for your time.
    Last edited by vitaR; 22nd March 2014 at 02:01.

Similar Threads

  1. Replies: 4
    Last Post: 15th May 2013, 13:58
  2. Modify image to have round corners
    By migel in forum Newbie
    Replies: 1
    Last Post: 4th September 2012, 11:38
  3. How to delete a QGraphicsPixmapItem in a scene.
    By newqtuser in forum Qt Programming
    Replies: 3
    Last Post: 9th July 2009, 08:07
  4. Removing a QGraphicsPixmapItem from a scene
    By newqtuser in forum Qt Programming
    Replies: 2
    Last Post: 12th July 2008, 22:54
  5. Replies: 32
    Last Post: 30th March 2008, 20:00

Tags for this Thread

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.