Basic Shapes: DXF Export added.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2886 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
abhishekm71
2014-02-28 08:20:00 +00:00
parent f131790f5d
commit 0af7b828b0
3 changed files with 61 additions and 20 deletions

View File

@@ -25,6 +25,37 @@ void QetShapeItem::setFullyBuilt(bool isBuilt)
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable);
}
QLineF *QetShapeItem::getLine()
{
QRectF rect = boundingRect();
QLineF *line = 0;
if (_shapeType == Line) {
if (_lineAngle)
line = new QLineF(rect.topRight(), rect.bottomLeft());
else
line = new QLineF(rect.topLeft(), rect.bottomRight());
}
return line;
}
QRectF *QetShapeItem::getRectangle()
{
QRectF rect = boundingRect();
QRectF *rec = 0;
if (_shapeType == Rectangle)
rec = new QRectF(rect);
return rec;
}
QRectF *QetShapeItem::getEllipse()
{
QRectF rect = boundingRect();
QRectF *rec = 0;
if (_shapeType == Ellipse)
rec = new QRectF(rect);
return rec;
}
QRectF QetShapeItem::boundingRect() const
{
return _boundingRect;

View File

@@ -17,11 +17,14 @@ class QetShapeItem : public QetGraphicsItem
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; }
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);
QLineF *getLine();
QRectF *getRectangle();
QRectF *getEllipse();
private:
ShapeType _shapeType;
@@ -30,6 +33,8 @@ class QetShapeItem : public QetGraphicsItem
bool _lineAngle; // false if line from topleft corner to bottomright corner
// and true if line from topright corner to bottomleft corner
bool _isFullyBuilt;
QPointF _lineP1;
QPointF _lineP2;
virtual void editProperty() {}