Hide area of QGraphicsItem that is out of boundary
问题 I have a QGraphicsPixmap item in a QGraphicsScene . The item has flags set to ItemIsMovable , and ItemIsSelectable . How do I ensure that when the item is moved out of a certain boundary - it can be a QGraphicsScene or just a fixed frame size at fixed coordinates - the part becomes hidden? Eg. The left part of the basketball becomes hidden. 回答1: You have to use setClipPath() . In the following code I have created a class that inherits from QGraphicsPixmapItem (the same could do with other