Deal with recent Qt methods deprecation (#3801)

* Deal with recent Qt methods deprecation

 * Use std::sort, std::less instead of qSort/qLess
 * Use QFontMetrics::horizontalAdvance instead of ::width
 * Use qApp->primaryScreen() instead of QDesktopWidget
 * use lambas instead of QSignalMapper
 * Use QTreeWidgetItem::setForeground instead of ::setTextColor
 * Use QDir::setPath instead of operator=(QString)
 * Use QList::swapItemsAt instead of ::swap

* fix error
This commit is contained in:
ctrlaltca 2019-08-28 02:06:54 +02:00 committed by Zach H
parent f54165025e
commit b6df5a4ac3
17 changed files with 71 additions and 40 deletions

View file

@ -3,6 +3,7 @@
#include <QDebug>
#include <QtWidgets>
#include <algorithm>
#include <climits>
#include "qt-json/json.h"
@ -70,7 +71,7 @@ bool OracleImporter::readSetsFromByteArray(const QByteArray &data)
newSetList.append(SetToDownload(shortName, longName, setCards, setType, releaseDate));
}
qSort(newSetList);
std::sort(newSetList.begin(), newSetList.end());
if (newSetList.isEmpty()) {
return false;
@ -337,8 +338,8 @@ int OracleImporter::importCardsFromSet(CardSetPtr currentSet, const QList<QVaria
// get all parts for this specific card
QList<SplitCardPart> splitCardParts = splitCards.values(nameSplit);
// sort them by index (aka position)
qSort(splitCardParts.begin(), splitCardParts.end(),
[](const SplitCardPart &a, const SplitCardPart &b) -> bool { return a.getIndex() < b.getIndex(); });
std::sort(splitCardParts.begin(), splitCardParts.end(),
[](const SplitCardPart &a, const SplitCardPart &b) -> bool { return a.getIndex() < b.getIndex(); });
text = QString("");
isToken = false;