[Interest] [OS X] maintaining a list of own WIds

John Weeks john at wavemetrics.com
Mon Feb 29 18:00:18 CET 2016


> This is on OS X, so I could also use a native API like KVO on [NSApp windows] but that doesn't seem to work as I'd like, possibly because that's not an observable property and undoubtedly also because not all WIds are NSWindows.

On OS X with Qt 5, WId's are NSViews. You can get the NSWindow from [NSView window]. And, of course, Qt doesn't create the NSWindow until the top-level widget is shown for the first time, but calling winID() will cause Qt to create an NSView even for non-top-level widgets. We call internalWinId() and we're prepared to get back nullptr. internalWinId() is undocumented, but a public API used lots of places in Qt code, so it's probably not going anywhere soon.

-John Weeks
WaveMetrics, Inc.




More information about the Interest mailing list