Congratulations to our 2022 Qt Champions!

Resizing QGraphicsItems

  • Hi,
    I have a problem when resizing customized QGraphicsItems.
    I am able to resize them by mouse dragging (drag from one of 8 resize handles, on ResizeHandle::mouseMove I actualy resize parentItem() ).
    The handle is a QGraphicsRectItem (4x4).
    The problem is that I want to establish a minimum width and a minimum height for all items ( eg minHeight,minWidth -> 20px).

    How can I restrict for instance the mouse vertical movement when I reach the minimum height ?

  • Take a look at the docs for "QGraphicsItem::itemChange": I think that can help you in this case.

Log in to reply