From 86677600990a9d9355fb6e2d460973699b990262 Mon Sep 17 00:00:00 2001 From: Timon Reinold Date: Wed, 9 Jul 2025 16:57:48 +0200 Subject: [PATCH] Avoid deprecated operator+(QMap::iterator, int) This operator+ is deprecated since Qt6.2: https://doc.qt.io/archives/qt-6.2/qmap-iterator.html. QMap is implemented as a red/black tree, presumably without storing subtree sizes, so this is a linear lookup. We need to call this for each displayed alias (multiple times), so linear complexity for lookup by rank is a bummer. But presumably nobody's going to have that many aliases, that this actually matters. Suggested-by: Copilot --- src/fdosecrets/widgets/SettingsModels.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/fdosecrets/widgets/SettingsModels.cpp b/src/fdosecrets/widgets/SettingsModels.cpp index 02f2b401d..98f218477 100644 --- a/src/fdosecrets/widgets/SettingsModels.cpp +++ b/src/fdosecrets/widgets/SettingsModels.cpp @@ -25,6 +25,7 @@ #include "gui/Icons.h" #include +#include namespace FdoSecrets { @@ -305,12 +306,12 @@ namespace FdoSecrets QVariantMap::const_iterator SettingsAliasesModel::rowAlias(const QModelIndex& index) const { - return m_aliases.cbegin() + index.row(); + return std::next(m_aliases.cbegin(), index.row()); } QVariantMap::iterator SettingsAliasesModel::rowAlias(const QModelIndex& index) { - return m_aliases.begin() + index.row(); + return std::next(m_aliases.begin(), index.row()); } QVariant SettingsAliasesModel::data(const QModelIndex& index, int role) const @@ -505,7 +506,7 @@ namespace FdoSecrets void SettingsAliasesModel::removeRow(int row) { beginRemoveRows({}, row, row); - m_aliases.erase(m_aliases.begin() + row); + m_aliases.erase(std::next(m_aliases.begin(), row)); endRemoveRows(); }