From f8e6c9c53cfeeb422b70e476671fd1c30d4a9798 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Thu, 16 Jun 2022 00:49:12 +0200 Subject: [PATCH] Speedup provider compilation --- scripts/emoji_codegen.py | 2 +- src/emoji/EmojiModel.cpp | 2 +- src/emoji/Provider.cpp | 2 +- src/emoji/Provider.h | 7 ++----- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/scripts/emoji_codegen.py b/scripts/emoji_codegen.py index f54b03d0..a0758454 100755 --- a/scripts/emoji_codegen.py +++ b/scripts/emoji_codegen.py @@ -14,7 +14,7 @@ class Emoji(object): def generate_qml_list(**kwargs): tmpl = Template(''' -const QVector emoji::Provider::emoji = { +const std::array emoji::Provider::emoji = { {%- for c in kwargs.items() %} // {{ c[0].capitalize() }} {%- for e in c[1] %} diff --git a/src/emoji/EmojiModel.cpp b/src/emoji/EmojiModel.cpp index 6f9ea9db..3381f767 100644 --- a/src/emoji/EmojiModel.cpp +++ b/src/emoji/EmojiModel.cpp @@ -45,7 +45,7 @@ EmojiModel::roleNames() const int EmojiModel::rowCount(const QModelIndex &parent) const { - return parent == QModelIndex() ? Provider::emoji.count() : 0; + return parent == QModelIndex() ? Provider::emoji.size() : 0; } QVariant diff --git a/src/emoji/Provider.cpp b/src/emoji/Provider.cpp index f5e7c0e8..f98e5d34 100644 --- a/src/emoji/Provider.cpp +++ b/src/emoji/Provider.cpp @@ -7,7 +7,7 @@ using namespace emoji; -const QVector emoji::Provider::emoji = { +const std::array emoji::Provider::emoji = { // People Emoji{QStringLiteral(u"\U0001F600"), QStringLiteral(u"grinning"), diff --git a/src/emoji/Provider.h b/src/emoji/Provider.h index 07a513ae..566c53a0 100644 --- a/src/emoji/Provider.h +++ b/src/emoji/Provider.h @@ -7,10 +7,7 @@ #pragma once #include -#include -#include -#include -#include +#include namespace emoji { Q_NAMESPACE @@ -49,7 +46,7 @@ class Provider { public: // all emoji for QML purposes - static const QVector emoji; + static const std::array emoji; }; } // namespace emoji