refact: Compatible with Qt 6.2

Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
ComixHe 2023-09-06 16:49:47 +08:00 committed by Comix
parent 34a10bddb1
commit 6561747c7d
4 changed files with 10 additions and 5 deletions

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -459,7 +459,8 @@ ObjectMap dumpDBusObject(const QMap<QDBusObjectPath, QSharedPointer<T>> &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);
}

View File

@ -11,7 +11,8 @@
QStringList generateCommand(const QVariantMap &props) noexcept
{
std::vector<std::unique_ptr<LaunchOption>> 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<setUserLaunchOption>(value));
} else if (key == setEnvLaunchOption::key()) {