[vtkusers] size of QVTKWidget

Clinton Stimpson clinton at elemtech.com
Fri Aug 25 13:43:52 EDT 2006


> Date: Thu, 24 Aug 2006 18:24:46 +0100
> From: "Anja Ende" <anja.ende at googlemail.com>
> Subject: [vtkusers] size of QVTKWidget
> To: vtkusers at vtk.org
> Message-ID:
> 	<1f5d2b4f0608241024p79b2c47fkeff09ce5cd96d1c2 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi everyone,
>
> This might be more of a QT question than a VTK question.
>
> I am having trouble finding the size of a QVTKWidget that hosts a
> vtkImageViewer. I want to center the input image and of course I need to
> find the host window size for that.
>
> Does not matter when I call the getRenderWindow()->GetSize() or the QTWidget
> size functions it always seems to return the wrong size of the
> window...Anything in the range from 640 to 86!
>
> If anyone has found a way to find the correct size of a QT window, please
> let me know.
>
> By the way, the window is contained in a vertical layout manager.
>
> Thanks,
>
> Anja
>   

Looks like you are asking for the size of the window before it has been 
properly sized.
If that is what you are doing, then you could call ensurePolished() on 
the widget or get the QEvent::Polish event, before you ask the size.  
Otherwise, just getting the size should work.

Clint




More information about the vtkusers mailing list