[vtkusers] Deleting a widget

John Drescher drescherjm at gmail.com
Mon Sep 20 16:44:12 EDT 2010


On Mon, Sep 20, 2010 at 4:33 PM, John Drescher <drescherjm at gmail.com> wrote:
>> 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);
> }
>

Oops. Missed the typedef for VTKObjPtr

Here goes:

typedef vtkSmartPointer<vtkObject>		VTKObjPtr;

-- 
John M. Drescher



More information about the vtkusers mailing list