Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > ff187cb994c94c614ecc64c5a8528b1b > files > 102

qt-doc-4.8.5-10.fc18.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" />
<!-- appicon.qdoc -->
  <title>Qt 4.8: Setting the Application Icon</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>Setting the Application Icon</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="#setting-the-application-icon-on-windows">Setting the Application Icon on Windows</a></li>
<li class="level1"><a href="#setting-the-application-icon-on-mac-os-x">Setting the Application Icon on Mac OS X</a></li>
<li class="level1"><a href="#setting-the-application-icon-on-common-linux-desktops">Setting the Application Icon on Common Linux Desktops</a></li>
<li class="level2"><a href="#k-desktop-environment-kde">K Desktop Environment (KDE)</a></li>
<li class="level2"><a href="#gnome">GNOME</a></li>
<li class="level1"><a href="#setting-the-application-icon-on-the-symbian-platform">Setting the Application Icon on the Symbian platform</a></li>
</ul>
</div>
<h1 class="title">Setting the Application Icon</h1>
<span class="subtitle"></span>
<!-- $$$appicon.html-description -->
<div class="descr"> <a name="details"></a>
<p>The application icon, typically displayed in the top-left corner of an application's top-level windows, is set by calling the <a href="qwidget.html#windowIcon-prop">QWidget::setWindowIcon</a>() method on top-level widgets.</p>
<p>In order to change the icon of the executable application file itself, as it is presented on the desktop (i.e&#x2e;, prior to application execution), it is necessary to employ another, platform-dependent technique.</p>
<a name="setting-the-application-icon-on-windows"></a>
<h2>Setting the Application Icon on Windows</h2>
<p>First, create an ICO format bitmap file that contains the icon image. This can be done with e.g&#x2e; Microsoft Visual C++: Select <b>File|New</b>, then select the <b>File</b> tab in the dialog that appears, and choose <b>Icon</b>. (Note that you do not need to load your application into Visual C++; here we are only using the icon editor.)</p>
<p>Store the ICO file in your application's source code directory, for example, with the name <tt>myappico.ico</tt>. Then, create a text file called, say, <tt>myapp.rc</tt> in which you put a single line of text:</p>
<pre class="cpp"> IDI_ICON1               ICON    DISCARDABLE     &quot;myappico.ico&quot;</pre>
<p>Finally, assuming you are using <tt>qmake</tt> to generate your makefiles, add this line to your <tt>myapp.pro</tt> file:</p>
<pre class="cpp"> RC_FILE = myapp.rc</pre>
<p>Regenerate your makefile and your application. The <tt>.exe</tt> file will now be represented with your icon in Explorer.</p>
<p>If you do not use <tt>qmake</tt>, the necessary steps are: first, run the <tt>rc</tt> program on the <tt>.rc</tt> file, then link your application with the resulting <tt>.res</tt> file.</p>
<a name="setting-the-application-icon-on-mac-os-x"></a>
<h2>Setting the Application Icon on Mac OS X</h2>
<p>The application icon, typically displayed in the application dock area, is set by calling <a href="qwidget.html#windowIcon-prop">QWidget::setWindowIcon</a>() on a top-level widget. It is possible that the program could appear in the application dock area before the function call, in which case a default icon will appear during the bouncing animation.</p>
<p>To ensure that the correct icon appears, both when the application is being launched, and in the Finder, it is necessary to employ a platform-dependent technique.</p>
<p>Although many programs can create icon files (<tt>.icns</tt>), the recommended approach is to use the <i>Icon Composer</i> program supplied by Apple (in the <tt>Developer/Application</tt> folder). <i>Icon Composer</i> allows you to import several different sized icons (for use in different contexts) as well as the masks that go with them. Save the set of icons to a file in your project directory.</p>
<p>If you are using qmake to generate your makefiles, you only need to add a single line to your <tt>.pro</tt> project file. For example, if the name of your icon file is <tt>myapp.icns</tt>, and your project file is <tt>myapp.pro</tt>, add this line to <tt>myapp.pro</tt>:</p>
<pre class="cpp"> ICON = myapp.icns</pre>
<p>This will ensure that <tt>qmake</tt> puts your icons in the proper place and creates an <tt>Info.plist</tt> entry for the icon.</p>
<p>If you do not use <tt>qmake</tt>, you must do the following manually:</p>
<ol class="1">
<li>Create an <tt>Info.plist</tt> file for your application (using the <tt>PropertyListEditor</tt>, found in <tt>Developer/Applications</tt>).</li>
<li>Associate your <tt>.icns</tt> record with the <tt>CFBundleIconFile</tt> record in the <tt>Info.plist</tt> file (again, using the <tt>PropertyListEditor</tt>).</li>
<li>Copy the <tt>Info.plist</tt> file into your application bundle's <tt>Contents</tt> directory.</li>
<li>Copy the <tt>.icns</tt> file into your application bundle's <tt>Contents/Resources</tt> directory.</li>
</ol>
<a name="setting-the-application-icon-on-common-linux-desktops"></a>
<h2>Setting the Application Icon on Common Linux Desktops</h2>
<p>In this section we briefly describe the issues involved in providing icons for applications for two common Linux desktop environments: <a href="http://www.kde.org/">KDE</a> and <a href="http://www.gnome.org/">GNOME</a>. The core technology used to describe application icons is the same for both desktops, and may also apply to others, but there are details which are specific to each. The main source of information on the standards used by these Linux desktops is <a href="http://www.freedesktop.org/">freedesktop.org</a>. For information on other Linux desktops please refer to the documentation for the desktops you are interested in.</p>
<p>Often, users do not use executable files directly, but instead launch applications by clicking icons on the desktop. These icons are representations of &quot;desktop entry files&quot; that contain a description of the application that includes information about its icon. Both desktop environments are able to retrieve the information in these files, and they use it to generate shortcuts to applications on the desktop, in the start menu, and on the panel.</p>
<p>More information about desktop entry files can be found in the <a href="http://www.freedesktop.org/Standards/desktop-entry-spec">Desktop Entry Specification</a>.</p>
<p>Although desktop entry files can usefully encapsulate the application's details, we still need to store the icons in the conventional location for each desktop environment. A number of locations for icons are given in the <a href="http://www.freedesktop.org/Standards/icon-theme-spec">Icon Theme Specification</a>.</p>
<p>Although the path used to locate icons depends on the desktop in use, and on its configuration, the directory structure beneath each of these should follow the same pattern: subdirectories are arranged by theme, icon size, and application type. Generally, application icons are added to the hicolor theme, so a square application icon 32 pixels in size would be stored in the <tt>hicolor/32x32/apps</tt> directory beneath the icon path.</p>
<a name="k-desktop-environment-kde"></a>
<h3>K Desktop Environment (KDE)</h3>
<p>Application icons can be installed for use by all users, or on a per-user basis. A user currently logged into their KDE desktop can discover these locations by using <a href="http://developer.kde.org/documentation/other/kde-config.html">kde-config</a>, for example, by typing the following in a terminal window:</p>
<pre class="cpp"> kde-config --path icon</pre>
<p>Typically, the list of colon-separated paths printed to stdout includes the user-specific icon path and the system-wide path. Beneath these directories, it should be possible to locate and install icons according to the conventions described in the <a href="http://www.freedesktop.org/Standards/icon-theme-spec">Icon Theme Specification</a>.</p>
<p>If you are developing exclusively for KDE, you may wish to take advantage of the <a href="http://developer.kde.org/documentation/other/makefile_am_howto.html">KDE build system</a> to configure your application. This ensures that your icons are installed in the appropriate locations for KDE.</p>
<p>The KDE developer website is at <a href="http://developer.kde.org/">http://developer.kde.org/</a>.</p>
<a name="gnome"></a>
<h3>GNOME</h3>
<p>Application icons are stored within a standard system-wide directory containing architecture-independent files. This location can be determined by using <tt>gnome-config</tt>, for example by typing the following in a terminal window:</p>
<pre class="cpp"> gnome-config --datadir</pre>
<p>The path printed on stdout refers to a location that should contain a directory called <tt>pixmaps</tt>; the directory structure within the <tt>pixmaps</tt> directory is described in the <a href="http://www.freedesktop.org/Standards/icon-theme-spec">Icon Theme Specification</a>.</p>
<p>If you are developing exclusively for GNOME, you may wish to use the standard set of <a href="http://developer.gnome.org/tools/build.html">GNU Build Tools</a>, also described in the relevant section of the <a href="http://developer.gnome.org/doc/GGAD/ggad.html">GTK+/Gnome Application Development book</a>. This ensures that your icons are installed in the appropriate locations for GNOME.</p>
<p>The GNOME developer website is at <a href="http://developer.gnome.org/">http://developer.gnome.org/</a>.</p>
<a name="setting-the-application-icon-on-the-symbian-platform"></a>
<h2>Setting the Application Icon on the Symbian platform</h2>
<p>In order to set the application icon for Symbian platform applications, you need an SVG-T icon. For information on how to create SVG-T compliant icons, please refer to <a href="http://wiki.forum.nokia.com/index.php/How_to_create_application_icon(SVG)_in_S60_3rd_edition">http://wiki.forum.nokia.com/index.php/How_to_create_application_icon</a>(SVG)_in_S60_3rd_edition</p>
<p>Once the icon is available in the correct format and assuming you are using <tt>qmake</tt> to generate your makefiles, you only need to add a single line to your <tt>.pro</tt> project file. For example, if the name of your icon file is <tt>myapp.svg</tt>, and your project file is <tt>myapp.pro</tt>, add this line to <tt>myapp.pro</tt>:</p>
<pre class="cpp"> ICON = myapp.svg</pre>
</div>
<!-- @@@appicon.html -->
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2013 Digia Plc and/or its
      subsidiaries. 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>
      Digia, Qt and their respective logos are trademarks of Digia Plc 
      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>