[vtkusers] vtkRenderWindowInteracotr does not return
Muhammad Jawad
softplanner at gmail.com
Tue Feb 23 09:58:06 EST 2016
Hi Dean,
Thanks for the suggestions. I did the same as you mentioned it's working.
But the problem is that, it immediately close the window.
What do you say ?
--
Muhammad Jawad
On 23 February 2016 at 15:17, DL I <inglis.dl at gmail.com> wrote:
> 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/e192ec5b/attachment.html>
More information about the vtkusers
mailing list