4
votes

I'm pretty new to QGraphicsView in Qt.

As far as I can tell there is no built in way to resize a QGraphicsItem in a scene with a mouse.

What I'm looking for is to be able to resize a QGraphicsRectItem by either dragging out the corners or the edges on screen.

Is there a simple way to do that? Is there a library or a piece of code somewhere online that implements this functionality?

I'm currently using Qt 4.5.1.

1

1 Answers

5
votes

I guess this thread has a similar question. You will have to manually resize the item after intercepting the mousemove events. You can get the 'pos' from 'event' argument like:-

QPointF pt = event->pos()

Use this point 'pt' for resizing to the correct location.

Also lookup the 'Elastic Nodes' application in Qt Demos application. This will help.