From 5052e39cbc7397fa3b62e0b2f4bab3d9a8e8309e Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Thu, 20 Nov 2014 16:15:59 +0100 Subject: [PATCH] Keep aspect ratio for image requests with width or height being 0. --- src/libtomahawk/utils/ImageRegistry.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libtomahawk/utils/ImageRegistry.cpp b/src/libtomahawk/utils/ImageRegistry.cpp index 17e6eb8f3..f13d21f33 100644 --- a/src/libtomahawk/utils/ImageRegistry.cpp +++ b/src/libtomahawk/utils/ImageRegistry.cpp @@ -116,7 +116,12 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, TomahawkUtils::I } if ( !size.isNull() && pixmap.size() != size ) - pixmap = pixmap.scaled( size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ); + { + Qt::AspectRatioMode aspect = Qt::IgnoreAspectRatio; + if ( size.height() == 0 || size.width() == 0 ) + aspect = Qt::KeepAspectRatio; + pixmap = pixmap.scaled( size, aspect, Qt::SmoothTransformation ); + } putInCache( image, size, mode, opacity, pixmap, tint ); }