PDA

View Full Version : can not get mouse double click event for QGraphicsItem



learning_qt
8th September 2009, 14:32
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!

wysota
9th September 2009, 22:36
Please provide a minimal compilable example reproducing the problem.

Specialized1
14th September 2009, 20:36
I had this problem. I have found that if had another method in my class (derived from QGraphicsPixmapItem), the mouseDoubleClickEvent was called:


void MyGraphicsItem::mousePressEvent(QGraphicsSceneMous eEvent *event)
{
// DO NOT CALL QGraphicsPixmapItem::mousePressEvent()
}

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