mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-03-05 05:19:59 +01:00
polygon editor : use QPropertyUndoCommand instead of ChangePartCommand
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4069 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -199,6 +199,7 @@ void PartPolygon::setPolygon(const QPolygonF &polygon)
|
||||
if (m_polygon == polygon) return;
|
||||
prepareGeometryChange();
|
||||
m_polygon = polygon;
|
||||
emit polygonChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -239,6 +240,14 @@ void PartPolygon::removeLastPoint()
|
||||
}
|
||||
}
|
||||
|
||||
void PartPolygon::setClosed(bool close)
|
||||
{
|
||||
if (m_closed == close) return;
|
||||
prepareGeometryChange();
|
||||
m_closed = close;
|
||||
emit closedChange();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PartPolygon::mousePressEvent
|
||||
* Handle mouse press event
|
||||
@@ -274,6 +283,7 @@ void PartPolygon::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
QPointF pos_ = event->modifiers() == Qt::ControlModifier ? event->pos() : mapFromScene(elementScene()->snapToGrid(event->scenePos()));
|
||||
prepareGeometryChange();
|
||||
m_polygon.replace(m_handler_index, pos_);
|
||||
emit polygonChanged();
|
||||
}
|
||||
else
|
||||
CustomElementGraphicPart::mouseMoveEvent(event);
|
||||
|
||||
@@ -45,6 +45,10 @@ class PartPolygon : public CustomElementGraphicPart
|
||||
private:
|
||||
PartPolygon(const PartPolygon &);
|
||||
|
||||
signals:
|
||||
void closedChange();
|
||||
void polygonChanged();
|
||||
|
||||
// methods
|
||||
public:
|
||||
enum { Type = UserType + 1105 };
|
||||
@@ -78,7 +82,7 @@ class PartPolygon : public CustomElementGraphicPart
|
||||
void removeLastPoint ();
|
||||
|
||||
bool isClosed () const {return m_closed;}
|
||||
void setClosed (bool c) {m_closed = c;}
|
||||
void setClosed (bool close);
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
|
||||
Reference in New Issue
Block a user