D19967: [kpeople] make it compile without foreach
David Faure
noreply at phabricator.kde.org
Sun Mar 24 15:24:33 GMT 2019
dfaure requested changes to this revision.
dfaure added inline comments.
This revision now requires changes to proceed.
INLINE COMMENTS
> matchessolver.cpp:62
> //because they are the same
> - QList<QString> keys = destinationResolver.keys(urlB);
> - foreach (const QString &key, keys) {
> - destinationResolver[key] = urlA;
> + const auto lst = destinationResolver.keys(urlB);
> + auto it = lst.constBegin();
`lst` used to be called `keys`, there's no particular reason to rename it.
> metacontact.cpp:51
> QVariantList ret;
> - Q_FOREACH (const AbstractContact::Ptr &contact, m_contacts) {
> + for (const AbstractContact::Ptr &contact : qAsConst(m_contacts)) {
> QVariant val = contact->customProperty(key);
(the qAsConst isn't technically needed since this method is const; but it doesn't hurt either)
> mergecontactswidget.cpp:185
> // retrieve all the widget where the box is checked
> - QPair<QPersistentModelIndex, PersonPresentationWidget *> mergeContact ;
> - Q_FOREACH (mergeContact, m_listMergeContacts) {
> + for (QPair<QPersistentModelIndex, PersonPresentationWidget *> mergeContact : qAsConst(m_listMergeContacts)) {
> if (mergeContact.second->isContactSelected()) {
const & would be even better.
(It'll get lengthy, so this might be a reason to switch for const auto & here, although some might object that the type isn't visible in the code here)
REPOSITORY
R307 KPeople
REVISION DETAIL
https://phabricator.kde.org/D19967
To: mlaurent, dfaure
Cc: apol, pino, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190324/4b26e26d/attachment.html>
More information about the Kde-frameworks-devel
mailing list