No subject


Mon Dec 15 09:51:36 EST 2008


rget the second event loop idea, its impossible and wouldn't solve anyt=
hing.  You've already got one running, and that's good enough.=
<br>
How about using a debugger and following where the execution goes from QVTK=
Widget::mousePressEvent.<br>
<br>
Clint<br>
<br>
Luis Roberto P. Paula wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Clint,<br>
<br>
In the main window of my application I have a QVTKWidget. I have set some c=
allbacks to detect mouse events and in this window everything is working fi=
ne.<br>
<br>
Then I tried to open a second window (QDialog for example) by clicking on a=
 button of the main window. In this second window I have also a QVTKWidget =
object. I&#39;m displaying an 2D image on it with the vtkImageViewer2 and t=
he zoom control with the mouse wheel is working fine (default action). The =
problem is with the callback that I have created. In the constructor of my =
QDialog class it is set like this:<br>

<br>
 &nbsp; vtkImageInteractionCallback* callback =3D vtkImageInteractionCallba=
ck::New();<br>
 &nbsp; imageStyle-&gt;AddObserver(vtkCommand::MouseMoveEvent, callback);<b=
r>
 &nbsp; imageStyle-&gt;AddObserver(vtkCommand::LeftButtonPressEvent, callba=
ck);<br>
 &nbsp; imageStyle-&gt;AddObserver(vtkCommand::LeftButtonReleaseEvent, call=
back);<br>
<br>
 &nbsp; vtkWidget-&gt;GetRenderWindow()-&gt;GetInteractor()-&gt;SetInteract=
orStyle(imageStyle); <br>
<br>
None of this events are being captured.<br>
<br>
I thought it could be something wrong in the code, but when I tried to load=
 this second window as the main window, everything worked.<br>
<br>
 &nbsp; int main(int argc, char *argv[])<br>
 &nbsp; {<br>
 &nbsp; &nbsp; &nbsp;QApplication app(argc, argv);<br>
<br>
 &nbsp; &nbsp; &nbsp;/*MyGui* mainWindow =3D new MyGui;<br>
 &nbsp; &nbsp; &nbsp;mainWindow-&gt;show();*/<br>
<br>
 &nbsp; &nbsp; &nbsp;MyDialog* dialog =3D new MyDialog; // HERE IT WORKS, B=
UT THE DIALOG SHOULD BE PART OF THE MAIN WINDOW.<br>
 &nbsp; &nbsp; &nbsp;dialog&gt;show();<br>
<br>
 &nbsp; &nbsp; &nbsp;return app.exec();<br>
 &nbsp; }<br>
<br>
Do you know why this is happening?<br>
<br>
Thanks,<br>
Luis<br>
<br>
On Wed, Feb 11, 2009 at 2:15 AM, Clinton Stimpson &lt;<a href=3D"mailto:cli=
nton at elemtech.com" target=3D"_blank">clinton at elemtech.com</a> &lt;mailto:<a=
 href=3D"mailto:clinton at elemtech.com" target=3D"_blank">clinton at elemtech.co=
m</a>&gt;&gt; wrote:<br>

<br>
<br>
 &nbsp; &nbsp;So which callbacks aren&#39;t working? &nbsp;I don&#39;t see =
how trying to make<br>
 &nbsp; &nbsp;another event loop would solve a callback problem.<br>
 &nbsp; &nbsp;If its a dialog, why not call exec() on it instead of show() =
?<br>
 &nbsp; &nbsp; exec() will create a temporary local event loop (see QEventL=
oop).<br>
 &nbsp; &nbsp;Also, each thread can only have one event loop active at a ti=
me,<br>
 &nbsp; &nbsp;and all Qt widgets are on the same thread.<br>
<br>
 &nbsp; &nbsp;Clint<br>
<br>
 &nbsp; &nbsp;Luis Roberto P. Paula wrote:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;I have set the second window as a Dialog window=
 and open it as<br>
 &nbsp; &nbsp; &nbsp; &nbsp;modal. For some reason, the callback for this n=
ew window are<br>
 &nbsp; &nbsp; &nbsp; &nbsp;not being observed.<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;On Tue, Feb 10, 2009 at 1:04 AM, Luis Roberto P=
. Paula<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;<a href=3D"mailto:luisrpp at gmail.com" target=
=3D"_blank">luisrpp at gmail.com</a> &lt;mailto:<a href=3D"mailto:luisrpp at gmai=
l.com" target=3D"_blank">luisrpp at gmail.com</a>&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;mailto:<a href=3D"mailto:luisrpp at gmail.com"=
 target=3D"_blank">luisrpp at gmail.com</a> &lt;mailto:<a href=3D"mailto:luisr=
pp at gmail.com" target=3D"_blank">luisrpp at gmail.com</a>&gt;&gt;&gt; wrote:<br=
>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hi All,<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Since QVTKInteractor cannot control the=
 event loop, how do<br>
 &nbsp; &nbsp; &nbsp; &nbsp;I start<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a second window after the click of a bu=
tton and make this new<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; window to have its own event loop?<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; When the button is clicked, this action=
 is performed:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MyWidget* widget =3D new &nbsp; =
MyWidget();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; widget-&gt;show();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; The new window appears, but to make the=
 interactor to work,<br>
 &nbsp; &nbsp; &nbsp; &nbsp;there<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; should be a command like:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; qApp-&gt;exec();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; but QT does not allow me to start a new=
 GUI event loop.<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Does anybody can help me?<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Thanks,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Luis<br>
<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;-----------------------------------------------=
-------------------------<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;_______________________________________________=
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Powered by <a href=3D"http://www.kitware.com" t=
arget=3D"_blank">www.kitware.com</a> &lt;<a href=3D"http://www.kitware.com"=
 target=3D"_blank">http://www.kitware.com</a>&gt;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Visit other Kitware open-source projects at<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<a href=3D"http://www.kitware.com/opensource/op=
ensource.html" target=3D"_blank">http://www.kitware.com/opensource/opensour=
ce.html</a><br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Please keep messages on-topic and check the VTK=
 FAQ at:<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<a href=3D"http://www.vtk.org/Wiki/VTK_FAQ" tar=
get=3D"_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Follow this link to subscribe/unsubscribe:<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<a href=3D"http://www.vtk.org/mailman/listinfo/=
vtkusers" target=3D"_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a=
><br>
 &nbsp; &nbsp; &nbsp; &nbsp;<br>
<br>
<br>
</blockquote>
<br>
<br>
_______________________________________________<br>
Powered by <a href=3D"http://www.kitware.com" target=3D"_blank">www.kitware=
.com</a><br>
<br></div></div><div class=3D"Ih2E3d">
Visit other Kitware open-source projects at <a href=3D"http://www.kitware.c=
om/opensource/opensource.html" target=3D"_blank">http://www.kitware.com/ope=
nsource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href=3D"http://w=
ww.vtk.org/Wiki/VTK_FAQ" target=3D"_blank">http://www.vtk.org/Wiki/VTK_FAQ<=
/a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href=3D"http://www.vtk.org/mailman/listinfo/vtkusers" target=3D"_blank">=
http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></blockquote>
<br>
<br>
</blockquote></div><br>

--0015175ccf2ec2f7280462a7b37d--


More information about the vtkusers mailing list