-
Notifications
You must be signed in to change notification settings - Fork 0
/
crop.h
70 lines (54 loc) · 1.81 KB
/
crop.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
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
#pragma once
#include <QObject>
#include <QQmlEngine>
#include <QRectF>
class Crop : public QObject {
Q_OBJECT
QML_ELEMENT
Q_PROPERTY( QRectF crop READ crop WRITE setCrop NOTIFY cropChanged )
Q_PROPERTY( QSizeF boundaries READ boundaries WRITE setBoundaries NOTIFY boundariesChanged )
Q_PROPERTY( bool startDraw READ startDraw WRITE setStartDraw NOTIFY startDrawChanged )
Q_PROPERTY( int stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged )
public:
Crop( QObject* parent = nullptr );
enum class CompositionType { RuleOfThirds, Diagonal, GoldenRatio };
Q_ENUM( CompositionType )
const QRectF& crop() const;
const QSizeF& boundaries() const;
bool startDraw() const;
int stepSize() const;
public Q_SLOTS:
void reset();
void setCrop( const QRectF& newCrop );
void setBoundaries( const QSizeF& newboundaries );
void setStartDraw( bool newStartDraw );
void setStartPoint( QPointF newStartPoint );
void setStepSize( int newStepSize );
void makeRect( qreal mouseX, qreal mouseY );
void setX( qreal newX );
void setY( qreal newY );
void setTopLeft( QPointF newTopLeft );
void setTopRight( QPointF newTopRight );
void setBottomLeft( QPointF newBottomLeft );
void setBottomRight( QPointF newBottomRight );
void setLeft( qreal newLeft );
void setRight( qreal newRight );
void setTop( qreal newTop );
void setBottom( qreal newBottom );
void increaseX();
void increaseY();
void decreaseX();
void decreaseY();
Q_SIGNALS:
void cropChanged();
void boundariesChanged();
void startDrawChanged();
void stepSizeChanged();
private:
QRectF m_crop;
QSizeF m_boundaries;
QPointF m_startPoint;
bool m_startDraw;
int m_stepSize;
};
Q_DECLARE_METATYPE( Crop::CompositionType )