Results 1 to 3 of 3

Thread: can not get mouse double click event for QGraphicsItem

  1. #1
    Join Date
    Sep 2008
    Posts
    93
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default can not get mouse double click event for QGraphicsItem

    Hello,

    I created QGraphicsRectItem objects and I added those items to
    QGraphicsScene, then I hope to get the event
    void QGraphicsItem::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent * event ) [virtual protected] when I double click one item.

    But the function void QGraphicsItem::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent * event ) is never called from my source code.

    Please give some helps!
    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: can not get mouse double click event for QGraphicsItem

    Please provide a minimal compilable example reproducing the problem.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: can not get mouse double click event for QGraphicsItem

    I had this problem. I have found that if had another method in my class (derived from QGraphicsPixmapItem), the mouseDoubleClickEvent was called:

    Qt Code:
    1. void MyGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
    2. {
    3. // DO NOT CALL QGraphicsPixmapItem::mousePressEvent()
    4. }
    To copy to clipboard, switch view to plain text mode 

    So if had such method in my class, the "mouseDoubleClickEvent(QGraphicsSceneMouseEven t* event)" was called.

Similar Threads

  1. Double Click Capturing
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2011, 15:12
  2. Replies: 2
    Last Post: 4th August 2008, 08:44
  3. The event fired by the mouse click on the frame
    By Placido Currò in forum Qt Programming
    Replies: 8
    Last Post: 3rd March 2007, 10:05
  4. Replies: 1
    Last Post: 9th February 2007, 10:41
  5. mouse click event
    By vijay anandh in forum Qt Programming
    Replies: 1
    Last Post: 1st May 2006, 10:24

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.