Hi All,
I implemented a PointPicker derived from osgGA::GUIEventHandler and overloading:

virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& 
aa, osg::Object*, osg::NodeVisitor*);

in which I handle both osgGA::GUIEventAdapter::PUSH and 
osgGA::GUIEventAdapter::RELEASE cases and always return false.

In my Qt application I have a ViewerWidget that inherits from osgQt::GLWidget 
and osgViewer::CompositeViewer. All key events ara handled in ViewerWidget by 
overloading keyPressEvent(QKeyEvent*).
Now, I thought to activate the PointPicker by pressing 'C' key. So for 
"Qt::Key_C" key I call:

getView(0)->addEventHandler(pointPicker);

Since the point picker must be deactivated after the first pick, then I thought 
to handle the mouse release event on the ViewerWidget side also, overloading 
the method mouseReleaseEvent:

ViewerWidget::mouseReleaseEvent(QMouseEvent* event)

where I call:

superclass::mouseReleaseEvent(event);
getView(0)->removeEventHandler(pointPicker);

The problem is that when removeEventHandler is called the event has not been 
already processed by PointPiker::handle(...). So 
osgGA::GUIEventAdapter::RELEASE case never happens. I tryed to call 
eventTraversal() as follows:

superclass::mouseReleaseEvent(event);
eventTraversal();
getView(0)->removeEventHandler(pointPicker);

but unfortunately it does not solve the problem.

I found a workaround but I will appreciate if someone could explain how to 
solve this case.

Regards,
Gianni

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61405#61405





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to