Qt 6.7 build fixes + a couple other ones

OBS-URL: https://build.opensuse.org/package/show/KDE:Extra/gammaray?expand=0&rev=84
This commit is contained in:
Christophe Marin 2024-04-11 12:50:10 +00:00 committed by Git OBS Bridge
parent 3cd9adcc3b
commit d516941d1c
12 changed files with 811 additions and 0 deletions

View File

@ -0,0 +1,62 @@
From f7bf40db5cd70972ca0597d096ca67c5a0b2a7b9 Mon Sep 17 00:00:00 2001
From: David Faure <faure@kde.org>
Date: Fri, 10 Nov 2023 11:29:43 +0100
Subject: [PATCH] 2 more QAbstractItemModelTester fixes
- RemoteModel: parent(invalid) should be invalid
- Delay restoring the QHeaderView until fully finishing the current
change
Otherwise we got a "ChangeInFlight" assert because QHeaderView
ends up calling QSFPM::sort() which emits layoutAboutToBeChanged,
but the model tester hasn't seen the columnsInserted signal yet,
when QHeaderView got it first.
(cherry picked from commit 048b0493bd4e21f0d55bdd78468bd1cdaa016131)
---
client/remotemodel.cpp | 4 +++-
ui/uistatemanager.cpp | 6 +++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/client/remotemodel.cpp b/client/remotemodel.cpp
index dc51a8366..9e0ff3ba9 100644
--- a/client/remotemodel.cpp
+++ b/client/remotemodel.cpp
@@ -136,6 +136,8 @@ QModelIndex RemoteModel::index(int row, int column, const QModelIndex &parent) c
QModelIndex RemoteModel::parent(const QModelIndex &index) const
{
+ if (!index.isValid())
+ return {};
Node *currentNode = nodeForIndex(index);
Q_ASSERT(currentNode);
if (currentNode == m_root || currentNode->parent == m_root)
@@ -158,7 +160,7 @@ int RemoteModel::rowCount(const QModelIndex &index) const
if (node->columnCount < 0) // not yet requested vs. in the middle of insertion
requestRowColumnCount(index);
}
- return qMax(0, node->rowCount); // if requestRowColumnCount is synchronoous, ie. changes rowCount (as in simple unit test), returning 0 above would cause ModelTest to see inconsistent data
+ return qMax(0, node->rowCount); // if requestRowColumnCount is synchronous, ie. changes rowCount (as in simple unit test), returning 0 above would cause ModelTest to see inconsistent data
}
int RemoteModel::columnCount(const QModelIndex &index) const
diff --git a/ui/uistatemanager.cpp b/ui/uistatemanager.cpp
index 07c12ae91..988b6b18e 100644
--- a/ui/uistatemanager.cpp
+++ b/ui/uistatemanager.cpp
@@ -555,7 +555,11 @@ void UIStateManager::saveHeaderState(QHeaderView *header)
void UIStateManager::headerSectionCountChanged()
{
- restoreHeaderState(qobject_cast<QHeaderView *>(sender()));
+ auto headerView = qobject_cast<QHeaderView *>(sender());
+ // Delay the call to restoreHeaderState to avoid multiple changes in flight at the QAIM level
+ // E.g. we might be here because of columnsInserted() (which just finished, but not all receivers were told yet)
+ // and restoring will sort() the model, which will emit layoutChanged(). Separate the two so QAbstractItemModelTester doesn't abort.
+ QMetaObject::invokeMethod(this, "restoreHeaderState", Qt::QueuedConnection, Q_ARG(QHeaderView *, headerView));
}
void UIStateManager::widgetResized(QWidget *widget)
--
2.44.0

View File

