[vtkusers] Get active renderwindow

Benjamin Sobotta mayday at gmx.net
Thu Jan 21 04:17:49 EST 2010


On Wednesday 20 January 2010 04:02:30 pm KS Jothybasu wrote:
> Here is it:
>
> self.win1=QVTKWidget()
> self.win2=QVTKWidget()
> self.win3=QVTKWidget3()
> self.win4=QVTKWidget()
>
> Tiled in a mainwindow
>
> Now when I want to measure distance using distance widget, how to pass the
> active renderwindowInteractor  to the distacne widget.
>
> if we know the active render window, we can use renwin.getInteractor() and
> pass it to it.
>
> Otherwise, I have to create separate functions to each and every window I
> would like to measure.
>
> I am trying from PyQt side, is there any method to get active widget..there
> should be isn't it??
>
> Thanks
>
> Jothy
>
> On Wed, Jan 20, 2010 at 2:53 PM, David Doria
> <daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
>
> > wrote:
> >
> > On Wed, Jan 20, 2010 at 9:28 AM, KS Jothybasu <jothybasu at gmail.com> wrote:
> >> Hi all,
> >>
> >> How to get the active render window?
> >>
> >> Any hint?
> >>
> >> Thanks
> >>
> >> Jothy
> >
> > Can you give an example of code where you wouldn't know which window was
> > active?
> >
> > Thanks,
> >
> > David

Hi!

One possibility is to keep track of vtkCommand::EnterEvent and 
vtkCommand::LeaveEvent. This way you always know in which VTK window the mouse 
is currently in. I have done this in past for a similar task.

What may also work is using QWidget::isActiveWindow. However, I'm not sure 
about that.

Cheers,

Ben



More information about the vtkusers mailing list