Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Resize a rotated GraphicsItem from Center
Forum Updated to NodeBB v4.3 + New Features

Resize a rotated GraphicsItem from Center

Scheduled Pinned Locked Moved Unsolved General and Desktop
qgraphicsitemqgraphicsscene
1 Posts 1 Posters 248 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sayan275
    wrote on last edited by sayan275
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved