[Interest] QMacNativeWidget & memory management

deDietrich Gabriel Gabriel.deDietrich at digia.com
Fri Dec 13 12:13:57 CET 2013


On Dec 11, 2013, at 11:46 AM, Tim Blechmann <tim at klingt.org> wrote:

>> QMacNativeWidget creates an NSView that you will insert in your view
>> hierarchy. That NSView will receive mouse and keyboard events, like
>> any other view, that will be forwarded to the QMacNativeWidget as Qt
>> events. Other events, such as expose or update events, will be also
>> forwarded to Qt since they come form the NSView hierarchy update
>> mechanism. However, the NSView, and hence Qt, will not receive
>> NSWindow notifications, such as minimization, fullscreen mode, etc.
>> (it does in pure Qt because we manage both the NSView and its
>> NSWindow). And, obviously, pure Cocoa events and notifications need
>> to be forwarded to Qt as well. We admit the documentation could be a
>> bit more complete in this area.
> 
> thanks a lot! also i wonder: is the parent NSView informed if the
> QMacNativeWidget is resized? in my use case i have a QMacNativeWidget,
> containing a layout. i suppose the layout resizes it depending on its
> content. but the parent NSView is not resizes accordingly, right? i
> suppose this is my responsibility to do this?

The QMacNativeWidget’s NSView will be resized to the widget’s size but, unless you use Cocoa's constraints-based layouting API, there’s no size propagation from subview to superview.

> oh and yes, any improvement in the documentation on how to use
> QMacNativeWidget would be more than welcome :)


We’ll try to improve it for 5.3, after we get enough feedback.

In any case, I strongly recommend you to send your messages to the “Qt interests” mailing list. Not only the matter of the discussion may be of interest to other people, but you will also get faster and better answers than if you send your questions only to one person. :)

Best regards,

Dr. Gabriel de Dietrich
Senior Software Developer
qt.digia.com




More information about the Interest mailing list