温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

QT通过 QT designer 可以生成 ui文件

发布时间:2020-06-17 20:46:29 来源:网络 阅读:1636 作者:WZM3558862 栏目:开发技术
  1. .生成方式:QT通过 QT designer 可以生成 ui文件  (.ui  && .ui.h)

  2. 2.UI文件内容: 以XML方式记录了QT designer生成的界面的相关内容,大体可以分为如下内容


  3. widget属性,其内容(图形元素, layout。。)的相关属性

  4. 头文件     

  5. 变量

  6. 槽 


  7. 函数

  8. 3. 通过UIC  (user interface compiler)可以把UI文件内容翻译成标准.h, .cpp文件

  9. uic使用方法:


  10. 生成声明(.h)文件:    uic [options] <file>  


  11. uic  [options] -subdecl <classname> <headerfile> <file>生成实现(.cpp)文件:uic [options] -impl <headerfile> <file>

  12. uic  [options] -subimpl <classname> <headerfile> <file选项:


  13. -o file - write output to 'file' rather than to stdout. 

  14. -nofwd - omit forward declarations of custom classes in the generated header file. This is necessary if typedef classes are used. 

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

  16. 4.使用: (IN Makefile)


  17.     %.h: %.ui        uic $< -o $@    %.cpp: %.ui        uic -impl $*.h $< -o $@注:

  18. .ui.h 文件包含ui文件功能实现部分(slot,function,include,variable)

  19. 更改.ui.h文件后(如:加入一个槽),可能.ui文件没有做自动改变,这样会导致编译失败,需手动更改.ui文件

  20. QT 的Makefile会根据.ui文件生成相应源代码,而不是.ui.h文件


  21. 5.更改 .ui文件中的中文(.ui文件中中文为utf8, vi中显示不正常)

  22.     iconv  -f utf8 -t gbk  input.ui > output.ui.gbk

  23.     vi  output.ui.gbk

  24.     iconv  -f gbk -t utf8 output.ui.gbk > input.ui


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

qt ne
AI