e6bda0866e70 — Chris Cannam 3 months ago
Qt6 compatibility
M src/Debug.h +6 -0
@@ 75,6 75,12 @@ public:
 
 #define DQ_DEBUG ::Dataquay::NoDebug()
 
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+using Qt::endl;
+#elif QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+using QTextStreamFunctions::endl;
+#endif
+
 #endif /* !NDEBUG */
 
 #endif /* !_DEBUG_H_ */

          
M src/Node.cpp +1 -0
@@ 37,6 37,7 @@ 
 
 #include <QDataStream>
 #include <QTextStream>
+#include <QIODevice>
 #include <QTime>
 #include <QByteArray>
 #include <QMetaType>

          
M src/Uri.cpp +2 -5
@@ 38,14 38,9 @@ 
 #include <QVariant>
 #include <QMutex>
 #include <QHash>
-#include <QRegExp>
 
 #include <iostream>
 
-#ifndef NDEBUG
-#include <QRegExp>
-#endif
-
 #include "Debug.h"
 #include "RDFException.h"
 

          
@@ 74,7 69,9 @@ private:
         DQ_DEBUG << "UriRegistrar: registering Dataquay::Uri" << endl;
         QByteArray bname = name.toLatin1();
         type = qRegisterMetaType<Uri>(bname.data());
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
         qRegisterMetaTypeStreamOperators<Uri>(bname.data());
+#endif
     }
 };
 

          
M src/objectmapper/ObjectLoader.cpp +5 -4
@@ 444,12 444,13 @@ private:
         // was only added the same 5.14 release!
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 
-        NodeSet remaining = NodeSet::fromList(children);
+        NodeSet remainingSet(children.begin(), children.end());
         Nodes ordered = orderedSiblingsOf(children[0]);
-        remaining.subtract(NodeSet::fromList(ordered));
-        foreach (Node n, remaining) ordered.push_back(n);
+        NodeSet orderedSet(ordered.begin(), ordered.end());
+        remainingSet.subtract(orderedSet);
+        foreach (Node n, remainingSet) ordered.push_back(n);
         DQ_DEBUG << "orderedChildrenOf: Node " << node << " has " << ordered.size()
-              << " children: " << ordered << endl;
+                 << " children: " << ordered << endl;
         return ordered;
     }
         

          
M src/objectmapper/ObjectMapper.cpp +11 -1
@@ 51,6 51,9 @@ 
 
 #include <QMetaProperty>
 #include <QMutex>
+#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
+#include <QRecursiveMutex>
+#endif
 #include <QMutexLocker>
 #include <QSet>
 #include <QHash>

          
@@ 106,7 109,9 @@ public:
         m_m(m),
         m_s(s),
         m_c(s),
+#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0)
         m_mutex(QMutex::Recursive),
+#endif
         m_inCommit(false),
         m_inReload(false),
         m_callback(this)

          
@@ 582,8 587,13 @@ private:
     Connection m_c;
     TypeMapping m_tm;
     Network m_n;
-
+    
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+    QRecursiveMutex m_mutex;
+#else
     QMutex m_mutex;
+#endif
+    
     QHash<QObject *, ObjectMapperForwarder *> m_forwarders;
     QSet<QObject *> m_changedObjects;
     QSet<Node> m_deletedObjectNodes;

          
M src/objectmapper/ObjectStorer.cpp +2 -2
@@ 197,7 197,7 @@ private:
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 
         QObjectList candidates = state.requested;
-        state.noBlanks = ObjectSet::fromList(candidates);
+        state.noBlanks = ObjectSet(candidates.begin(), candidates.end());
         ObjectSet visited;
 
         // Avoid ever pushing null (if returned as absence case) as a

          
@@ 603,7 603,7 @@ ObjectStorer::D::replacePropertyNodes(No
 void
 ObjectStorer::D::replacePropertyNodes(Node node, Uri propertyUri, Nodes newValues)
 {
-    QSet<Node> nodeSet = QSet<Node>::fromList(newValues);
+    QSet<Node> nodeSet = QSet<Node>(newValues.begin(), newValues.end());
     removePropertyNodes(node, propertyUri, &nodeSet);
     // nodeSet now contains only those nodes whose triples need to be
     // added, i.e. those not present as our properties before