[vtk-developers] [VTK 0013323]: vtkInteractorStyle.cxx uses outdated EventPosition

Mantis Bug Tracker mantis at public.kitware.com
Tue Jul 24 10:44:05 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://vtk.org/Bug/view.php?id=13323 
====================================================================== 
Reported By:                edice
Assigned To:                
====================================================================== 
Project:                    VTK
Issue ID:                   13323
Category:                   (No Category)
Reproducibility:            have not tried
Severity:                   minor
Priority:                   normal
Status:                     backlog
Project:                    TBD 
Type:                       incorrect functionality 
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             2012-07-24 10:44 EDT
Last Modified:              2012-07-24 10:44 EDT
====================================================================== 
Summary:                    vtkInteractorStyle.cxx uses outdated EventPosition
Description: 
In this code from vtkInteractorStyle.cxx:
    case 'f' :
    case 'F' :
      {
      if(this->CurrentRenderer!=0)
        {
        this->AnimState = VTKIS_ANIM_ON;
        vtkAssemblyPath *path = NULL;
        this->FindPokedRenderer(rwi->GetEventPosition()[0],
                                rwi->GetEventPosition()[1]);


The InteractorStyle is responding to a key press, and is using "EventPosition"
to determine the poked renderer and the pick coordinate.

However, in QVTKInteractorAdapter.cxx (and also likely in the equivalent for
MFC, Cocoa, etc) this is what is done in response to a key press:

iren->SetKeyEventInformation(
      (e2->modifiers() & Qt::ControlModifier),
      (e2->modifiers() & Qt::ShiftModifier),
      ascii_key, e2->count(), keysym);

SetKeyEventInformation() does everything except set EventPosition.
So the interactor style is using an EventPosition that was set during the last
MouseMove or other mouse event.

That is normally ok, unless the mouse is moved outside the widget.  The widget
still has the focus and receives key presses, but EventPosition is left at the
last known mouse position (at the point it left the window).


Fixes:
a)
Instead, the key event should call SetEventInformation() with the current mouse
cursor position (from QCursor::pos(), converted to widget coords).

b)
The InteractorStyle should not use EventPosition, but instead use a mechanism to
query the current mouse position.

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-07-24 10:44 edice          New Issue                                    
======================================================================




More information about the vtk-developers mailing list