Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QMainWindow: how to get a mouseReleaseEvent after resizing?

    General and Desktop
    qmainwindow resizeevent
    2
    4
    516
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      BwvB last edited by

      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,
      Bertwim

      JonB 1 Reply Last reply Reply Quote 0
      • JonB
        JonB @BwvB last edited by JonB

        @BwvB
        According to https://www.qtcentre.org/threads/52916-window-resizing-done?p=237042#post237042, 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 https://stackoverflow.com/questions/7753795/qt-user-resize-event-ends-stops

        B 1 Reply Last reply Reply Quote 1
        • B
          BwvB @JonB last edited by

          @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,

          .

          JonB 1 Reply Last reply Reply Quote 0
          • JonB
            JonB @BwvB last edited by

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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post