Qt: replace deprecated QSet APIs
This commit is contained in:
parent
a75c6c41e0
commit
40cae51e28
@ -9,6 +9,7 @@
|
|||||||
#include "ConfigController.h"
|
#include "ConfigController.h"
|
||||||
#include "GBAApp.h"
|
#include "GBAApp.h"
|
||||||
#include "LibraryModel.h"
|
#include "LibraryModel.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QListView>
|
#include <QListView>
|
||||||
@ -190,7 +191,7 @@ void LibraryController::refresh() {
|
|||||||
|
|
||||||
setDisabled(true);
|
setDisabled(true);
|
||||||
|
|
||||||
QSet<QString> removedEntries(m_knownGames.keyBegin(), m_knownGames.keyEnd());
|
QSet<QString> removedEntries(qListToSet(m_knownGames.keys()));
|
||||||
QList<LibraryEntry> updatedEntries;
|
QList<LibraryEntry> updatedEntries;
|
||||||
QList<LibraryEntry> newEntries;
|
QList<LibraryEntry> newEntries;
|
||||||
|
|
||||||
@ -215,7 +216,7 @@ void LibraryController::refresh() {
|
|||||||
m_knownGames.remove(path);
|
m_knownGames.remove(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_libraryModel->removeEntries(QList<QString>(removedEntries.begin(), removedEntries.end()));
|
m_libraryModel->removeEntries(removedEntries.values());
|
||||||
m_libraryModel->updateEntries(updatedEntries);
|
m_libraryModel->updateEntries(updatedEntries);
|
||||||
m_libraryModel->addEntries(newEntries);
|
m_libraryModel->addEntries(newEntries);
|
||||||
|
|
||||||
|
@ -134,4 +134,13 @@ struct SpanSet {
|
|||||||
QVector<Span> spans;
|
QVector<Span> spans;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
QSet<T> qListToSet(const QList<T>& list) {
|
||||||
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
return QSet<T>::fromList(list);
|
||||||
|
#else
|
||||||
|
return QSet<T>(list.begin(), list.end());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user