D19913: [plasma-desktop] make it compiles without foreach

Kai Uwe Broulik noreply at phabricator.kde.org
Tue Apr 9 07:41:54 BST 2019


broulik added inline comments.

INLINE COMMENTS

> coronatest.cpp:150
> +    const auto containments = m_corona->containments();
> +    for (auto cont : containments) {
>          switch (cont->id()) {

Please always annotate `auto` with e.g. asterisk or ampersand depending on type

> coronatest.cpp:216
>  
> -    foreach (Plasma::Containment *cont, m_corona->containments()) {
> +    auto containments = m_corona->containments();
> +    for (Plasma::Containment *cont : qAsConst(containments)) {

why not make the container `const`?

> daysmodel.cpp:171
>  
> -    Q_FOREACH (const QDate date, updatesList) {
> +    for (const QDate date : qAsConst(updatesList)) {
>          const QModelIndex changedIndex = indexForDate(date);

While at it `const QDate &`

> apol wrote in datamodel.cpp:309
> same?
> Also this should clearly be using iterators, no?

Yes, please change it to iterators

REPOSITORY
  R242 Plasma Framework (Library)

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

To: mlaurent, dfaure
Cc: broulik, apol, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190409/7e7ecfbf/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list