]> git.sesse.net Git - kdenlive/blobdiff - src/onmonitoritems/onmonitorcornersitem.h
Fix includes
[kdenlive] / src / onmonitoritems / onmonitorcornersitem.h
index aaade57c3746002cac43078d4856efa3f4f603cf..5701c33ca0782c22bade28c21adc4f9b33391578 100644 (file)
 #ifndef ONMONITORCORNERSITEM_H
 #define ONMONITORCORNERSITEM_H
 
-#include "abstractonmonitoritem.h"
 
-#include <QtCore>
 #include <QGraphicsPolygonItem>
 
-class OnMonitorCornersItem : public AbstractOnMonitorItem, public QGraphicsPolygonItem
+class QGraphicsView;
+
+class OnMonitorCornersItem : public QObject, public QGraphicsPolygonItem
 {
     Q_OBJECT
 public:
-    OnMonitorCornersItem(MonitorScene *scene, QGraphicsItem *parent = 0);
+    OnMonitorCornersItem(QGraphicsItem *parent = 0);
 
     enum cornersActions { Corner, Move, MoveSide, NoAction };
     /** @brief Gets The action mode for the area @param pos +- 4. */
-    cornersActions getMode(QPointF pos, int *corner);
+    cornersActions getMode(const QPointF &pos, int *corner);
 
     /** @brief Reimplemented to draw the handles. */
-    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 );
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 );
 
-public slots:
-    /** @brief Saves current mouse position and mode. */
-    void slotMousePressed(QGraphicsSceneMouseEvent *event);
-    /** @brief Modifies item according to mouse position and mode. */
-    void slotMouseMoved(QGraphicsSceneMouseEvent *event);
+protected:
+    void mousePressEvent(QGraphicsSceneMouseEvent *event);
+    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+    void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
 
 private:
     /** @brief Returns the centroid (= 'center of mass') of this polygon. */
@@ -52,10 +52,19 @@ private:
     /** @brief Returns the points of this polygon but sorted clockwise. */
     QList <QPointF> sortedClockwise();
 
+    /** @brief Tries to get the view of the scene. */
+    bool getView();
+
     cornersActions m_mode;
     /** Number of the selected corner or if in MoveSide mode number of the first corner on this side */
     int m_selectedCorner;
     QPointF m_lastPoint;
+    bool m_modified;
+
+    QGraphicsView *m_view;
+
+signals:
+    void changed();
 };
 
 #endif