mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-03-07 23:29:59 +01:00
Many files were changed, so debugging required. Minor Bug exists: If we export to xml first time, it is OK. But if we then add another shape and then export, then the new shape is not added in XML. Reason: UndoAction not implemented at present for basi shape addition. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2888 bfdf4180-ca20-0410-9c96-a3a8aa849046
53 lines
1.4 KiB
C++
53 lines
1.4 KiB
C++
#ifndef QETSHAPEITEM_H
|
|
#define QETSHAPEITEM_H
|
|
|
|
#include "qetgraphicsitem.h"
|
|
|
|
class QetShapeItem : public QetGraphicsItem
|
|
{
|
|
public:
|
|
|
|
enum ShapeType {
|
|
Line = 0,
|
|
Rectangle,
|
|
Ellipse
|
|
};
|
|
|
|
QetShapeItem(QPointF, QPointF = QPointF(0,0), ShapeType = Line, 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);
|
|
QLineF *getLine();
|
|
QRectF *getRectangle();
|
|
QRectF *getEllipse();
|
|
virtual bool fromXml(const QDomElement &);
|
|
virtual QDomElement toXml(QDomDocument &document) const;
|
|
void setWritingXml(bool writing) { _writingXml = writing; }
|
|
|
|
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;
|
|
QPointF _lineP1;
|
|
QPointF _lineP2;
|
|
bool _writingXml;
|
|
|
|
virtual void editProperty() {}
|
|
|
|
protected:
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
|
QRectF boundingRect() const;
|
|
QPainterPath shape() const;
|
|
|
|
};
|
|
|
|
#endif // QETSHAPEITEM_H
|