Results 1 to 2 of 2

Thread: QGraphicsScene illustrating the position of a joystick

  1. #1

    Default QGraphicsScene illustrating the position of a joystick

    Hi all.

    I am getting inputs from a joystick through the serial port, and I want to make a visual representation of the X and Y coordinates from the joystick.

    Therefore I need some kind of coordinate system with a point (small dot) showing the position of the joystick. I have read a lot about viewports, graphicscenes, and Pixmaps and now I (finally) have a .png file (my dot) shown in the scene.

    Problem now is that the viewport always "centers" the scene somehow, so whenever I change the position of the dot in the scene the viewport automatically changes the position of the scene (if I understand this correctly). The result is that the dot isn't changing position "visually".

    So I need a way to fixe the scene or something?.. Help please

  2. #2

    Default Re: QGraphicsScene illustrating the position of a joystick

    Oh I found a way:

    scene->setSceneRect(0, 0, ui->graphicsView->width(), ui->graphicsView->height());

Similar Threads

  1. To Draw Text at given position on QGraphicsScene
    By volcano in forum Qt Programming
    Replies: 6
    Last Post: 4th February 2010, 08:16
  2. Replies: 4
    Last Post: 30th October 2009, 07:36
  3. QGraphicsScene Position Problem
    By addu in forum Qt Programming
    Replies: 14
    Last Post: 22nd July 2009, 14:38
  4. Position of Items in QGraphicsScene/QGraphicsView
    By StefanK2 in forum Qt Programming
    Replies: 11
    Last Post: 7th July 2009, 14:04
  5. Position in a QPixMap created from a QGraphicsScene
    By stevel in forum Qt Programming
    Replies: 8
    Last Post: 8th April 2009, 22:39

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.