[vtkusers] Deleting a widget

John Drescher drescherjm at gmail.com
Mon Sep 20 16:33:46 EDT 2010


> 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?.
>

Here is what I did last week..

class MyClass
{
...
public:
typedef QList<VTKObjPtr>	VTKObjPtrList;
protected:
VTKObjPtrList			m_lstVTKObjects;

..
}

Then just create the object like this:

MyClass:SomeMember()
{
  vtkSmartPointer<vtkImageEllipsoidSource> pImageSource =
vtkSmartPointer<vtkImageEllipsoidSource>::New();
  m_lstVTKObjects.append(pImageSource);
}



More information about the vtkusers mailing list