26 const bool sizeChanged = ( p.size() != mPixmap.size() );
29 if ( mPixmap.isNull() )
30 this->setMinimumHeight( 0 );
32 this->setMinimumHeight( PIXMAP_MINIMUM_HEIGHT );
39 QLabel::setPixmap( mPixmap.scaled( this->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
44 if ( mPixmap.isNull() )
47 return ( ( qreal )mPixmap.height() * width ) / mPixmap.width();
52 if ( mPixmap.isNull() )
55 const int w = this->width();
61 QLabel::resizeEvent( e );
62 if ( !mPixmap.isNull() )
65 QLabel::setPixmap( mPixmap.scaled( this->size() -= QSize( 1, 1 ), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
73 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.