#include #include #include #include class ImagePreviewWidget : public QWidget { Q_OBJECT signals: void clicked(); public: ImagePreviewWidget(QWidget *parent=nullptr); void updateImage(const QImage &image); void updateBackgroundColor(const QColor &color); protected: void paintEvent(QPaintEvent *event); void mousePressEvent(QMouseEvent *event); private: QImage m_image; QColor m_backgroundColor; void resizeImage(QImage *image, const QSize &newSize); };