use Qt-functions to rotate lines and polygons

This commit is contained in:
plc-user
2025-02-16 15:28:15 +01:00
parent e98ce4de1d
commit 2aeae1fe46
3 changed files with 10 additions and 39 deletions

View File

@@ -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();