返回介绍

User Interface Compiler (uic)

发布于 2019-10-04 15:05:10 字数 2631 浏览 1140 评论 0 收藏 0

This page documents the User Interface Compiler for the Qt GUI
application framework. The uic reads a user interface definition
(.ui) file in XML as generated by Qt
Designer and creates corresponding C++ header or source files.
It can also generate an image file to embed raw image data in C++
source code.

Options

File Generation Options

Generate declaration:

uic  [options]  <file>

Generate implementation:

uic  [options] -impl <headerfile> <file>
  • <headerfile> - name of the declaration file

Generate image collection:

uic  [options] -embed <project> <image1> <image2> <image3> ...
  • <project> - project name
  • <image[0..n]> - image files

For convenience, uic can also generate declaration or
implementation stubs for subclasses.

Generate subclass declaration:

uic  [options] -subdecl <classname> <headerfile> <file>
  • <classname> - name of the subclass to generate
  • <headerfile> - declaration file of the baseclass

Generate subclass implementation:

uic  [options] -subimpl <classname> <headerfile> <file>
  • <classname> - name of the subclass to generate
  • <headerfile> - declaration file of the subclass

General Options

  • -o file - write output to 'file' rather than to stdout.
  • -nofwd - omit forward declarations of custom classes in the
    generated header file. This is necessary if typedef classes are used.

  • -tr func - use func(sourceText, comment) rather than
    trUtf8(sourceText, comment) for internationalization.

Usage

uic is almost always invoked by make (1), rather than by hand.

Here are useful makefile rules if you only use GNU make:

    %.h: %.ui
        uic 
lt; -o $@

    %.cpp: %.ui
        uic -impl $*.h 
lt; -o $@

If you want to write portably, you can use individual rules of the
following form:

    NAME.h: NAME.ui
        uic 
lt; -o $@

    NAME.cpp: NAME.ui
        uic -impl $*.h 
lt; -o $@

You must also remember to add NAME.cpp to your SOURCES (substitute
your favorite name) variable and NAME.o to your OBJECTS variable.

(While we prefer to name our C++ source files .cpp, the uic doesn't
care, so you can use .C, .cc, .CC, .cxx or even .c++ if you prefer.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文