Important: Please read the Qt Code of Conduct -

Widgets stealing mouse wheel focus from one another.

  • Here's a video of my app in action and you can see what happens when I mouse wheel:

    I have a FlowLayout:

    Containing a dynamic list of QGraphicsView widgets essentially. I have zoom capability on the customized QGraphicsViews using the mouseWheelEvent.

    However, as you can see midway through the video, when you mouse wheel and your focused on an editor (view), then the FlowLayout also scrolls.

    So essentially the event is being captured by two handlers. Whereas the desired behavior is that it should only zoom the editor.


    If it helps, here is the complete source code which is rather clean and easy to navigate:

  • Solved it with this code added to my FlowLayout:

        def addWidget(self, widget):
        def eventFilter(self, watched, event):
            if event.type() == QEvent.Wheel:
                return True
            return super().eventFilter(watched, event)

Log in to reply