30 lines
399 B
C++
Executable File
30 lines
399 B
C++
Executable File
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <QLabel>
|
|
#include <QObject>
|
|
#include <QPixmap>
|
|
|
|
|
|
class RatioAwareLabel : public QLabel
|
|
{
|
|
public:
|
|
RatioAwareLabel(QWidget *parent);
|
|
|
|
protected:
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
QSize sizeHint() const override;
|
|
|
|
public slots:
|
|
void setPixmap(const QPixmap &pixmap);
|
|
|
|
private:
|
|
int heightRatio(int width) const;
|
|
void scale();
|
|
|
|
QPixmap m_pixmap;
|
|
};
|
|
|