开发者

How to compile the qt .uic file with Xcode?

开发者 https://www.devze.com 2023-02-17 12:45 出处:网络
How do I link up the C++ files with the .uic fi开发者_开发知识库les in Qt?I suggest use qmake. This tool greatly simplifies the Qt compilation process.

How do I link up the C++ files with the .uic fi开发者_开发知识库les in Qt?


I suggest use qmake. This tool greatly simplifies the Qt compilation process. All .ui files have to be converted into C++ code, and compiled. All classes that inherit from QObject have to be processed by the meta object compiler.


*.ui are user interface files generated by designer. They are processed by uic. Try uic -h for help information.

qmake will generate xcode project files by default or can generate Makefiles.


You can add a rule in Xcode. See this link for the rule adding info for the moc

http://gauthieralexandreblog.wordpress.com/2012/12/14/qt-and-xcode-4-5-how-to-moc-q_object-classes-automatically/

You will probably want to add rules for both the moc and uic.

I am using Xcode 5.0.2 and under the Build Rules tab I selected "Copy To Target" for "System C Rule". That gives me a little window where I set it up like so:

Process: "Source Files With Names Matching" *.ui Using: "Custom Script"

Script: /Users/develop-brooke/Qt/5.2.1/clang_64/bin/uic -o ${INPUT_FILE_DIR}/GeneratedFiles/ui_${INPUT_FILE_BASE}.h ${INPUT_FILE_PATH}

Output File: ${INPUT_FILE_DIR}/GeneratedFiles/ui_${INPUT_FILE_BASE}.h

Obviously point to your directory of Qt. You could omit the GeneratedFiles directory if you want. Add all of your ui files to the Build Phase: Compile Sources. Once you build it once, go back and make sure the path to these files is in your project. I added them to my project.

Best, Brooke

0

精彩评论

暂无评论...
验证码 换一张
取 消