Port away from deprecated qSort function

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22354
This commit is contained in:
Vlad Zagorodniy 2019-07-10 00:00:07 +03:00
parent c7639fd7ed
commit 927f579df9
5 changed files with 7 additions and 7 deletions

View file

@ -176,7 +176,7 @@ void TestBuiltInEffectLoader::testKnownEffects()
KWin::BuiltInEffectLoader loader; KWin::BuiltInEffectLoader loader;
QStringList result = loader.listOfKnownEffects(); QStringList result = loader.listOfKnownEffects();
QCOMPARE(result.size(), expectedEffects.size()); QCOMPARE(result.size(), expectedEffects.size());
qSort(result); std::sort(result.begin(), result.end());
for (int i = 0; i < expectedEffects.size(); ++i) { for (int i = 0; i < expectedEffects.size(); ++i) {
QCOMPARE(result.at(i), expectedEffects.at(i)); QCOMPARE(result.at(i), expectedEffects.at(i));
} }
@ -557,7 +557,7 @@ void TestBuiltInEffectLoader::testLoadAllEffects()
QCOMPARE(list.size(), 2); QCOMPARE(list.size(), 2);
loadedEffects << list.at(1).toString(); loadedEffects << list.at(1).toString();
} }
qSort(loadedEffects); std::sort(loadedEffects.begin(), loadedEffects.end());
QCOMPARE(loadedEffects.at(0), QStringLiteral("kscreen")); QCOMPARE(loadedEffects.at(0), QStringLiteral("kscreen"));
QCOMPARE(loadedEffects.at(1), QStringLiteral("mouseclick")); QCOMPARE(loadedEffects.at(1), QStringLiteral("mouseclick"));
} }

View file

@ -437,7 +437,7 @@ void TestScriptedEffectLoader::testLoadAllEffects()
QCOMPARE(list.size(), 2); QCOMPARE(list.size(), 2);
loadedEffects << list.at(1).toString(); loadedEffects << list.at(1).toString();
} }
qSort(loadedEffects); std::sort(loadedEffects.begin(), loadedEffects.end());
QCOMPARE(loadedEffects.at(0), kwin4 + QStringLiteral("eyeonscreen")); QCOMPARE(loadedEffects.at(0), kwin4 + QStringLiteral("eyeonscreen"));
QCOMPARE(loadedEffects.at(1), kwin4 + QStringLiteral("fade")); QCOMPARE(loadedEffects.at(1), kwin4 + QStringLiteral("fade"));
} }

View file

@ -1133,7 +1133,7 @@ void PresentWindowsEffect::calculateWindowTransformationsKompose(EffectWindowLis
QRect availRect = effects->clientArea(ScreenArea, screen, effects->currentDesktop()); QRect availRect = effects->clientArea(ScreenArea, screen, effects->currentDesktop());
if (m_showPanel) // reserve space for the panel if (m_showPanel) // reserve space for the panel
availRect = effects->clientArea(MaximizeArea, screen, effects->currentDesktop()); availRect = effects->clientArea(MaximizeArea, screen, effects->currentDesktop());
qSort(windowlist); // The location of the windows should not depend on the stacking order std::sort(windowlist.begin(), windowlist.end()); // The location of the windows should not depend on the stacking order
// Following code is taken from Kompose 0.5.4, src/komposelayout.cpp // Following code is taken from Kompose 0.5.4, src/komposelayout.cpp
@ -1280,7 +1280,7 @@ void PresentWindowsEffect::calculateWindowTransformationsNatural(EffectWindowLis
// As we are using pseudo-random movement (See "slot") we need to make sure the list // As we are using pseudo-random movement (See "slot") we need to make sure the list
// is always sorted the same way no matter which window is currently active. // is always sorted the same way no matter which window is currently active.
qSort(windowlist); std::sort(windowlist.begin(), windowlist.end());
QRect area = effects->clientArea(ScreenArea, screen, effects->currentDesktop()); QRect area = effects->clientArea(ScreenArea, screen, effects->currentDesktop());
if (m_showPanel) // reserve space for the panel if (m_showPanel) // reserve space for the panel

View file

@ -397,7 +397,7 @@ void EffectsModel::load(LoadOptions options)
loadJavascriptEffects(kwinConfig); loadJavascriptEffects(kwinConfig);
loadPluginEffects(kwinConfig, configs); loadPluginEffects(kwinConfig, configs);
qSort(m_pendingEffects.begin(), m_pendingEffects.end(), std::sort(m_pendingEffects.begin(), m_pendingEffects.end(),
[](const EffectData &a, const EffectData &b) { [](const EffectData &a, const EffectData &b) {
if (a.category == b.category) { if (a.category == b.category) {
if (a.exclusiveGroup == b.exclusiveGroup) { if (a.exclusiveGroup == b.exclusiveGroup) {

View file

@ -389,7 +389,7 @@ void CompositingType::generateCompositing()
it++; it++;
} }
qSort(m_compositingList.begin(), m_compositingList.end(), [](const CompositingData &a, const CompositingData &b) { std::sort(m_compositingList.begin(), m_compositingList.end(), [](const CompositingData &a, const CompositingData &b) {
return a.type < b.type; return a.type < b.type;
}); });
endResetModel(); endResetModel();