1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the documentation of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Lesser General Public License Usage
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
18 | ** General Public License version 2.1 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
20 | ** packaging of this file. Please review the following information to
|
---|
21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
23 | **
|
---|
24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | /*!
|
---|
43 | \page mac-differences.html
|
---|
44 | \title Qt for Mac OS X - Specific Issues
|
---|
45 | \brief A description of issues with Qt that are specific to Mac OS X.
|
---|
46 | \ingroup platform-specific
|
---|
47 |
|
---|
48 | This file outlines known issues and possible workarounds when
|
---|
49 | using Qt on Mac OS X. Contact Qt's technical support team if you find
|
---|
50 | additional issues which are not covered here. (See also the
|
---|
51 | document \l{qtmac-as-native.html} {Qt is Mac OS X Native}.)
|
---|
52 |
|
---|
53 | \tableofcontents
|
---|
54 |
|
---|
55 | \section1 GUI Applications
|
---|
56 |
|
---|
57 | Mac OS X handles most applications as "bundles". A bundle is a
|
---|
58 | directory structure that groups related files together (e.g.,
|
---|
59 | widgets.app/). GUI applications in particular must be run from a
|
---|
60 | bundle or by using the open(1), because Mac OS X needs the bundle
|
---|
61 | to dispatch events correctly, as well as for accessing the menu
|
---|
62 | bar.
|
---|
63 |
|
---|
64 | If you are using older versions of GDB you must run with the full
|
---|
65 | path to the executable. Later versions allow you to pass the
|
---|
66 | bundle name on the command line.
|
---|
67 |
|
---|
68 | \section1 Painting
|
---|
69 |
|
---|
70 | Mac OS X always double buffers the screen so the
|
---|
71 | Qt::WA_PaintOnScreen attribute has no effect. Also it is
|
---|
72 | impossible to paint outside of a paint event so
|
---|
73 | Qt::WA_PaintOutsidePaintEvent has no effect either.
|
---|
74 |
|
---|
75 | \section1 Library Support
|
---|
76 |
|
---|
77 | \section2 Qt libraries as frameworks
|
---|
78 |
|
---|
79 | By default, Qt is built as a set of frameworks. Frameworks is the
|
---|
80 | Mac OS X "preferred" way of distributing libraries. There are
|
---|
81 | definite advantages to using them. See
|
---|
82 | \l{http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/index.html}
|
---|
83 | {Apple's Framework Programming Guide} for more information.
|
---|
84 |
|
---|
85 | In general, this shouldn't be an issue because qmake takes care of
|
---|
86 | the specifics for you. The
|
---|
87 | \l{http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/index.html}
|
---|
88 | {Framework Programming Guide} discusses issues to keep in mind
|
---|
89 | when choosing frameworks over the more typical, dynamic libraries.
|
---|
90 | However, one point to remember is: \bold {Frameworks always link
|
---|
91 | with "release" versions of libraries}.
|
---|
92 |
|
---|
93 | If you actually want to use a \e{debug} version of a Qt framework,
|
---|
94 | you must ensure that your application actually loads that debug
|
---|
95 | version. This is often done by using the DYLD_IMAGE_SUFFIX
|
---|
96 | environment variables, but that way often doesn't work so well.
|
---|
97 | Instead, you can temporarily swap your debug and release versions,
|
---|
98 | which is documented in
|
---|
99 | \l{http://developer.apple.com/technotes/tn2004/tn2124.html#SECJUSTONELIB}
|
---|
100 | {Apple's "Debugging Magic" technical note}.
|
---|
101 |
|
---|
102 | If you don't want to use frameworks, simply configure Qt with
|
---|
103 | \c{-no-framework}.
|
---|
104 |
|
---|
105 | \section2 Bundle-Based Libraries
|
---|
106 |
|
---|
107 | If you want to use some dynamic libraries in your Mac OS X
|
---|
108 | application bundle (the application directory), create a
|
---|
109 | subdirectory named "Frameworks" in the application bundle
|
---|
110 | directory and place your dynamic libraries there. The application
|
---|
111 | will find a dynamic library if it has the install name
|
---|
112 | \e{@executable_path/../Frameworks/libname.dylib}.
|
---|
113 |
|
---|
114 | If you use \c qmake and Makefiles, use the \c QMAKE_LFLAGS_SONAME setting:
|
---|
115 |
|
---|
116 | \snippet doc/src/snippets/code/doc_src_mac-differences.qdoc 0
|
---|
117 |
|
---|
118 | Alternatively, you can modify the install name using the
|
---|
119 | install_name_tool(1) on the command line. See its manpage for more
|
---|
120 | information.
|
---|
121 |
|
---|
122 | Note that the \c DYLD_LIBRARY_PATH environment variable will
|
---|
123 | override these settings, and any other default paths, such as a
|
---|
124 | lookup of dynamic libraries inside \c /usr/lib and similar default
|
---|
125 | locations.
|
---|
126 |
|
---|
127 | \section2 Combining Libraries
|
---|
128 |
|
---|
129 | If you want to build a new dynamic library combining the Qt 4
|
---|
130 | dynamic libraries, you need to introduce the \c{ld -r} flag. Then
|
---|
131 | relocation information is stored in the output file, so that
|
---|
132 | this file could be the subject of another \c ld run. This is done
|
---|
133 | by setting the \c -r flag in the \c .pro file, and the \c LFLAGS
|
---|
134 | settings.
|
---|
135 |
|
---|
136 | \section2 Initialization Order
|
---|
137 |
|
---|
138 | dyld(1) calls global static initializers in the order they are
|
---|
139 | linked into your application. If a library links against Qt and
|
---|
140 | references globals in Qt (from global initializers in your own
|
---|
141 | library), be sure to link your application against Qt before
|
---|
142 | linking it against the library. Otherwise the result will be
|
---|
143 | undefined because Qt's global initializers have not been called
|
---|
144 | yet.
|
---|
145 |
|
---|
146 | \section1 Compile-Time Flags
|
---|
147 |
|
---|
|
---|