Use QHash instead of QMap when key is a pointer type

Ordering in container by pointer to memory doesn't make much sense.
QHash is faster for lookups in this case.

Change-Id: I0d4bdac7f5bb9afffdeaef70b99326547c080f55
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2020-11-17 00:23:17 +01:00
parent 5efbdd5f10
commit 2c919c43be
8 changed files with 12 additions and 11 deletions

View File

@@ -207,7 +207,7 @@ void updateEditorToolBar(Core::IEditor *editor)
TextDocument *document = textEditor->textDocument();
Client *client = LanguageClientManager::clientForDocument(textEditor->textDocument());
static QMap<QWidget *, QAction *> actions;
static QHash<QWidget *, QAction *> actions;
if (actions.contains(widget)) {
auto action = actions[widget];
@@ -253,7 +253,7 @@ void updateEditorToolBar(Core::IEditor *editor)
});
}
static QMap<QWidget *, QPair<Client *, QAction *>> outlines;
static QHash<QWidget *, QPair<Client *, QAction *>> outlines;
if (outlines.contains(widget)) {
auto outline = outlines[widget];