@ -0,0 +1,27 @@
From 9674e01aa787e2168b9b983dec14db9df875986b Mon Sep 17 00:00:00 2001
From: Matt Aber <matt.aber@kdab.com>
Date: Mon, 5 Feb 2024 14:41:24 -0500
Subject: [PATCH] Enable building with Qt 6.7
(packager note: merged with upstream commit 45e025e3329d3be691ce80796315eb62dae60c66)
---
core/metaobjectrepository.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/core/metaobjectrepository.cpp b/core/metaobjectrepository.cpp
index bf4f4a5..5ae11c0 100644
--- a/core/metaobjectrepository.cpp
+++ b/core/metaobjectrepository.cpp
@@ -135,7 +135,9 @@ void MetaObjectRepository::initQObjectTypes()
MO_ADD_PROPERTY_RO(QDateTime, isNull);
MO_ADD_PROPERTY_RO(QDateTime, isValid);
MO_ADD_PROPERTY_RO(QDateTime, offsetFromUtc);
+#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0)
MO_ADD_PROPERTY(QDateTime, timeZone, setTimeZone);
+#endif
MO_ADD_METAOBJECT0(QTimeZone);
MO_ADD_PROPERTY_RO(QTimeZone, comment);
--
2.44.0

View File

@ -0,0 +1,50 @@
From 6b46413d04579cb2159a77b01e83bca148899626 Mon Sep 17 00:00:00 2001
From: David Faure <david.faure@kdab.com>
Date: Thu, 9 Nov 2023 20:13:28 +0100
Subject: [PATCH] Fix 3 bugs detected by QAbstractItemModelTester
(cherry picked from commit cc9af5742ef075d1f7dd633751b80154073ea23f)
---
core/paintbuffermodel.cpp | 4 ++--
plugins/modelinspector/modelmodel.cpp | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/core/paintbuffermodel.cpp b/core/paintbuffermodel.cpp
index 096d40d3f..7bfa5826b 100644
--- a/core/paintbuffermodel.cpp
+++ b/core/paintbuffermodel.cpp
@@ -423,7 +423,7 @@ int PaintBufferModel::columnCount(const QModelIndex &parent) const
int PaintBufferModel::rowCount(const QModelIndex &parent) const
{
- if (!m_privateBuffer)
+ if (!m_privateBuffer || parent.column() > 0)
return 0;
if (parent.isValid()) {
const auto cmd = m_privateBuffer->commands.at(parent.row());
@@ -441,7 +441,7 @@ QModelIndex PaintBufferModel::index(int row, int column, const QModelIndex &pare
QModelIndex PaintBufferModel::parent(const QModelIndex &child) const
{
- if (child.internalId() == TopLevelId)
+ if (!child.isValid() || child.internalId() == TopLevelId)
return {};
return createIndex(child.internalId(), 0, TopLevelId);
}
diff --git a/plugins/modelinspector/modelmodel.cpp b/plugins/modelinspector/modelmodel.cpp
index 55fa7647a..40319cb57 100644
--- a/plugins/modelinspector/modelmodel.cpp
+++ b/plugins/modelinspector/modelmodel.cpp
@@ -48,6 +48,9 @@ int ModelModel::rowCount(const QModelIndex &parent) const
QModelIndex ModelModel::parent(const QModelIndex &child) const
{
+ if (!child.isValid())
+ return {};
+
QAbstractItemModel *model = static_cast<QAbstractItemModel *>(child.internalPointer());
Q_ASSERT(model);
if (m_models.contains(model))
--
2.44.0

100
0001-Fix-Qt-6.6-build.patch Normal file
View File

@ -0,0 +1,100 @@
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

View File

@ -0,0 +1,246 @@
From 8baa121ea1a2af0ffd81c6b2514b7e7d80d06cd5 Mon Sep 17 00:00:00 2001
From: Matt <144846910+mattkdab@users.noreply.github.com>
Date: Tue, 26 Mar 2024 12:55:26 -0400
Subject: [PATCH] Fix build on 6.7 for after QDeferredDeleteEvent export
reversion (#957)
In the next 6.7 release, this reversion will be done:
https://codereview.qt-project.org/c/qt/qtbase/+/544223
which will break building GammaRay against 6.7
Use static_cast in an explicit specialization
GammaRay::DynamicCast<QDeferredDeleteEvent *, QEvent>
to avoid missing typeinfo errors from linker
* Fix build on 6.7 for after QDeferredDeleteEvent export reversion
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Followup #957: Remove unneeded include
* Followup #957: check qt version before including qcoreevent_p
* Followup #957: QtGlobal for version check
* Followup #957: qt5 ci fix: include metatypedecl in metaprop
* Followup #957: GuiPrivate -> CorePrivate, comment
Requested by @redstrate
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Followup #957: Remove now-unneeded additions
Caught by Waqar in his review.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
---
core/typetraits.h | 13 +++++++++++++
plugins/actioninspector/CMakeLists.txt | 8 +++++++-
plugins/bluetooth/CMakeLists.txt | 2 +-
plugins/openglsupport/CMakeLists.txt | 2 +-
plugins/positioning/CMakeLists.txt | 2 +-
plugins/qt3dinspector/CMakeLists.txt | 1 +
plugins/quickwidgetsupport/CMakeLists.txt | 2 +-
plugins/sceneinspector/CMakeLists.txt | 1 +
plugins/textdocumentinspector/CMakeLists.txt | 2 +-
plugins/widgetinspector/CMakeLists.txt | 1 +
plugins/wlcompositorinspector/CMakeLists.txt | 1 +
tests/CMakeLists.txt | 8 ++++++--
12 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/core/typetraits.h b/core/typetraits.h
index 20397af..4195e99 100644
--- a/core/typetraits.h
+++ b/core/typetraits.h
@@ -15,6 +15,11 @@
#define GAMMARAY_TYPETRAITS_H
#include <type_traits>
+#include <QtGlobal>
+// Needed for QDeferredDeleteEvent after Qt 6.7
+#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
+#include <private/qcoreevent_p.h>
+#endif
namespace GammaRay {
@@ -27,6 +32,14 @@ Out DynamicCast(In *in)
return dynamic_cast<Out>(in);
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
+template<>
+inline QDeferredDeleteEvent *DynamicCast<QDeferredDeleteEvent *, QEvent>(QEvent *in)
+{
+ return static_cast<QDeferredDeleteEvent *>(in);
+}
+#endif
+
///@cond internal
template<typename Out>
Out DynamicCast(void *)
diff --git a/plugins/actioninspector/CMakeLists.txt b/plugins/actioninspector/CMakeLists.txt
index 134c3d4..87ceeef 100644
--- a/plugins/actioninspector/CMakeLists.txt
+++ b/plugins/actioninspector/CMakeLists.txt
@@ -18,7 +18,13 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
${gammaray_actioninspector_plugin_srcs}
)
- target_link_libraries(gammaray_actioninspector_plugin Qt::Gui Qt::Widgets gammaray_core)
+ target_link_libraries(
+ gammaray_actioninspector_plugin
+ Qt::Gui
+ Qt::CorePrivate
+ Qt::Widgets
+ gammaray_core
+ )
endif()
# ui part
diff --git a/plugins/bluetooth/CMakeLists.txt b/plugins/bluetooth/CMakeLists.txt
index a5c2392..951000e 100644
--- a/plugins/bluetooth/CMakeLists.txt
+++ b/plugins/bluetooth/CMakeLists.txt
@@ -15,6 +15,6 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
SOURCES
bluetooth.cpp
)
- target_link_libraries(gammaray_bluetooth gammaray_core Qt::Bluetooth)
+ target_link_libraries(gammaray_bluetooth gammaray_core Qt::Bluetooth Qt::CorePrivate)
set_target_properties(gammaray_bluetooth PROPERTIES DISABLE_PRECOMPILE_HEADERS ON)
endif()
diff --git a/plugins/openglsupport/CMakeLists.txt b/plugins/openglsupport/CMakeLists.txt
index e5614be..f610a46 100644
--- a/plugins/openglsupport/CMakeLists.txt
+++ b/plugins/openglsupport/CMakeLists.txt
@@ -15,7 +15,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
SOURCES
openglsupport.cpp
)
- target_link_libraries(gammaray_openglsupport gammaray_core Qt::Gui)
+ target_link_libraries(gammaray_openglsupport gammaray_core Qt::Gui Qt::CorePrivate)
if(TARGET Qt6::OpenGL)
target_link_libraries(gammaray_openglsupport Qt6::OpenGL)
endif()
diff --git a/plugins/positioning/CMakeLists.txt b/plugins/positioning/CMakeLists.txt
index e19616a..8ea8bdd 100644
--- a/plugins/positioning/CMakeLists.txt
+++ b/plugins/positioning/CMakeLists.txt
@@ -16,7 +16,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
SOURCES
${gammaray_positioning_srcs}
)
- target_link_libraries(gammaray_positioning gammaray_core Qt::Positioning)
+ target_link_libraries(gammaray_positioning gammaray_core Qt::Positioning Qt::CorePrivate)
set_target_properties(gammaray_positioning PROPERTIES DISABLE_PRECOMPILE_HEADERS ON)
# proxy geo position info source factory
diff --git a/plugins/qt3dinspector/CMakeLists.txt b/plugins/qt3dinspector/CMakeLists.txt
index ab514d9..31bed03 100644
--- a/plugins/qt3dinspector/CMakeLists.txt
+++ b/plugins/qt3dinspector/CMakeLists.txt
@@ -33,6 +33,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
gammaray_kitemmodels
Qt::3DInput
Qt::3DRender
+ Qt::CorePrivate
)
if(TARGET Qt::3DAnimation)
target_link_libraries(gammaray_3dinspector Qt::3DAnimation)
diff --git a/plugins/quickwidgetsupport/CMakeLists.txt b/plugins/quickwidgetsupport/CMakeLists.txt
index 99b1211..1dcbc19 100644
--- a/plugins/quickwidgetsupport/CMakeLists.txt
+++ b/plugins/quickwidgetsupport/CMakeLists.txt
@@ -16,5 +16,5 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
SOURCES
${gammaray_quickwidgetsupport_srcs}
)
- target_link_libraries(gammaray_quickwidgetsupport gammaray_core Qt::QuickWidgets)
+ target_link_libraries(gammaray_quickwidgetsupport gammaray_core Qt::QuickWidgets Qt::CorePrivate)
endif()
diff --git a/plugins/sceneinspector/CMakeLists.txt b/plugins/sceneinspector/CMakeLists.txt
index 8ebbfd8..2de614b 100644
--- a/plugins/sceneinspector/CMakeLists.txt
+++ b/plugins/sceneinspector/CMakeLists.txt
@@ -23,6 +23,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
target_link_libraries(
gammaray_sceneinspector_plugin
Qt::Gui
+ Qt::CorePrivate
Qt::Widgets
gammaray_kitemmodels
gammaray_core
diff --git a/plugins/textdocumentinspector/CMakeLists.txt b/plugins/textdocumentinspector/CMakeLists.txt
index 1e5f3a9..655f351 100644
--- a/plugins/textdocumentinspector/CMakeLists.txt
+++ b/plugins/textdocumentinspector/CMakeLists.txt
@@ -17,7 +17,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
${gammaray_textdocumentinspector_srcs}
)
target_link_libraries(gammaray_textdocumentinspector gammaray_core)
- target_link_libraries(gammaray_textdocumentinspector Qt::Gui)
+ target_link_libraries(gammaray_textdocumentinspector Qt::Gui Qt::CorePrivate)
endif()
# ui plugin
diff --git a/plugins/widgetinspector/CMakeLists.txt b/plugins/widgetinspector/CMakeLists.txt
index 18b2897..019aa5d 100644
--- a/plugins/widgetinspector/CMakeLists.txt
+++ b/plugins/widgetinspector/CMakeLists.txt
@@ -30,6 +30,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
target_link_libraries(
gammaray_widgetinspector_plugin
Qt::Gui
+ Qt::CorePrivate
Qt::Widgets
gammaray_kitemmodels
gammaray_core
diff --git a/plugins/wlcompositorinspector/CMakeLists.txt b/plugins/wlcompositorinspector/CMakeLists.txt
index 9d8c0e5..144d23b 100644
--- a/plugins/wlcompositorinspector/CMakeLists.txt
+++ b/plugins/wlcompositorinspector/CMakeLists.txt
@@ -31,6 +31,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
gammaray_core
gammaray_kitemmodels
Qt::WaylandCompositor
+ Qt::CorePrivate
Wayland::Server
)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 6057ffd..608b585 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -231,7 +231,7 @@ target_link_libraries(
gammaray_add_test(metaobjecttest metaobjecttest.cpp)
target_link_libraries(
- metaobjecttest gammaray_core
+ metaobjecttest Qt::CorePrivate gammaray_core
)
if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
@@ -257,7 +257,11 @@ target_link_libraries(
gammaray_add_test(propertyadaptortest propertyadaptortest.cpp)
target_link_libraries(
- propertyadaptortest gammaray_core Qt::Gui gammaray_shared_test_data
+ propertyadaptortest
+ gammaray_core
+ Qt::Gui
+ Qt::CorePrivate
+ gammaray_shared_test_data
)
if(HAVE_QT_WIDGETS)
--
2.44.0

View File

@ -0,0 +1,60 @@
From 3dc92d2ede1897b1eadc0e8e1e664e2a9b88017d Mon Sep 17 00:00:00 2001
From: David Faure <faure@kde.org>
Date: Wed, 8 Nov 2023 22:42:33 +0100
Subject: [PATCH] Fix gcc-13 warnings about references to temporaries
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
ui/clienttoolmodel.cpp:42:21: warning: possibly dangling reference to a temporary [-Wdangling-reference]
42 | const ToolInfo &tool = m_toolManager->tools().at(index.row());
| ^~~~
ui/clienttoolmodel.cpp:42:53: note: the temporary was destroyed at the end of the full expression
GammaRay::ClientToolManager::tools() const().QList<GammaRay::ToolInfo>::at(((qsizetype)(& index)->QModelIndex::row()))
(cherry picked from commit 4ecfa803c01ed3621a43a276b01480fd523c4134)
---
plugins/network/networkinterfacemodel.cpp | 4 ++--
ui/clienttoolmodel.cpp | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/plugins/network/networkinterfacemodel.cpp b/plugins/network/networkinterfacemodel.cpp
index d2d9f712f..79bbce08e 100644
--- a/plugins/network/networkinterfacemodel.cpp
+++ b/plugins/network/networkinterfacemodel.cpp
@@ -80,8 +80,8 @@ QVariant NetworkInterfaceModel::data(const QModelIndex &index, int role) const
return MetaEnum::flagsToString(iface.flags(), interface_flag_table);
}
} else if (index.column() == 0) {
- const auto &iface = m_interfaces.at(index.internalId());
- const auto &addr = iface.addressEntries().at(index.row());
+ const auto iface = m_interfaces.at(index.internalId());
+ const auto addr = iface.addressEntries().at(index.row());
return QString(addr.ip().toString() + QLatin1Char('/') + addr.netmask().toString());
}
}
diff --git a/ui/clienttoolmodel.cpp b/ui/clienttoolmodel.cpp
index aa3b24ce0..9fe85d8e7 100644
--- a/ui/clienttoolmodel.cpp
+++ b/ui/clienttoolmodel.cpp
@@ -39,7 +39,7 @@ QVariant ClientToolModel::data(const QModelIndex &index, int role) const
if (!index.isValid())
return QVariant();
- const ToolInfo &tool = m_toolManager->tools().at(index.row());
+ const ToolInfo tool = m_toolManager->tools().at(index.row());
switch (role) {
case Qt::DisplayRole:
return tool.name();
@@ -89,7 +89,7 @@ Qt::ItemFlags ClientToolModel::flags(const QModelIndex &index) const
if (!index.isValid())
return flags;
- const auto &tool = m_toolManager->tools().at(index.row());
+ const auto tool = m_toolManager->tools().at(index.row());
if (!tool.isEnabled() || (!tool.remotingSupported() && Endpoint::instance()->isRemoteClient()))
flags &= ~(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
return flags;
--
2.44.0

View File

@ -0,0 +1,42 @@
From 14c13f437e1957e36db4c0f3bd22e25e711e20d2 Mon Sep 17 00:00:00 2001
From: David Faure <faure@kde.org>
Date: Thu, 9 Nov 2023 00:52:24 +0100
Subject: [PATCH] Fix two issues in ObjectEnumModel, found by
QAbstractItemModelTester
- only column 0 has children
- parent(invalid index) should be invalid index
(cherry picked from commit 13abaef3b2bf7f31ff35dc16ce7820dc4ba5a8a9)
---
core/objectenummodel.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/core/objectenummodel.cpp b/core/objectenummodel.cpp
index f52288ed1..4e764ff1c 100644
--- a/core/objectenummodel.cpp
+++ b/core/objectenummodel.cpp
@@ -33,7 +33,7 @@ int ObjectEnumModel::rowCount(const QModelIndex &parent) const
{
if (!parent.isValid())
return SuperClass::rowCount(parent);
- if (parent.parent().isValid())
+ if (parent.parent().isValid() || parent.column() > 0)
return 0;
const QMetaEnum e = m_metaObject->enumerator(parent.row());
return e.keyCount();
@@ -93,8 +93,9 @@ QModelIndex GammaRay::ObjectEnumModel::index(int row, int column, const QModelIn
QModelIndex GammaRay::ObjectEnumModel::parent(const QModelIndex &child) const
{
- // note: Qt4 doesn't have qintptr
- if (static_cast<qptrdiff>(child.internalId()) == -1)
+ if (!child.isValid())
+ return {};
+ if (static_cast<qintptr>(child.internalId()) == -1)
return SuperClass::parent(child);
return SuperClass::index(child.internalId(), 0, QModelIndex());
}
--
2.44.0

View File

@ -0,0 +1,31 @@
From ad1d799d213ef4a0364cce2e3b19ec2c378f9173 Mon Sep 17 00:00:00 2001
From: David Faure <faure@kde.org>
Date: Thu, 9 Nov 2023 00:49:23 +0100
Subject: [PATCH] QuickSceneGraphModel: don't nest row insertion/removal
signals
Fixes #826
(cherry picked from commit 73049a9d15c629a012eb4826c37d5ced59d13621)
---
plugins/quickinspector/quickscenegraphmodel.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/quickinspector/quickscenegraphmodel.cpp b/plugins/quickinspector/quickscenegraphmodel.cpp
index f9989e851..438f04585 100644
--- a/plugins/quickinspector/quickscenegraphmodel.cpp
+++ b/plugins/quickinspector/quickscenegraphmodel.cpp
@@ -257,9 +257,9 @@ void QuickSceneGraphModel::populateFromNode(QSGNode *node, bool emitSignals)
beginInsertRows(myIndex, idx, idx);
m_childParentMap[*j] = node;
i = childList.insert(i, *j);
- populateFromNode(*j, false);
if (emitSignals)
endInsertRows();
+ populateFromNode(*j, false);
}
++i;
++j;
--
2.44.0

View File

@ -0,0 +1,48 @@
From 91200e5e1cb8fa700cfd0546e2515a7995cce441 Mon Sep 17 00:00:00 2001
From: David Faure <faure@kde.org>
Date: Wed, 8 Nov 2023 11:54:09 +0100
Subject: [PATCH] Repair lack of classnames in "Graphics Scenes" or "Styles"
combobox
Since Qt 6.3, QAbstractProxyModel::itemData() no longer calls data()
but calls into the source model. So we need to reimplement it in order
to use our data() reimplementation.
(cherry picked from commit 06a89419845e74534a42dffaa0f0c7cd99a1694c)
---
core/singlecolumnobjectproxymodel.cpp | 8 ++++++++
core/singlecolumnobjectproxymodel.h | 2 ++
2 files changed, 10 insertions(+)
diff --git a/core/singlecolumnobjectproxymodel.cpp b/core/singlecolumnobjectproxymodel.cpp
index 05150ac..1aa8255 100644
--- a/core/singlecolumnobjectproxymodel.cpp
+++ b/core/singlecolumnobjectproxymodel.cpp
@@ -38,3 +38,11 @@ QVariant SingleColumnObjectProxyModel::data(const QModelIndex &proxyIndex, int r
return QIdentityProxyModel::data(proxyIndex, role);
}
+
+QMap<int, QVariant> SingleColumnObjectProxyModel::itemData(const QModelIndex &proxyIndex) const
+{
+ QMap<int, QVariant> map = QIdentityProxyModel::itemData(proxyIndex);
+ map[Qt::DisplayRole] = data(proxyIndex);
+ return map;
+}
+
diff --git a/core/singlecolumnobjectproxymodel.h b/core/singlecolumnobjectproxymodel.h
index 6dac2e0..ca25a47 100644
--- a/core/singlecolumnobjectproxymodel.h
+++ b/core/singlecolumnobjectproxymodel.h
@@ -52,6 +52,8 @@ public:
* QVariant() if some anamoly occurs.
*/
QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const override;
+
+ QMap<int, QVariant> itemData(const QModelIndex &proxyIndex) const override;
};
}
--
2.44.0

View File

@ -0,0 +1,120 @@
From 19b2fcddc0013e3fc628acfc1997edc7337aa525 Mon Sep 17 00:00:00 2001
From: Milian Wolff <milian.wolff@kdab.com>
Date: Mon, 4 Dec 2023 15:11:55 +0100
Subject: [PATCH] Unbreak recursive filtering in ObjectIdsFilterProxyModel and
more
The code tried to be compatible with older Qt and newer but failed
to do so correctly. When a model only implemented `acceptRow` then
that was never called by newer Qt.
Instead, enforce all models to override `acceptRow` and prevent them
from overriding `filterAcceptsRow` - instead add the dance there to
make the code compatible to the old KRecursiveFilterProxyModel.
This unbreaks the "ctrl+shift+click" picker dialog to not show all
objects but really only those that are visible at the given position.
(cherry picked from commit 4e5205c228769ddb6b5a0fc84280aa05783b70f8)
---
common/recursiveproxymodelbase.cpp | 9 +++++++++
common/recursiveproxymodelbase.h | 14 ++++++--------
core/tools/resourcebrowser/resourcefiltermodel.cpp | 4 ++--
core/tools/resourcebrowser/resourcefiltermodel.h | 2 +-
4 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/common/recursiveproxymodelbase.cpp b/common/recursiveproxymodelbase.cpp
index 0ce52a168..c29cb30eb 100644
--- a/common/recursiveproxymodelbase.cpp
+++ b/common/recursiveproxymodelbase.cpp
@@ -12,7 +12,16 @@
*/
#include "recursiveproxymodelbase.h"
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
bool RecursiveProxyModelBase::acceptRow(int sourceRow, const QModelIndex &sourceParent) const
{
+ // delegate to base class
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
}
+#endif
+
+bool RecursiveProxyModelBase::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
+{
+ // delegate to acceptRow
+ return acceptRow(sourceRow, sourceParent);
+}
diff --git a/common/recursiveproxymodelbase.h b/common/recursiveproxymodelbase.h
index 82cc66dd7..cb716f081 100644
--- a/common/recursiveproxymodelbase.h
+++ b/common/recursiveproxymodelbase.h
@@ -22,7 +22,7 @@
* NOTE: This class can be removed once we raise our minimum Qt version to 5.10 or above
*/
-#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
+#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
#include <kde/krecursivefilterproxymodel.h>
#define GAMMARAY_PROXY_BASE_CLASS KRecursiveFilterProxyModel
#else
@@ -30,12 +30,7 @@
#define GAMMARAY_PROXY_BASE_CLASS QSortFilterProxyModel
#endif
-class GAMMARAY_COMMON_EXPORT RecursiveProxyModelBase : public
-#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
- KRecursiveFilterProxyModel
-#else
- QSortFilterProxyModel
-#endif
+class GAMMARAY_COMMON_EXPORT RecursiveProxyModelBase : public GAMMARAY_PROXY_BASE_CLASS
{
public:
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
@@ -46,8 +41,11 @@ public:
{
setRecursiveFilteringEnabled(true);
}
-#endif
virtual bool acceptRow(int sourceRow, const QModelIndex &sourceParent) const;
+#endif
+
+ // compat: always override acceptRow in subclasses
+ bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const final;
};
#endif
diff --git a/core/tools/resourcebrowser/resourcefiltermodel.cpp b/core/tools/resourcebrowser/resourcefiltermodel.cpp
index 7e1ad8e55..cad4a5394 100644
--- a/core/tools/resourcebrowser/resourcefiltermodel.cpp
+++ b/core/tools/resourcebrowser/resourcefiltermodel.cpp
@@ -24,11 +24,11 @@ ResourceFilterModel::ResourceFilterModel(QObject *parent)
{
}
-bool ResourceFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+bool ResourceFilterModel::acceptRow(int source_row, const QModelIndex &source_parent) const
{
const QModelIndex index = sourceModel()->index(source_row, 0, source_parent);
const QString path = index.data(ResourceModel::FilePathRole).toString();
if (path == QLatin1String(":/gammaray") || path.startsWith(QLatin1String(":/gammaray/")))
return false;
- return RecursiveProxyModelBase::filterAcceptsRow(source_row, source_parent);
+ return RecursiveProxyModelBase::acceptRow(source_row, source_parent);
}
diff --git a/core/tools/resourcebrowser/resourcefiltermodel.h b/core/tools/resourcebrowser/resourcefiltermodel.h
index 2e9d8c430..5bdbeedf0 100644
--- a/core/tools/resourcebrowser/resourcefiltermodel.h
+++ b/core/tools/resourcebrowser/resourcefiltermodel.h
@@ -22,7 +22,7 @@ class ResourceFilterModel : public RecursiveProxyModelBase
Q_OBJECT
public:
explicit ResourceFilterModel(QObject *parent = nullptr);
- bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
+ bool acceptRow(int source_row, const QModelIndex &source_parent) const override;
};
}
--
2.44.0

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Sat Apr 6 20:20:59 UTC 2024 - Christophe Marin <christophe@krop.fr>
- Add upstream changes:
* 0001-Fix-Qt-6.6-build.patch
* 0001-Repair-lack-of-classnames-in-Graphics-Scenes-or-Styl.patch
* 0001-QuickSceneGraphModel-don-t-nest-row-insertion-remova.patch
* 0001-Fix-gcc-13-warnings-about-references-to-temporaries.patch
* 0001-Fix-3-bugs-detected-by-QAbstractItemModelTester.patch
* 0001-Fix-two-issues-in-ObjectEnumModel-found-by-QAbstract.patch
* 0001-2-more-QAbstractItemModelTester-fixes.patch
* 0001-Unbreak-recursive-filtering-in-ObjectIdsFilterProxyM.patch
* 0001-Enable-building-with-Qt-6.7.patch
* 0001-Fix-build-on-6.7-for-after-QDeferredDeleteEvent-expo.patch
-------------------------------------------------------------------
Sat Nov 25 23:06:34 UTC 2023 - Fabian Vogt <fabian@ritter-vogt.de>

