<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hey all,<br>
<b><br>
I would like to interact with a QVTKwidget when I release the ESC key.</b><br>
<br>
I am able to add an observer on the Interactor of my QVTKwidget this way, that calls the function UnselectWidget() anytime I release a key if i was interacting with my QVTKwidget :<br>
<blockquote><i>meshWidget->GetInteractor()->AddObserver(vtkCommand::KeyReleaseEvent, this, &ShapePopulationViewer::UnselectWidget);</i><br>
</blockquote>
<br>
I'd like to verify if the key that was released was ESC, just like this line for Ctrl :<br>
<blockquote><i>if(selectedInteractor->GetControlKey()==1)</i><br>
</blockquote>
<br>
If it is easier it can be when I press ESC (<i>KeyPressedEvent)</i> instead, but I still need to identify the Key.<i><br>
<br>
</i>I tried to use the QT function this way instead, but the function is only called when I am in the main window, and is not recognized when I am interacting with the QVTKwidget :<br>
<blockquote><i>void myclass::keyPressEvent(QKeyEvent *event){</i><br>
<i> if((event->key() == Qt::Key_Escape)){</i><br>
<i> [...]</i><br>
<i>}}</i><br>
</blockquote>
<br>
Any idea? Thank you. Alexis<br>
</div>
</body>
</html>