/usr/share/qt5/doc/qtdoc/appicon.html is in qt5-doc-html 5.5.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- appicon.qdoc -->
<title>Setting the Application Icon | Qt 5.5 </title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<ul>
<li><a href="index.html">Qt 5.5</a></li>
<li>Setting the Application Icon</li>
<li id="buildversion">Qt 5.5.1 Reference Documentation</li>
</ul>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<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-os-x">Setting the Application Icon on 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>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></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 QWindow::setWindowIcon() method.</p>
<p>In order to change the icon of the executable application file itself, as it is presented on the desktop (i.e., prior to application execution), it is necessary to employ another, platform-dependent technique.</p>
<a name="setting-the-application-icon-on-windows"></a>
<h2 id="setting-the-application-icon-on-windows">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. 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 <code>myappico.ico</code>.</p>
<p>Then, assuming you are using qmake to generate your makefiles, you only need to add a single line to your <code>.pro</code> project file:</p>
<pre class="cpp">RC_ICONS = myappico.ico</pre>
<p>Finally, regenerate your makefile and your application. The <code>.exe</code> file will now be represented by your icon in Explorer.</p>
<p>However, if you already have an <code>.rc</code> file, for example, with the name <code>myapp.rc</code>, which you want to reuse, the following two steps will be required. First, put a single line of text to the <code>myapp.rc</code> file:</p>
<pre class="cpp">IDI_ICON1 ICON DISCARDABLE <span class="string">"myappico.ico"</span></pre>
<p>Then, add this line to your <code>myapp.pro</code> file:</p>
<pre class="cpp">RC_FILE = myapp.rc</pre>
<p>If you do not use <code>qmake</code>, the necessary steps are: first, create an <code>.rc</code> file and run the <code>rc</code> or <code>windres</code> program on the <code>.rc</code> file, then link your application with the resulting <code>.res</code> file.</p>
<a name="setting-the-application-icon-on-os-x"></a>
<h2 id="setting-the-application-icon-on-os-x">Setting the Application Icon on OS X</h2>
<p>The application icon, typically displayed in the application dock area, is set by calling QWindow::setWindowIcon() on a window. 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 (<code>.icns</code>), the recommended approach is to use the <i>Icon Composer</i> program supplied by Apple (in the <code>Developer/Application</code> 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 <code>.pro</code> project file. For example, if the name of your icon file is <code>myapp.icns</code>, and your project file is <code>myapp.pro</code>, add this line to <code>myapp.pro</code>:</p>
<pre class="cpp">ICON = myapp.icns</pre>
<p>This will ensure that <code>qmake</code> puts your icons in the proper place and creates an <code>Info.plist</code> entry for the icon.</p>
<p>If you do not use <code>qmake</code>, you must do the following manually:</p>
<ol class="1">
<li>Create an <code>Info.plist</code> file for your application (using the <code>PropertyListEditor</code>, found in <code>Developer/Applications</code>).</li>
<li>Associate your <code>.icns</code> record with the <code>CFBundleIconFile</code> record in the <code>Info.plist</code> file (again, using the <code>PropertyListEditor</code>).</li>
<li>Copy the <code>Info.plist</code> file into your application bundle's <code>Contents</code> directory.</li>
<li>Copy the <code>.icns</code> file into your application bundle's <code>Contents/Resources</code> directory.</li>
</ol>
<a name="setting-the-application-icon-on-common-linux-desktops"></a>
<h2 id="setting-the-application-icon-on-common-linux-desktops">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 "desktop entry files" 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 <code>hicolor/32x32/apps</code> 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 4 desktop can discover these locations by using kde4-config, for example, by typing the following in a terminal window:</p>
<pre class="cpp">kde4<span class="operator">-</span>config <span class="operator">-</span><span class="operator">-</span>path icon</pre>
<p>Applications using Qt 5 and KDE Frameworks 5 will find their icons in the list returned by this command:</p>
<pre class="cpp">qtpaths <span class="operator">-</span><span class="operator">-</span>locate<span class="operator">-</span>dirs GenericDataLocation icons</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://techbase.kde.org/Development/CMake/Addons_for_KDE">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://techbase.kde.org/">http://techbase.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 <code>gnome-config</code>, for example by typing the following in a terminal window:</p>
<pre class="cpp">gnome<span class="operator">-</span>config <span class="operator">-</span><span class="operator">-</span>datadir</pre>
<p>The path printed on stdout refers to a location that should contain a directory called <code>pixmaps</code>; the directory structure within the <code>pixmaps</code> 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>
</div>
<!-- @@@appicon.html -->
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2015 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.<br> 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.<br> 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. </p>
</div>
</body>
</html>
|