D19539: Replace some iterator loops by range-based for

Albert Astals Cid noreply at phabricator.kde.org
Thu Mar 14 23:05:24 GMT 2019


aacid added a comment.


  Sorry it did take a while to asnwer, since you're not using arc i can't use phabricator to navigate the code and have to find time to sit don't and check whether some of those variables were const or not because their declaration was outside the lines of the diff
  
  Ok, now that i did that, a few of the don't need qAsConst, adding it doesn't make it worse, but it's a bit weird so i'd prefer if you removed it.

INLINE COMMENTS

> pageview.cpp:1090
>      // create children widgets
> -    QVector< Okular::Page * >::const_iterator setIt = pageSet.constBegin(), setEnd = pageSet.constEnd();
> -    for ( ; setIt != setEnd; ++setIt )
> +    for ( const Okular::Page * page : qAsConst( pageSet ) )
>      {

you don't need qAsConst, pageSet is already const as defined in the function signature.

> pageview.cpp:1098
> +        const QLinkedList< Okular::FormField * > pageFields = page->formFields();
> +        for ( Okular::FormField * ff : qAsConst( pageFields ) )
>          {

You don't need qAsConst here, pageFields is already const as defined in the line above.

> presentationwidget.cpp:332
>      float screenRatio = (float)m_height / (float)m_width;
> -    for ( ; setIt != setEnd; ++setIt )
> +    for ( const Okular::Page * page : qAsConst( pageSet ) )
>      {

pageset is const, please remove qAsConst.

> presentationwidget.cpp:337
> +        const QLinkedList< Okular::Annotation * > annotations = page->annotations();
> +        for ( Okular::Annotation * a : qAsConst( annotations ) )
>          {

annotations is const, please remove qasconst

REPOSITORY
  R223 Okular

REVISION DETAIL
  https://phabricator.kde.org/D19539

To: sander, #okular
Cc: aacid, davidhurka, okular-devel, tfella, ngraham, darcyshen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20190314/e8ecedf1/attachment-0001.html>


More information about the Okular-devel mailing list