Results 1 to 3 of 3

Thread: Using QGraphicsSceneMouseEvent

  1. #1
    Join Date
    Mar 2008
    Location
    Morocco
    Posts
    47
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Using QGraphicsSceneMouseEvent

    Hi..
    i would like to use the QGraphicsSceneMouseEvent for My application To get The coordinate of the mouse at The GraphicsView ( which contains the GraphicsScene)..

    I tried t create my own Class scene that inherit from QGraphicScene to implement the virtual mouse methods ..

    void midoscene::mousePressEvent(QGraphicsSceneMouseEven t *e){

    point+=e->scenePos(); //QPointF point(0,0)
    //...
    }

    but the problem is that i should write the coordinate of mouse on a label in the mainWidget tht contain the scene ..

    please if someone could show how to use that methode to return the mouse coordinates ..

    thanks !!!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Using QGraphicsSceneMouseEvent

    emit a custom signal and connect it to a slot in the label or elsewhere (depending on the signature).

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

    peace_comp (11th April 2008)

  4. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Using QGraphicsSceneMouseEvent

    Or you can install a filter on mainwindow and convert the mouse cordinates to scene cordinates and display them status bar or whereever u want.

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.