I am building a footage library, where each thumbnail is a QIcon on a QPushButton. I’d like the thumbnails to advance a frame as the user middle-mouse-button scrolls on top of the QPushButton. The challenge is getting which widget is under the mouse at the time of scroll.
I’m getting the X and Y position of the wheel-scrolling event like this:
def wheelEvent(self, event):
x = event.pos().x()
y = event.pos().y()
So, is there is some native PyQt function I’m overlooking, like getWidgetAt(x,y) that I could use to figure out which QPushButton the user is hovering over?
Thank you for your advice!
You can get the widget with either
But it would make more sense to subclass
QPushButtonto implementwheelEventdirectly inside the target widget.