[vtkusers] Qt and keyboard events

Shakes Shekhar.Chandra at sci.monash.edu.au
Tue Mar 4 22:51:49 EST 2008


Hi Jon,

VTK uses observers to look out for events. Use the RemoveObservers() 
members of the interactor to unbind the ones u want. You can find the 
list of events in vtkCommand class docs. For example:

///Unbind the right mouse button events as Qt uses context menu.
QVTKWidget::GetRenderWindow()->GetInteractor()->RemoveObservers(vtkCommand::RightButtonPressEvent);
QVTKWidget::GetRenderWindow()->GetInteractor()->RemoveObservers(vtkCommand::RightButtonReleaseEvent);

As for getting Qt and VTK to do things simultaneously, u could use the 
vtkCallbackCommand or vtkEventForwarderCommand to redirect the events 
and call Qt stuff. I haven't done this, so perhaps someone else knows a 
better way.

Hope that helps
Cheers
Shakes

jonathan grimm wrote:
> I'm trying to assign application wide keyboard shortcuts in my 
> application , but if a qvtkwidget has focus it seems to be consuming 
> all keyboard events regardless of whether it handles them.   Is there 
> any way to allow the  keypress and keyrelease events to continue to 
> propagate if vtk has not processed them?
>
> -- 
> Sometimes it's hard to tell the dancer from the dance - Corwin in CoC
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Shekhar_Chandra.vcf
Type: text/x-vcard
Size: 247 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080305/fe655e1f/attachment.vcf>


More information about the vtkusers mailing list