# HG changeset patch # User Chris Cannam # Date 1500387109 -3600 # Node ID a9c2e791ab8d5a3f2dd532c68a129dee748db91b # Parent f683b191dbe6317bc2a09a863b280b6d9390dccd Fix loading of should-not-auto-invert scalable icons diff -r f683b191dbe6 -r a9c2e791ab8d widgets/IconLoader.cpp --- 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