Did you try vtkQtTreeView::SetShowRootNode(true)  ? <div>Julien.<br><br><div class="gmail_quote">On Tue, Mar 15, 2011 at 6:28 PM, Nicolas Rannou <span dir="ltr">&lt;<a href="mailto:nicolas_rannou@hms.harvard.edu">nicolas_rannou@hms.harvard.edu</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 Jeff,<br>
    <br>
    another thing we noticed is that the root vertex is not shown in the
    vtkQtTreeView. Is there any reason for that or is it a bug?<br>
    <br>
    If &quot;A&quot; is the tree root vertex:<br>
    <br>
    vtkGraphLayoutView:<br>
    <br>
    A---&gt;B---&gt;C---&gt;D<br>
        |        |<br>
        |        -&gt;E<br>
        -&gt;F<br>
    <br>
    vtkQtTreeView:<br>
    <br>
    B---&gt;C---&gt;D<br>
        |<br>
        -&gt;E<br>
    F<br>
    <br>
    Thanks,<br><font color="#888888">
    <br>
    <br>
    Nicolas</font><div><div></div><div class="h5"><br>
    <br>
    On 03/14/2011 02:36 PM, Nicolas Rannou wrote:
    <blockquote type="cite">
      
      
      Thanks for the feedback Jeff,<br>
      <br>
      I added it in the bug tracker. (<a href="http://public.kitware.com/Bug/view.php?id=11969" target="_blank">http://public.kitware.com/Bug/view.php?id=11969</a>)<br>
      <br>
      I&#39;ll submit a patch for the vtkGraphLayoutView in the next days.<br>
      <br>
      Thanks,<br>
      <br>
      Nicolas<br>
      <br>
      On 03/14/2011 01:12 PM, Jeff Baumes wrote:
      <blockquote type="cite">Glancing at your message again, it appears you are
        also finding a bug in vtkQtTreeView where it interprets edge ids
        as vertex ids. If you could add that to the VTK bug tracker, I
        could hopefully take a look at it sometime soon. Getting rid of
        edge selections in the graph layout view as I suggested would
        work around this problem.
        <div> <br>
          <div class="gmail_quote">On Mon, Mar 14, 2011 at 1:07 PM, Jeff
            Baumes <span dir="ltr">&lt;<a href="mailto:jeff.baumes@kitware.com" target="_blank">jeff.baumes@kitware.com</a>&gt;</span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"> I do not know of a simple way to make
              this difference in selections go away. The
              vtkGraphLayoutView generates vertex + edge selections, and
              vtkQtTreeView generates vertex-only selections. I believe
              the best solution is to have vtkGraphLayoutView have an
              option to not select edges, as you suggested. If you are
              interested in adding that option, you can patch
              vtkGraphLayoutView.cxx to add some checks in
              ConvertSelection() based on a new boolean member variable
              and submit it to us for inclusion in VTK, or you could
              subclass vtkGraphLayoutView and reimplement
              ConvertSelection() if you want to just get it working for
              your own application.
              <div> <br>
              </div>
              <div>Jeff<br>
                <br>
                <div class="gmail_quote">
                  <div>
                    <div>On Fri, Mar 11, 2011 at 4:41 PM,
                      Nicolas Rannou <span dir="ltr">&lt;<a href="mailto:nicolas_rannou@hms.harvard.edu" target="_blank">nicolas_rannou@hms.harvard.edu</a>&gt;</span>
                      wrote:<br>
                    </div>
                  </div>
                  <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
                    <div>
                      <div>
                        <div text="#000000" bgcolor="#ffffff"> Hi all,<br>
                          <br>
                          I&#39;m trying to connect a <small>vtkQtTree</small>
                          and a <small>vtkGraphLayout</small> but the
                          selection is not working as expected.<br>
                          <br>
                          When I select something in the <small>vtkGraphLayout</small>,
                          the selection can contain vertices and edges.<br>
                          When I select something in the <small>vtkQtTree</small>,
                          the selection only contains vertices.<br>
                          <br>
                          If I select edges + vertices in the <small>vtkGraphLayout</small>,
                          i.e. vertices: 1 and 4, edge:3, it highlights
                          <u>vertices</u> 1,3,4 in the <small>vtkQtTree</small>...<br>
                          <br>
                          Then I have 3 questions/issues:<br>
                          (see pseudo-code at the end of the email)<br>
                          <br>
                          #1: should I modify the structure of my <small>vtkTree</small>
                          (<small>Add specific arrays for
                            vertices/edges?</small>) so the <small>vtkQtTree</small>
                          handles properly selection of edges+vertices?<br>
                          <br>
                          #2: can I get my <small>vtkQtTree</small> to
                          return the edges? Or should I find the edges
                          after it returns the vertices (is there an
                          efficient way to do it?)?<br>
                          <br>
                          #3: is there a straight forward way to disable
                          edges selection in the <small>vtkGraphLayoutView</small>?
                          <small>(Something like: EdgesNotSelectable()?)</small><br>
                          <br>
                          <br>
                          Thanks,<br>
                          <br>
                          <br>
                          Nicolas<br>
                          <br>
                          <br>
                          // What I do<br>
                          <br>
                          I first create a graph and add some arrays
                          associated to the <u>vertices</u>. <br>
                          <small> 
                            vtkSmartPointer&lt;vtkMutableDirectedGraph&gt;
                            graph =<br>
                               
                            vtkSmartPointer&lt;vtkMutableDirectedGraph&gt;::New();<br>
                              vtkIdType a = graph-&gt;AddVertex();<br>
                              vtkIdType b = graph-&gt;AddChild(a);<br>
                              vtkIdType c = graph-&gt;AddChild(a);<br>
                            <br>
                              vtkSmartPointer&lt;vtkStringArray&gt;
                            cellType =<br>
                                 
                            vtkSmartPointer&lt;vtkStringArray&gt;::New();<br>
                              cellType-&gt;SetName(&quot;name&quot;);<br>
                              cellType-&gt;InsertValue(a, &quot;TypeA&quot;);<br>
                              cellType-&gt;InsertValue(b, &quot;TypeB&quot;);<br>
                              cellType-&gt;InsertValue(c, &quot;TypeC&quot;);<br>
                            <br>
                             
                            graph-&gt;GetVertexData()-&gt;AddArray(cellType);<br>
                            ...<br>
                          </small><br>
                          I convert the graph to a <small>vtkTree</small>
                          and add this representation to the <small>vtkQtTree</small>
                          and to the <small>vtkGraphLayout</small>.<br>
                          <br>
                          I connect the views through <small>vtkAnnotations</small>
                          and <small>vtkEventQtSlotConnect</small>.<br>
                          <small>  this-&gt;m_annotationLink =
                            vtkSmartPointer&lt;vtkAnnotationLink&gt;::New();<br>
                             
this-&gt;m_treeGraphView-&gt;GetRepresentation()-&gt;SetAnnotationLink(this-&gt;m_annotationLink);<br>
                             
this-&gt;m_treeTableView-&gt;GetRepresentation()-&gt;SetAnnotationLink(this-&gt;m_annotationLink);</small><br>
                          <br>
                          <small>  this-&gt;m_connect =
                            vtkSmartPointer&lt;vtkEventQtSlotConnect&gt;::New();<br>
                             
this-&gt;m_connect-&gt;Connect(this-&gt;m_treeTableView-&gt;GetRepresentation(),<br>
                                vtkCommand::SelectionChangedEvent,<br>
                                this, SLOT(selectionChanged(vtkObject*,
                            unsigned long, void*, void*)));<br>
                             
this-&gt;m_connect-&gt;Connect(this-&gt;m_treeGraphView-&gt;GetRepresentation(),<br>
                                vtkCommand::SelectionChangedEvent,<br>
                                this, SLOT(selectionChanged(vtkObject*,
                            unsigned long, void*, void*)));</small><br>
                          <br>
                          <small>selectionChanged() only call update on
                            the 2 views</small><br>
                        </div>
                        <br>
                      </div>
                    </div>
                    _______________________________________________<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">
                <br>
                -- <br>
                Jeff Baumes, Ph.D.<br>
                Technical Lead, Kitware Inc.<br>
                (518) 881-4932<br>
              </div>
            </blockquote>
          </div>
          <br>
          <br clear="all">
          <br>
          -- <br>
          Jeff Baumes, Ph.D.<br>
          Technical Lead, Kitware Inc.<br>
          (518) 881-4932<br>
        </div>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </div></div></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>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br></blockquote></div><br></div>