mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-26 13:20:52 +01:00
* 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:
committed by
Laurent Trinques
parent
9135099dbf
commit
c640d96bca
@@ -603,6 +603,19 @@ void PartLine::setSecondEndLength(const qreal &l)
|
||||
emit secondEndLengthChanged();
|
||||
}
|
||||
|
||||
void PartLine::setRotation(qreal angle) {
|
||||
|
||||
QTransform rotation = QTransform().translate(m_line.p1().x(),m_line.p1().y()).rotate(angle-m_rot).translate(-m_line.p1().x(),-m_line.p1().y());
|
||||
m_rot=angle;
|
||||
|
||||
setLine(rotation.map(m_line));
|
||||
}
|
||||
|
||||
qreal PartLine::rotation() const {
|
||||
return m_rot;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@brief PartLine::path
|
||||
@return this line has a QPainterPath.
|
||||
|
||||
Reference in New Issue
Block a user