[vtk-developers] QVTKRenderWindowInteractor and resizeEvent
Clinton Stimpson
clinton at elemtech.com
Mon Aug 29 21:36:14 EDT 2011
On Aug 29, 2011, at 12:43 PM, Panagiotis Mavrogiorgos wrote:
> The QVTKRenderWindowInteractor class for qt4 defines resizeEvent method like this:
>
> def resizeEvent(self, ev):
> w = self.width()
> h = self.height()
> self._RenderWindow.SetSize(w, h)
> self._Iren.SetSize(w, h)
>
> This works ok on Linux, but on windows 7 x64 it leads to incosistent behavior. Try to run the attached example (it places the Interactor within a QGridLayout inside a QFrame) and change the tiling of the windows from the menu. You will notice that the size of the rendererwindow takes more place than it should.
Seems like the extra resizing comes from vtkWin32OpenGLRenderWindow::SetSize() calling SetWindowPos() on a Qt managed window.
>
> If I override the resizeEvent method like this (essentially omitting the _RenderWindow.SetSize() method) it works ok on both linux and win 7.
>
> def resizeEvent(self, ev):
> w = self.width()
> h = self.height()
> self._Iren.SetSize(w, h)
>
> So, is there a reason for setting explicitly _RenderWindow's size or is it redundant?
It is not redundant. Its propagating the size information down into VTK. There are classes that ask the vtkRenderWindow for the size.
>
> Just for the record, the QVTKRenderWindowInteractor class for qt defines resizeEvent method like this (e.g. the same as the override method + calling the configureEvent method):
>
> def resizeEvent(self,ev):
> size = self.size()
> self._Iren.SetSize(size.width(), size.height())
> self._Iren.ConfigureEvent()
> self.update()
>
> So the questions are the following ones:
> 1. Are there any scenarios where setting the _RenderWindow's size is necessary?
Yes. But could you instead try something like super(vtkRenderWindow, self._RenderWindow).SetSize(w.h) to not call the X11/Win32/etc.. code?
There's only one way to set those variables, and that is with the SetSize() function. But for already resized windows, there's no way to only just update those variables, without directly calling the base class.
> 2. Calling the ConfigureEvent method is necessary?
Probably not, but its there for completeness.
Clint
>
> If the answer is no to both questions, then the resizeEvent method could be simplified to this
>
> def resizeEvent(self, ev):
> w = self.width()
> h = self.height()
> self._Iren.SetSize(w, h)
>
> with regards,
> Panos
> <bug.py>_______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110829/0ef77f11/attachment.html>
More information about the vtk-developers
mailing list