From ae36c1dc9c395e010334532319faaf4e3a911365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 11 May 2023 15:31:22 +0200 Subject: [PATCH] Invalidate QIconLoader cache when setting fallback theme Setting a fallback theme will affect the lookup strategy, so we need to invalidate earlier lookups. Pick-to: 6.5 6.6 Change-Id: I962245ddb3a20b7798d5ce831ed8a369b0ab76b4 Reviewed-by: Friedemann Kleint Reviewed-by: Axel Spoerl --- src/gui/image/qiconloader.cpp | 1 + tests/auto/gui/image/qicon/CMakeLists.txt | 2 ++ .../qicon/icons/fallbacktheme/16x16/edit-cut.png | Bin 0 -> 267 bytes .../image/qicon/icons/fallbacktheme/index.theme | 8 ++++++++ tests/auto/gui/image/qicon/tst_qicon.cpp | 8 ++++++++ 5 files changed, 19 insertions(+) create mode 100644 tests/auto/gui/image/qicon/icons/fallbacktheme/16x16/edit-cut.png create mode 100644 tests/auto/gui/image/qicon/icons/fallbacktheme/index.theme diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index d0adf9b8f2..10d5f65b80 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -164,6 +164,7 @@ void QIconLoader::setFallbackThemeName(const QString &themeName) { qCDebug(lcIconLoader) << "Setting fallback theme name to" << themeName; m_userFallbackTheme = themeName; + invalidateKey(); } void QIconLoader::setThemeSearchPath(const QStringList &searchPaths) diff --git a/tests/auto/gui/image/qicon/CMakeLists.txt b/tests/auto/gui/image/qicon/CMakeLists.txt index c900c60d5b..2d212defb7 100644 --- a/tests/auto/gui/image/qicon/CMakeLists.txt +++ b/tests/auto/gui/image/qicon/CMakeLists.txt @@ -56,6 +56,8 @@ set(tst_qicon_resource_files "./icons/themeparent/index.theme" "./icons/themeparent/scalable/actions/address-book-new.svg" "./icons/themeparent/scalable/actions/appointment-new.svg" + "./icons/fallbacktheme/index.theme" + "./icons/fallbacktheme/16x16/edit-cut.png" "./second_icons/testtheme/32x32/actions/appointment-new.png" "./styles/commonstyle/images/standardbutton-open-128.png" "./styles/commonstyle/images/standardbutton-open-16.png" diff --git a/tests/auto/gui/image/qicon/icons/fallbacktheme/16x16/edit-cut.png b/tests/auto/gui/image/qicon/icons/fallbacktheme/16x16/edit-cut.png new file mode 100644 index 0000000000000000000000000000000000000000..661ef1ad030c8889444d4bff3940e34267b0763a GIT binary patch literal 267 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GGLLkg|>2BR0px|Cl z7sn8b-nBv8qRj>Z-T@6Qo-WvkPeA22$!bT9sT=b0+MW7r+PfV{eR=grsmMZfdpyEV0&VP2eN zh0Nzu41NrG3~cW2%Z|I3Xdm+4*;Cd2K@sv2)XSnJ+B z_`vh8kb8HXih8F__Z8NV!orHl7j7I>