View File

@ -39,6 +39,16 @@ Source: https://github.com/KDAB/GammaRay/releases/download/v%{version}/%
Patch0: 0001-Fix-doc-tools-detection.patch
# PATCH-FIX-UPSTREAM
Patch1: gammaray-gles.patch
Patch2: 0001-Fix-Qt-6.6-build.patch
Patch3: 0001-Repair-lack-of-classnames-in-Graphics-Scenes-or-Styl.patch
Patch4: 0001-QuickSceneGraphModel-don-t-nest-row-insertion-remova.patch
Patch5: 0001-Fix-gcc-13-warnings-about-references-to-temporaries.patch
Patch6: 0001-Fix-3-bugs-detected-by-QAbstractItemModelTester.patch
Patch7: 0001-Fix-two-issues-in-ObjectEnumModel-found-by-QAbstract.patch
Patch8: 0001-2-more-QAbstractItemModelTester-fixes.patch
Patch9: 0001-Unbreak-recursive-filtering-in-ObjectIdsFilterProxyM.patch
Patch10: 0001-Enable-building-with-Qt-6.7.patch
Patch11: 0001-Fix-build-on-6.7-for-after-QDeferredDeleteEvent-expo.patch
BuildRequires: binutils-devel
BuildRequires: cmake >= 3.16.0
BuildRequires: doxygen