Results 1 to 2 of 2

Thread: QGraphicsView mouseEvents...?

  1. #1
    Join Date
    Nov 2006
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QGraphicsView mouseEvents...?

    Currently, I have a subclassed widget, which contains a QGraphicsScene and a QGraphicsView. I have yet to find a way (after copious searching) to handle the mouse clicks on the QGraphicsView. I would really like to not have to subclass the view just for this. QEventFilter does not seem to be working, it seems, and overriding the main class's mousePressEvent doesn't seem to be working either. What am I missing, here? What am I not seeing?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QGraphicsView mouseEvents...?

    Install the event filter on the graphics view's viewport:
    Qt Code:
    1. graphicsView->viewport()->installEventFilter(this);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

Similar Threads

  1. How to use QGraphicsView and Scene right ...
    By Mike in forum Qt Programming
    Replies: 6
    Last Post: 22nd January 2007, 09:51
  2. QGraphicsView and game programming
    By ball in forum Newbie
    Replies: 5
    Last Post: 9th January 2007, 22:14
  3. QGraphicsView and QGraphicsScene speeds
    By jnk5y in forum Qt Programming
    Replies: 2
    Last Post: 20th October 2006, 08:13
  4. QGraphicsView and contextMenuEvent
    By laurabee in forum Qt Programming
    Replies: 1
    Last Post: 12th October 2006, 23:22
  5. Examples of QGraphicsView
    By grosem in forum Newbie
    Replies: 16
    Last Post: 22nd August 2006, 22:48

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.