[vtk-developers] QVTKRenderWindowInteractor and resizeEvent

Panagiotis Mavrogiorgos pmav99 at gmail.com
Mon Aug 29 14:43:10 EDT 2011


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.

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?

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?
2. Calling the ConfigureEvent method is necessary?

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110829/0704fc9a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug.py
Type: text/x-python
Size: 5343 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110829/0704fc9a/attachment-0001.py>


More information about the vtk-developers mailing list