Python Forum
PyQT5 - connect to mouseMoveEvent
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PyQT5 - connect to mouseMoveEvent
#1
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 :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Huge code problems (buttons(PyQt5),PyQt5 Threads, Windows etc) ZenWoR 0 2,823 Apr-06-2019, 11:15 PM
Last Post: ZenWoR

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020