uic.html 5.24 KB
Newer Older
xuebingbing's avatar
xuebingbing committed
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- uic.qdoc -->
  <title>User Interface Compiler (uic) | Qt 5.11</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="index.html">Qt 5.11</a></td><td >User Interface Compiler (uic)</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.11.2 Reference Documentation</td>
        </tr></table>
      </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="#options">Options</a></li>
<li class="level1"><a href="#examples">Examples</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">User Interface Compiler (uic)</h1>
<span class="subtitle"></span>
<!-- $$$uic.html-description -->
<div class="descr"> <a name="details"></a>
<p>This page documents the <i>User Interface Compiler</i> for the <a href="../qtwidgets/qtwidgets-index.html">Qt Widgets</a> module. The <code>uic</code> reads an XML format user interface definition (<code>.ui</code>) file as generated by <a href="../qtdesigner/qtdesigner-manual.html">Qt Designer</a> and creates a corresponding C++ header file.</p>
<p>Usage:</p>
<pre class="cpp">

  uic <span class="operator">[</span>options<span class="operator">]</span> <span class="operator">&lt;</span>uifile<span class="operator">&gt;</span>

</pre>
<a name="options"></a>
<h2 id="options">Options</h2>
<p>The following table lists the command-line options recognized by <code>uic</code>.</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th >Option</th><th >Description</th></tr></thead>
<tr valign="top" class="odd"><td ><code>-o &lt;file&gt;</code></td><td >Write output to <code>&lt;file&gt;</code> instead of to standard output.</td></tr>
<tr valign="top" class="even"><td ><code>-tr &lt;func&gt;</code></td><td >Use <code>&lt;func&gt;</code> for translating strings instead of <code>tr()</code>.</td></tr>
<tr valign="top" class="odd"><td ><code>-p</code></td><td >Don't generate guards against multiple inclusion (<code>#ifndef</code> FOO_H ..&#x2e;)&#x2e;</td></tr>
<tr valign="top" class="even"><td ><code>-h</code></td><td >Display the usage and the list of options.</td></tr>
<tr valign="top" class="odd"><td ><code>-v</code></td><td >Display <code>uic</code>'s version number.</td></tr>
<tr valign="top" class="even"><td ><code>-d</code></td><td >Display the dependencies for the UI.</td></tr>
<tr valign="top" class="odd"><td ><code>-n</code></td><td >Don't generate any #include directives.</td></tr>
<tr valign="top" class="even"><td ><code>--postfix &lt;postfix&gt;</code></td><td >Append <code>&lt;postfix&gt;</code> to all generated classnames.</td></tr>
<tr valign="top" class="odd"><td ><code>--include &lt;file&gt;</code></td><td >Add #include <code>&lt;file&gt;</code> to the output.</td></tr>
</table></div>
<a name="examples"></a>
<h2 id="examples">Examples</h2>
<p>If you use <code>qmake</code>, <code>uic</code> will be invoked automatically for header files.</p>
<p>Here are useful makefile rules if you only use GNU make:</p>
<pre class="cpp">

  ui_<span class="operator">%</span><span class="operator">.</span>h: <span class="operator">%</span><span class="operator">.</span>ui
          uic $<span class="operator">&lt;</span> <span class="operator">-</span>o $@

</pre>
<p>If you want to write portably, you can use individual rules of the following form:</p>
<pre class="cpp">

  ui_foo<span class="operator">.</span>h: foo<span class="operator">.</span>ui
          uic $<span class="operator">&lt;</span> <span class="operator">-</span>o $@

</pre>
<p>You must also remember to add <code>ui_foo.h</code> to your <code>HEADERS</code> (substitute your favorite name).</p>
</div>
<!-- @@@uic.html -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2018 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>