diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2024-01-16 09:31:02 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2024-01-26 14:51:35 +0100 |
commit | 3042d40be79f28eaa1828474bc8109d0dbe152b8 (patch) | |
tree | 135a0fde94a84faec1e17d979ee3c1d9634a9db4 /src/plugins/platforms | |
parent | 3a4397af2e5076a3425e92d8bbeae37b4267c389 (diff) |
Simplify new QIcon ThemeIcon constants and API
Originally we thought that exposing the string literal through the API
would be useful for people that want to know what icon they will get
when using a specific constant. But since the mapping from platform
independent icon name to platform specific icon name is anyway hidden
in the engine implementation, this is no longer useful.
Based on header review comments, simplify this by making the ThemeIcon
list of constants a scoped enum.
If it's really useful for e.g. designers to know which exact icon they
get on a specific platform, then we could, in a future release, add a
static QIcon::themeIconName API that returns the platform specific icon
string for a ThemeIcon constant.
Pick-to: 6.7
Change-Id: I231eb98fefb4ac82d38209b4e1257bb3caadeb08
Reviewed-by: Tor Arne VestbΓΈ <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformiconengine.cpp | 24 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsiconengine.cpp | 22 |
2 files changed, 23 insertions, 23 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformiconengine.cpp b/src/plugins/platforms/android/qandroidplatformiconengine.cpp index c66a6bd211..61dfa26cf0 100644 --- a/src/plugins/platforms/android/qandroidplatformiconengine.cpp +++ b/src/plugins/platforms/android/qandroidplatformiconengine.cpp @@ -225,18 +225,18 @@ QString QAndroidPlatformIconEngine::glyphs() const return {}; static constexpr std::pair<QLatin1StringView, QStringView> glyphMap[] = { - {QIcon::ThemeIcon::EditClear, u"\ue872"}, - {QIcon::ThemeIcon::EditCopy, u"\ue14d"}, - {QIcon::ThemeIcon::EditCut, u"\ue14e"}, - {QIcon::ThemeIcon::EditDelete, u"\ue14a"}, - {QIcon::ThemeIcon::EditFind, u"\ue8b6"}, - {QIcon::ThemeIcon::EditFindReplace, u"\ue881"}, - {QIcon::ThemeIcon::EditPaste, u"\ue14f"}, - {QIcon::ThemeIcon::EditRedo, u"\ue15a"}, - {QIcon::ThemeIcon::EditSelectAll, u"\ue162"}, - {QIcon::ThemeIcon::EditUndo, u"\ue166"}, - {QIcon::ThemeIcon::Printer, u"\ue8ad"}, - {QLatin1StringView("banana"), u"π"}, + {"edit-clear"_L1, u"\ue872"}, + {"edit-copy"_L1, u"\ue14d"}, + {"edit-cut"_L1, u"\ue14e"}, + {"edit-delete"_L1, u"\ue14a"}, + {"edit-find"_L1, u"\ue8b6"}, + {"edit-find-replace"_L1, u"\ue881"}, + {"edit-paste"_L1, u"\ue14f"}, + {"edit-redo"_L1, u"\ue15a"}, + {"edit-select-all"_L1, u"\ue162"}, + {"edit-undo"_L1, u"\ue166"}, + {"printer"_L1, u"\ue8ad"}, + {"banana"_L1, u"π"}, }; const auto it = std::find_if(std::begin(glyphMap), std::end(glyphMap), [this](const auto &c){ diff --git a/src/plugins/platforms/windows/qwindowsiconengine.cpp b/src/plugins/platforms/windows/qwindowsiconengine.cpp index e371af706b..abd36049e9 100644 --- a/src/plugins/platforms/windows/qwindowsiconengine.cpp +++ b/src/plugins/platforms/windows/qwindowsiconengine.cpp @@ -18,17 +18,17 @@ QString QWindowsIconEngine::glyphs() const return {}; static constexpr std::pair<QLatin1StringView, QStringView> glyphMap[] = { - {QIcon::ThemeIcon::EditClear, u"\ue894"}, - {QIcon::ThemeIcon::EditCopy, u"\ue8c8"}, - {QIcon::ThemeIcon::EditCut, u"\ue8c6"}, - {QIcon::ThemeIcon::EditDelete, u"\ue74d"}, - {QIcon::ThemeIcon::EditFind, u"\ue721"}, - {QIcon::ThemeIcon::EditPaste, u"\ue77f"}, - {QIcon::ThemeIcon::EditRedo, u"\ue7a6"}, - {QIcon::ThemeIcon::EditSelectAll, u"\ue8b3"}, - {QIcon::ThemeIcon::EditUndo, u"\ue7a7"}, - {QIcon::ThemeIcon::Printer, u"\ue749"}, - {QLatin1StringView("banana"), u"π"}, + {"edit-clear"_L1, u"\ue894"}, + {"edit-copy"_L1, u"\ue8c8"}, + {"edit-cut"_L1, u"\ue8c6"}, + {"edit-delete"_L1, u"\ue74d"}, + {"edit-find"_L1, u"\ue721"}, + {"edit-paste"_L1, u"\ue77f"}, + {"edit-redo"_L1, u"\ue7a6"}, + {"edit-select-all"_L1, u"\ue8b3"}, + {"edit-undo"_L1, u"\ue7a7"}, + {"printer"_L1, u"\ue749"}, + {"banana"_L1, u"π"}, }; const auto it = std::find_if(std::begin(glyphMap), std::end(glyphMap), [this](const auto &c){ |