[vtkusers] Using QVTKWidget

Clinton Stimpson clinton at elemtech.com
Wed Apr 27 12:43:09 EDT 2005


>------------------------------
>
>Message: 2
>Date: Tue, 26 Apr 2005 15:53:50 -0500
>From: Joey Mukherjee <joey at swri.edu>
>Subject: [vtkusers] Using QVTKWidget
>To: Vtk Users <vtkusers at vtk.org>
>Message-ID: <0505323bf209050d55f3c0e72f70588d at swri.edu>
>Content-Type: text/plain; charset=US-ASCII; format=flowed
>
>I usually use Motif as my GUI of choice, but I wanted to try Qt and the 
>new QVTKWidget.  However, the interface seems to be very different than 
>the Motif one.
>
>For instance, in Motif, I create a
>
>  _iren = vtkXRenderWindowInteractor::New ();
>
>and then do a:
>
>         extern XtAppContext application_context;
>         ((vtkXRenderWindowInteractor *) _iren)->Initialize 
>(application_context);
>         _iren->Enable ();
>
>and a new Window is drawn and I can interact with it.
>
>On Qt, this interface does not seem to work.  
>
No it doesn't work.  Don't use vtkXRenderWindowInteractor at all if you 
are going to use QVTKWidget.

>Is there a better way of 
>doing this in Qt?  
>
Use QVTKWidget if you are using Qt.

>What is unique (maybe) about what I do is I let VTK 
>create the window for me.  
>
It is fine to go as far as creating an instance of a vtkRenderWindow, 
but that window should be given to a QVTKWidget before it is initialized.

>I am not trying to embed the drawing into an 
>existing application.  My main application is just the buttons of the 
>interface, in both Qt and Motif.
>
Are you using Qt's Motif extension?

>Is there an example program that might show how to do this?  The reason 
>why the existing ones do not help is that they all assume the window is 
>embedded in the GUI.
>
So it appears you just want a top level window in a Qt GUI.  In that 
case, just create a QVTKWidget without a parent, and be sure to call 
show() on it.  The ImageViewer example is the closest to this scenario.
Are you new to Qt?  If so, I'd probably look more at how Qt works and 
then you can get a better feel for how QVTKWidget works, because it is a 
Qt widget, not a VTK window.

Clint





More information about the vtkusers mailing list