Results 1 to 3 of 3

Thread: QGraphicScene does not handle mouseDoubleClickEvents

  1. #1
    Join Date
    Apr 2012
    Posts
    3

    Default QGraphicScene does not handle mouseDoubleClickEvents

    I've got a class that derives form QMainWindow. It's central widget is set to be an instance of DiagramScene that derives from QGraphicScene.
    The problem is that as I reimplement mouseDoubleClickEvent in DiagramScene, it does not work.

    Here's a snippet:

    Qt Code:
    1. void DiagramScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
    2. {
    3. QList<QGraphicsItem*> items = this->items(event->pos());
    4. if (items.count() > 0 && items.first()->type() == Entity::Type ){
    5. Entity *item = qgraphicsitem_cast<Entity *>(items.first());
    6. item->editDialog();
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 


    It looks for me strange especially because I've reimplemented in DiagramScene other mouse events, such as: mousePressEvent or mouseReleaseEvent and they work well

    I spent a lot of time exploring documentation, but I still have no idea why it happens

    Thanks in advance!
    (Entity is my other class)
    Last edited by sinek; 26th April 2012 at 18:48.

  2. #2
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: QGraphicScene does not handle mouseDoubleClickEvents

    Are you sure it doesn't go there? I mean - isn't the message box missing an exec()? Try it with a breakpoint and/or or a qDebug() << "kjkgvkjvf"; if you are not sure.

  3. #3
    Join Date
    Apr 2012
    Posts
    3

    Default Re: QGraphicScene does not handle mouseDoubleClickEvents

    I'm damn foolish That was the issue, of course. Problem is solved. Thanks for help!

Similar Threads

  1. Multiple use of QGraphicScene
    By Xtresis in forum Newbie
    Replies: 4
    Last Post: 6th September 2010, 12:06
  2. fit QGraphicscene to QGraphicsview
    By nataly in forum Qt Programming
    Replies: 1
    Last Post: 17th January 2010, 15:05
  3. Qgraphicscene - rendering
    By jsmith in forum Qt Programming
    Replies: 0
    Last Post: 22nd July 2009, 13:08
  4. QGraphicScene to stream
    By phannent in forum Newbie
    Replies: 2
    Last Post: 28th June 2008, 09:43
  5. QGraphicScene MousePressEvent
    By Spitz in forum Qt Programming
    Replies: 3
    Last Post: 16th November 2007, 21:46

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.