Re: [Interest] Finished resizing a window?
John Weeks schreef op 24-2-2014 22:56: We have windows in our application that are potentially expensive to repaint, so when the user resizes a window we may need to put off repainting until the resizing is finished. It seems that we don't get mouse down/mouse up events when the user clicks in the window frame/resize grip area, so I can't wait until mouse up. Is that correct? Is there a solution to this? Others have already suggested timers. I usually use this [1] solution for this and similar problems. André [1] http://qt-project.org/wiki/Delay_action_to_wait_for_user_interaction ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Finished resizing a window?
On Monday 24 February 2014 13:56:01 John Weeks wrote: We have windows in our application that are potentially expensive to repaint, so when the user resizes a window we may need to put off repainting until the resizing is finished. It seems that we don't get mouse down/mouse up events when the user clicks in the window frame/resize grip area, so I can't wait until mouse up. Is that correct? Is there a solution to this? Thanks! -John Weeks One option is to grab the window contents upon the first resize event, do a crude scaling using that. In your resize handler trigger a timer that when it expires does a real resize and update of your content. If you get another resize event before this timer fires, reset the timer. Cheers, Sean ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Finished resizing a window?
Em seg 24 fev 2014, às 14:30:29, John Weeks escreveu: On 24-Feb-2014, at 2:24 PM, Thiago Macieira wrote: That's something entirely controlled by the window manager. Sorry. Thanks, Thiago. That's good to know. Here's a suggestion: do a delayed repainting after you get a resize event. If you wait 200 ms before repainting, if the window keeps getting resized, the delay keeps resetting. So effectively, you won't repaint until the window settles. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Finished resizing a window?
On 02/25/2014 12:56 PM, Thiago Macieira wrote: Em seg 24 fev 2014, às 14:30:29, John Weeks escreveu: On 24-Feb-2014, at 2:24 PM, Thiago Macieira wrote: That's something entirely controlled by the window manager. Sorry. Thanks, Thiago. That's good to know. Here's a suggestion: do a delayed repainting after you get a resize event. If you wait 200 ms before repainting, if the window keeps getting resized, the delay keeps resetting. So effectively, you won't repaint until the window settles. But if the user pauses for more than 200ms the expensive redraw will commence and annoy. Perhaps... Break the redraw up into a number of parts, each of which takes a relatively short amount of time. resize() { partToDraw = 1;// Start over. cancelAnyExistingTimer(); singleshot(200,timeout()); } // Draw the parts. // If a new resize arrives, the process restarts // in a short amount of time, without having to // wait for the complete redraw to complete. timeout() { drawPart(partToDraw) if( ++partToDraw != numberOfParts ) singleshot(0,timeout(); // Return to event loop. } ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Finished resizing a window?
Have you tried implementing a layout that has a locking mechanism? In theory you can get the root layout to not layout until you approve the change? This will produce an unfilled area until you unlock it. From: william.croc...@analog.com william.croc...@analog.com To: interest@qt-project.org Sent: Tuesday, February 25, 2014 1:08 PM Subject: Re: [Interest] Finished resizing a window? On 02/25/2014 12:56 PM, Thiago Macieira wrote: Em seg 24 fev 2014, às 14:30:29, John Weeks escreveu: On 24-Feb-2014, at 2:24 PM, Thiago Macieira wrote: That's something entirely controlled by the window manager. Sorry. Thanks, Thiago. That's good to know. Here's a suggestion: do a delayed repainting after you get a resize event. If you wait 200 ms before repainting, if the window keeps getting resized, the delay keeps resetting. So effectively, you won't repaint until the window settles. But if the user pauses for more than 200ms the expensive redraw will commence and annoy. Perhaps... Break the redraw up into a number of parts, each of which takes a relatively short amount of time. resize() { partToDraw = 1; // Start over. cancelAnyExistingTimer(); singleshot(200,timeout()); } // Draw the parts. // If a new resize arrives, the process restarts // in a short amount of time, without having to // wait for the complete redraw to complete. timeout() { drawPart(partToDraw) if( ++partToDraw != numberOfParts ) singleshot(0,timeout(); // Return to event loop. } ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] Finished resizing a window?
We have windows in our application that are potentially expensive to repaint, so when the user resizes a window we may need to put off repainting until the resizing is finished. It seems that we don't get mouse down/mouse up events when the user clicks in the window frame/resize grip area, so I can't wait until mouse up. Is that correct? Is there a solution to this? Thanks! -John Weeks ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Finished resizing a window?
On 24-Feb-2014, at 2:24 PM, Thiago Macieira wrote: That's something entirely controlled by the window manager. Sorry. Thanks, Thiago. That's good to know. -John ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Finished resizing a window?
Em seg 24 fev 2014, às 13:56:01, John Weeks escreveu: We have windows in our application that are potentially expensive to repaint, so when the user resizes a window we may need to put off repainting until the resizing is finished. It seems that we don't get mouse down/mouse up events when the user clicks in the window frame/resize grip area, so I can't wait until mouse up. Is that correct? Is there a solution to this? That's something entirely controlled by the window manager. Sorry. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Finished resizing a window?
Hi John, I would suggest a short single-shot timer roughly: resizeEvent base::resizeEvent if !mTimer.isRunning mTimer.start paintEvent if !mTimer.isRunning base::paintEvent timer slot: repaint I'm not sure whether overriding the paintEvent is enough to prevent the child widgets from painting. Good luck - please let the group know what you decide with this. Tony From: interest-bounces+tony=rightsoft.com...@qt-project.org [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of John Weeks Sent: Tuesday, 25 February 2014 8:56 AM To: Interest@qt-project.org Interest Subject: [Interest] Finished resizing a window? We have windows in our application that are potentially expensive to repaint, so when the user resizes a window we may need to put off repainting until the resizing is finished. It seems that we don't get mouse down/mouse up events when the user clicks in the window frame/resize grip area, so I can't wait until mouse up. Is that correct? Is there a solution to this? Thanks! -John Weeks ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Finished resizing a window?
Also, note that the Qt event loop will collapse all pending resizes into one final one. You should be able to block updating the layouts until the timer expires. Its been a while but you'll need to subclass the window and don't call the base class resizes until the timer is done. I don't think the below will work, but like I said, it's been a whole for me working with widgets. From: Tony Rietwyk t...@rightsoft.com.au To: interest@qt-project.org Sent: Monday, February 24, 2014 6:45 PM Subject: Re: [Interest] Finished resizing a window? Hi John, I would suggest a short single-shot timer roughly: resizeEvent base::resizeEvent if !mTimer.isRunning mTimer.start paintEvent if !mTimer.isRunning base::paintEvent timer slot: repaint I'm not sure whether overriding the paintEvent is enough to prevent the child widgets from painting. Good luck - please let the group know what you decide with this. Tony From:interest-bounces+tony=rightsoft.com...@qt-project.org [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of John Weeks Sent: Tuesday, 25 February 2014 8:56 AM To: Interest@qt-project.org Interest Subject: [Interest] Finished resizing a window? We have windows in our application that are potentially expensive to repaint, so when the user resizes a window we may need to put off repainting until the resizing is finished. It seems that we don't get mouse down/mouse up events when the user clicks in the window frame/resize grip area, so I can't wait until mouse up. Is that correct? Is there a solution to this? Thanks! -John Weeks ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Finished resizing a window?
We have windows in our application that are potentially expensive to repaint, so when the user resizes a window we may need to put off repainting until the resizing is finished. It seems that we don't get mouse down/mouse up events when the user clicks in the window frame/resize grip area, so I can't wait until mouse up. Could you use this to watch for (then paint on) the mouse release? Qt::MouseButtons QApplication::mouseButtons() [static] Bill ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Finished resizing a window?
The problem is the window resize does not come from the application, it comes from the OS/Window Manager. From: william.croc...@analog.com william.croc...@analog.com To: interest@qt-project.org Sent: Monday, February 24, 2014 8:46 PM Subject: Re: [Interest] Finished resizing a window? We have windows in our application that are potentially expensive to repaint, so when the user resizes a window we may need to put off repainting until the resizing is finished. It seems that we don't get mouse down/mouse up events when the user clicks in the window frame/resize grip area, so I can't wait until mouse up. Could you use this to watch for (then paint on) the mouse release? Qt::MouseButtons QApplication::mouseButtons() [static] Bill ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Finished resizing a window?
Am 25.02.2014 um 00:45 schrieb Tony Rietwyk t...@rightsoft.com.au: Hi John, I would suggest a short single-shot timer roughly: Yes, using a timer should work, I did this in a 3D point rendering/editing application where rendering the point cloud (in software - and we talk about the year 2000 ;)) was expensive. So while the timer did not shoot I simply resized the (already) rendered pixmap (giving some sort of interactive feeling), and after the user did not resize the window for, say, 200 ms then I would do the full rendering/update. Cheers, Oliver___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest