]> git.sesse.net Git - kdenlive/blobdiff - src/onmonitoritems/onmonitorrectitem.h
Fix includes
[kdenlive] / src / onmonitoritems / onmonitorrectitem.h
index 96e3db366f0613cc9a053c6711ef3c92e74b8273..6530495fa10acd4d716aabb7157c4838a390cd63 100644 (file)
 #ifndef ONMONITORRECTITEM_H
 #define ONMONITORRECTITEM_H
 
-#include "abstractonmonitoritem.h"
 
-#include <QtCore>
 #include <QGraphicsRectItem>
 
+class QGraphicsView;
+
 enum rectActions { Move, ResizeTopLeft, ResizeBottomLeft, ResizeTopRight, ResizeBottomRight, ResizeLeft, ResizeRight, ResizeTop, ResizeBottom, NoAction };
 
-class OnMonitorRectItem : public AbstractOnMonitorItem, public QGraphicsRectItem
+
+class OnMonitorRectItem : public QObject, public QGraphicsRectItem
 {
     Q_OBJECT
 public:
-    OnMonitorRectItem(const QRectF &rect, MonitorScene *scene, QGraphicsItem *parent = 0);
+    OnMonitorRectItem(const QRectF &rect, double dar, QGraphicsItem *parent = 0);
 
     /** @brief Gets The action mode for the area @param pos +- 4.
      * e.g. pos(0,0) returns ResizeTopLeft */
-    rectActions getMode(QPoint pos);
-    
-    /*enum { Type = UserType + 1};
-    / ** @brief Reimplemented to make sure casting works. * /
-    int type() const;*/
+    rectActions getMode(const QPointF &pos);
 
     /** @brief Reimplemented to draw the handles. */
     virtual 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:
+    double m_dar;
     rectActions m_mode;
-    QPointF m_clickPoint;
+    QRectF m_oldRect;
+    QPointF m_lastPoint;
+    bool m_modified;
+
+    QGraphicsView *m_view;
+
+    /** @brief Tries to get the view of the scene. */
+    bool getView();
+
+signals:
+    void changed();
 };
 
 #endif