Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Resize a rotated GraphicsItem from Center



  • https://forum.qt.io/topic/67664/solved-resizable-rotatable-graphicsitem

    Hello, the above post resizes with the handle selected and changes the center of the boundingRect.
    I need to do the same by keyPressEvent and it would resize the rotated boundingRect uniformly from center, ie, it'll increase the width by 1 unit on both right and left sides, similarly decrease by 1 unit on both sides and similarly increase/decrease the height.
    Now the problem with keyPress is that we'll not get
    QPointF ptMouseMoveInItemsCoord = mapFromScene(event->scenePos()); //in mouseMoveEvent
    so we know where to set the edges of the boundingRect, but we don't have this when we increment/decrement the width/height on both sides uniformly without changing the center.

    How can we find the new scenecoords of the boundingRect, known old sceneCoords, angle, width and height of boundingRect, center should remain same?

    Any help is appreciated.

    Regards,
    Sayan