How can I check for a double-click on my items?
How can I check for a double-click on my items?
bool QGraphicsItem::sceneEvent ( QEvent * event )
event is QEvent::GraphicsSceneMouseDoubleClick
"Behind every great fortune lies a crime" - Balzac
How exactly do I use that?
why cant you re-impliment "void mouseDoubleClickEvent ( QGraphicsSceneMouseEvent * event ) ".
To use sceneEvent(), u should first register the item for which u need all the events and filter the events.
To register you can use "void installSceneEventFilter ( QGraphicsItem * filterItem )".
and override bool sceneEvent ( QEvent * event ) and filter the events which you need..
wow..... maybe an example? Thats a litle beyond me.
see the previous to last post of this thread
http://www.qtcentre.org/forum/f-newb...eys-22921.html
"Behind every great fortune lies a crime" - Balzac
Qt Code:
{ printf("is it coming inside event..\n"); if(ke->key()==Qt::Key_F1){ qApp->quit(); printf("Logout buttin clicked..\n"); } return true; } }To copy to clipboard, switch view to plain text mode
Ok. So just by having this function it gets called automatically every time QObject *ob receives an event?
Or do I still need signals/slots?
instead u useQt Code:
To copy to clipboard, switch view to plain text mode
Qt Code:
To copy to clipboard, switch view to plain text mode
and inside the condition u can do any thing .. display a alert message dialog or emit a signal or return a statement ..etc ..
"Behind every great fortune lies a crime" - Balzac
so I'll use the function like ? :
Qt Code:
To copy to clipboard, switch view to plain text mode
why u have to use function like eventFilter(myGraphicsItem, QEvent *e) ...!
its a virtual function reimplement the virtual function in your QGraphicsView class and install this event filter in your QGraphicsScene() of the view ..
see the link
http://doc.trolltech.com/4.3/eventsa...#event-filters
"Behind every great fortune lies a crime" - Balzac
Okay. Now my mind cleared up. Thanks for the help, my problem is solved.Tx.
Bookmarks