<div dir="ltr"><div><div><div>Hi Miro,</div><br>> What would be the preferred way to pass objects stored as
vtkSmartPointer<T> object?<br></div>Here is one way to do it:<br><br>class myclass{<br></div><div><br> myclass() { this->var = vtkSmartPointer<vtkClass>::New(); };<br><br></div><div> vtkSmartPointer<vtkClass> GetvtkClass(){ return this->var; }; <br>
<br></div><div> // THIS IS ALSO VALID:<br></div><div> // vtkClass* GetvtkClass(){ return this->var; }; <br></div><div><br></div><div></div> vtkSmartPointer<vtkClass> var;<br><div>};<br><br><br>> I want to pass the object via signal/slot mechanism. What would be
the best way?<br></div><div>look at vtk documentation for class vtkEventQtSlotConnect<br><br></div><div>Dean <br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 14, 2013 at 3:57 AM, Miro Drahos <span dir="ltr"><<a href="mailto:miroslav.drahos@ucsf.edu" target="_blank">miroslav.drahos@ucsf.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
Hi all,<br>
<div> I am having really hard times
passing on reference to the objects that are stored as
vtkSmartPointer<T> as private data within a class. E.g.:<br>
<tt>class MyClass </tt><tt><br>
</tt><tt>{</tt><tt><br>
</tt><tt> public:</tt><tt><br>
</tt><tt> ...</tt><tt><br>
</tt><tt> private:</tt><tt><br>
</tt><tt> vtkSmartPointer<vtkPolyData> surface;</tt><tt><br>
</tt><tt>};</tt><tt><br>
</tt><br>
What is the best way to pass 'surface' via signal/slot mechanism
of Qt? <br>
I thought I'd create a public method<br>
<tt>vtkPolyData * MyClass::getSurface() { return
surface.GetPointer(); }</tt><br>
The problem is that GetPointer() returns <b>const</b> T* which
the compiler complains about when I later want to use it. As a
matter of fact, all vtkSmartPointer's public methods return const
something. <br>
<br>
What would be the preferred way to pass objects stored as
vtkSmartPointer<T> object?<br>
1.) T* MyClass::getT() const { return object.GetPointer(); }<br>
2.) vtkSmartPointer<T> MyClass::getT() { return object; }<br>
3.) something else?<br>
<br>
I want to pass the object via signal/slot mechanism. What would be
the best way?<br>
A.) signal doneSurfaceProcessing(vtkPolyData &); <br>
B.) signal doneSurfaceProcessing(vtkPolyData *);<br>
C.) signal
doneSurfaceProcessing(vtkSmartPointer<vtkPolyData>);<br>
<br>
Thank you!!<span class="HOEnZb"><font color="#888888"><br>
Miro<br>
<br>
</font></span></div>
<br>
</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>