1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 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:FDL$
|
---|
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 a
|
---|
14 | ** written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Free Documentation License
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Free
|
---|
18 | ** Documentation License version 1.3 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file included in the packaging of this
|
---|
20 | ** file.
|
---|
21 | **
|
---|
22 | ** If you have questions regarding the use of this file, please contact
|
---|
23 | ** Nokia at [email protected].
|
---|
24 | ** $QT_END_LICENSE$
|
---|
25 | **
|
---|
26 | ****************************************************************************/
|
---|
27 |
|
---|
28 | /*!
|
---|
29 | \page qtmac-as-native.html
|
---|
30 | \title Qt is Mac OS X Native
|
---|
31 | \brief An explanation of Qt's native features on Mac OS X.
|
---|
32 | \ingroup platform-specific
|
---|
33 |
|
---|
34 | This document explains what makes an application native on Mac OS X.
|
---|
35 | It shows the areas where Qt is compliant, and the grey areas where
|
---|
36 | compliance is more questionable. (See also the document
|
---|
37 | \l{mac-differences.html}{Qt for Mac OS X - Specific Issues}.)
|
---|
38 |
|
---|
39 | Normally when referring to a native Mac application, one really means an
|
---|
40 | application that talks directly to the underlying window system, rather
|
---|
41 | than one that uses some intermediary (for example Apple's X11 server, or a
|
---|
42 | web browser). Qt applications run as first class citizens, just like
|
---|
43 | Cocoa, and Carbon applications. In fact, we use Carbon and HIView
|
---|
44 | internally to communicate with OS X.
|
---|
45 |
|
---|
46 | When an application is running as a first class citizen, it means that
|
---|
47 | it can interact with specific components of the Mac OS X experience:
|
---|
48 |
|
---|
49 | \tableofcontents
|
---|
50 |
|
---|
51 | \section1 The Global Menu Bar
|
---|
52 |
|
---|
53 | Qt does this via the QMenuBar abstraction. Mac users expect to
|
---|
54 | have a menu bar at the top of the screen and Qt honors this.
|
---|
55 |
|
---|
56 | Additionally, users expect certain conventions to be respected, for
|
---|
57 | example the application menu should contain About, Preferences,
|
---|
58 | Quit, etc. Qt handles this automatically, although it does not
|
---|
59 | provide a means of interacting directly with the application menu.
|
---|
60 | (By doing this automatically, Qt makes it easier to port Qt
|
---|
61 | applications to other platforms.)
|
---|
62 |
|
---|
63 | \section1 Aqua
|
---|
64 |
|
---|
65 | This is a critical piece of Mac OS X (documentation can be found at
|
---|
66 | \l{http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html}).
|
---|
67 | It is a huge topic, but the most important guidelines for GUI
|
---|
68 | design are probably these:
|
---|
69 |
|
---|
70 | \list
|
---|
71 | \i \e{Aqua look}
|
---|
72 |
|
---|
73 | As with Cocoa/Carbon, Qt provides widgets that look like those
|
---|
74 | described in the Human Interface Descriptions. Qt's widgets use
|
---|
75 | Appearance Manager on Mac OS X 10.2 and the new HIThemes on Mac OS X 10.3
|
---|
76 | and higher to implement the look, in other words we use Apple's own API's
|
---|
77 | for doing the rendering.
|
---|
78 |
|
---|
79 | \i \e{Aqua feel}
|
---|
80 |
|
---|
81 | This is a bit more subjective, but certainly Qt strives to
|
---|
82 | provide the same feel as any Mac OS X application (and we
|
---|
83 | consider situations where it doesn't achieve this to be bugs).
|
---|
84 | Of course Qt has other concerns to bear in mind, especially
|
---|
85 | remaining cross-platform. Some "baggage" that Qt carries is in
|
---|
86 | an effort to provide a widget on a platform for which an
|
---|
87 | equivelant doesn't exist, or so that a single API can be used to
|
---|
88 | do something, even if the API doesn't make entire sense for a
|
---|
89 | specific widget.
|
---|
90 |
|
---|
91 | \i \e{Aqua guides}
|
---|
92 |
|
---|
93 | This is the most subjective, but there are many suggestions and
|
---|
94 | guidelines in the Aqua style guidelines. This is the area where Qt is
|
---|
95 | of least assistance. The decisions that must be made to conform (widget
|
---|
96 | sizes, widget layouts with respect to other widgets, window margins,
|
---|
97 | placement of OK and Cancel, etc) must be made based on the user
|
---|
98 | experience demanded by your application. If your user base is small or
|
---|
99 | mostly comes from the Windows or Unix worlds, these are minor issues much
|
---|
100 | less important than trying to make a mass market product. Qt for Mac OS X
|
---|
101 | is fully API compatible with Qt for Windows and X11, but Mac OS X is a
|
---|
102 | significantly different platform to Windows and some special
|
---|
103 | considerations must be made based on your audience.
|
---|
104 |
|
---|
105 | \endlist
|
---|
106 |
|
---|
107 | \section1 Dock
|
---|
108 |
|
---|
109 | Interaction with the dock is possible. The icon can be set by calling
|
---|
110 | QWidget::setWindowIcon() on the main window in your application. The
|
---|
111 | setWindowIcon() call can be made as often as necessary, providing an
|
---|
112 | icon that can be easily updated.
|
---|
113 | \omit
|
---|
114 | It is also possible to set a QMenu as the dock menu through the use of the
|
---|
115 | qt_mac_set_dock_menu() function.
|
---|
116 | \endomit
|
---|
117 |
|
---|
118 | \section1 Accessiblity
|
---|
119 |
|
---|
120 | Although many users never use this, some users will only interact with your
|
---|
121 | applications via assistive devices. With Qt the aim is to make this
|
---|
122 | automatic in your application so that it conforms to accepted practice on
|
---|
123 | its platform. Qt uses Apple's accessibility framework to provide access
|
---|
124 | to users with diabilities.
|
---|
125 |
|
---|
126 | \section1 Development Tools
|
---|
127 |
|
---|
128 | Mac OS X developers expect a certain level of interopability
|
---|
129 | between their development toolkit and the platform's developer
|
---|
130 | tools (for example Visual Studio, gmake, etc). Qt supports both Unix
|
---|
131 | style Makefiles, and ProjectBuilder/Xcode project files by using
|
---|
132 | the \l qmake tool. For example:
|
---|
133 |
|
---|
134 | \snippet doc/src/snippets/code/doc_src_qtmac-as-native.qdoc 0
|
---|
135 |
|
---|
136 | will generate an Xcode project file from project.pro. With \l qmake
|
---|
137 | you do not have to worry about rules for Qt's preprocessors (\l moc
|
---|
138 | and \l uic) since \l qmake automatically handles them and ensures that
|
---|
139 | everything necessary is linked into your application.
|
---|
140 |
|
---|
141 | Qt does not entirely interact with the development environment (for
|
---|
142 | example plugins to set a file to "mocable" from within the Xcode
|
---|
143 | user interface). Nokia is actively working on improving Qt's
|
---|
144 | interoperability with various IDEs.
|
---|
145 | */
|
---|