[vtkusers] vtkRenderWindowInteracotr does not return

DL I inglis.dl at gmail.com
Tue Feb 23 09:17:38 EST 2016


Hi Muhammad,

QVTKWidget uses its own sub-classed vtkRenderWindowInteractor
(QVTKInteractor) for proper control of the Qt event loop.  When you
set up your vtkImageViewer2 in your QApplication, try the following:

vtkRenderWindow* renwin = engine->GetRenderWindow();
imageViewer->SetRenderWindow( renwin);
imageViewer->SetupInteractor( renwin->GetInteractor() );  // make the link
between Qt and vtkImageViewer
imageViewer->SetInput( reader->GetOutput() );
renwin->Render();

there is no need to call Start() on the interactor: QApplication will
initialize the event loop.

best regards,
Dean


On Tue, Feb 23, 2016 at 4:16 AM, Muhammad Jawad <softplanner at gmail.com>
wrote:

> Dear all,
>
> I am using Qt 5.4 with vtk 6.2 on windows. I am facing some problem using
> QVtkWidget with vtkRenderWindowInteractor, It never returns once
> vtkrenderwindowinteractor->start() call.
>
> When I close the QVtkWidget or main application but it still running in
> background.
>
> my code is:
>
>
> vtkImageViewer2 *imageViewer = vtkImageViewer2::New();
>
>
> imageViewer->SetInputData(reader->GetOutput());
>
>
> vtkRenderWindowInteractor *renderWindowInteractor = vtkRenderWindowInteractor::New();
>
>
> imageViewer->SetupInteractor(renderWindowInteractor);
>
> QVtkWidget *engine = new QVtkWidget();
>
> engine->SetRenderWindow(imageViewer->GetRenderWindow()); // make the link between VTK and QT
>
> renderWindowInteractor->SetRenderWindow(imageViewer->GetRenderWindow());
>
> engine->show();
>
> imageViewer->GetRenderWindow()->Render ();
>
>
> //renderWindowInteractor->Initialize();
>
> engine->GetRenderWindow()->GetInteractor()->Start();
>
> //renderWindowInteractor->Start();
>
>
> cerr<<"exit";
>
>
> How I can return from vtkRenderWindowInteractor->Start() function ?
>
>
>
> Thanks.
>
>
>
> --
>
> Muhammad Jawad
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160223/9b2c22c4/attachment-0001.html>


More information about the vtkusers mailing list