-
Notifications
You must be signed in to change notification settings - Fork 0
/
agcliprectangleitem.h
48 lines (38 loc) · 1.38 KB
/
agcliprectangleitem.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
#ifndef AGCLIPRECTANGLEITEM_H
#define AGCLIPRECTANGLEITEM_H
#include <QObject>
#include <QGraphicsRectItem>
#include <QDebug>
#include <QKeyEvent>
#include <QGraphicsSceneMouseEvent>
class AGClipRectangleItem: public QObject, public QGraphicsRectItem
{
Q_OBJECT
int draggedWidth;
int draggedX;
QPointF mDragStartPosition;
QPointF mDragEndPosition;
bool mDragging;
bool leftDragZone;
bool midDragZone;
bool rightDragZone;
int originalClipIn;
int originalClipOut;
public:
AGClipRectangleItem(QGraphicsItem *parent = nullptr);
void setRect(const QRectF &rectangle);
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
signals:
void agItemChanged(QGraphicsItem *clipItem);
void agMouseReleased(QGraphicsItem *clipItem);
void hoverPositionChanged(QGraphicsItem *clipItem, double position);
private slots:
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
QRectF boundingRect() const override;
};
#endif // AGCLIPRECTANGLEITEM_H