mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +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
@@ -30,7 +30,9 @@
|
||||
*/
|
||||
PartRectangle::PartRectangle(QETElementEditor *editor, QGraphicsItem *parent) :
|
||||
CustomElementGraphicPart(editor, parent)
|
||||
{}
|
||||
{
|
||||
m_rot=0;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief PartRectangle::~PartRectangle
|
||||
@@ -169,6 +171,18 @@ void PartRectangle::setYRadius(qreal Y)
|
||||
emit YRadiusChanged();
|
||||
}
|
||||
|
||||
void PartRectangle::setRotation(qreal angle) {
|
||||
|
||||
QTransform rotation = QTransform().rotate(angle-m_rot);
|
||||
m_rot=angle;
|
||||
|
||||
setRect(rotation.mapRect(m_rect));
|
||||
}
|
||||
|
||||
qreal PartRectangle::rotation() const {
|
||||
return m_rot;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief PartRectangle::sceneGeometricRect
|
||||
@return the minimum, margin-less rectangle this part can fit into, in scene
|
||||
@@ -187,7 +201,7 @@ QRectF PartRectangle::sceneGeometricRect() const
|
||||
*/
|
||||
QPointF PartRectangle::sceneTopLeft() const
|
||||
{
|
||||
return(mapToScene(rect().topLeft()));
|
||||
return(mapToScene(rect().topLeft()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user