diff --git a/src/platform/qt/ShortcutModel.cpp b/src/platform/qt/ShortcutModel.cpp index aa37bff90..331fa6c37 100644 --- a/src/platform/qt/ShortcutModel.cpp +++ b/src/platform/qt/ShortcutModel.cpp @@ -80,7 +80,7 @@ QModelIndex ShortcutModel::index(int row, int column, const QModelIndex& parent) pmenu = static_cast(parent.internalPointer())->name; } QString name = m_controller->name(row, pmenu); - Item* item = &(*const_cast*>(&m_cache))[name]; + Item* item = &m_cache[name]; item->name = name; item->shortcut = m_controller->shortcut(name); return createIndex(row, column, item); @@ -95,7 +95,7 @@ QModelIndex ShortcutModel::parent(const QModelIndex& index) const { if (parent.isNull()) { return QModelIndex(); } - Item* pitem = &(*const_cast*>(&m_cache))[parent]; + Item* pitem = &m_cache[parent]; pitem->name = parent; pitem->shortcut = m_controller->shortcut(parent); return createIndex(m_controller->indexIn(parent), 0, pitem); diff --git a/src/platform/qt/ShortcutModel.h b/src/platform/qt/ShortcutModel.h index 69893ef9c..3eb3b1178 100644 --- a/src/platform/qt/ShortcutModel.h +++ b/src/platform/qt/ShortcutModel.h @@ -44,7 +44,7 @@ private: const Shortcut* shortcut = nullptr; }; - QHash m_cache; + mutable QHash m_cache; }; } \ No newline at end of file