[Development] Foreign windows, embedding and transiency

Sorvig Morten Morten.Sorvig at digia.com
Tue Dec 11 12:47:36 CET 2012

On Dec 11, 2012, at 12:33 PM, Samuel Rødal <samuel.rodal at digia.com>
>> In order to create a QWindow for a foreign window, there might be a
>> special subclass of QWindow (QForeignWindow?) or maybe it could just be
>> a QWindow with a special Qt::ForeignWindow flag (and maybe a constructor
>> like QWindow::QWindow(WinId foreignWindow)).
>> Your opinions on which way foreign windows could be created (and on
>> whether all of this sounds like a good idea to you) are very welcome. :-)
> This worked for QWidgets in Qt 4 by passing a native window handle (WId) 
> to create(). However, then we also knew at compile time what the native 
> windowing system would be.
> Is it possible to define a WId type that will work on X11, Wayland, and 
> any other theoretical windowing system on Unix platforms?

I've been planning this a bit from he perspective if the Cocoa port, here's what I think I need:

- A Qt::WindowFlags flag ("Qt::NativeWindow")
- An basic API for setting the native window*, for example a function exported by QPlatformNativeInterface.
- Nice API in QtMacExtras 
- The implementation itself in the cocoa plugin.

I don't think we should create QWindow subclass. We could add a constructor instead of using QPlatformNativeInterface, and then we would perhaps not need a flag either.


* which would be a NSView, not a NSWindow. QWindow handles both the top-level and non-top-level case, Cocoa has separate classes.

More information about the Development mailing list