[vtkusers] size of QVTKWidget

Anja Ende anja.ende at googlemail.com
Sat Aug 26 11:20:57 EDT 2006


Hi Clint,

Thanks for your reply. I really tried calling ensurePolished() and it still
returns the same window size.

Actually if I query the window size after the exec() has returned, then it
returns the correct value... But my then it is too late :(

Here is a bit of code, to see when I am actually querying for the size...

QHBoxLayout * mainLayout = new QHBoxLayout;
mainLayout->addLayout(viewersLayout);
mainLayout->addLayout(toolbarLayout);

mainWindow.AddLayout(mainLayout);
mainWindow.Pack();
// As you can see, I call show before I query the size...
mainWindow.showFullScreen();

// totally bogus values....
int * size = xyViewer->GetSize();

Is there a way yo override some of these creation events....???

Cheers and thanks,

Anja

On 25/08/06, Clinton Stimpson <clinton at elemtech.com> wro
te:
>
>
> > 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060826/9254840b/attachment.htm>


More information about the vtkusers mailing list