mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
[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.
This commit is contained in:
parent
958aee1d41
commit
04de4a0b02
1 changed files with 3 additions and 3 deletions
|
@ -39,7 +39,7 @@ ThemeWidget::ThemeWidget(const ThemeInfo& info, QWidget* parent)
|
||||||
layout->addWidget( m_check, 1 );
|
layout->addWidget( m_check, 1 );
|
||||||
|
|
||||||
const QSize image_size{
|
const QSize image_size{
|
||||||
qMax(12 * CalamaresUtils::defaultFontHeight(), 120),
|
qMax(12 * CalamaresUtils::defaultFontHeight(), 120),
|
||||||
qMax(8 * CalamaresUtils::defaultFontHeight(), 80) };
|
qMax(8 * CalamaresUtils::defaultFontHeight(), 80) };
|
||||||
|
|
||||||
QPixmap image( info.imagePath );
|
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;
|
cDebug() << "Theme image" << info.imagePath << "not found, hash" << hash_color;
|
||||||
image.fill( QColor( QRgb( 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 );
|
QLabel* image_label = new QLabel( this );
|
||||||
image_label->setPixmap( image );
|
image_label->setPixmap( image );
|
||||||
|
|
Loading…
Add table
Reference in a new issue