PyQT5 - connect to mouseMoveEvent - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: PyQT5 - connect to mouseMoveEvent (/thread-14403.html) |
PyQT5 - connect to mouseMoveEvent - kainev - Nov-28-2018 Hi, I have class which inherits from QGraphicsRectItem which is being displayed in a graphics scene/view. It's just a rectangle that can be moved by dragging and resized, currently one of the functions it overrides is from QGraphicsRectItem is 'mouseMoveEvent'. I want to be able to connect other widgets to this event so as it's moved I can update the widgets. I've tried looking through the class to see if there were in-built signals I could connect to, like buttons 'clicked' signal, but I've had no luck so far. Thanks in advance, Kaine EDIT: So I attempted using signals for the QGraphicsRectItem but worked out that a class must derive from QObject to use signals. So far what I've done is subclassed my QGraphicsScene and have added signals to that. That way I can emit the signal in the QGraphicsRectItem by doing self.scene().mySignal.emit(). Please let me know if this is bad practice/there is a better way of accomplishing this. Thanks :) |