From aac89104bd378cb2c8fff888b55286962d0c16b4 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 10 Dec 2014 19:18:47 +0100 Subject: [PATCH] roundToIconSize(0) should return 0 If an invalid icon size is passed to roundToIconSize we should return an invalid icon size. This can cause IconItem to load a small pixmap which will never be shown. Change-Id: Ia678f2e879b83317e2971069acf8f00d9ce2e052 --- src/declarativeimports/core/units.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/declarativeimports/core/units.cpp b/src/declarativeimports/core/units.cpp index dfc817af2..ba065539a 100644 --- a/src/declarativeimports/core/units.cpp +++ b/src/declarativeimports/core/units.cpp @@ -107,9 +107,10 @@ QQmlPropertyMap *Units::iconSizes() const int Units::roundToIconSize(int size) { /*Do *not* use devicePixelIconSize here, we want to use the sizes of the pixmaps of the smallest icons on the disk. And those are unaffected by dpi*/ - if (size < KIconLoader::SizeSmall) { + if (size <= 0) { + return 0; + } else if (size < KIconLoader::SizeSmall) { return KIconLoader::SizeSmall/2; - } else if (size < KIconLoader::SizeSmallMedium) { return KIconLoader::SizeSmall;