<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 29, 2011, at 12:43 PM, Panagiotis Mavrogiorgos wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">The QVTKRenderWindowInteractor class for qt4 defines resizeEvent method like this:<br><br><span style="font-family: courier new,monospace;"> def resizeEvent(self, ev):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> w = self.width()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> h = self.height()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> self._RenderWindow.SetSize(w, h)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> self._Iren.SetSize(w, h)</span><br>
<br>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.<br></blockquote><div><br></div>Seems like the extra resizing comes from vtkWin32OpenGLRenderWindow::SetSize() calling SetWindowPos() on a Qt managed window.</div><div><br><blockquote type="cite">
<br>If I override the resizeEvent method like this (essentially omitting the _RenderWindow.SetSize() method) it works ok on both linux and win 7.<br><br><span style="font-family: courier new,monospace;"> def resizeEvent(self, ev):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> w = self.width()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> h = self.height()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> self._Iren.SetSize(w, h)</span><br><br>So, is there a reason for setting explicitly _RenderWindow's size or is it redundant?<br></blockquote><div><br></div><div>It is not redundant. Its propagating the size information down into VTK. There are classes that ask the vtkRenderWindow for the size.</div><div><br></div><blockquote type="cite"><br>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):<br>
<br><span style="font-family: courier new,monospace;"> def resizeEvent(self,ev):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> size = self.size()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> self._Iren.SetSize(size.width(), size.height())</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> self._Iren.ConfigureEvent()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> self.update()</span><br><br>So the questions are the following ones:<br>1. Are there any scenarios where setting the _RenderWindow's size is necessary?<br></blockquote><div><br></div><div>Yes. But could you instead try something like super(vtkRenderWindow, self._RenderWindow).SetSize(w.h) to not call the X11/Win32/etc.. code?</div><div>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.</div><div><br></div><br><blockquote type="cite">2. Calling the ConfigureEvent method is necessary?<br></blockquote><div><br></div><div>Probably not, but its there for completeness.</div><div><br></div><div>Clint</div><div><br></div><br><blockquote type="cite">
<br>If the answer is no to both questions, then the resizeEvent method could be simplified to this<br><span style="font-family: courier new,monospace;"><br> def resizeEvent(self, ev):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> w = self.width()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> h = self.height()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> self._Iren.SetSize(w, h)</span><br><br>with regards,<br>Panos<br>
<span><bug.py></span>_______________________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtk-developers">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br><br></blockquote></div><br></body></html>