[osg-users] osgviewerQT + StatsHandler (possible modif in osgviewerQT)

Poirier, Guillaume Guillaume.Poirier at nrc-cnrc.gc.ca
Thu Oct 18 07:47:29 PDT 2007


Ha I know what is going on... It does work my apologies...

I had changed the line in void AdapterWidget::keyPressEvent( QKeyEvent* event )

_gw->getEventQueue()->keyPress( (osgGA::GUIEventAdapter::KeySymbol) *(event->text().toAscii().data() ) );

to 

_gw->getEventQueue()->keyPress( (osgGA::GUIEventAdapter::KeySymbol) event->key() );

The reason was that the former was producing '0' for all arrow keys... This is I guess because
there is no ASCII code for the arrow keys ? I made the following change in osgviewerQT to
solve the problem:

if(event->key() == Qt::Key_Left)
   _gw->getEventQueue()->keyPress(osgGA::GUIEventAdapter::KEY_Left);
else if(event->key() == Qt::Key_Right)
   _gw->getEventQueue()->keyPress(osgGA::GUIEventAdapter::KEY_Right);  
else if(event->key() == Qt::Key_Up)
   _gw->getEventQueue()->keyPress(osgGA::GUIEventAdapter::KEY_Up);  
else if(event->key() == Qt::Key_Down)
   _gw->getEventQueue()->keyPress(osgGA::GUIEventAdapter::KEY_Down);  
else  
   _gw->getEventQueue()->keyPress( (osgGA::GUIEventAdapter::KeySymbol) *(event->text().toAscii().data() ) );


bill


-----Original Message-----
From: osg-users-bounces at lists.openscenegraph.org on behalf of Mario Valle
Sent: Wed 10/17/2007 9:40 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] osgviewerQT + StatsHandler
 
Poirier, Guillaume wrote:
>
> Hello !
>
> Sorry if this was already discussed... I checked on the gmane archive 
> and could
> not find anything on the topic :(
>
> Is the osgviewerQT supposed to work with the StatsHandler ? Most 
> viewer examples
> use it except osgviewerQT.cpp. When I do
>
> ViewerQT* viewerWindow = new ViewerQT;
> viewerWindow->addEventHandler(new osgViewer::StatsHandler);
>
> and press 's' I get a "Stats report:" printout but see nothing in the 
> window.
>
The same was happening to osgviewerWX. It happens because WX passes 'S' 
instead of 's' to osg in OnKeyUp and OnKeyDown, ie. the uppercase 
lettere is always passed. I think the same is happening in Qt.
Hope it helps
                               mario

> Cheers !
>
>
> bill
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>   


-- 
Ing. Mario Valle
Visualization Group                              | http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS)      | Tel:  +41 (91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91) 610.82.82

_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 4019 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071018/873930eb/attachment-0003.bin>


More information about the osg-users mailing list