36 setScaledContents(
false);
41 if (fullPixmap.isNull())
43 return static_cast<int>(
static_cast<qreal
>(width) * fullPixmap.height() / fullPixmap.width());
48 return fullPixmap.scaled(this->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
53 if (fullPixmap.isNull())
55 int w = std::min(width(), static_cast<int>(fullPixmap.width() / fullPixmap.devicePixelRatio()));
62 if (!fullPixmap.isNull())
69 if (fullPixmap.isNull())
70 QLabel::setPixmap(pixmap);
void setPixmap(const QPixmap &pixmap)
setPixmap Sets the current pixmap
QPixmap scaledPixmap() const
scaledPixmap Scale the pixmap to fit desired size
virtual void resizeEvent(QResizeEvent *event)
virtual QSize sizeHint() const
sizeHint Calculate desired size
ScaledPixmapLabel(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
ScaledPixmapLabel.
virtual int heightForWidth(int width) const
heightForWidth Given a desired width, return the desired height