From 407ff0a99d843e7de0725dc535b57436ef2b2ce4 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 20 Oct 2015 13:24:11 +0200 Subject: [PATCH] Theme: cache the QIcon::fromTheme We are calling that every time we draw the folder delegate. Which is a lot when the sync is runing and the progress bar is moving --- src/libsync/theme.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index 6cb127567..094d6a09d 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -124,14 +124,14 @@ QIcon Theme::themeIcon( const QString& name, bool sysTray ) const flavor = QLatin1String("colored"); } - if( QIcon::hasThemeIcon( name )) { - // use from theme - return QIcon::fromTheme( name ); - } - QString key = name + "," + flavor; QIcon & cached = _iconCache[key]; if (cached.isNull()) { + if(QIcon::hasThemeIcon(name)) { + // use from theme + return cached = QIcon::fromTheme(name); + } + QList sizes; sizes <<16 << 22 << 32 << 48 << 64 << 128 << 256; foreach (int size, sizes) { -- 2.30.2