X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fonmonitoritems%2Fonmonitorrectitem.h;h=6530495fa10acd4d716aabb7157c4838a390cd63;hb=9f42f1faa3f2c0e23def9890c9cf644a3e75f9c5;hp=96e3db366f0613cc9a053c6711ef3c92e74b8273;hpb=a1a30d2dc43371481086a5718743642451d01302;p=kdenlive diff --git a/src/onmonitoritems/onmonitorrectitem.h b/src/onmonitoritems/onmonitorrectitem.h index 96e3db36..6530495f 100644 --- a/src/onmonitoritems/onmonitorrectitem.h +++ b/src/onmonitoritems/onmonitorrectitem.h @@ -21,39 +21,47 @@ #ifndef ONMONITORRECTITEM_H #define ONMONITORRECTITEM_H -#include "abstractonmonitoritem.h" -#include #include +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