[vtkusers] Detect which QVTKWidget I am interacting with

Alex Malyushytskyy alexmalvtk at gmail.com
Tue Jul 23 20:10:29 EDT 2013


You may solve it in  using Qt ways.

QVTKWidget is derived from QWidget.
Active widget will have a focus.

So you either may iterate over your QVTKWidget to check which one has a
focus or override QWidget::focusInEvent / install event hsandler  to find
out whyen focus changed.

Regards,
   Alex






On Tue, Jul 23, 2013 at 8:38 AM, Girault, Alexis <girault at email.unc.edu>wrote:

> Hey all, let me rephrase my question, I guess it was way too long,
>
> I want to detect which QVTKWidget I am interacting with, for example when
> i just click on it.
>
> I create multiple QVTKWidgets this way, and I add them in a layout to
> display (scrollAreaWidgetContents), and a list to access (widgetList) :
>       QVTKWidget *meshWidget = new
>       QVTKWidget(this->scrollAreaWidgetContents);
>       this->widgetList->append(meshWidget);
>
> I usually access them this way (to render everything for example or
> connect to a unique camera) :
>       for (int i = 0; i < this->widgetList->size(); i++)
>       {
>
> this->widgetList->value(i)->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->SetActiveCamera(headcam);
>                                       //connect to headcam for synchro
>
> this->widgetList->value(i)->GetRenderWindow()->AddObserver(vtkCommand::RenderEvent,
> this, &ShapePopulationViewer::ModifiedHandler);  //syncronize when rendering
>       }
>
> Therefore when i click on one of them, I'd like to get the "i value"
> inside the widgetList, or simply a pointer on the QVTKWidget I selected.
>
> I tried with "vtkObject::AddObserver", and "qobjet::connect" but I could
> not find a solution.
>
> Thanks for your time,
>
> Regards,
> Alexis
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130723/31a2cc68/attachment.htm>


More information about the vtkusers mailing list