Commit 34d68d4e authored by Alexey Min's avatar Alexey Min
Browse files

Fix usage of deprecated QSet/QList methods

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

Reviewers: apol, ngraham

Reviewed By: ngraham

Subscribers: apol, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26069
parent 3dd3cb9d
......@@ -67,7 +67,7 @@ void StandardBackendUpdater::start()
m_settingUp = true;
emit progressingChanged(true);
setProgress(0);
auto upgradeList = m_toUpgrade.toList();
auto upgradeList = m_toUpgrade.values();
std::sort(upgradeList.begin(), upgradeList.end(), [](const AbstractResource* a, const AbstractResource* b){ return a->name() < b->name(); });
const bool couldCancel = m_canCancel;
......@@ -217,15 +217,25 @@ int StandardBackendUpdater::updatesCount() const
void StandardBackendUpdater::addResources(const QList< AbstractResource* >& apps)
{
Q_ASSERT(m_upgradeable.contains(apps.toSet()));
m_toUpgrade += apps.toSet();
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QSet<AbstractResource *> upgradeableApps(apps.begin(), apps.end());
#else
const QSet<AbstractResource *> upgradeableApps = apps.toSet();
#endif
Q_ASSERT(m_upgradeable.contains(upgradeableApps));
m_toUpgrade += upgradeableApps;
}
void StandardBackendUpdater::removeResources(const QList< AbstractResource* >& apps)
{
Q_ASSERT(m_upgradeable.contains(apps.toSet()));
Q_ASSERT(m_toUpgrade.contains(apps.toSet()));
m_toUpgrade -= apps.toSet();
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
const QSet<AbstractResource *> upgradeableApps(apps.begin(), apps.end());
#else
const QSet<AbstractResource *> upgradeableApps = apps.toSet();
#endif
Q_ASSERT(m_upgradeable.contains(upgradeableApps));
Q_ASSERT(m_toUpgrade.contains(upgradeableApps));
m_toUpgrade -= upgradeableApps;
}
void StandardBackendUpdater::cleanup()
......@@ -239,7 +249,7 @@ void StandardBackendUpdater::cleanup()
QList<AbstractResource*> StandardBackendUpdater::toUpdate() const
{
return m_toUpgrade.toList();
return m_toUpgrade.values();
}
bool StandardBackendUpdater::isMarked(AbstractResource* res) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment