<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>> From: enrico.qt@email.it<br>> To: qt-interest@trolltech.com<br>> Subject: Re: [Qt-interest] [vtkusers] QT and VTK interactor how to manage the signals<br>> Date: Tue, 2 Mar 2010 17:14:45 +0100<br>> CC: ilferraresebono@hotmail.it; vtkusers@vtk.org<br>> <br>> On Tuesday 02 March 2010 16:19:37 Giancarlo Amati wrote:<br>> > Hi Clinton,<br>> > thanks a lot for the answer. I just would like to make an example.<br>> > Let's say that if I have a QVTKWidget in my QT interface and I press W on<br>> > the keyword, that event is detected by QT (first) which forward it to the<br>> > QVTKWidget and then the interactor. is that right?<br>> > <br>> > So I wonder, if I make QT managing the press of W first and then I would<br>> > like QVTKWidget doing whatever is programmed to do, would it be enough to<br>> > add the correspondent handler in my QT Class (whatever it is? )<br>> > <br>> > Thanks<br>> > Giancarlo<br>> <br>> <br>> Hello Giancarlo, here is an example that may be useful to you:<br>> <br>> 1. when initializing the widget, connect to the signal you want <br>> <br>> // connect Vtk Events to Qt Slots<br>> m_connections = vtkEventQtSlotConnect::New();<br>> <br>> // get key pressed with high priority (1.0)<br>> m_connections->Connect(m_widget->GetRenderWindow()->GetInteractor(), <br>> vtkCommand::KeyPressEvent, target, SLOT(slotKeyPressed(vtkObject*, unsigned <br>> long, void*, void*, vtkCommand*)), 0, 1.0); // <-notice the 1.0<br>> <br>> 2. in your slot:<br>> <br>> void Target::slotKeyPressed(vtkObject *, unsigned long, void *, void *, <br>> vtkCommand *command)<br>> {<br>> if ( doSomething() ) {<br>> // consume event so the interactor doesn't get it<br>> command->AbortFlagOn();<br>> }<br>> }<br>> <br>> So you can handle the key press and you're the first to do so (1.0) and if you <br>> want to stop the Interactor from getting the event, you can do it by calling <br>> AbortFlagOn();<br>> <br>> Does this solve your problems?<br>> <br>> Ciao,<br>> 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>