2023-08-31 09:09:52 +02:00
|
|
|
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-03-27 12:49:53 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
2023-08-31 13:39:59 +02:00
|
|
|
class ImageLabel : public QLabel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2023-03-27 12:49:53 -04:00
|
|
|
public:
|
2023-08-31 13:39:59 +02:00
|
|
|
explicit ImageLabel(QWidget *parent = nullptr);
|
2023-03-27 12:49:53 -04:00
|
|
|
|
2023-08-31 13:39:59 +02:00
|
|
|
[[nodiscard]] int heightForWidth(int width) const override;
|
|
|
|
[[nodiscard]] QSize sizeHint() const override;
|
|
|
|
[[nodiscard]] QPixmap scaledPixmap() const;
|
2023-03-27 12:49:53 -04:00
|
|
|
|
2023-08-31 10:02:32 +02:00
|
|
|
public Q_SLOTS:
|
2023-08-31 13:39:59 +02:00
|
|
|
void setPixmap(const QPixmap &);
|
|
|
|
void resizeEvent(QResizeEvent *) override;
|
2023-03-27 12:49:53 -04:00
|
|
|
|
|
|
|
private:
|
2023-08-31 13:39:59 +02:00
|
|
|
QPixmap pix;
|
2023-03-27 12:49:53 -04:00
|
|
|
};
|