Fix usage of deprecated QSet/QList methods
ClosedPublic

Authored by alexeymin on Dec 17 2019, 4:10 PM.

Details

Summary

Compiiling with Qt 5.14 produces the following warnings:

.../libdiscover/resources/StandardBackendUpdater.cpp:70:43: warning:

‘QList<T> QSet<T>::toList() const [with T = AbstractResource*]’ is deprecated:
Use values() instead. [-Wdeprecated-declarations]

.../libdiscover/resources/StandardBackendUpdater.cpp:220:48: warning:

‘QSet<T> QList<T>::toSet() const [with T = AbstractResource*]’ is deprecated:
Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
Test Plan

Clean build with Qt 5.14 with no warnings. Still builds with Qt 5.12

Diff Detail

Repository
R134 Discover Software Store
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
alexeymin created this revision.Dec 17 2019, 4:10 PM
Restricted Application added a project: Plasma. · View Herald TranscriptDec 17 2019, 4:10 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
alexeymin requested review of this revision.Dec 17 2019, 4:10 PM
apol added a subscriber: apol.Dec 17 2019, 6:21 PM

Will all of this build on Qt 5.12?

alexeymin added a comment.EditedDec 17 2019, 7:21 PM

No :( just checked, Qt 5.12's https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/tools/qset.h?h=v5.12.0 is missing inline QSet(InputIterator first, InputIterator last), which appeared only in 5.14.

../libdiscover/resources/StandardBackendUpdater.cpp:227:75: error: no matching function for call to ‘QSet<AbstractResource*>::QSet(QList<AbstractResource*>::const_iterator, QList<AbstractResource*>::const_iterator)’

I guess I need an #ifdef for QSet construction then.

alexeymin updated this revision to Diff 71748.Dec 17 2019, 7:57 PM

Add QT_VERSION_CHECK checks

alexeymin edited the summary of this revision. (Show Details)Dec 17 2019, 7:59 PM
alexeymin edited the test plan for this revision. (Show Details)
alexeymin updated this revision to Diff 71749.Dec 17 2019, 8:01 PM

I feel sad doing such things

Should be fine now?

ngraham accepted this revision.Dec 21 2019, 6:19 PM
This revision is now accepted and ready to land.Dec 21 2019, 6:19 PM
This revision was automatically updated to reflect the committed changes.