2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2015-06-20 01:04:54 +02:00
|
|
|
*
|
2020-08-20 22:42:19 +02:00
|
|
|
* SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2017 Adriaan de Groot <groot@kde.org>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2015-06-20 01:04:54 +02:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2015-06-20 01:04:54 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "FixedAspectRatioLabel.h"
|
|
|
|
|
|
|
|
|
|
|
|
FixedAspectRatioLabel::FixedAspectRatioLabel( QWidget* parent )
|
|
|
|
: QLabel( parent )
|
2019-08-13 20:57:52 +02:00
|
|
|
{
|
|
|
|
}
|
2015-06-20 01:04:54 +02:00
|
|
|
|
|
|
|
|
2020-05-01 10:01:24 +02:00
|
|
|
FixedAspectRatioLabel::~FixedAspectRatioLabel() { }
|
2015-06-20 01:04:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
FixedAspectRatioLabel::setPixmap( const QPixmap& pixmap )
|
|
|
|
{
|
|
|
|
m_pixmap = pixmap;
|
2019-08-13 20:57:52 +02:00
|
|
|
QLabel::setPixmap( pixmap.scaled( contentsRect().size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
|
2015-06-20 01:04:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
FixedAspectRatioLabel::resizeEvent( QResizeEvent* event )
|
|
|
|
{
|
2019-04-17 11:57:46 +02:00
|
|
|
Q_UNUSED( event )
|
2019-08-13 20:57:52 +02:00
|
|
|
QLabel::setPixmap( m_pixmap.scaled( contentsRect().size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
|
2015-06-20 01:04:54 +02:00
|
|
|
}
|