[Icon Item] Don't needlessly unset imagePath

We'll eventually delete the Plasma::Svg anyway if we failed to find an appropriate icon.
Just need to make sure we don't use isValid with the old source set but this is only done with
m_usesPlasmaTheme, hence the new check there, also optimizes the non-themed case.

Differential Revision: https://phabricator.kde.org/D7584
This commit is contained in:
Kai Uwe Broulik 2017-08-30 16:39:53 +02:00
parent 5921b2a70c
commit a963302926

View File

@ -175,13 +175,10 @@ void IconItem::setSource(const QVariant &source)
//try as a svg icon from plasma theme
m_svgIcon->setImagePath(QLatin1String("icons/") + sourceString.section('-', 0, 0));
m_svgIcon->setContainsMultipleImages(true);
//invalidate the image path to recalculate it later
} else {
m_svgIcon->setImagePath(QString());
}
//success?
if (m_svgIcon->isValid() && m_svgIcon->hasElement(sourceString)) {
if (m_usesPlasmaTheme && m_svgIcon->isValid() && m_svgIcon->hasElement(sourceString)) {
m_icon = QIcon();
m_svgIconName = sourceString;
//ok, svg not available from the plasma theme