Qt5 用户界面编译器:-i 选项不可用 [英] Qt5 User Interface Compiler: -i option not available
问题描述
我使用 QtDesigner 创建了一个 .ui 文件 (myform.ui),我想创建相应的头文件 (myform.h) 和实现 (myform.cpp) 文件.
I created a .ui file (myform.ui) using QtDesigner and I would like to create the corresponding header (myform.h) and implementation (myform.cpp) file.
现在我可以在 Linux 上使用以下命令创建头文件 (myform.h):
Now I can create the header file (myform.h) with the following command on Linux:
uic mainwindow.ui -o mainwindow.h
StackExchange 上的旧答案(此处)建议使用以下命令创建实现文件(myform.cpp):
An older answer on StackExchange (here) suggested using the following command to create the implementation file (myform.cpp):
uic -i mainwindow.h -o mainwindow.cpp mainwindow.ui
但是,uic 似乎不支持命令选项 -i,我收到错误消息未知选项 -i".
However, the command option -i doesn't seem to be supported by uic, I get the error message "unknown option -i".
有谁知道我如何从 .h 和 .ui 文件自动生成 .cpp 文件?
Does anyone know how I can automatically generate the .cpp file from the .h and .ui file?
uic 版本是 5.9.5
uic Version is 5.9.5
推荐答案
只需要生成头文件,所有代码(即setupUi()
和retranslateUi()
code>) 位于 uic 生成的标头内.
Only header files need to be generated, all the code (which is setupUi()
and retranslateUi()
) is inside the header generated by uic.
这篇关于Qt5 用户界面编译器:-i 选项不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!