34 lines
835 B
C++
34 lines
835 B
C++
#ifndef GRAPHICSPOLYGONITEM_H
|
|
#define GRAPHICSPOLYGONITEM_H
|
|
|
|
#include "graphicsBaseItem.h"
|
|
|
|
class GraphicPolygonItem : public GraphicsBaseItem
|
|
{
|
|
public:
|
|
GraphicPolygonItem(QGraphicsItem *parent = 0);
|
|
virtual ~GraphicPolygonItem();
|
|
|
|
void resize(int,double, double, const QPointF&);
|
|
void updateCoordinate();
|
|
void move(const QPointF&);
|
|
void editShape(int, const QPointF&);
|
|
|
|
void addPoint(const QPointF&);
|
|
bool endDrawing();
|
|
QPolygonF getPoints(void) { return m_points; }
|
|
|
|
protected:
|
|
virtual QPainterPath shape();
|
|
virtual QRectF boundingRect();
|
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*);
|
|
|
|
private:
|
|
virtual void updateHandles();
|
|
|
|
QPolygonF m_lastPoints; //记录上一时刻的点集数据,用于缩放等操作
|
|
QPolygonF m_points;
|
|
};
|
|
|
|
#endif
|