D24171: [src/filewidgets/*] replace deprecated foreach with range for

David Faure noreply at phabricator.kde.org
Sat Sep 28 12:18:07 BST 2019


dfaure requested changes to this revision.
dfaure added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> kfilepreviewgenerator.cpp:733
>      // to use their default MIME type icon.
> -    foreach (const QUrl &url, m_cutItemsCache.keys()) {
> +    const QList<QUrl> list = m_cutItemsCache.keys();
> +    for (const QUrl &url : list) {

SLOW. This should actually use iterators.

> knewfilemenu.cpp:1223
> +        QList<QAction *> actions = d->m_newMenuGroup->actions();
> +        for (auto it = actions.begin(); it != actions.end(); ++it) {
> +            delete (*it);

qDeleteAll(actions);

> kurlnavigator.cpp:803
>  {
> -    foreach (KUrlNavigatorButton *button, m_navButtons) {
> +    for (auto it = m_navButtons.begin(); it != m_navButtons.end(); ++it) {
> +        KUrlNavigatorButton *button = *it;

Why not a range for here? It should be just fine.

REPOSITORY
  R241 KIO

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

To: ahmadsamir, kde-frameworks-devel, dfaure
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190928/cac7c4e5/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list