Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMainWindow: how to get a mouseReleaseEvent after resizing?

QMainWindow: how to get a mouseReleaseEvent after resizing?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qmainwindowresizeevent
4 Posts 2 Posters 1.3k Views
  • 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 Offline
    B Offline
    BwvB
    wrote on last edited by
    #1

    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

    JonBJ 1 Reply Last reply
    0
    • B BwvB

      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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @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
      1
      • JonBJ 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 Offline
        B Offline
        BwvB
        wrote on last edited by
        #3

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

        .

        JonBJ 1 Reply Last reply
        0
        • B BwvB

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

          .

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

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

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved