[vtkusers] Deleting a widget

Leonardo M. Ramé l.rame at griensu.com
Mon Sep 20 16:26:45 EDT 2010


On 2010-09-20 16:16:41 -0400, David Doria wrote:
> On Mon, Sep 20, 2010 at 4:07 PM, Leonardo M. Ramé <l.rame at griensu.com> wrote:
> > To set an interactor observer for a vtkWidget, one have to do this:
> >
> > myWidget->SetInteractor(myInteractor);
> >
> > Now, how can I get the list of widgets associated to this interactor?.
> >
> > I need this, because I want to select a widget (for example a
> > vtkDistanceWidget) using the mouse, then traverse the list of widgets
> > associated with an interactor, and ask if the nth element of the widget
> > list is the one currently selected, then just delete it.
> >
> > If you know an easier way, please let me know.
> 
> You can always subclass the interactor and add member variables where
> you store the widget pointers so you can access them from the
> interactor functions.
> 
> David

Yes, of course, I asked here because I thought it should be an
out-of-the-box way to do this.

BTW, I'm subclassing a QVTKWidget, where I have methods like this:

void  MYWidget::addMeasure()
{
  mynewwidget = vtkDistanceWidget::New();
}

I think its easier to add a collection class member for my widget to
store the list of widgets. The question is, is there a predefined
collection class for storing widgets?.

-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com



More information about the vtkusers mailing list