• 12167阅读
  • 2回复

qt .pri文件 [复制链接]

上一主题 下一主题
离线人月计划
 
只看楼主 倒序阅读 楼主  发表于: 2009-05-16
qt4后好像多了一种文件类型就是.pri文件,像qconfig.pri等等,那这种文件类型做什么用的,麻烦各位给点解释阿,谢谢了,
离线hercules

只看该作者 1楼 发表于: 2009-05-16
pri文件和头文件的作用类似,最后会include到pro文件中
我的QQ号:337396132
欢迎大家加我为好友,一起学习Qt
离线jorneyr

只看该作者 2楼 发表于: 2009-05-18
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.
[Your main .pro file]
TEMPLATE = app
include(foo/foo.pri)
SOURCES += main.cpp \ ...

DEPENDPATH += foo [not sure, it is necessary] 可以不用
INCLUDEPATH += foo [not sure, it is necessary] 可以不用

[foo.pri]
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.
快速回复
限100 字节
 
上一个 下一个