[vtkusers] QVTKRenderWindowInteractor Issue

JBK juk124 at psu.edu
Mon Mar 21 09:02:41 EDT 2011


Hi Ben,

I've since gotten QMdiArea to work with the QVTKRenderWindowInteractor 
by playing around with the layout management, etc.  I should have 
mentioned before that I am developing in Python and PyQt.

However, I still experienced the issue with the mouse events being 
detected 35 pixels off in the y direction.  To get around this, I 
modified the QVTKRenderWindowInteractor.py file to shift all mouse 
events by 35 pixels in Y before they are sent to 
_Iren.SetEventInformationFlipY.  In addition, I added an event handler 
to this source file for "mouseDoubleClickEvent" with the same type of 
shift added.  Everything seems to be working fine now, both from the 
standpoint of picking glyphs in the render window and interacting with 
VTK widgets.

Like I say, I narrowed the issue down to something with the layout 
management in Qt/PyQt because if I just created the render window 
interactor without adding it to a layout manager, the interaction was 
fine.  However, the layout manager is obviously necessary, otherwise the 
render window can never be resized, moved, etc.

Thanks,
Josh


On 3/20/2011 5:47 PM, Ben Medina wrote:
> What issues are you seeing with QMdiArea? I've done this in an app,
> and it worked fine, at least on Windows and Linux. On Mac, there are
> unfortunate rendering issues.
>
> On Mon, Feb 28, 2011 at 5:09 AM, JBK<juk124 at psu.edu>  wrote:
>> Hi,
>>
>> I am developing visualization software that uses Qt and VTK.  I am creating
>> a QVTKRenderWindowInteractor and adding this to a QWorkspace as the central
>> widget of the application window.  Just as a note, I realize that QWorkspace
>> is technically deprecated, but it's replacement QMdiArea does not seem to be
>> able to handle a VTK render window as its widget.  Anyway, the QWorkspace
>> seems to be working just fine except for one annoying issue/bug.
>>   Interaction that occurs within the render window seems to be shifted by
>> about 35 pixels in the -y direction.  In other words, a mouse click is
>> detected 35 pixels higher on the screen than where the glyph I am trying to
>> pick is located.  The reason I know this is because I have added in a
>> correction factor that shifts the mouse event by 35 pixels along the y axis
>> and the pick event is then positioned correctly.
>>
>> I have narrowed this issue down to possibly an issue with Qt's layout
>> manager.  In other words, if I just create the render window and don't add
>> it to a layout manager (just give it a parent window), the interaction seems
>> to be correct.  However, when I add it to a layout manager so that it is
>> resized according to its parent widget - which is what I need to happen -
>> the 35 pixel interaction shift occurs.
>>
>> Has anyone run into this issue or does anyone have any ideas for some
>> creative fixes?  I need to fix this so that I can using other VTK widgets
>> that require interaction such as the box probe.
>>
>> Thanks,
>> Josh
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>



More information about the vtkusers mailing list