Important: Please read the Qt Code of Conduct -

QMainWindow: how to get a mouseReleaseEvent after resizing?

  • I would like to perform an action after I resize a QMainWindow (dragging the mouseafter cloicking the border or a cornerpoint.)
    Straightforward connecting a slot to a resizeEvent is not what I need, as while resizing the QMainWindow many of these events are emitted. I only want to do the action once, only after the 'last resizeEvent'. So I thought to override the 'mouseRelaeseEvent' virtual function in my (subclassed) QMainWindow. However, this does not work. When I release the mouse after dragging the main window at a corner, the mouseReleaseEvent is not entered.

    Q: how do I catch this mouse release event, after I have changed my QMainWIndow by resizing it at a corner?

    Kind Regards,

  • @BwvB
    According to, there is no "end resize event", and you have to do by QTimer after no resize event for a while. Which is what i thought of. Though I would have thought you would need some way of knowing if the user keeps the mouse down yet does not move for a while, so no resize events, but you'll have to investigate.

    Looks like a more thorough discussion is in

  • @JonB Ah, indeed. Exactly the same question, asked 9 years back! Thanks for pointing me to it, I will investigate the QTimer option. Weird, that this problem needs such an indirect solution, but so be it. I would have expected that releasing the mouse button would have caused some signal to be emitted,


  • @BwvB
    I don't know whether installing an eventFilter somewhere would see the mouse release. But I don't see the solutions mentioning that.

Log in to reply