mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-05-02 11:29:59 +02:00
QetShapeItem can be edited via the properties editor dock
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4024 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -32,61 +32,62 @@ class QetShapeItem : public QetGraphicsItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
signals:
|
||||
void styleChanged();
|
||||
|
||||
public:
|
||||
Q_ENUMS(ShapeType)
|
||||
enum ShapeType {Line =0,
|
||||
Rectangle =1,
|
||||
Ellipse =2,
|
||||
Polyline =3 };
|
||||
Q_ENUMS(ShapeType)
|
||||
enum ShapeType {Line =0,
|
||||
Rectangle =1,
|
||||
Ellipse =2,
|
||||
Polyline =3 };
|
||||
|
||||
enum { Type = UserType + 1008 };
|
||||
enum { Type = UserType + 1008 };
|
||||
|
||||
QetShapeItem(QPointF, QPointF = QPointF(0,0), ShapeType = Line, QGraphicsItem *parent = 0);
|
||||
virtual ~QetShapeItem();
|
||||
QetShapeItem(QPointF, QPointF = QPointF(0,0), ShapeType = Line, QGraphicsItem *parent = 0);
|
||||
virtual ~QetShapeItem();
|
||||
|
||||
/**
|
||||
Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a QetShapeItem
|
||||
@return the QGraphicsItem type
|
||||
*/
|
||||
virtual int type() const { return Type; }
|
||||
//Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a QetShapeItem @return the QGraphicsItem type
|
||||
virtual int type() const { return Type; }
|
||||
|
||||
///METHODS
|
||||
void setStyle(Qt::PenStyle);
|
||||
///METHODS
|
||||
void setStyle(Qt::PenStyle);
|
||||
Qt::PenStyle penStyle() const { return m_shapeStyle;}
|
||||
|
||||
virtual bool fromXml (const QDomElement &);
|
||||
virtual QDomElement toXml (QDomDocument &document) const;
|
||||
virtual bool toDXF (const QString &filepath);
|
||||
virtual bool fromXml (const QDomElement &);
|
||||
virtual QDomElement toXml (QDomDocument &document) const;
|
||||
virtual bool toDXF (const QString &filepath);
|
||||
|
||||
virtual void editProperty();
|
||||
virtual QString name() const;
|
||||
virtual void editProperty();
|
||||
virtual QString name() const;
|
||||
|
||||
void setP2 (QPointF P2);
|
||||
void setP2 (QPointF P2);
|
||||
|
||||
//Methods available for polygon shape
|
||||
int pointsCount () const;
|
||||
void setNextPoint (QPointF P);
|
||||
void removePoints (int number = 1);
|
||||
//Methods available for polygon shape
|
||||
int pointsCount () const;
|
||||
void setNextPoint (QPointF P);
|
||||
void removePoints (int number = 1);
|
||||
|
||||
QRectF boundingRect() const;
|
||||
QPainterPath shape() const;
|
||||
QRectF boundingRect() const;
|
||||
QPainterPath shape() const;
|
||||
|
||||
protected:
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
virtual void hoverEnterEvent (QGraphicsSceneHoverEvent *event);
|
||||
virtual void hoverLeaveEvent (QGraphicsSceneHoverEvent *event);
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
virtual void hoverEnterEvent (QGraphicsSceneHoverEvent *event);
|
||||
virtual void hoverLeaveEvent (QGraphicsSceneHoverEvent *event);
|
||||
|
||||
private:
|
||||
void changeGraphicsItem (const ShapeType &newtype);
|
||||
void changeGraphicsItem (const ShapeType &newtype);
|
||||
|
||||
private slots:
|
||||
void previewScale(int factor);
|
||||
void previewScale(int factor);
|
||||
|
||||
///ATTRIBUTES
|
||||
///ATTRIBUTES
|
||||
private:
|
||||
ShapeType m_shapeType;
|
||||
Qt::PenStyle m_shapeStyle;
|
||||
QPointF m_P1, m_P2;
|
||||
QPolygonF m_polygon;
|
||||
bool m_hovered;
|
||||
ShapeType m_shapeType;
|
||||
Qt::PenStyle m_shapeStyle;
|
||||
QPointF m_P1, m_P2;
|
||||
QPolygonF m_polygon;
|
||||
bool m_hovered;
|
||||
};
|
||||
#endif // QETSHAPEITEM_H
|
||||
|
||||
Reference in New Issue
Block a user