标题:qt .pri文件
作者:人月计划
日期:2009-05-16 19:25
内容:
qt4后好像多了一种文件类型就是.pri文件,像qconfig.pri等等,那这种文件类型做什么用的,麻烦各位给点解释阿,谢谢了,
#1 [hercules 05-16 19:36]
pri文件和头文件的作用类似,最后会include到pro文件中
#2 [jorneyr 05-18 03:05]
I wonder if there is a way to have a view of the project tree, showing subdirectories. In our project, we have many different classes that are each in a different directory. Being able to get those subdirectories to show would be useful to find the file we want to edit.
方法: I'm using .pri file in each subdirectory instead of .pro.
TEMPLATE = app
include(foo/foo.pri)
SOURCES += main.cpp \ ...
DEPENDPATH += foo 可以不用
INCLUDEPATH += foo 可以不用
HEADERS += $$PWD/foo.h
SOURCES += $$PWD/foo.cpp
注: $$PWD/必须要用, 否则是显示不出目录结构的, 这个在Windows, Mac下都能起作用, 想必在Linux也同样有效.
什么是.pri文件呢?
Thanks for the hint, but what exactly are .pri files, I often see them
around, but I haven't found anywhere in the documentation where they are
mentioned. Is there a place I can learn about them?
It's just a naming convention for junks of .pro files that are supposed
to be included using 'include(...)' in 'real' .pro files, 'real' meaning
'having a TARGET=... line'.
.pri文件其实就是把.pro文件的后缀改成.pri, .pro文件中使用include(xxx/xxx.pri)和有TARGET=xzy这两行.
The .pri file contains the list of source files, header files, .ui files, and .qrc files in the project. Developers on platforms other than Windows can add or remove files to the project by editing the .pri file.