我对 Qt 中的 QGraphicsView 很陌生。
据我所知,没有内置方法可以使用鼠标在场景中调整 QGraphicsItem 的大小。
我正在寻找的是能够通过拖出屏幕上的角或边缘来调整 QGraphicsRectItem 的大小。
有没有一种简单的方法可以做到这一点?在线某处是否有实现此功能的库或一段代码?
我目前正在使用 Qt 4.5.1。
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.