mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-22 01:10:53 +01:00
use Qt-functions to rotate lines and polygons
This commit is contained in:
@@ -297,21 +297,9 @@ void PartPolygon::resetAllHandlerColor()
|
||||
|
||||
|
||||
void PartPolygon::setRotation(qreal angle) {
|
||||
for (auto &punkt : m_polygon) {
|
||||
double tmp, x, y;
|
||||
if (angle > 0) {
|
||||
tmp = punkt.y();
|
||||
y = punkt.x();
|
||||
x = (-1) * tmp;
|
||||
} else {
|
||||
tmp = punkt.x();
|
||||
x = punkt.y();
|
||||
y = (-1) * tmp;
|
||||
}
|
||||
punkt = QPointF(x, y);
|
||||
}
|
||||
|
||||
setPolygon(m_polygon);
|
||||
QTransform rotation = QTransform().rotate(angle);
|
||||
m_rot += angle;
|
||||
setPolygon(rotation.map(m_polygon));
|
||||
prepareGeometryChange();
|
||||
adjustHandlerPos();
|
||||
emit polygonChanged();
|
||||
|
||||
Reference in New Issue
Block a user