Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 1520

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- developing-on-mac.qdoc -->
  <title>Qt 4.8: Developing Qt Applications for Mac OS X</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li>Developing Qt Applications for Mac OS X</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#what-versions-of-mac-os-x-are-supported">What Versions of Mac OS X are Supported?</a></li>
<li class="level2"><a href="#carbon-or-cocoa">Carbon or Cocoa?</a></li>
<li class="level2"><a href="#which-one-should-i-use">Which One Should I Use?</a></li>
<li class="level2"><a href="#building-qt-statically">Building Qt statically</a></li>
<li class="level1"><a href="#universal-binaries">Universal Binaries</a></li>
<li class="level2"><a href="#working-with-several-versions-of-qt">Working with several versions of Qt</a></li>
<li class="level1"><a href="#day-to-day-application-development-on-os-x">Day-to-Day Application Development on OS X</a></li>
<li class="level1"><a href="#deployment-compile-once-deploy-everywhere">Deployment - &quot;Compile once, deploy everywhere&quot;</a></li>
</ul>
</div>
<h1 class="title">Developing Qt Applications for Mac OS X</h1>
<span class="subtitle"></span>
<!-- $$$developing-on-mac.html-description -->
<div class="descr"> <a name="details"></a>
<p>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 Carbon and Cocoa APIs. Application development on Mac OS X is done using Xcode Tools, an optional install included on every Mac with updates available from <a href="http://developer.apple.com">Apple's developer website</a>. Xcode Tools includes Apple-modified versions of the GCC compiler.</p>
<a name="what-versions-of-mac-os-x-are-supported"></a>
<h2>What Versions of Mac OS X are Supported?</h2>
<p>As of Qt 4.7, Qt supports Mac OS X versions 10.4 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.4&#x2e;11 as well as the updated release of Mac OS X 10.5 and Mac OS X 10.6&#x2e;</p>
<a name="carbon-or-cocoa"></a>
<h3>Carbon or Cocoa?</h3>
<p>Qt supports building in two flavors, using either the Carbon or Cocoa API. Using the Cocoa API, Qt requires 10.5 and provides both 32-bit and 64-bit support. With Carbon, Qt can be developed on and deployed to 10.4, but there is no 64-bit support.</p>
<p>Note: There is no accessibility support in the Cocoa version. This is planned for Qt 4.8&#x2e;</p>
<p>With Qt 4.7 we recommend using the Cocoa version of Qt for development, unless you want to target the 10.4 platform. Qt uses Cocoa by default, both for the binary package and when configuring Qt from source (using the <tt>configure</tt> script). To build Qt for Carbon, specify the <tt>-carbon</tt> flag to configure.</p>
<p>There are two versions of the Qt binary, one with x86 and x86_64 Cocoa and another with x86 and ppc Carbon. If you want a different setup you must build Qt yourself using the source package. To explicitly configure Qt to build for 34-bit or 64-bit architectures (or both), use the <tt>-arch</tt> flags (see <a href="#universal-binaries">Universal Binaries</a>). For the Cocoa version, 64 bit is chosen by default.</p>
<p>Currently, Apple's default GCC compiler is used by default (GCC 4.0&#x2e;1 on 10.4 and 10.5, GCC 4.2 on 10.6). You can specify alternate compilers though. For example, on Mac OS X 10.5, Apple's GCC 4.2 is also available and selectable with the configure flag: <tt>-platform macx-g++42</tt>. LLVM-GCC support is available by passing in the <tt>-platform macx-llvm</tt> flag. GCC 3.x will <i>not</i> work. Though they may work, We do not support custom-built GCC's.</p>
<p>The following table summarizes the different versions of Mac OS X and what capabilities are used by Qt.</p>
<table class="generic">
<thead><tr class="qt-style"><th >Mac OS X Version</th><th >Cat Name</th><th >Native API Used by Qt</th><th >Bits available to address memory</th><th >CPU Architecture Supported</th><th >Development Platform</th></tr></thead>
<tr valign="top" class="odd"><td >10.4</td><td >Tiger</td><td >Carbon</td><td >32</td><td >PPC/Intel</td><td >Yes</td></tr>
<tr valign="top" class="even"><td >10.5</td><td >Leopard</td><td >Carbon</td><td >32</td><td >PPC/Intel</td><td >Yes</td></tr>
<tr valign="top" class="odd"><td >10.5</td><td >Leopard</td><td >Cocoa</td><td >32/64</td><td >PPC/Intel</td><td >Yes</td></tr>
<tr valign="top" class="even"><td >10.6</td><td >Snow Leopard</td><td >Cocoa/Carbon</td><td >32</td><td >PPC/Intel</td><td >Yes</td></tr>
<tr valign="top" class="odd"><td >10.6</td><td >Snow Leopard</td><td >Cocoa</td><td >64</td><td >Intel</td><td >Yes</td></tr>
</table>
<p>Note that building for ppc-64 is not supported on 10.6&#x2e;</p>
<a name="which-one-should-i-use"></a>
<h3>Which One Should I Use?</h3>
<p>Carbon and Cocoa both have their advantages and disadvantages. Probably the easiest way to determine is to look at the version of Mac OS X you are targetting. If your application can target 10.5 and up, then we recommend using Cocoa. If you need to target earlier versions of the operating system and do not need access to 64-bit or newer Apple technologies, then Carbon is a good fit. If your needs fall in between, you can go with a 64-bit Cocoa and 32-bit Carbon universal application.</p>
<p>For Mac OS X 10.6, Apple has started recommending developers to build their applications 64-bit. The main reason is that there is a small speed increase due to the extra registers on Intel CPU's, all their machine offerings have been 64-bit since 2007, and there is a cost for reading all the 32-bit libraries into memory if everything else is 64-bit. If you want to follow this advice, there is only one choice, 64-bit Cocoa.</p>
<a name="building-qt-statically"></a>
<h3>Building Qt statically</h3>
<p>We recommend building Qt as shared frameworks. Static builds are only partially supported, meaning that you can build most of Qt statically, but some modules, like web-kit and Designer, will fail. You can specify which modules to build from configure (e.g&#x2e; -no-webkit -nomake tools). For Cocoa configurations, both static and no-framework builds requires manually copying the 'src/gui/mac/qt_menu.nib/ directory into the &quot; Resources&quot; directory in the application bundle.</p>
<a name="universal-binaries"></a><a name="universal-binaries"></a>
<h2>Universal Binaries</h2>
<p>In 2006, Apple begin transitioning from PowerPC (PPC) to Intel (x86) systems. Both architectures are supported by Qt. The release of Mac OS X 10.5 in October 2007 added the possibility of writing and deploying 64-bit GUI applications. Qt 4.5 and up supports both the 32-bit (PPC and x86) and 64-bit (PPC64 and x86-64) versions of PowerPC and Intel-based systems.</p>
<p>Universal binaries are used to bundle binaries for more than one architecture into a single package, simplifying deployment and distribution. When running an application the operating system will select the most appropriate architecture. Universal binaries support the following architectures; they can be added to the build at configure time using the <tt>-arch</tt> arguments:</p>
<table class="generic">
<thead><tr class="qt-style"><th >Architecture</th><th >Flag</th></tr></thead>
<tr valign="top" class="odd"><td >Intel, 32-bit</td><td ><tt>-arch x86</tt></td></tr>
<tr valign="top" class="even"><td >Intel, 64-bit</td><td ><tt>-arch x86_64</tt></td></tr>
<tr valign="top" class="odd"><td >PPC, 32-bit</td><td ><tt>-arch ppc</tt></td></tr>
<tr valign="top" class="even"><td >PPC, 64-bit</td><td ><tt>-arch ppc64</tt></td></tr>
</table>
<p>If there are no <tt>-arch</tt> flags specified, configure builds Qt for a 32-bit architecture when using Carbon, and a 64-bit architecture when using Cocoa. Universal binaries were initially used to simplify the PPC to Intel migration. You can use <tt>-universal</tt> to build for both the 32-bit Intel and PPC architectures.</p>
<p><b>Note:</b> The <tt>-arch</tt> flags at configure time only affect how Qt is built. Applications are by default built for the 32-bit architecture you are currently on. To build a universal binary, add the architectures to the CONFIG variable in the .pro file:</p>
<pre class="cpp"> CONFIG <span class="operator">+</span><span class="operator">=</span> x86 ppc x86_64 ppc64</pre>
<a name="working-with-several-versions-of-qt"></a>
<h3>Working with several versions of Qt</h3>
<p>You can only install one version of Qt at a time when using the binary package. The reason for this is that a binary installation will install different parts of Qt (frameworks, documentation, examples, tools, etc) to different predefined locations on the OS, as described by Apple. If you want to work against other versions at the same time, you need to build the other versions explicitly from source. When doing so, you can provide <tt>-prefix</tt> to configure to set install location. The binary package will install Qt to the following locations:</p>
<table class="generic">
<thead><tr class="qt-style"><th >Qt</th><th >Location</th></tr></thead>
<tr valign="top" class="odd"><td >Designer, Linguist ..&#x2e;</td><td >/Developer/Applications/Qt</td></tr>
<tr valign="top" class="even"><td >Documentation</td><td >/Developer/Documentation/Qt</td></tr>
<tr valign="top" class="odd"><td >Examples</td><td >/Developer/Examples/Qt</td></tr>
<tr valign="top" class="even"><td >Plugins</td><td >/Developer/Applications/Qt/Plugins</td></tr>
<tr valign="top" class="odd"><td >Frameworks</td><td >/Library/Frameworks</td></tr>
<tr valign="top" class="even"><td >Libraries</td><td >/usr/lib</td></tr>
<tr valign="top" class="odd"><td >qmake, moc, uic ..&#x2e;</td><td >/Developer/Tools/Qt (symlink to /usr/bin)</td></tr>
<tr valign="top" class="even"><td >uninstall-qt.py, uninstall-qtsdk.py</td><td >/Developer/Tools</td></tr>
</table>
<a name="day-to-day-application-development-on-os-x"></a>
<h2>Day-to-Day Application Development on OS X</h2>
<p>On the command-line, applications can be built using <tt>qmake</tt> and <tt>make</tt>. Optionally, <tt>qmake</tt> can generate project files for Xcode with <tt>-spec macx-xcode</tt>. If you are using the binary package, <tt>qmake</tt> generates Xcode projects by default; use <tt>-spec macx-gcc</tt> to generate makefiles.</p>
<p>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. <tt>myApp.app/Contents/MacOS/myApp</tt>.</p>
<p>If you wish to have a command-line tool that does not use the GUI (e.g&#x2e;, <tt>moc</tt>, <tt>uic</tt> or <tt>ls</tt>), you can tell <tt>qmake</tt> not to execute the bundle creating steps by removing it from the <tt>CONFIG</tt> in your <tt>.pro</tt> file:</p>
<pre class="cpp"> CONFIG <span class="operator">-</span><span class="operator">=</span> app_bundle</pre>
<a name="deployment-compile-once-deploy-everywhere"></a>
<h2>Deployment - &quot;Compile once, deploy everywhere&quot;</h2>
<p>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.4 Tiger and run the same binary on 10.5 and up.</p>
<p>Some restrictions apply:</p>
<ul>
<li>Some functions and optimization paths that exist in later versions of Mac OS X will not be available if you build on an earlier version of Mac OS X.</li>
<li>The CPU architecture should match.</li>
<li>Cocoa support is only available for Mac OS X 10.5 and up.</li>
</ul>
<p>Universal binaries can be used to provide a smorgasbord of configurations catering to all possible architectures.</p>
<p>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.</p>
<p>The most 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 <a href="deployment-mac.html">Mac deployment guide</a> for more information about deployment. It is also possible to use an installer wizard. More information on this option can be found in <a href="http://developer.apple.com/mac/">Apple's documentation</a>.</p>
</div>
<!-- @@@developing-on-mac.html -->
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>