[vtkusers] Problem with bugging additional window (QVTKWidget)

Erik Tuerke tuerke at cbs.mpg.de
Thu Nov 4 09:29:20 EDT 2010


Eric E. Monson wrote:
> Hey Erik,
>
> Take a look at [vtk_src]/Examples/GUI/Qt/SimpleView/SimpleView.cxx and see how it's doing the setup with a QVTKWidget. You may be better off not trying to create the render window and interactor, but just using the ones created by the widget. Maybe something like this:
>
> QVTKWidget *m_AxialWidget;
> m_Image = vtkImageData::New();
> m_ActorAxial = vtkActor::New();
> m_MapperAxial = vtkDataSetMapper::New();
> m_ExtractAxial = vtkImageClip::New();
> m_RendererAxial = vtkRenderer::New();
> m_InteractionStyleAxial = new ViewerInteractor(this, m_RendererAxial); //my own interactor style
>
> m_WindowAxial = m_AxialWidget->GetRenderWindow();
> m_InteractorAxial = m_WindowAxial->GetInteractor();
> m_InteractorAxial->SetInteractorStyle( m_InteractionStyleAxial );
> m_WindowAxial->AddRenderer( m_RendererAxial );
> m_ExtractAxial->SetInput( m_Image );
>
> (..) //configuring m_ExtractAxial
>
> m_MapperAxial->SetInputConnection( m_ExtractAxial->GetOutputPort() );
> m_ActorAxial->SetMapper( m_MapperAxial );
> m_RendererAxial->AddActor( m_ActorAxial );
> m_RendererAxial->ResetCamera();
>
> Not sure if that's quite right (still finishing my coffee this morning), but I think it will get you closer.
> -Eric
>
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
>
> On Nov 4, 2010, at 6:14 AM, Erik Tuerke wrote:
>
>   
>> Hi!
>>
>> I want to create an application with qt and vtk using the QVTKWidget. My problem is that for all QVTKWidgets i get an additional widget (decoupled from my application). It appears that vtk creates this window when i call the vtkRenderWindowInteractor::Initialize() function.
>>
>> So here is my pipeline:
>>
>> QVTKWidget *m_AxialWidget;
>> m_Image = vtkImageData::New();
>> m_ActorAxial = vtkActor::New();
>> m_MapperAxial = vtkDataSetMapper::New();
>> m_ExtractAxial = vtkImageClip::New();
>> m_RendererAxial = vtkRenderer::New();
>> m_WindowAxial = vtkRenderWindow::New();
>> m_InteractorAxial = vtkRenderWindowInteractor::New();
>> m_InteractionStyleAxial = new ViewerInteractor(this, m_RendererAxial); //my own interactor style
>>
>> m_InteractorAxial->SetInteractorStyle( m_InteractionStyleAxial );
>> m_WindowAxial->SetInteractor( m_InteractorAxial );
>> m_WindowAxial->AddRenderer( m_RendererAxial );
>> m_ExtractAxial->SetInput( m_Image );
>> (..) //configuring m_ExtractAxial
>> m_ExtractAxial->Update();
>> m_MapperAxial->SetInput( m_ExtractAxial->GetOutput() );
>> m_ActorAxial->SetMapper( m_MapperAxial );
>> m_RendererAxial->AddActor( m_ActorAxial );
>> m_InteractorAxial->Initialize(); // <--------additional window appears
>> m_AxialWidget->SetRenderWindow( m_WindowAxial );
>> m_RendererAxial->ResetCamera();
>> m_AxialWidget->update();
>>
>>
>> How can i get rid of this window?
>>
>> Thanks a lot!!!
>>
>> -- 
>> Erik Tuerke
>> Department of Neurophysics Max-Planck-Institute for Human Cognitive and Brain Sciences
>> Stephanstrasse 1A
>> 04103 Leipzig
>> Germany Tel: +49 341 99 40-2440
>> Email: tuerke at cbs.mpg.de
>> www.cbs.mpg.de
>>
>>
>> _______________________________________________
>> 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
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>     
>
>   
Hi!

Ahhh...cool; very thanks!  Solution was to get both, interactor AND 
renderWindow, from QVTKWidget.

Greetings!



-- 
Erik Tuerke
Department of Neurophysics 
Max-Planck-Institute for Human Cognitive and Brain Sciences
Stephanstrasse 1A
04103 Leipzig
Germany 
Tel: +49 341 99 40-2440
Email: tuerke at cbs.mpg.de
www.cbs.mpg.de





More information about the vtkusers mailing list