fix compilation for Qt > 5.14: QSet::fromList(QList) deprecated
Description
Description
Details
Details
- Committed
jjazeix Apr 18 2020, 9:17 AM - Parents
- R125:587cefd09a77: GIT_SILENT Update Appstream for new release
- Branches
- Unknown
- Tags
Comment Actions
Hi. For the new code variant you might want to follow the idea hehind the change of the QSet API, and avoids the intermediate QList<QString> creation (here and in similar changes):
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) return QSet<QString>::fromList( mRanges.uniqueKeys() ); #else return QSet<QString>( mRanges.keyBegin(), mRanges.keyEnd() ); #endif
More performant (no mallocs for the intermediate list), and less code to write & read :) The iterators over the keys are const methods, so no detaching is done.