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

List:       kde-commits
Subject:    Re: [kdelibs/frameworks] tier1/kwindowsystem: Fix KWindowSystem::setMainWindow
From:       Aurélien_Gâteau <agateau () kde ! org>
Date:       2013-09-16 9:14:35
Message-ID: 5194066.UzMTLKGfpq () trinity
[Download RAW message or body]

On Friday 13 September 2013 21:43:09 David Faure wrote:
> On Friday 13 September 2013 15:24:57 Aurélien Gâteau wrote:
> > +    // Set the WA_NativeWindow attribute to force the creation of the
> > QWindow. +    // Without this QWidget::windowHandle() returns 0.
> > +    subWidget->setAttribute(Qt::WA_NativeWindow, true);
> > +    QWindow *subWindow = subWidget->windowHandle();
> 
> Why not just call winId()? Doesn't it force the creation of the QWindow?
> 
> Seems more portable than using some internal attribute.

Yes, calling winId() works as well, but the Qt::WA_NativeWindow attribute is 
not internal, it is documented as creating the window if necessary.

The code would look like this:

    subWidget->winId();
    QWindow *subWindow = subWidget->windowHandle();

Which I don't think is easier to understand than:

    subWidget->setAttribute(Qt::WA_NativeWindow, true);
    QWindow *subWindow = subWidget->windowHandle();

But I don't have any strong opinion there, I am happy to change it if you 
prefer using winId().

Aurélien
[prev in list] [next in list] [prev in thread] [next in thread] 

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