Review Request 110236: Remove pointless call to model index parent to count top level items
Martin Klapetek
martin.klapetek at gmail.com
Mon Apr 29 12:06:41 UTC 2013
> On April 29, 2013, 6:57 a.m., Daniele E. Domenichelli wrote:
> > global-presence-chooser.cpp, line 95
> > <http://git.reviewboard.kde.org/r/110236/diff/1/?file=141318#file141318line95>
> >
> > Isn't QModelIndex() and invalid index?
>
> David Edmundson wrote:
> Yes. And the parent of a top level item is an invalid index.
>
> If we look at rowCount we do:
> if (parent.isValid) {return 0;}
>
> we want to pass an invalid index to get the list row count.
>
> Daniele E. Domenichelli wrote:
> I still don't get this, sorry...
> If "rowCount(QModelIndex())" returns 0, "rowCount(QModelIndex())-1" is always "-1", or am I missing something?
>
I don't think the rowCount part from David is correct. If you pass invalid index to rowCount(), it counts the top-level items, which in this case they are all top-level, so it does not return 0, but the correct list size.
- Martin
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/110236/#review31725
-----------------------------------------------------------
On April 29, 2013, 11:58 a.m., David Edmundson wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/110236/
> -----------------------------------------------------------
>
> (Updated April 29, 2013, 11:58 a.m.)
>
>
> Review request for Telepathy.
>
>
> Description
> -------
>
> Remove pointless call to model index parent to count top level items
>
> BUG: 304085
>
>
> Diffs
> -----
>
> global-presence-chooser.cpp f5d59399a904195121ebac7266bef4176ac82bfb
>
> Diff: http://git.reviewboard.kde.org/r/110236/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> David Edmundson
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-telepathy/attachments/20130429/b8c9bd3e/attachment.html>
More information about the KDE-Telepathy
mailing list