[Coin-discuss] Problems with Keys in SoQtExaminerViewer

Matthew Saltzman mjs at clemson.edu
Tue Apr 20 10:16:22 EDT 2010


Ralf-

I believe you want coin3d.org, not coin-or.org.

On Tue, 2010-04-20 at 15:57 +0200, Ralf Dohmann wrote: 
> Hi,
> 
> i got a problem with the SoQtExaminerViewer ( i'm using Coin Version 3.1.2 with SoQt ), in version 1 of Coin it was possible to switch the view mode of the examinerViewer by pressing  Alt Gr ( the view mode got changed as long as the button was pressed ). 
> 
> I found this piece of code in the SoQt sources in function processSoEvent() of file SoGuiViewer.cpp.in in class So at Gui@Viewer 
> ( after parsing SoQtViewer ):
> 
> // Let the end-user toggle between camera-interaction mode
> // ("viewing") and scenegraph-interaction mode with ALT key(s).
>   case SoKeyboardEvent::LEFT_ALT:
>   case SoKeyboardEvent::RIGHT_ALT:
>     if (!this->isViewing() && (keyevent->getState() ==  SoButtonEvent::DOWN)) {
>       PRIVATE(this)->altdown = TRUE;
>       this->setViewing(TRUE);
>       return TRUE;
>     }
>     else if (PRIVATE(this)->altdown && (keyevent->getState() == SoButtonEvent::UP)) {
>       this->setViewing(FALSE);
>       PRIVATE(this)->altdown = FALSE;
>       return TRUE;
>     }
>     break;
> 
> It seems to me that these lines describe this behaviour, but in my 
> case this does not work. In my program it is possible to switch the 
> mode by pressing Escape, pressing Alt Gr switches the view mode to true if it is set to false, but not vice versa. I use the function handleEvent() to forward all events, the surrounding Qt frame recieves, to the examinerViewer.
> 
> My forwarding of events looks like this:
> 
> void MyClass::keyPressEvent( QKeyEvent *argEvent ){
>   // - theViewer is the ExaminerViewer 
>   // - handleEvent is just a public interface to call the protected function
>   //   processEvent
>   theViewer->handleEvent( argEvent );
> }
> 
> I could not find in the documentation how this behaviour is specified
> and I do not understand why my application does not handle the else condition while releasing Alt Gr.
> 
> Maybe someone of you can help me, to find a reason why this doesn't work.
> 
> Thanks
> 
> Kind regards
> Ralf

-- 
                Matthew Saltzman

Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs





More information about the Coin-discuss mailing list