I am fairly new to Qt (PyQt - PySide).
I am trying to build a custom widget which is a menu. However I have hit a hard road and I can not seem to be able to sort myself out. I've read the documentation but I don't think there is a mouse state I can verify to find out if mouse cursor is over the given widget.
I am calling a function upon the mouseReleaseEvent
of a QWidget
.
Ex.:
def mouseReleaseEvent(self, e):
When this event is triggered, I have to know if the mouse is actually over the widget or outside of it (the widget of which this event is triggered).
if mouseCursorOverSelf == True:
# do something ..
How can I achieve this? What do I need to do?
Thank you very much!
underMouse() is what should be used to determine whether your mouse is over a widget.Usage: widget.underMouse()
http://pyqt.sourceforge.net/Docs/PyQt4/qwidget.html#underMouse
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With