From 7c5714bc9abf2c4526e3b0be88477d94377d441c Mon Sep 17 00:00:00 2001 From: Eric Van Albert Date: Sun, 16 Feb 2020 15:44:26 -0500 Subject: [PATCH] Fix QmlSharedPointer and remove deprecated set handling Remove function wrappers to avoid incompatibility with older qt versions New stuff not compatible with <5.14, so add in preprocessor commands to switch which statements are used missed one --- src/Library.cpp | 8 +++++++- src/Model.cpp | 6 ++++++ src/OutputWindow.cpp | 1 + src/QmlSharedPointer.h | 41 +++++++++-------------------------------- src/View.cpp | 9 +++++++-- 5 files changed, 30 insertions(+), 35 deletions(-) diff --git src/Library.cpp src/Library.cpp index ba44ff7..1f7cb2e 100644 --- src/Library.cpp +++ src/Library.cpp @@ -3,6 +3,7 @@ #include "Registry.h" #include #include +#include LibraryItem::LibraryItem(const QString &name, const QString &fileToInstantiate, LibraryItem *parent) { @@ -98,7 +99,12 @@ void Library::populate(LibraryItem *item, QString currentDirectory = ".") { QDir userDir(Paths::userLibrary() + "/" + currentDirectory); auto systemLs = systemDir.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); auto userLs = userDir.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); - auto ls = (systemLs + userLs).toSet().toList(); + auto lsList = systemLs + userLs; +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + auto ls = lsList.toSet().toList(); +#else + auto ls = QSet(lsList.begin(), lsList.end()).values(); +#endif ls.sort(Qt::CaseInsensitive); for (auto f = ls.begin(); f != ls.end(); f++) { auto path = currentDirectory + "/" + *f; diff --git src/Model.cpp src/Model.cpp index e4de414..4898ed2 100644 --- src/Model.cpp +++ src/Model.cpp @@ -9,6 +9,7 @@ #include #include #include +#include static QString vnp(VideoNodeSP *videoNode) { if (videoNode) return QString("%1(%2)").arg((*videoNode)->metaObject()->className()).arg((qintptr)videoNode->data()); @@ -361,8 +362,13 @@ void Model::flush() { // Compute the changeset { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) auto v = QSet::fromList(m_vertices); auto v4r = QSet::fromList(m_verticesForRendering); +#else + auto v = QSet(m_vertices.begin(), m_vertices.end()); + auto v4r = QSet(m_verticesForRendering.begin(), m_verticesForRendering.end()); +#endif // TODO Can't use QSet without implementing qHash //auto e = QSet::fromList(m_edges); //auto e4r = QSet::fromList(m_edgesForRendering); diff --git src/OutputWindow.cpp src/OutputWindow.cpp index 73aead8..135e31d 100644 --- src/OutputWindow.cpp +++ src/OutputWindow.cpp @@ -2,6 +2,7 @@ #include #include +#include // OutputWindow diff --git src/QmlSharedPointer.h src/QmlSharedPointer.h index 4551e6f..661137b 100644 --- src/QmlSharedPointer.h +++ src/QmlSharedPointer.h @@ -9,6 +9,7 @@ #include #include #include +#include template class QmlSharedPointer; @@ -102,11 +103,7 @@ private: QMetaObject::disconnect(data(), i, this, i); } } - static const QMetaObject *gen_superdata(); static const QByteArrayData *gen_stringdata(); - static const uint *gen_data(); - static const QMetaObject * const *gen_relatedMetaObjects(); - static void *gen_extradata(); static void findAndActivateSignal(QObject *_o, int _id, void **_a); public: @@ -286,12 +283,6 @@ template void QmlSharedPointer::qt_static_metacal } } -template -const QMetaObject *QmlSharedPointer::gen_superdata() -{ - return &B::staticMetaObject; -} - template const QByteArrayData *QmlSharedPointer::gen_stringdata() { @@ -307,7 +298,11 @@ const QByteArrayData *QmlSharedPointer::gen_stringdata() static QByteArrayData new_stringdata[MAX_N_STRINGS]; for (int i=0; i::gen_stringdata() return new_stringdata; } -template -const uint *QmlSharedPointer::gen_data() -{ - return T::staticMetaObject.d.data; -} - -template -const QMetaObject * const *QmlSharedPointer::gen_relatedMetaObjects() -{ - return T::staticMetaObject.d.relatedMetaObjects; -} - -template -void *QmlSharedPointer::gen_extradata() -{ - return T::staticMetaObject.d.extradata; -} - template const QMetaObject QmlSharedPointer::staticMetaObject = { { - QmlSharedPointer::gen_superdata(), + &B::staticMetaObject, QmlSharedPointer::gen_stringdata(), - QmlSharedPointer::gen_data(), + T::staticMetaObject.d.data, QmlSharedPointer::qt_static_metacall, - QmlSharedPointer::gen_relatedMetaObjects(), - QmlSharedPointer::gen_extradata(), + T::staticMetaObject.d.relatedMetaObjects, + T::staticMetaObject.d.extradata, } }; diff --git src/View.cpp src/View.cpp index 120b591..20e7ca2 100644 --- src/View.cpp +++ src/View.cpp @@ -1,10 +1,11 @@ #include "View.h" +#include "VideoNode.h" +#include "Paths.h" #include #include #include #include -#include "VideoNode.h" -#include "Paths.h" +#include View::View() : m_model(nullptr) @@ -668,7 +669,11 @@ QVariantList View::selectedConnectedComponents() { QSet selectedVerticesSet; QVector selectedVertices; { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) auto vSet = QSet::fromList(vertices); +#else + auto vSet = QSet(vertices.begin(), vertices.end()); +#endif for (int i=0; i