#ifndef GRAPHICSRECTITEM_H
#define GRAPHICSRECTITEM_H

#include "graphicsBaseItem.h"

class GraphicsRectItem : public GraphicsBaseItem
{
    Q_OBJECT
public:
    GraphicsRectItem(const QRect &rect, bool isRound = false, QGraphicsItem *parent = 0);
    virtual ~GraphicsRectItem();

    void resize(int,double, double, const QPointF&);
    void updateCoordinate();
    void move(const QPointF&);
    void editShape(int, const QPointF&);

    bool isRound() const { return m_bIsRound; }
    void setIsRound(bool round) { m_bIsRound = round; }
    double ratioX() const { return m_dRatioX; }
    double ratioY() const { return m_dRatioY; }
    void setRatioX(double rx) { m_dRatioX = rx; }
    void setRatioY(double ry) { m_dRatioY = ry; }

protected:
    virtual QPainterPath shape();
    virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*);

private:
    virtual void updateHandles();

    QRectF  m_lastBoudingRect; //记录上一时刻的boundingRect
    bool    m_bIsRound; //是否为圆角矩形
    double  m_dRatioX;
    double  m_dRatioY;
};

#endif
