<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Beautiful! <br>Thanks for the help! :)<br><br>Giancarlo<br><br>&gt; From: enrico.qt@email.it<br>&gt; To: qt-interest@trolltech.com<br>&gt; Subject: Re: [Qt-interest] [vtkusers] QT and VTK interactor how to manage the signals<br>&gt; Date: Tue, 2 Mar 2010 17:14:45 +0100<br>&gt; CC: ilferraresebono@hotmail.it; vtkusers@vtk.org<br>&gt; <br>&gt; On Tuesday 02 March 2010 16:19:37 Giancarlo Amati wrote:<br>&gt; &gt; Hi Clinton,<br>&gt; &gt; thanks a lot for the answer. I just would like to make an example.<br>&gt; &gt; Let's say that if I have a QVTKWidget in my QT interface and I press W on<br>&gt; &gt; the keyword, that event is detected by QT (first) which forward it to the<br>&gt; &gt; QVTKWidget and then the interactor. is that right?<br>&gt; &gt; <br>&gt; &gt; So I wonder, if I make QT managing the press of W first and then I would<br>&gt; &gt; like QVTKWidget doing whatever is programmed to do, would it be enough to<br>&gt; &gt; add the correspondent handler in my QT Class (whatever it is? )<br>&gt; &gt; <br>&gt; &gt; Thanks<br>&gt; &gt; Giancarlo<br>&gt; <br>&gt; <br>&gt; Hello Giancarlo, here is an example that may be useful to you:<br>&gt; <br>&gt; 1. when initializing the widget, connect to the signal you want <br>&gt; <br>&gt; // connect Vtk Events to Qt Slots<br>&gt; m_connections = vtkEventQtSlotConnect::New();<br>&gt; <br>&gt; // get key pressed with high priority (1.0)<br>&gt; m_connections-&gt;Connect(m_widget-&gt;GetRenderWindow()-&gt;GetInteractor(), <br>&gt; vtkCommand::KeyPressEvent, target, SLOT(slotKeyPressed(vtkObject*, unsigned <br>&gt; long, void*, void*, vtkCommand*)), 0, 1.0); // &lt;-notice the 1.0<br>&gt; <br>&gt; 2. in your slot:<br>&gt; <br>&gt; void Target::slotKeyPressed(vtkObject *, unsigned long, void *, void *, <br>&gt; vtkCommand *command)<br>&gt; {<br>&gt;     if ( doSomething() ) {<br>&gt;         // consume event so the interactor doesn't get it<br>&gt;         command-&gt;AbortFlagOn();<br>&gt;     }<br>&gt; }<br>&gt; <br>&gt; So you can handle the key press and you're the first to do so (1.0) and if you <br>&gt; want to stop the Interactor from getting the event, you can do it by calling <br>&gt; AbortFlagOn();<br>&gt; <br>&gt; Does this solve your problems?<br>&gt; <br>&gt; Ciao,<br>&gt; Enrico Ros<br>                                               <br /><hr />Lo spazio su Hotmail aumente con le tue esigenze... <a href='http://www.windowslive.it/hotmail/SpazioDisponibile.aspx' target='_new'>Vai oltre i 5GB</a></body>
</html>