How to enable dragging in QGraphicsScene?

你离开我真会死。 提交于 2019-12-07 07:49:26

问题


I'm trying to put two pictures in the QGraphicsScene. One is fixed and the other one is movable. But I succeed only in putting those pictures in the QGraphicsScene, I can't move them. How can I achieve this?


回答1:


You have to make sure the item is movable. Have a look at QGraphicsItem::setFlag.

You'll have to do something like this :

myImageItem->setFlag(QGraphicsItem::ItemIsMovable, true);


来源:https://stackoverflow.com/questions/3062465/how-to-enable-dragging-in-qgraphicsscene

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!