[Containment Interface] No need for values() as contains() looks up keys
ClosedPublic

Authored by broulik on Jan 30 2017, 1:17 PM.

Details

Summary

Avoids creating a temporary list for no reason.
Also use value() which is always const compared to operator[]

Test Plan

Dropped a file, still got an icon widget

Diff Detail

Repository
R242 Plasma Framework (Library)
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik updated this revision to Diff 10716.Jan 30 2017, 1:17 PM
broulik retitled this revision from to [Containment Interface] No need for values() as contains() looks up keys.
broulik updated this object.
broulik edited the test plan for this revision. (Show Details)
broulik added a reviewer: Plasma.
broulik set the repository for this revision to R242 Plasma Framework (Library).
Restricted Application added projects: Plasma, Frameworks. · View Herald TranscriptJan 30 2017, 1:17 PM
Restricted Application added subscribers: Frameworks, plasma-devel. · View Herald Transcript
davidedmundson accepted this revision.Jan 30 2017, 1:17 PM
davidedmundson added a reviewer: davidedmundson.
This revision is now accepted and ready to land.Jan 30 2017, 1:17 PM
This revision was automatically updated to reflect the committed changes.
apol added a subscriber: apol.Jan 30 2017, 2:22 PM
apol added inline comments.
src/scriptengines/qml/plasmoid/containmentinterface.cpp
565

Here you're still doing 1 look-up too many.

QPoint posi = m_dropPoints.value(tjob); will possibly do the same, then you can if (posi.isNull()).

Otherwise you can constFind and it!=constEnd