[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-games-devel
Subject:    Re: [Kde-games-devel] Extra resize events from KXmlGuiWindow
From:       Parker Coates <parker.coates () gmail ! com>
Date:       2009-03-31 0:49:21
Message-ID: 85d347350903301749h42dee578uadeb27e0d33bdf63 () mail ! gmail ! com
[Download RAW message or body]

On Mon, Mar 30, 2009 at 7:45 PM, Ian Wadham wrote:
> On Tue, 31 Mar 2009 1:36:38 am Parker Coates wrote:
>> This morning on IRC, David pointed me to his workaround code in the
>> Konqueror unit tests [1]. I applied it to KPat and it does, indeed
>> skip the resize event related to the delayed menubar insertion.
>
> Can you explain (on the KDE Games list) how the code at
>
> http://lxr.kde.org/source/KDE/kdebase/apps/konqueror/src/tests/konqviewmgrtest.cpp#057
>
> addresses the problem and which bit of code does so?  I had a look at it.  It
> seems to precipitate "pending" events, but I cannot see how it avoids them.

Simply call that function on your mainwindow before you show it. As
for how it works, I'm only guessing, but I think:
- Qt only does certain layout actions once the widget in question is visible.
- The code checks all subwidgets for the Qt::WA_PendingResizeEvent
flag indicating that it is waiting for a resize.
- It then constructs a resize event and makes the widget visible so
that the resize can occur.
- It then processes those the pending events and starts again.
- If it it can't find anything waiting to be resized, it hides
everything again, so that Qt isn't surprised when it tries to show it
later on.

So essentially the resize events are all processed synchronously
inside this function, so that you can move on with your life. This
works nicely for KPat because I can easily call this function before
actually creating the view or the scene [1]. I now realise this might
not be as cleanly applicable to other games.

Parker

[1] See the bottom of kpat/main.cpp in trunk.
_______________________________________________
kde-games-devel mailing list
kde-games-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-games-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic