From ffea029001e42f9f06384ee39af7cf04b24610ff Mon Sep 17 00:00:00 2001 From: Gianluca Recchia Date: Thu, 17 Jan 2019 06:03:58 +0100 Subject: [PATCH] Replace QMap with QHash when the key is a pointer QHash gives faster lookups than QMap when the key is a pointer. --- src/gui/MessageBox.cpp | 4 ++-- src/gui/MessageBox.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/MessageBox.cpp b/src/gui/MessageBox.cpp index 5878aff69..582baa5cc 100644 --- a/src/gui/MessageBox.cpp +++ b/src/gui/MessageBox.cpp @@ -20,8 +20,8 @@ MessageBox::Button MessageBox::m_nextAnswer(MessageBox::NoButton); -QMap MessageBox::m_addedButtonLookup = - QMap(); +QHash MessageBox::m_addedButtonLookup = + QHash(); QMap> MessageBox::m_buttonDefs = QMap>(); diff --git a/src/gui/MessageBox.h b/src/gui/MessageBox.h index ded415f6a..b8bd10ad8 100644 --- a/src/gui/MessageBox.h +++ b/src/gui/MessageBox.h @@ -19,6 +19,7 @@ #ifndef KEEPASSX_MESSAGEBOX_H #define KEEPASSX_MESSAGEBOX_H +#include #include #include #include @@ -102,7 +103,7 @@ public: private: static Button m_nextAnswer; - static QMap m_addedButtonLookup; + static QHash m_addedButtonLookup; static QMap> m_buttonDefs; static Button messageBox(QWidget* parent,