[Coin-discuss] Problems with Keys in SoQtExaminerViewer

Ralf Dohmann 51rv3r at gmx.de
Tue Apr 20 09:57:53 EDT 2010


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
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01




More information about the Coin-discuss mailing list