mirror of https://github.com/mgba-emu/mgba.git
Qt: replace deprecated QSet APIs
This commit is contained in:
parent
a75c6c41e0
commit
40cae51e28
|
@ -9,6 +9,7 @@
|
|||
#include "ConfigController.h"
|
||||
#include "GBAApp.h"
|
||||
#include "LibraryModel.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <QHeaderView>
|
||||
#include <QListView>
|
||||
|
@ -190,7 +191,7 @@ void LibraryController::refresh() {
|
|||
|
||||
setDisabled(true);
|
||||
|
||||
QSet<QString> removedEntries(m_knownGames.keyBegin(), m_knownGames.keyEnd());
|
||||
QSet<QString> removedEntries(qListToSet(m_knownGames.keys()));
|
||||
QList<LibraryEntry> updatedEntries;
|
||||
QList<LibraryEntry> newEntries;
|
||||
|
||||
|
@ -215,7 +216,7 @@ void LibraryController::refresh() {
|
|||
m_knownGames.remove(path);
|
||||
}
|
||||
|
||||
m_libraryModel->removeEntries(QList<QString>(removedEntries.begin(), removedEntries.end()));
|
||||
m_libraryModel->removeEntries(removedEntries.values());
|
||||
m_libraryModel->updateEntries(updatedEntries);
|
||||
m_libraryModel->addEntries(newEntries);
|
||||
|
||||
|
|
|
@ -134,4 +134,13 @@ struct SpanSet {
|
|||
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…
Reference in New Issue