Results 1 to 2 of 2

Thread: Mouse events on graphicItems

  1. #1
    Join Date
    Feb 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Mouse events on graphicItems

    Hello,
    I have a graphics scene in a graphics view.
    I managed to draw rectangles (QGraphicsRectItems) and lines (QGraphicsLineItems) on the scene, but I encountered another problem:

    How can I overwrite mouse events on these (and other) items?

    I am quite resistant against writing my own subclasses, because I want to access many items, so it would be quite demanding and (as far as I understand) I should also subclass the QGraphicsScene to accept my items.
    In my search for the solution, I came across the eventFilter. However I have read, that I cannot be applied it to QGraphicsItems.

    Please, help me clarify the possible solutions for the problem.

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: Mouse events on graphicItems

    I don't see how you would need to subclass QGraphicsScene. It should work with any class derived from QGraphicsRectItem or QGraphicsLineItem. You probably have no choice -- and that's how it's supposed to work in C++ and in Qt.

Similar Threads

  1. Mouse events
    By Maluko_Da_Tola in forum Newbie
    Replies: 3
    Last Post: 25th August 2010, 06:55
  2. Artificial mouse events
    By redbaron in forum Qt Programming
    Replies: 2
    Last Post: 11th August 2010, 11:31
  3. Mouse Events
    By daviddoria in forum Qt Programming
    Replies: 6
    Last Post: 13th May 2008, 11:55
  4. mouse events
    By xyzt in forum Newbie
    Replies: 3
    Last Post: 23rd March 2008, 11:14
  5. mouse moving don't produce mouse events
    By coralbird in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2006, 06:13

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.