-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTargetImageWidget.h
40 lines (31 loc) · 974 Bytes
/
TargetImageWidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef TARGETIMAGEWIDGET_H
#define TARGETIMAGEWIDGET_H
#include "PanAndZoomWidget.h"
/**
* This application requires a 4096 by 4096 image to work with, this widget
* aims to allow a user to load, scale, translate and rotate any image so that
* it fills a 4096 * 4096 area.
*/
class TargetImageWidget : public PanAndZoomWidget {
Q_OBJECT
public:
explicit TargetImageWidget(QWidget* parent = nullptr);
void LoadImage(QString fileName);
QImage GetImageInViewTargetArea() const;
QImage GetWholeImage() const;
signals:
void onUseWholeImageRequested();
public slots:
void onLoadImageRequested();
void onSaveImageRequested();
void onResetTranslationRequested();
void onFitToTargetRequested();
void onRotateRequested();
protected:
virtual void paintEvent(QPaintEvent* event) override;
private:
QImage image_;
void PaintImage(QPainter& p) const;
QRectF GetTargetRect() const;
};
#endif // TARGETIMAGEWIDGET_H