From 04de4a0b028057060c5b998918078c6546a0d3bc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 14 Feb 2018 11:23:53 -0500 Subject: [PATCH] [plasmalnf] Properly scale the image - Since the image size isn't known a priori (due to sizing based on fonts), load the image and then resize in all code paths. - Use the right resizing flags. - .. and actually use the resulting scaled pixmap. Thanks to Jeff Hodd. --- src/modules/plasmalnf/ThemeWidget.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/plasmalnf/ThemeWidget.cpp b/src/modules/plasmalnf/ThemeWidget.cpp index b3f6d161e..f2a038030 100644 --- a/src/modules/plasmalnf/ThemeWidget.cpp +++ b/src/modules/plasmalnf/ThemeWidget.cpp @@ -39,7 +39,7 @@ ThemeWidget::ThemeWidget(const ThemeInfo& info, QWidget* parent) layout->addWidget( m_check, 1 ); const QSize image_size{ - qMax(12 * CalamaresUtils::defaultFontHeight(), 120), + qMax(12 * CalamaresUtils::defaultFontHeight(), 120), qMax(8 * CalamaresUtils::defaultFontHeight(), 80) }; QPixmap image( info.imagePath ); @@ -57,8 +57,8 @@ ThemeWidget::ThemeWidget(const ThemeInfo& info, QWidget* parent) cDebug() << "Theme image" << info.imagePath << "not found, hash" << hash_color; image.fill( QColor( QRgb( hash_color ) ) ); } - else - image.scaled( image_size ); + + image = image.scaled( image_size, Qt::KeepAspectRatio, Qt::SmoothTransformation ); QLabel* image_label = new QLabel( this ); image_label->setPixmap( image );