Remove weird non-virtual override in ImageLabel

This commit is contained in:
Joshua Goins 2023-08-31 14:08:24 +02:00
parent e5288d145a
commit aec3ffa4b3
3 changed files with 4 additions and 4 deletions

View file

@ -48,7 +48,7 @@ ArtDetailWindow::ArtDetailWindow(const QString &filename, const QDir &assetDirec
previewBox->setLayout(previewLayout); previewBox->setLayout(previewLayout);
auto imageView = new ImageLabel(); auto imageView = new ImageLabel();
imageView->setPixmap(QPixmap::fromImage(image)); imageView->setQPixmap(QPixmap::fromImage(image));
previewLayout->addWidget(imageView); previewLayout->addWidget(imageView);
m_titleEdit = new QLineEdit(); m_titleEdit = new QLineEdit();

View file

@ -11,7 +11,7 @@ ImageLabel::ImageLabel(QWidget *parent)
setScaledContents(false); setScaledContents(false);
} }
void ImageLabel::setPixmap(const QPixmap &p) void ImageLabel::setQPixmap(const QPixmap &p)
{ {
pix = p; pix = p;
QLabel::setPixmap(scaledPixmap()); QLabel::setPixmap(scaledPixmap());
@ -19,7 +19,7 @@ void ImageLabel::setPixmap(const QPixmap &p)
int ImageLabel::heightForWidth(int width) const int ImageLabel::heightForWidth(int width) const
{ {
return pix.isNull() ? this->height() : ((qreal)pix.height() * width) / pix.width(); return pix.isNull() ? height() : (pix.height() * width) / pix.width();
} }
QSize ImageLabel::sizeHint() const QSize ImageLabel::sizeHint() const

View file

@ -17,7 +17,7 @@ public:
[[nodiscard]] QPixmap scaledPixmap() const; [[nodiscard]] QPixmap scaledPixmap() const;
public Q_SLOTS: public Q_SLOTS:
void setPixmap(const QPixmap &); void setQPixmap(const QPixmap &);
void resizeEvent(QResizeEvent *) override; void resizeEvent(QResizeEvent *) override;
private: private: