Important: Please read the Qt Code of Conduct -

get new point coordinates on a rect after applying transformation

  • I rotated a rect to 90 on its center. P is point on initial rect,
    QPoint P(x,y);

    qreal angle = ...;
    QRect rect = ...;
    Qpoint center =;
    QTransform t = QTransform().translate( center.x(), center-y() ).rotate( angle ).translate( -center.x(), -center.y() );
    Qrect rotatedRect = t.mapToRect( rect );

    Now how to get new coordinated of P on rotatedRect ?

  • QPoint rotatedP =;

Log in to reply