[Okular-devel] Review Request: Unfolded toc remains unfolded on reload unless the file is changed

Albert Astals Cid tsdgeos at terra.es
Sun Dec 30 20:53:49 UTC 2012



> On Dec. 28, 2012, 11:56 p.m., Albert Astals Cid wrote:
> > Why did you add an "id"? What is that "id" supposed to mean?
> 
> Jaydeep Solanki wrote:
>     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.
> 
> Albert Astals Cid wrote:
>     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.
> 
> Jaydeep Solanki wrote:
>     there's one problem in using QMOdelIndex, when returning QModelindex from the model (tocmodel::data(..)), it returns a QVariant object, & when we want to compare the QModelIndexes, we cannot cast QVariant to QModelIndex.
>     & even if we succeed in that, the comparision with the QModelIndex of the cloned model & the actual model will result false always, because AFAIK QModelIndex contains the address of the memory location too.
>

It's not data() what you need to return but index() if you want a QModelIndex


- Albert


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107994/#review24157
-----------------------------------------------------------


On Dec. 30, 2012, 4:32 p.m., Jaydeep Solanki wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/107994/
> -----------------------------------------------------------
> 
> (Updated Dec. 30, 2012, 4:32 p.m.)
> 
> 
> Review request for Okular.
> 
> 
> Description
> -------
> 
> 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)
> 
> 
> This addresses bug 312138.
>     http://bugs.kde.org/show_bug.cgi?id=312138
> 
> 
> Diffs
> -----
> 
>   part.h 0c57560 
>   part.cpp 1922128 
>   ui/toc.h eeeff98 
>   ui/toc.cpp 4c84b62 
>   ui/tocmodel.h a857dc0 
>   ui/tocmodel.cpp 39add80 
> 
> Diff: http://git.reviewboard.kde.org/r/107994/diff/
> 
> 
> Testing
> -------
> 
> Checked. Works fine with me.
> 
> 
> Thanks,
> 
> Jaydeep Solanki
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20121230/0742c97e/attachment.html>


More information about the Okular-devel mailing list