From 806be588a70349b1705a687d38b90bfa6702d010 Mon Sep 17 00:00:00 2001
From: Carlos Matos <cmatos@redhat.com>
Date: Fri, 29 May 2020 13:59:32 -0400
Subject: [PATCH] Use QT provided macro function to version check - deprecation
 errors

---
 src/SaveAsRPMDialog.cpp |  7 ++++++-
 src/TailoringWindow.cpp | 14 ++++++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/SaveAsRPMDialog.cpp b/src/SaveAsRPMDialog.cpp
index 611d15f..854396b 100644
--- a/src/SaveAsRPMDialog.cpp
+++ b/src/SaveAsRPMDialog.cpp
@@ -86,7 +86,12 @@ void SaveAsRPMDialog::slotFinished(int result)
     closure.remove(mScanningSession->getOpenedFilePath());
     QList<QString> closureOrdered;
     closureOrdered.append(mScanningSession->getOpenedFilePath());
-    closureOrdered.append(closure.toList());
+    #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+        closureOrdered.append(closure.values());
+    #else
+        // support older versions where deprecation warning is not fatal
+        closureOrdered.append(closure.toList());
+    #endif
 
     const QDir cwd = ScanningSession::getCommonAncestorDirectory(closure);
 
diff --git a/src/TailoringWindow.cpp b/src/TailoringWindow.cpp
index ceced3e..e4081cf 100644
--- a/src/TailoringWindow.cpp
+++ b/src/TailoringWindow.cpp
@@ -645,7 +645,12 @@ QString TailoringWindow::getQSettingsKey() const
 void TailoringWindow::deserializeCollapsedItems()
 {
     const QStringList list = mQSettings->value(getQSettingsKey()).toStringList();
-    mCollapsedItemIds = QSet<QString>::fromList(list);
+    #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+        mCollapsedItemIds = QSet<QString>(list.begin(), list.end());
+    #else
+        // support older versions where deprecation warning is not fatal
+        mCollapsedItemIds = QSet<QString>::fromList(list);
+    #endif
 }
 
 void TailoringWindow::serializeCollapsedItems()
@@ -657,7 +662,12 @@ void TailoringWindow::serializeCollapsedItems()
     }
     else
     {
-        mQSettings->setValue(getQSettingsKey(), QVariant(mCollapsedItemIds.toList()));
+        #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+            mQSettings->setValue(getQSettingsKey(), QVariant(mCollapsedItemIds.values()));
+        #else
+            // support older versions where deprecation warning is not fatal
+            mQSettings->setValue(getQSettingsKey(), QVariant(mCollapsedItemIds.toList()));
+        #endif
         mQSettings->setValue(getQSettingsKey() + "_lastUsed", QVariant(QDateTime::currentDateTime()));
     }
 }
-- 
2.30.0

