Clearing icon cache.

This commit is contained in:
Martin Rotter 2015-06-29 16:48:18 +02:00
parent 4ffab88435
commit bcb2421be1
3 changed files with 9 additions and 0 deletions

View File

@ -283,6 +283,9 @@ void FormMain::setupIcons() {
// Setup icons on TabWidget too.
m_ui->m_tabWidget->setupIcons();
// Most of icons are loaded, clear the cache.
qApp->icons()->clearCache();
}
void FormMain::loadSize() {

View File

@ -57,6 +57,10 @@ QByteArray IconFactory::toByteArray(const QIcon &icon) {
return array.toBase64();
}
void IconFactory::clearCache() {
m_cachedIcons.clear();
}
void IconFactory::setupSearchPaths() {
QIcon::setThemeSearchPaths(QStringList() << APP_THEME_PATH);
qDebug("Available icon theme paths: %s.",

View File

@ -44,6 +44,8 @@ class IconFactory : public QObject {
QIcon fromByteArray(QByteArray array);
QByteArray toByteArray(const QIcon &icon);
void clearCache();
// Returns icon from active theme or invalid icon if
// "no icon theme" is set.
inline QIcon fromTheme(const QString &name) {