37 lines
798 B
C++
Executable File
37 lines
798 B
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* A QLabel that rescales the set pixmap with respect of the current aspect ratio
|
|
* $Id: flm_preview_file_dialog.cpp 52224 2020-09-30 12:31:15Z ojog_i $
|
|
* $HeadURL: svn://192.168.133.21/TDS/branches/product/iterations/21_01_chaos/Lts/Plugins/FileManagement/Gui/Explorer/flm_preview_file_dialog.cpp $
|
|
* $Author: ojog_i $
|
|
*
|
|
* Created by Mike Wille, SLTE, 2020-03-03
|
|
*/
|
|
|
|
#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;
|
|
};
|
|
|