<div dir="ltr">Hi Miro,<div><br></div><div>Most of your questions about vtkSmartPointer are answered in this tutorial:</div><div><a href="http://www.vtk.org/Wiki/VTK/Tutorials/SmartPointers">http://www.vtk.org/Wiki/VTK/Tutorials/SmartPointers</a><br>
</div><div><br></div><div>I&#39;ll let someone else handle the Qt signal/slots questions since I haven&#39;t tried to do that.  But I would point out that VTK is not thread-safe, so if you are trying to use this mechanism to communicate between threads make sure you know what you are getting into first.</div>
<div><br></div><div>HTH,</div><div>Shawn</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 14, 2013 at 12:45 PM, Miro Drahos <span dir="ltr">&lt;<a href="mailto:mdrahos@robodoc.com" target="_blank">mdrahos@robodoc.com</a>&gt;</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>
    I am having really hard times passing on reference to the objects
    that are stored as vtkSmartPointer&lt;T&gt; 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&lt;vtkPolyData&gt; surface;</tt><tt><br>
    </tt><tt>};</tt><tt><br>
    </tt><br>
    What is the best way to pass &#39;surface&#39; via signal/slot mechanism of
    Qt? <br>
    I thought I&#39;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&#39;s public methods return const something. <br>
    <br>
    What would be the preferred way to pass objects stored as
    vtkSmartPointer&lt;T&gt; object?<br>
    1.) T* MyClass::getT() const { return object.GetPointer(); }<br>
    2.) vtkSmartPointer&lt;T&gt; 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 &amp;);  <br>
    B.) signal doneSurfaceProcessing(vtkPolyData *);<br>
    C.) signal
    doneSurfaceProcessing(vtkSmartPointer&lt;vtkPolyData&gt;);<br>
    <br>
    The idea is to send off the signal with something like<br>
    emit doneSurfaceProcessing(myclass-&gt;getSurface());<br>
    <br>
    then the slot would be<br>
    setSurface(???)  //vtkSmartPointer&lt;T&gt;  or T* or T&amp; ?<br>
    <br>
    Thank you!!<span class="HOEnZb"><font color="#888888"><br>
    Miro
    <div style="font-size:75%"><br>
    </div>
    <div>
    </div>
  </font></span></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><br clear="all"><div><br></div>-- <br><div dir="ltr">Shawn Waldon<div>Graduate Research Assistant</div><div>Department of Computer Science</div><div>University of North Carolina at Chapel Hill</div>
<div><a href="mailto:swaldon@cs.unc.edu" target="_blank">swaldon@cs.unc.edu</a></div></div>
</div>