问题
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.
Now I can create the header file (myform.h) with the following command on Linux:
uic mainwindow.ui -o mainwindow.h
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
However, the command option -i doesn't seem to be supported by uic, I get the error message "unknown option -i".
Does anyone know how I can automatically generate the .cpp file from the .h and .ui file?
uic Version is 5.9.5
回答1:
Only header files need to be generated, all the code (which is setupUi()
and retranslateUi()
) is inside the header generated by uic.
来源:https://stackoverflow.com/questions/52708498/qt5-user-interface-compiler-i-option-not-available