* Added the m_rotate_action to qetelementeditor.ui * Adding QAction to qetelementeditor.cpp and connecting it to new slot RotateElementsCommand defined in editorcommands.cpp

* Some types of elements need to specialize the setRotation method in order to behave correctly :
- PartTerminal needs to call setOrientation
- PartLine, PartRectangle and PartPolygon need a different rotation center.
This commit is contained in:
Adrien Allain
2021-09-13 20:38:39 +02:00
committed by Laurent Trinques
parent 9135099dbf
commit c640d96bca
12 changed files with 204 additions and 5 deletions

View File

@@ -293,6 +293,21 @@ void PartPolygon::resetAllHandlerColor()
}
}
void PartPolygon::setRotation(qreal angle) {
QTransform rotation = QTransform().translate(m_polygon.first().x(),m_polygon.first().y()).rotate(angle-m_rot).translate(-m_polygon.first().x(),-m_polygon.first().y());
m_rot=angle;
setPolygon(rotation.map(m_polygon));
}
qreal PartPolygon::rotation() const {
return m_rot;
}
/**
@brief PartPolygon::itemChange
@param change