From 3d61c8adba6bab9f2d076a4338bf36c0407dbeb9 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 9 Mar 2020 16:24:04 +0100 Subject: Sort output list alphabetically when assigning resolutions --- src/xx.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/xx.cpp b/src/xx.cpp index b8b1eab..d3cd1ee 100644 --- a/src/xx.cpp +++ b/src/xx.cpp @@ -339,12 +339,18 @@ ConfigBackup ScreenSetup::setResolutionsFromString(const QString &resolutions, c } } auto outputListStr = mapping.split(QRegularExpression(QLatin1String("\\s+")), QString::SkipEmptyParts); + qDebug() << mapping << ">" << outputListStr; if (outputListStr.isEmpty()) { - int i = 0; + QList sorted; for (auto *o : a->_outputMap) { + sorted.append(o->outputName); + } + qSort(sorted); + int i = 0; + for (auto o : sorted) { int index = i % config.size(); auto x = config.at(index).second; - x.append(o->outputName); + x.append(o); config.replace(index, qMakePair(config.at(index).first, x)); qDebug() << "Resolution" << config.at(index).first << "is now" << config.at(index).second; ++i; -- cgit v1.2.3-55-g7522