Mercurial > hg > svgui
changeset 1262:a9c2e791ab8d
Fix loading of should-not-auto-invert scalable icons
author | Chris Cannam |
---|---|
date | Tue, 18 Jul 2017 15:11:49 +0100 |
parents | f683b191dbe6 |
children | 5bab9562eaa3 |
files | widgets/IconLoader.cpp |
diffstat | 1 files changed, 14 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/widgets/IconLoader.cpp Mon Jul 10 14:24:25 2017 +0100 +++ b/widgets/IconLoader.cpp Tue Jul 18 15:11:49 2017 +0100 @@ -96,30 +96,35 @@ QString scalableName, nonScalableName; QPixmap pmap; + // attempt to load a pixmap with the right size and inversion nonScalableName = makeNonScalableFilename(name, size, invert); pmap = QPixmap(nonScalableName); - if (!pmap.isNull()) return pmap; - if (size > 0) { + if (pmap.isNull() && size > 0) { + // if that failed, load a scalable vector with the right + // inversion and scale it scalableName = makeScalableFilename(name, invert); pmap = loadScalable(scalableName, size); - if (!pmap.isNull()) return pmap; } - if (invert && shouldAutoInvert(name)) { - + if (pmap.isNull() && invert) { + // if that failed, and we were asking for an inverted pixmap, + // that may mean we don't have an inverted version of it. We + // could either auto-invert or use the uninverted version nonScalableName = makeNonScalableFilename(name, size, false); pmap = QPixmap(nonScalableName); - if (!pmap.isNull()) return invertPixmap(pmap); - if (size > 0) { + if (pmap.isNull() && size > 0) { scalableName = makeScalableFilename(name, false); pmap = loadScalable(scalableName, size); - if (!pmap.isNull()) return invertPixmap(pmap); + } + + if (!pmap.isNull() && shouldAutoInvert(name)) { + pmap = invertPixmap(pmap); } } - return QPixmap(); + return pmap; } QPixmap