[vtkusers] vtk / qt question: qvtkwidget does not resize properly

Christian Zemlin zemlinc at upstate.edu
Thu Nov 18 15:31:57 EST 2010


On 11/18/2010 03:01 PM, Clinton Stimpson wrote:
> On Thursday, November 18, 2010 06:31:32 am Christian Zemlin wrote:
>> Hi vtk-users,
>>
>> I would like to use qvtkwidget to render with vtk in a Qt application.
>> I started with a standard vtk example:
>>
>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Qt/BorderWidget
>>
>> which renders a sphere.
>>
>> For layout, I created a project in QtCreator, placed a qvtkwidget as the
>> only widget in the the form, and applied a vertical (I also tried
>> horizontal) layout.
>>
>> This compiles and runs, but when I resize the main window, the qvtkwidget
>> resized only in the vertical direction (and the sphere grows/shrinks
>> accordingly).  In the horizontal direction, the size is fixed, no matter
>> how much I enlarge the main window in horizontal direction.
>>
>> This problem occurs independently of which "size policy" I use in the Qt
>> designer.
> You probably mean to ask why the sphere doesn't grow/shrink in the horizontal
> direction when resizing the QVTKWidget?  This is OpenGL related behavior.
> Perhaps you want to look at the vtkCamera::HorizontalViewAngle setting to
> adjust that.
>
> Or are you saying the QVTKWidget itself will not grow/shrink in the horizontal
> direction because of something like a size policy being fixed?  If this is your
> problem, then you can ask on a Qt list how to make widgets resize in a
> horizontal direction.
>
> Clint
> _______________________________________________
> 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
>
Thank you, Clint.  I just realized that my MainWindow in Qt was 
misconfigured, that was the main problem.  I will look at 
vtkCamera::HorizontalViewAngle as you suggested to set the horizontal 
viewing angle.

Christian

-- 
Christian Zemlin, PhD
Research Assistant Professor
Department of Pharmacology
SUNY Upstate Medical University
Syracuse, NY 13210
Phone: (315) 464-7988
Fax: (315) 464-8014
Email: zemlinc at upstate.edu




More information about the vtkusers mailing list