Results 1 to 5 of 5

Thread: Getting the moment when resize is finished

  1. #1
    Join Date
    Sep 2006
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Getting the moment when resize is finished

    Hi guys.
    I have an unexpected problem with getting the last resize event. In other words I need to know when user is finished with resizing. I've tried to reimplement mouseReleaseEvent but unfortunately this doesn't work since I receive no events of such type while resizing the window. Maybe I should implement the corresponding event filter but something suggests to me that there is an easier way to get what I want...

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Getting the moment when resize is finished

    I usually suggest triggering a timer from the resize event that will timeout after a second or so of resize inactivity. If you assume that one second is a long enough period between consecutive resizes to assume they are two separate resize series, you can connect a slot to the timer's timeout signal and do your job there. Of course you'll need to restart the timer in every resize event.

  3. The following user says thank you to wysota for this useful post:

    m_e (6th November 2007)

  4. #3
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Getting the moment when resize is finished

    You could always use a bool member variable in your "resize" event handler.
    Call it m_resizing and set it to true in the handler, then one the mouse release event check if it's set to true, then you know it has been resized recently. Then in that if block set it to false.

  5. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Getting the moment when resize is finished

    Quote Originally Posted by stevey View Post
    You could always use a bool member variable in your "resize" event handler.
    Call it m_resizing and set it to true in the handler, then one the mouse release event check if it's set to true, then you know it has been resized recently. Then in that if block set it to false.
    I'm afraid this doesn't work because as far as I remember, the application doesn't even receive mouse events when a window is resized by grabbing from its decoration. This is all handled by the underlying window system, not by Qt.
    J-P Nurmi

  6. #5
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Getting the moment when resize is finished

    Oh well, was just an idea.

Similar Threads

  1. postponing resize event
    By Honestmath in forum Qt Programming
    Replies: 11
    Last Post: 26th February 2006, 00:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.