Files
qelectrotech-source-mirror/sources/qetgraphicsitem/qetshapeitem.h
abhishekm71 8e4c71c3e7 Basic shapes: Items can be selected and moved (thanks joshua)
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2879 bfdf4180-ca20-0410-9c96-a3a8aa849046
2014-02-27 09:55:54 +00:00

44 lines
1.1 KiB
C++

#ifndef QETSHAPEITEM_H
#define QETSHAPEITEM_H
#include "qetgraphicsitem.h"
class QetShapeItem : public QetGraphicsItem
{
public:
enum ShapeType {
Line,
Rectangle,
Ellipse
};
QetShapeItem(QPointF, QPointF, ShapeType, bool lineAngle = false, QGraphicsItem *parent = 0);
virtual ~QetShapeItem();
void setStyle(Qt::PenStyle);
Qt::PenStyle getStyle() const { return _shapeStyle; }
ShapeType getType() const { return _shapeType; }
void setBoundingRect(QRectF rec) { _boundingRect = rec; }
void setLineAngle(bool lineAngle){ _lineAngle = lineAngle; }
void setFullyBuilt(bool isBuilt);
private:
ShapeType _shapeType;
Qt::PenStyle _shapeStyle;
QRectF _boundingRect;
bool _lineAngle; // false if line from topleft corner to bottomright corner
// and true if line from topright corner to bottomleft corner
bool _isFullyBuilt;
virtual void editProperty() {}
protected:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QRectF boundingRect() const;
QPainterPath shape() const;
};
#endif // QETSHAPEITEM_H