版权声明
请尊重原创作品。转载请保持文章完整性,并以超链接形式注明原始作者“tingsking18”和主站点地址,方便其他朋友提问和指正。
下面是QT Assistant中关于QT变量的说明:
If the CONFIG variable contains the qt value, qmake's support for Qt applications is enabled. This makes it possible to fine-tune which of the Qt modules are used by your application. This is achieved with the QT variable which can be used to declare the required extension modules. For example, we can enable the XML and network modules in the following way:
CONFIG += qt
QT += network xml
Note that QT includes the core and gui modules by default, so the above declaration adds the network and XML modules to this default list. The following assignment omits the default modules, and will lead to errors when the application's source code is being compiled:
QT = network xml # This will omit the core and gui modules.
If you want to build a project without the gui module, you need to exclude it with the "-=" operator. By default, QT contains both core and gui, so the following line will result in a minimal Qt project being built:
QT -= gui # Only the core module is used.
The table below shows the options that can be used with the QT variable and the features that are associated with each of them:
Note that adding the opengl option to the QT variable automatically causes the equivalent option to be added to the CONFIG variable. Therefore, for Qt applications, it is not necessary to add the opengl option to both CONFIG and QT.
我解释一下:QT缺省使用了core和gui库。我们在$QT/mkspecs/default/qmake.conf中可以看到有
QT+= core gui
这就是缺省为QT变量赋的值。
同样在$QT/mkspecs/win32-msvc/qmake.conf中也可以看到
QT+= core gui的定义。
当我们需要使用除core和gui之外的库的时候。我们就需要:
QT +=webkit类似这样的来使QT获取webkit的库。
我们来看$QT/mkspecs\features\qt.prf
# As order does matter for static libs, we reorder the QT variable here
TMPLIBS = webkit phonon dbus testlib script svg qt3support sql xmlpatterns xml opengl gui network core
for(QTLIB, $$list($$TMPLIBS)) {
contains(QT, $$QTLIB): QT_ORDERED += $$QTLIB
}
QT_UNKNOWN = $$QT
QT_UNKNOWN -= $$QT_ORDERED
QT = $$QT_ORDERED
for(QTLIB, $$list($$QT_UNKNOWN)) {
!contains(TMPLIBS, $$QTLIB):message("Warning: unknown QT: $$QTLIB")
}
这一段就是对QT这个变量进行重新赋值,如果我们使用的库在上述TMPLIBS定义的里面,就添加到QT变量中去。否则就warning
连接的时候需要lib文件,下面是对QTLIB进行的设置。
for(QTLIB, $$list($$lower($$unique(QT)))) {
unset(qlib_style)
!qt_debug:!qt_release {
CONFIG(debug, debug|release):qlib_style = debug
else:qlib_style = release
} else:CONFIG(qt_debug, qt_debug|qt_release) {
qlib_style = debug
} else {
qlib_style = release
}
unset(qlib)
isEqual(QTLIB, gui):qlib = QtGui
else:isEqual(QTLIB, network):qlib = QtNetwork
else:isEqual(QTLIB, xml):qlib = QtXml
else:isEqual(QTLIB, xmlpatterns):qlib = QtXmlPatterns
else:isEqual(QTLIB, opengl):qlib = QtOpenGL
else:isEqual(QTLIB, sql):qlib = QtSql
else:isEqual(QTLIB, core):qlib = QtCore
else:isEqual(QTLIB, canvas):qlib = QtCanvas
else:isEqual(QTLIB, qt3support):qlib = Qt3Support
else:isEqual(QTLIB, svg):qlib = QtSvg
else:isEqual(QTLIB, script):qlib = QtScript
else:isEqual(QTLIB, testlib):qlib = QtTest
else:isEqual(QTLIB, dbus):qlib = QtDBus
else:isEqual(QTLIB, phonon):qlib = phonon
else:isEqual(QTLIB, webkit):qlib = QtWebKit
else:message("Unknown QT: $$QTLIB"):qlib =
!isEmpty(qlib) {
target_qt:isEqual(TARGET, qlib) {
warning($$TARGET cannot have a QT of $$QTLIB)
} else {
DEFINES *= $$upper(QT_$${QTLIB}_LIB)
exists($$QMAKE_INCDIR_QT/$$qlib) {
INCLUDEPATH -= $$QMAKE_INCDIR_QT/$$qlib
INCLUDEPATH = $$QMAKE_INCDIR_QT/$$qlib $$INCLUDEPATH
}
isEqual(QTLIB, opengl):CONFIG += opengl
isEqual(QTLIB, qt3support):DEFINES *= QT3_SUPPORT
isEqual(QTLIB, testlib):CONFIG += console
isEqual(QTLIB, dbus):CONFIG += dbusadaptors dbusinterfaces
qtAddLibrary($$qlib)
}
}
}
分享到:
相关推荐
再在终端输入:zhuquan@zhuquan-HP-Z230-Tower-Workstation:~$ qmake -v显示结果为:QMake version
QT参考手册qmake手册Qt对象模型qt设计器等4个pdf文档
这个是单独的qmake.exe工具,如果不想安装qt的相关的包仅仅想使用QT creator。
交叉编译QT4.8.7源码生成qmake工具.pdf
使用qmake,开发者创建一个简单的“项目”文件并且运行qmake生成适当的Makefile。qmake会注意所有的编译器和平台的依赖性,可以把开发者解放出来只关心他们的代码。Trolltech公司使用qmake作为Qt库和Qt所提供的工具...
Qt5.14.2交叉编译配套qmake.conf文件
003 QT的SDK中各个目录和文件功能说明 004 创建第一个qtcreator项目并确定文件和目录的作用 005 linux中安装qt及其依赖并编写测试项目 006 windows下qtcreator调试环境安装配置使用 007 qtcreator引入第三方...
qt生成vs.net工程实例,pro文件格式解析
QT4学习资源,qmake-manual,英文版
本篇讲解在Qt的.pro文件使用defineReplace函数。 1、先看官网的说明文档 https://doc.qt.io/qt-5/qmake-language.html#replace-functions 1.1 语法 使用defineReplace函数定义func函数 defineReplace(func) { } ...
qt4资源 和一些qmake .....和一些港湾网络的一个教学材料。。。哈哈
Qt pro文件转 vc project qmake -t vcapp
从题而看,我们必须要明确的是qmake不仅仅是可以在QT中可以使用,在其他的情况下也可以使用。实际上qmake是一个帮助在不同平台上简化编译步骤的工具,她是来自Trolltech,qmake能够自动生成Makefile 使得只需要少量...
qt video,从基础开始,第2部分,一共14部分,使用vs2015的addin作为教学工具,很不错的。
Qt中怎么用Ui文件 第一步, 制作ui文件。 首先应该用Qt Designer绘制一个自己的界面,并存为myform.ui(这里的myform可以用自己喜欢的名字代替)。 在制作自己的界面文件时要注意以下几个要点: 1、要记住ui文件的...
./QT中PRO文件写法的详细介绍.pdf ./Qt持久性对象进行序列化.pdf ./Qt新渲染底层Scene Graph研究3.pdf ./Qt模块化笔记之Qt_Quick--用QQuickImageProvider给Image组件添加图片.pdf ./QT中emit,signal,slot.pdf ./Q_...
由于默认的ProtocolBuf在windows下生成的是静态链接库,在官方下载的动态编译的QT下无法使用,所以自己编译了动态链接库的版本。
《Qt 6 C++开发指南》包含丰富的示例项目,并且提供了 4 个版本的示例程序 功能和目的:这是全书示例项目的完整源代码,使用 qmake 构建系统管理项目。...根目录下有一个版本说明文件,说明了软件 版本和历史修改记录。
qmake及QTCreator的使用教程
安装某些软件是总是缺少一些库,这是我搜索的资源希望对你有用 qt4-qmake_4.4.3-1+lenny1_i386.deb