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
This commit is contained in:
David Edmundson 2014-12-10 19:18:47 +01:00
parent d47e417e40
commit aac89104bd

View File

@ -107,9 +107,10 @@ QQmlPropertyMap *Units::iconSizes() const
int Units::roundToIconSize(int size) 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*/ /*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; return KIconLoader::SizeSmall/2;
} else if (size < KIconLoader::SizeSmallMedium) { } else if (size < KIconLoader::SizeSmallMedium) {
return KIconLoader::SizeSmall; return KIconLoader::SizeSmall;