Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

Developing Qt Applications for Mac OS X

Mac OS X is a UNIX platform and behaves similar to other Unix-like platforms. The main difference is X11 is not used as the primary windowing system. Instead, Mac OS X uses its own native windowing system that is accessible through the Cocoa API. Application development on Mac OS X is done using Xcode, available from the Mac App store.

After installng Xcode you need to download the command line tools. This is done in the Preferences dialog under the Downloads section. After installing, "clang" should be available on the command line.

You can also download the command line tools directly and skip the code download. Log on to developer.apple.com and look for "Command Line Tools for Xcode" in the download area.

What Versions of Mac OS X are Supported?

Qt 5 supports Mac OS X versions 10.6 (Snow Leopard) and up. It is usually in the best interest of the developer and user to be running the latest updates to any version. We test internally against Mac OS X 10.6 and 10.7.

Carbon or Cocoa?

Qt 5 uses Cocoa. Building for Carbon is not possible.

32-bit or 64-bit

Qt can be built for either x86 or x86_64. 64-bit is used by default. To select a 32-bit build, use the macx-clang-32 (or macx-g++32) mkspec. This is selectable at configure time: ./configure -platform macx-clang-32

The Qt build system does not support building unversal binaries directly. Instead, use the "lipo" tool to glue two Qt builds together.

Building Qt statically

Static builds are not tested.

Day-to-Day Application Development on OS X

On the command-line, applications can be built using qmake and make. Optionally, qmake can generate project files for Xcode with -spec macx-xcode. If you are using the binary package, qmake generates Xcode projects by default; use -spec macx-gcc to generate makefiles.

The result of the build process is an application bundle, which is a directory structure that contains the actual application executable. The application can be launched by double-clicking it in Finder, or by referring directly to its executable from the command line, i. e. myApp.app/Contents/MacOS/myApp.

If you wish to have a command-line tool that does not use the GUI (e.g., moc, uic or ls), you can tell qmake not to execute the bundle creating steps by removing it from the CONFIG in your .pro file:

 CONFIG -= app_bundle

Deployment - "Compile once, deploy everywhere"

In general, Qt supports building on one Mac OS X version and deploying on all others, both forward and backwards. You can build on 10.7 Lion and run the same binary on 10.6 and up. The recommended way is to build on the latest OS version and deploy backwards.

Mac applications are typically deployed as self-contained application bundles. The application bundle contains the application executable as well as dependencies such as the Qt libraries, plugins, translations and other resources you may need. Third party libraries like Qt are normally not installed system-wide; each application provides its own copy.

A common way to distribute applications is to provide a compressed disk image (.dmg file) that the user can mount in Finder. The Mac deployment tool (macdeployqt) can be used to create the self-contained bundles, and optionally also create a .dmg archive. See the Mac deployment guide for more information about deployment.

Applications can also be distributed through the Mac App store. Qt 5 aims to stay within the app store sandbox rules. macdeployqt (qttools/src/macdeployqt) can be used as a starting point for app store deployment.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web