#define ONMONITORRECTITEM_H
-#include <QtCore>
#include <QGraphicsRectItem>
+class QGraphicsView;
+
enum rectActions { Move, ResizeTopLeft, ResizeBottomLeft, ResizeTopRight, ResizeBottomRight, ResizeLeft, ResizeRight, ResizeTop, ResizeBottom, NoAction };
+
class OnMonitorRectItem : public QObject, public QGraphicsRectItem
{
Q_OBJECT
/** @brief Gets The action mode for the area @param pos +- 4.
* e.g. pos(0,0) returns ResizeTopLeft */
- rectActions getMode(QPointF pos);
+ rectActions getMode(const QPointF &pos);
/** @brief Reimplemented to draw the handles. */
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 );
protected:
- virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
- virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
- virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
- virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+ void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
double m_dar;
QPointF m_lastPoint;
bool m_modified;
+ QGraphicsView *m_view;
+
+ /** @brief Tries to get the view of the scene. */
+ bool getView();
+
signals:
void changed();
};