Hi Clint,<br><br>It is working now.<br><br>I just added this at the end of the constructor: QDialog::exec();<br><br>I was calling exec outside the class and It wasn't the exec implemented by QDialog.<br><br>Thanks for your help!<br>
<br>Luis<br><br><div class="gmail_quote">On Wed, Feb 11, 2009 at 2:01 PM, Clinton Stimpson <span dir="ltr"><<a href="mailto:clinton@elemtech.com">clinton@elemtech.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Are you showing this dialog on another thread?<br>
<br>
Clint<br><font color="#888888">
<br>
Clinton Stimpson wrote:<br>
</font><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">
<br>
>From what you've given, I can't tell what your problem is. Forget the second event loop idea, its impossible and wouldn't solve anything. You've already got one running, and that's good enough.<br>
How about using a debugger and following where the execution goes from QVTKWidget::mousePressEvent.<br>
<br>
Clint<br>
<br>
Luis Roberto P. Paula wrote:<br>
<blockquote class="gmail_quote" style="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 callbacks to detect mouse events and in this window everything is working fine.<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'm displaying an 2D image on it with the vtkImageViewer2 and the 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>
vtkImageInteractionCallback* callback = vtkImageInteractionCallback::New();<br>
imageStyle->AddObserver(vtkCommand::MouseMoveEvent, callback);<br>
imageStyle->AddObserver(vtkCommand::LeftButtonPressEvent, callback);<br>
imageStyle->AddObserver(vtkCommand::LeftButtonReleaseEvent, callback);<br>
<br>
vtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(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>
int main(int argc, char *argv[])<br>
{<br>
QApplication app(argc, argv);<br>
<br>
/*MyGui* mainWindow = new MyGui;<br>
mainWindow->show();*/<br>
<br>
MyDialog* dialog = new MyDialog; // HERE IT WORKS, BUT THE DIALOG SHOULD BE PART OF THE MAIN WINDOW.<br>
dialog>show();<br>
<br>
return app.exec();<br>
}<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 <<a href="mailto:clinton@elemtech.com" target="_blank">clinton@elemtech.com</a> <mailto:<a href="mailto:clinton@elemtech.com" target="_blank">clinton@elemtech.com</a>>> wrote:<br>
<br>
<br>
So which callbacks aren't working? I don't see how trying to make<br>
another event loop would solve a callback problem.<br>
If its a dialog, why not call exec() on it instead of show() ?<br>
exec() will create a temporary local event loop (see QEventLoop).<br>
Also, each thread can only have one event loop active at a time,<br>
and all Qt widgets are on the same thread.<br>
<br>
Clint<br>
<br>
Luis Roberto P. Paula wrote:<br>
<br>
I have set the second window as a Dialog window and open it as<br>
modal. For some reason, the callback for this new window are<br>
not being observed.<br>
<br>
On Tue, Feb 10, 2009 at 1:04 AM, Luis Roberto P. Paula<br>
<<a href="mailto:luisrpp@gmail.com" target="_blank">luisrpp@gmail.com</a> <mailto:<a href="mailto:luisrpp@gmail.com" target="_blank">luisrpp@gmail.com</a>><br>
<mailto:<a href="mailto:luisrpp@gmail.com" target="_blank">luisrpp@gmail.com</a> <mailto:<a href="mailto:luisrpp@gmail.com" target="_blank">luisrpp@gmail.com</a>>>> wrote:<br>
<br>
Hi All,<br>
<br>
Since QVTKInteractor cannot control the event loop, how do<br>
I start<br>
a second window after the click of a button and make this new<br>
window to have its own event loop?<br>
<br>
When the button is clicked, this action is performed:<br>
<br>
MyWidget* widget = new MyWidget();<br>
widget->show();<br>
<br>
The new window appears, but to make the interactor to work,<br>
there<br>
should be a command like:<br>
<br>
qApp->exec();<br>
<br>
but QT does not allow me to start a new GUI event loop.<br>
<br>
Does anybody can help me?<br>
<br>
Thanks,<br>
Luis<br>
<br>
<br>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> <<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at:<br>
<a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
<br>
<br>
</blockquote>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br></div></div><div class="Ih2E3d">
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></blockquote>
<br>
<br>
</blockquote></div><br>