<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/107994/">http://git.reviewboard.kde.org/r/107994/</a>
     </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On December 28th, 2012, 11:56 p.m., <b>Albert Astals Cid</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Why did you add an "id"? What is that "id" supposed to mean?</pre>
 </blockquote>




 <p>On December 29th, 2012, 12:32 a.m., <b>Jaydeep Solanki</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">because when the display name of two nodes are same, okular won't know which one to expand & will end up expanding the wrong one at times. So id gives a unique identity to each node, to avoid ambiguity. </pre>
 </blockquote>








</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Right, i see the problem.

Could you try storing QModelIndexes instead of the "id" you just have created? QModelIndex should work fine since it already has the parent structure, etc, so it should be "doable".

The "problem" i see with the current "id" thing is that are adding more memory usage for something that doesn't seem to be necessary.

Also you need to delete/clear m_oldTocModel and m_expandedList after the reload is done, otherwise we are leaking memory (in the first case) or using more memory than needed (in the second case)

There's also a few minor "style" issue i'll comment in a moment.</pre>
<br />








<p>- Albert</p>


<br />
<p>On December 28th, 2012, 11:15 p.m., Jaydeep Solanki wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Okular.</div>
<div>By Jaydeep Solanki.</div>


<p style="color: grey;"><i>Updated Dec. 28, 2012, 11:15 p.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This fix will preserve the state of the Table Of Content (toc) on document reload, but if the toc is edited/changed, then it will be restored to default (i.e. all nodes will be folded)</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Checked. Works fine with me.</pre>
  </td>
 </tr>
</table>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="http://bugs.kde.org/show_bug.cgi?id=312138">312138</a>


</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>part.h <span style="color: grey">(0c57560)</span></li>

 <li>part.cpp <span style="color: grey">(1922128)</span></li>

 <li>ui/toc.h <span style="color: grey">(eeeff98)</span></li>

 <li>ui/toc.cpp <span style="color: grey">(4c84b62)</span></li>

 <li>ui/tocmodel.h <span style="color: grey">(a857dc0)</span></li>

 <li>ui/tocmodel.cpp <span style="color: grey">(39add80)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/107994/diff/" style="margin-left: 3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>