D22488: invoke QIcon::setFallbackThemeName a bit later
Albert Astals Cid
noreply at phabricator.kde.org
Sat May 23 00:19:19 BST 2020
aacid added a comment.
Wouldn't it make more sense to fix in Qt?
Something like
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 41fe649fc5..f86ad3c760 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -1260,7 +1260,7 @@ QString QIcon::fallbackThemeName()
*/
void QIcon::setFallbackThemeName(const QString &name)
{
- QIconLoader::instance()->setFallbackThemeName(name);
+ QIconLoader::instance(NoInializeNeeded)->setFallbackThemeName(name);
}
/*!
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 15ab1b3cd9..96dfd9163d 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -125,10 +125,12 @@ void QIconLoader::ensureInitialized()
}
}
-QIconLoader *QIconLoader::instance()
+QIconLoader *QIconLoader::instance(InstanceOptions o)
{
- iconLoaderInstance()->ensureInitialized();
- return iconLoaderInstance();
+ if (o == EnsureInitialized) {
+ iconLoaderInstance()->ensureInitialized();
+ }
+ return iconLoaderInstance();
}
// Queries the system theme and invalidates existing
diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h
index fac18b5d79..a69da4a5f7 100644
--- a/src/gui/image/qiconloader_p.h
+++ b/src/gui/image/qiconloader_p.h
@@ -185,7 +185,11 @@ public:
void setFallbackSearchPaths(const QStringList &searchPaths);
QStringList fallbackSearchPaths() const;
QIconDirInfo dirInfo(int dirindex);
- static QIconLoader *instance();
+ enum InstanceOptions {
+ NoInializeNeeded = 0,
+ EnsureInitialized = 1
+ }
+ static QIconLoader *instance(InstanceOptions o = EnsureInitialized);
void updateSystemTheme();
void invalidateKey() { m_themeKey++; }
void ensureInitialized();
I think this should be relatively easy to push though in Qt explaining that small ordering issue there is
Not sure it compiles, for some reason i can't compile Qt 5.15 branch right now
REPOSITORY
R302 KIconThemes
REVISION DETAIL
https://phabricator.kde.org/D22488
To: mart, #frameworks, #plasma
Cc: aacid, mlaurent, broulik, kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200522/394c7480/attachment-0001.htm>
More information about the Kde-frameworks-devel
mailing list