17#include "moc_qgspixmaplabel.cpp"
27 const bool sizeChanged = ( p.size() != mPixmap.size() );
30 if ( mPixmap.isNull() )
31 this->setMinimumHeight( 0 );
33 this->setMinimumHeight( PIXMAP_MINIMUM_HEIGHT );
40 QLabel::setPixmap( mPixmap.scaled( this->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
45 if ( mPixmap.isNull() )
48 return ( ( qreal ) mPixmap.height() * width ) / mPixmap.width();
53 if ( mPixmap.isNull() )
56 const int w = this->width();
62 QLabel::resizeEvent( e );
63 if ( !mPixmap.isNull() )
66 QLabel::setPixmap( mPixmap.scaled( this->size() -= QSize( 1, 1 ), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
74 this->setMinimumHeight( 0 );
void clear()
Clears any label contents.
int heightForWidth(int width) const override
Calculates the height for the given width.
QSize sizeHint() const override
An optimal size for the widget.
void resizeEvent(QResizeEvent *) override
void setPixmap(const QPixmap &)
QgsPixmapLabel(QWidget *parent=nullptr)
Constructor for QgsPixmapLabel.