Bottom Page

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 :)
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  PyQt5 : Interpreter Crashes While Initializing Message Box iMuny 6 67 Aug-23-2019, 07:38 PM
Last Post: Denni
  Find active PyQT5 textline and add result to dictionary mart79 3 145 Jul-31-2019, 03:25 PM
Last Post: Denni
  PyQT5 : Unable to Create Another Dialog While One is Open iMuny 3 245 Jul-17-2019, 11:40 AM
Last Post: iMuny
  updating to pyqt5 LavaCreeperKing 4 333 Jun-30-2019, 10:13 PM
Last Post: LavaCreeperKing
  pyQt5 QCalendarWidget setHeaderTextFormat zazen000 0 284 Apr-14-2019, 11:50 PM
Last Post: zazen000
  Huge code problems (buttons(PyQt5),PyQt5 Threads, Windows etc) ZenWoR 0 246 Apr-06-2019, 11:15 PM
Last Post: ZenWoR
  [Pyqt5]Display name of new inserted USB stick on GUI Atalanttore 0 352 Mar-24-2019, 08:29 PM
Last Post: Atalanttore
  Python3/PyQt5/gnuplot on linux erg 1 284 Mar-20-2019, 01:57 PM
Last Post: Axel_Erfurt
  How to show graph as a slideshow in PyQt5 using matplotlib binsha 0 661 Mar-08-2019, 03:58 AM
Last Post: binsha
  [PyQt] How to pass arguments in QDBusConnection connect() method Alfalfa 1 306 Mar-07-2019, 03:59 AM
Last Post: Alfalfa

Forum Jump:


Users browsing this thread: 1 Guest(s)