[Interest] [OS X] maintaining a list of own WIds
René J. V. Bertin
rjvbertin at gmail.com
Tue Mar 1 16:15:23 CET 2016
John Weeks wrote:
Thanks,
> On OS X with Qt 5, WId's are NSViews. You can get the NSWindow from [NSView
Actually, I'm also seeing QNSWindows (even the occasional QNSPanel). I'm not
perfectly sure if I've ever seen instances of those because of a WId I received;
can you be that all WIds are always and exclusively of the (Q)NSView persuasion?
> 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.
internalWinId() is defined as `inline WId internalWinId() const { return data-
>winid; }` in the QWidget class definition, so I doubt that calling the function
will have a lot of side-effects if no winid was created yet ;)
Either way, calling a method to obtain the WId from an object that is bound to
have such a property helps me only if I can do it in a function that is called
each time such an object is created. That's what I was really asking about: how
to get notified each time something is created that has a WId.
Alternatively I could work with a notification when a new window (NSWindow) is
created or one is closed, and then parse the entire list of windows with their
NSView and sub-NSViews (or their superView and that critter's subviews).
I've tried googling, but until now I've only come up with searches that give way
too many irrelevant hits.
R.
More information about the Interest
mailing list