Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Move Image around a QGraphicsView
Forum Updated to NodeBB v4.3 + New Features

Move Image around a QGraphicsView

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 992 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vitaR
    wrote on last edited by
    #1

    Hi, I'm Trying to move an Image around a QGraphicsView and I don't have any concept on how to do it, I know I have to use a QTimer, but that's all I know about it, I don't know how to make this.

    I have to move a Cat throw a Path in a maze (A Mouse too and turn per turn, but I guess learning how to move the cat I can handle how to move the mouse), I know the positions the cat is going to use to do it, but I don't know how to work between the QTimer and this Image, also I have to make some conditions in this function.
    This function have to move the cat and the mouse, and validate when they eat a food or get drunk. (Its like the main function, where everything's happen).

    "LINK TO THE IMAGE I WANT TO MOVE":http://imgur.com/tOwysOU

    The code I got at this moment, I only set the starting position of the cat.
    @void Window::start(PilaD *caminoGato,PilaD caminoRaton){
    /

    You can Avoid this code, this is only some code that I'm using to know the current position of the cat. In my main window this code is not a comment.
    Nodo *recorGato,*recorRaton;
    recorGato = new Nodo();
    recorRaton = new Nodo();
    recorGato = caminoGato->tope;
    recorRaton = caminoRaton->tope;
    */
    QPixmap *icon = new QPixmap(list.at(2)); //List is a string, the path of the image.
    QGraphicsPixmapItem gato = new QGraphicsPixmapItem(icon);
    scene->addItem(gato);
    gato->setPos(recorGato->col
    icon->width()+200,recorGato->row
    icon->height()+100);
    }@

    Sorry I tried to read some post, but still don't figure it out how to handle this.
    Thanks for your time.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved