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 <Friedemann.Kleint@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
parent
059f4dc6f8
commit
ae36c1dc9c
@ -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)
|
||||
|
@ -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"
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 267 B |
@ -0,0 +1,8 @@
|
||||
[Icon Theme]
|
||||
Name=fallbacktheme
|
||||
|
||||
Directories=16x16
|
||||
|
||||
[16x16]
|
||||
Size=16
|
||||
Type=Fixed
|
@ -717,6 +717,11 @@ void tst_QIcon::fromTheme()
|
||||
QCOMPARE(i.availableSizes(), abIcon.availableSizes());
|
||||
}
|
||||
|
||||
// Check that setting a fallback theme invalidates earlier lookups
|
||||
QVERIFY(QIcon::fromTheme("edit-cut").isNull());
|
||||
QIcon::setFallbackThemeName("fallbacktheme");
|
||||
QVERIFY(!QIcon::fromTheme("edit-cut").isNull());
|
||||
|
||||
// Make sure setting the theme name clears the state
|
||||
QIcon::setThemeName("");
|
||||
abIcon = QIcon::fromTheme("address-book-new");
|
||||
@ -725,6 +730,9 @@ void tst_QIcon::fromTheme()
|
||||
// Passing a full path to fromTheme is not very useful, but should work anyway
|
||||
QIcon fullPathIcon = QIcon::fromTheme(m_pngImageFileName);
|
||||
QVERIFY(!fullPathIcon.isNull());
|
||||
|
||||
// Restore to system fallback theme
|
||||
QIcon::setFallbackThemeName("");
|
||||
}
|
||||
|
||||
static inline QString findGtkUpdateIconCache()
|
||||
|
Loading…
Reference in New Issue
Block a user