gammaray/0001-Fix-Qt-6.6-build.patch

101 lines
4.6 KiB
Diff

From 9978a0a7c4f4d122477f4f14755e55196365d8ce Mon Sep 17 00:00:00 2001
From: Waqar Ahmed <waqar.ahmed@kdab.com>
Date: Thu, 7 Sep 2023 13:23:47 +0500
Subject: [PATCH] Fix Qt 6.6+ build
Fixes #827
---
common/propertysyncer.cpp | 3 ++-
core/metaobjectrepository.cpp | 3 +++
core/probesettings.cpp | 6 ++++--
core/qmetapropertyadaptor.cpp | 3 ++-
ui/propertybinder.cpp | 6 ++++--
5 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/common/propertysyncer.cpp b/common/propertysyncer.cpp
index 1e06c2002..c31a95010 100644
--- a/common/propertysyncer.cpp
+++ b/common/propertysyncer.cpp
@@ -53,7 +53,8 @@ void PropertySyncer::addObject(Protocol::ObjectAddress addr, QObject *obj)
const auto prop = obj->metaObject()->property(i);
if (!prop.hasNotifySignal())
continue;
- connect(obj, QByteArray("2") + prop.notifySignal().methodSignature(), this, SLOT(propertyChanged()));
+ const QByteArray ba = QByteArray("2") + prop.notifySignal().methodSignature();
+ connect(obj, ba, this, SLOT(propertyChanged()));
}
connect(obj, &QObject::destroyed, this, &PropertySyncer::objectDestroyed);
diff --git a/core/metaobjectrepository.cpp b/core/metaobjectrepository.cpp
index 8b108b6cc..bf4f4a578 100644
--- a/core/metaobjectrepository.cpp
+++ b/core/metaobjectrepository.cpp
@@ -24,6 +24,9 @@
#include <QFile>
#include <QObject>
#include <private/qobject_p.h>
+#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
+#include <private/qcoreevent_p.h>
+#endif
#include <QSortFilterProxyModel>
#include <QStringList>
#include <QThread>
diff --git a/core/probesettings.cpp b/core/probesettings.cpp
index 067e18a44..646c35a65 100644
--- a/core/probesettings.cpp
+++ b/core/probesettings.cpp
@@ -225,8 +225,10 @@ static QVariant getPackageMetaData(const QString &key, const QVariant &defaultVa
QVariant ProbeSettings::value(const QString &key, const QVariant &defaultValue)
{
QByteArray v = s_probeSettings()->settings.value(key.toUtf8());
- if (v.isEmpty())
- v = qgetenv("GAMMARAY_" + key.toLocal8Bit());
+ if (v.isEmpty()) {
+ const QByteArray cstr = "GAMMARAY_" + key.toLocal8Bit();
+ v = qgetenv(cstr);
+ }
#ifdef QT_ANDROIDEXTRAS_LIB
if (v.isEmpty()) {
diff --git a/core/qmetapropertyadaptor.cpp b/core/qmetapropertyadaptor.cpp
index ab93c4ffa..9a36a2196 100644
--- a/core/qmetapropertyadaptor.cpp
+++ b/core/qmetapropertyadaptor.cpp
@@ -44,7 +44,8 @@ void QMetaPropertyAdaptor::doSetObject(const ObjectInstance &oi)
const QMetaProperty prop = mo->property(i);
if (!PropertyFilters::matches(propertyMetaData(i))) {
if (oi.type() == ObjectInstance::QtObject && oi.qtObject() && prop.hasNotifySignal()) {
- connect(oi.qtObject(), QByteArray("2") + prop.notifySignal().methodSignature(), this, SLOT(propertyUpdated()));
+ const QByteArray sig = QByteArray("2") + prop.notifySignal().methodSignature();
+ connect(oi.qtObject(), sig, this, SLOT(propertyUpdated()));
m_notifyToRowMap.insert(prop.notifySignalIndex(), m_rowToPropertyIndex.size());
}
m_rowToPropertyIndex.push_back(i);
diff --git a/ui/propertybinder.cpp b/ui/propertybinder.cpp
index a0ac7dbb9..5be3e881d 100644
--- a/ui/propertybinder.cpp
+++ b/ui/propertybinder.cpp
@@ -56,7 +56,8 @@ void PropertyBinder::add(const char *sourceProp, const char *destProp)
b.sourceProperty = m_source->metaObject()->property(sourceIndex);
Q_ASSERT(b.sourceProperty.isValid());
Q_ASSERT(b.sourceProperty.hasNotifySignal());
- connect(m_source, QByteArray("2") + b.sourceProperty.notifySignal().methodSignature(), this, SLOT(syncSourceToDestination()));
+ const QByteArray sig1 = QByteArray("2") + b.sourceProperty.notifySignal().methodSignature();
+ connect(m_source, sig1, this, SLOT(syncSourceToDestination()));
const auto destIndex = m_destination->metaObject()->indexOfProperty(destProp);
b.destinationProperty = m_destination->metaObject()->property(destIndex);
@@ -69,7 +70,8 @@ void PropertyBinder::add(const char *sourceProp, const char *destProp)
if (!b.destinationProperty.hasNotifySignal() || !b.sourceProperty.isWritable())
return;
- connect(m_destination, QByteArray("2") + b.destinationProperty.notifySignal().methodSignature(), this, SLOT(syncDestinationToSource()));
+ const QByteArray sig2 = QByteArray("2") + b.destinationProperty.notifySignal().methodSignature();
+ connect(m_destination, sig2, this, SLOT(syncDestinationToSource()));
}
void PropertyBinder::syncSourceToDestination()
--
2.44.0