[vtkusers] Grabbing focus from custom interactor style in Python

Elvis Stansvik elvis.stansvik at orexplore.com
Mon Jun 20 07:32:41 EDT 2016


2016-06-17 14:27 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:

> Hi,
>
> Looking at how e.g. vtkInteractorStyleTrackballCamera, one of the built-in
> interactor styles, handles left mouse button presses, it does
>
>     this->GrabFocus(this->EventCallbackCommand);
>
> in order to grab focus for the duration of the interaction. That is, it
> calls vtkInteractorObserver::GrabFocus, passing in
> vtkInteractorObserver::EventCallbackCommand, which is a protected variable.
>
> I'm basing my custom interactor style on vtkInteractorStyleUser, and I
> would like to do the same (grab focus during an interaction), but I'm
> working from Python and can't access the
> vtkInteractorObserver::EventCallbackCommand variable in my
> vtkInteractorStyleUser subclass.
>
> Any ideas on how to do this is much appreciated!
>

This is less of an issue since it seems somehow Qt magically takes care of
this for me, e.g. if I begin a click-drag operation inside the widget, my
interactor style keeps getting mouse move events even if I drag outside the
window. So I'm happy for now.

It would still have been nice if there were protected getters for some of
the protected variables in vtkInteractorObserver such as
EventCallbackCommand, to make them accessible from Python subclasses.

Elvis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160620/f516498c/attachment.html>


More information about the vtkusers mailing list