diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-17 08:56:43 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-07-02 10:10:17 -0400 |
| commit | a13067602590f16484561b9ca23f15aa45089db8 (patch) | |
| tree | cda0cd0069642b4ef3b03f811be127934b8a7740 /src/modinfodialogimages.h | |
| parent | 9f1520c69e88113d9a1a06f91bbabe9cf5ddef9f (diff) | |
images list now vertical on the left
reworked scaling to respect aspect ratio and not exceed original size
Diffstat (limited to 'src/modinfodialogimages.h')
| -rw-r--r-- | src/modinfodialogimages.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/modinfodialogimages.h b/src/modinfodialogimages.h index 3c492e77..73fb5936 100644 --- a/src/modinfodialogimages.h +++ b/src/modinfodialogimages.h @@ -3,19 +3,29 @@ #include "modinfodialog.h" -class ThumbnailButton : public QPushButton +class ScalableImage : public QWidget { Q_OBJECT; public: - ThumbnailButton(const QString& fullPath, QImage image); + ScalableImage(QImage image={}); + + void setImage(QImage image); const QImage& image() const; + bool hasHeightForWidth() const; + int heightForWidth(int w) const; + signals: - void open(const QImage& image); + void clicked(const QImage& image); + +protected: + void paintEvent(QPaintEvent* e) override; + void mousePressEvent(QMouseEvent* e) override; private: - const QImage m_original; + QImage m_original, m_scaled; + int m_border; }; @@ -29,9 +39,10 @@ public: private: Ui::ModInfoDialog* ui; + ScalableImage* m_image; void add(const QString& fullPath); - void onOpen(const QImage& image); + void onClicked(const QImage& image); }; #endif // MODINFODIALOGIMAGES_H |
