From 40827457a7883bf2465b5365c9e95f38a59404d5 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 20 Jan 2017 10:22:32 -0800 Subject: QMacCocoaViewContainer: Fix typos, wording in documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also removes reference to Carbon and the old dual backend. Change-Id: I01292caa7efcbe85526cd7602ec8ac678fd78eab Reviewed-by: Tor Arne Vestbø Reviewed-by: Timur Pocheptsov --- src/widgets/widgets/qmaccocoaviewcontainer_mac.mm | 39 ++++++++++------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm index b4f2b8959e..8e565ecfe0 100644 --- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm +++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm @@ -56,27 +56,21 @@ \inmodule QtWidgets While Qt offers a lot of classes for writing your application, Apple's - Cocoa framework offers lots of functionality that is not currently in Qt or - may never end up in Qt. Using QMacCocoaViewContainer, it is possible to put an - arbitrary NSView-derived class from Cocoa and put it in a Qt hierarchy. - Depending on how comfortable you are with using objective-C, you can use - QMacCocoaViewContainer directly, or subclass it to wrap further functionality - of the underlying NSView. - - QMacCocoaViewContainer works regardless if Qt is built against Carbon or - Cocoa. However, QCocoaContainerView requires \macos 10.5 or better to be - used with Carbon. - - It should be also noted that at the low level on \macos, there is a - difference between windows (top-levels) and view (widgets that are inside a - window). For this reason, make sure that the NSView that you are wrapping - doesn't end up as a top-level. The best way to ensure this is to make sure - you always have a parent and not set the parent to 0. - - If you are using QMacCocoaViewContainer as a sub-class and are mixing and - matching objective-C with C++ (a.k.a. objective-C++). It is probably - simpler to have your file end with \tt{.mm} than \tt{.cpp}. Most Apple tools will - correctly identify the source as objective-C++. + Cocoa frameworks offer functionality that is not currently available (or + may never end up) in Qt. Using QMacCocoaViewContainer, it is possible to take an + arbitrary NSView-derived class from Cocoa and put it in a Qt widgets hierarchy. + Depending on the level of integration you need, you can use QMacCocoaViewContainer + directly or subclass it to wrap more functionality of the underlying NSView. + + It should be also noted that, at the Cocoa level, there is a difference + between top-level windows and views (widgets that are inside a window). + For this reason, make sure that the NSView that you are wrapping doesn't + end up as a top-level window. The best way to ensure this is to make sure + QMacCocoaViewContainer's parent widget is not null. + + If you are using QMacCocoaViewContainer as a subclass and are accessing Cocoa API, + it is probably simpler to have your file end with \tt{.mm} instead of \tt{.cpp}. + Most Apple tools will correctly identify the source as Objective-C++. QMacCocoaViewContainer requires knowledge of how Cocoa works, especially in regard to its reference counting (retain/release) nature. It is noted in @@ -85,7 +79,8 @@ pool. If this is done outside of a running event loop, it is up to the developer to provide the autorelease pool. - The following is a snippet of subclassing QMacCocoaViewContainer to wrap a NSSearchField. + The following is a snippet showing how to subclass QMacCocoaViewContainer + to wrap an NSSearchField. \snippet macmainwindow.mm 0 */ -- cgit v1.2.3