From 6561747c7d0f3be379c3e2ae2d69b314fbd07a7f Mon Sep 17 00:00:00 2001 From: ComixHe Date: Wed, 6 Sep 2023 16:49:47 +0800 Subject: [PATCH] refact: Compatible with Qt 6.2 Signed-off-by: ComixHe --- src/dbus/applicationservice.cpp | 3 ++- src/desktopentry.cpp | 6 ++++-- src/global.h | 3 ++- src/launchoptions.cpp | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/dbus/applicationservice.cpp b/src/dbus/applicationservice.cpp index 39b5126..33030aa 100644 --- a/src/dbus/applicationservice.cpp +++ b/src/dbus/applicationservice.cpp @@ -459,7 +459,8 @@ void ApplicationService::removeAllInstance() noexcept QDBusObjectPath ApplicationService::findInstance(const QString &instanceId) const { - for (const auto &[path, ptr] : m_Instances.asKeyValueRange()) { + for (auto it = m_Instances.constKeyValueBegin(); it != m_Instances.constKeyValueEnd(); ++it) { + const auto &[path, ptr] = *it; if (ptr->instanceId() == instanceId) { return path; } diff --git a/src/desktopentry.cpp b/src/desktopentry.cpp index 20f96b0..aad79ce 100644 --- a/src/desktopentry.cpp +++ b/src/desktopentry.cpp @@ -237,9 +237,11 @@ bool DesktopEntry::checkMainEntryValidation() const noexcept auto type = it->find("Type"); if (type == it->end()) { qWarning() << "No Type."; - for (const auto &[k, v] : it->asKeyValueRange()) { + for (auto tmp = it->constKeyValueBegin(); tmp != it->constKeyValueEnd(); ++tmp) { + const auto& [k,v] = *tmp; qInfo() << "keyName:" << k; - for (const auto &[key, value] : v.asKeyValueRange()) { + for (auto valIt = v.constKeyValueBegin() ; valIt != v.constKeyValueEnd(); ++valIt) { + const auto &[key, value] = *valIt; qInfo() << key << value; } } diff --git a/src/global.h b/src/global.h index 64263ed..7c3c2be 100644 --- a/src/global.h +++ b/src/global.h @@ -459,7 +459,8 @@ ObjectMap dumpDBusObject(const QMap> &map) { ObjectMap objs; - for (const auto &[key, value] : map.asKeyValueRange()) { + for (auto it = map.constKeyValueBegin(); it != map.constKeyValueEnd(); ++it) { + const auto &[key, value] = *it; auto interAndProps = getChildInterfacesAndPropertiesFromObject(value.data()); objs.insert(key, interAndProps); } diff --git a/src/launchoptions.cpp b/src/launchoptions.cpp index ee769da..8ed8498 100644 --- a/src/launchoptions.cpp +++ b/src/launchoptions.cpp @@ -11,7 +11,8 @@ QStringList generateCommand(const QVariantMap &props) noexcept { std::vector> options; - for (const auto &[key, value] : props.asKeyValueRange()) { + for (auto it = props.constKeyValueBegin(); it!= props.constKeyValueEnd(); ++it) { + const auto &[key, value] = *it; if (key == setUserLaunchOption::key()) { options.push_back(std::make_unique(value)); } else if (key == setEnvLaunchOption::key()) {