[Kde-games-devel] Saving overheads when resizing SVG

Dmitry Suzdalev dimsuz at gmail.com
Sat Jun 2 12:26:18 CEST 2007


On Saturday 02 June 2007 08:52, Ian Wadham wrote:
> In case you did not see Dmitry's recent commit (I only came across
> it by chance), here is a way to avoid resizing and re-rendering your
> SVG elements when another resize event is pending.  In your resixe
> event code do something like:
>
>     if (QWidget::testAttribute (Qt::WA_PendingResizeEvent) {
>         return;
>     }
>
> In particular, when the main window starts up, it generates *two*
> resize events, one of which is "pending", so your game could be
> rendering its SVG twice at startup time.  The above will fix that.
That's a nice thing, yes. But it has a small bug, I'm not sure were it comes 
from - windowing system or qt or both :).

If you quit your app while it was in "maximize" state (i.e. you maximize it by 
hitting "Maximize" button on window header), then on the next startup Qt will 
generate ONE resizeEvent for which testAttribute(Qt::QA_PendingResizeEvent) 
will return true, indicating that further resize event will come next, but 
there isn't one. This leaves your app in an inconsistant state - it expected 
to get one more resizeEvent, but didn't get one :-).

Note that this happens to me ONLY when I quit app while it is maximized. All 
other cases work perfectly as expected.

> Nice tip, Dmitry!  All the best, Ian W.
You should also thank Aaron and John Flux - thay are a true fathers of the 
tip ;-)

Cheers,
Dmitry.

P.S. Ian, thanks for new word in my 'known-English-words' list that I keep in 
my head :-). It's the word 'mug' :-). Also thank you for a bunch of smiles 
that touched my lips upon reading your yesterday's short reply to 
Mauricio :-).


More information about the kde-games-devel mailing list