-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimagewidget.h
More file actions
73 lines (64 loc) · 1.74 KB
/
imagewidget.h
File metadata and controls
73 lines (64 loc) · 1.74 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
class QUndoStack;
class QLabel;
class ImageWidget : public QWidget
{
Q_OBJECT
public:
explicit ImageWidget(QWidget *parent = 0);
QImage image() const;
QString filePath() const;
QSize sizeHint() const;
void setImage(const QImage &image);
void paste(const QImage &image);
bool load(const QString &filePath);
bool save(const QString &filePath);
bool canUndo() const;
bool canRedo() const;
QString redoText() const;
QString undoText() const;
void zoom(qreal m);
void autoImageResize();
bool canZoomIn() const;
bool canZoomOut() const;
qreal magnification() const;
bool isAutoImageResize() const;
signals:
void canRedoChanged(bool canRedo);
void canUndoChanged(bool canUndo);
void cleanChanged(bool clean);
void undoTextChanged(const QString &undoText);
void redoTextChanged(const QString &redoText);
void canZoomInChanged(bool canZoomIn);
void canZoomOutChanged(bool canZoomOut);
void magnificationChanged(qreal m);
void autoImageResizeChanged(bool flag);
public slots:
void undo();
void redo();
void filterGrayscale();
void filterTo1Bit();
void linearFilter();
void medianFilter();
void normFilter();
void filterInsertRandomNoise();
void zoomIn();
void zoomOut();
void zoomFullScale();
void setAutoImageResize(bool yes);
protected:
void resizeEvent(QResizeEvent *event);
void wheelEvent(QWheelEvent *event);
private:
void updateImageLabel();
void emitZoomStateChanged();
QImage m_image;
QLabel *m_imageLabel;
QUndoStack *m_stack;
QString m_filePath;
qreal m_magnification;
bool m_flagAutoImageResize;
};
#endif // WIDGET_H