QT pro 中使用 pri

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 i

nclude(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.

 

注意 : .pri 文件必须用$$PWD,否则qmake就会提示找不到文件.

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值