PDA

View Full Version : Getting the moment when resize is finished



m_e
4th November 2007, 23:03
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...

wysota
5th November 2007, 00:19
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.

stevey
7th November 2007, 20:32
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.

jpn
7th November 2007, 21:12
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.

stevey
7th November 2007, 21:14
Oh well, was just an idea.