mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-03-11 08:54:48 +00:00
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
This commit is contained in:
parent
913c912677
commit
8667760099
1 changed files with 4 additions and 3 deletions
|
|
@ -25,6 +25,7 @@
|
|||
#include "gui/Icons.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <iterator>
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue