PyQt5 allows developers to define movable QGraphicsItems
by setting the itemIsMovable
flag, yet, this flag limits customization. The snippet in movable_disk.py
shows how to achieve a similar result by implementing movable QGraphicsItems
(here, a disk) w/o setting the itemIsMovable
flag, but by redefining the handlers for mouse events. In this way we allow for a more customizable motility, as demonstrated in movable_disk_group.py
: disks can now move individually (red disks) or altogether (green disks).
lewlin/movable-items
(Python, PyQt5) Show how to implement movable objects in PyQt w/o using the itemIsMovable flag.
Python