开发者

How to enable dragging in QGraphicsScene?

开发者 https://www.devze.com 2023-01-04 00:39 出处:网络
I\'m trying to put two pictures in the QGraphicsScene. One is fixed and the other one is movable. But I succ开发者_如何学Pythoneed only in putting those pictures in the QGraphicsScene, I can\'t move t

I'm trying to put two pictures in the QGraphicsScene. One is fixed and the other one is movable. But I succ开发者_如何学Pythoneed only in putting those pictures in the QGraphicsScene, I can't move them. How can I achieve this?


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);
0

精彩评论

暂无评论...
验证码 换一张
取 消