Description of QT variables in the Pro file generated by qmake

Source: Internet
Author: User
Copyright Notice

Respect Original Works. Reprinted, please maintain the integrity of the article, and in the form of a hyperlink to indicate the original author "tingsking18" and the main site address, so that other friends can ask and correct.

 

The following describes the QT variables in qt assistant:

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 should des 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.

 

 

I will explain that QT uses core and GUI Libraries by default. In $ QT/mkspecs/default/qmake. conf, we can see that

Qt + = core Gui

This is the default value assigned to the QT variable.

Also available in $ QT/mkspecs/win32-msvc/qmake. conf

Qt ++ = core GUI definition.

When we need to use libraries other than core and GUI. We need:

Qt ++ = WebKit allows QT to obtain the WebKit library.

Let's take a look at $ QT/mkspecs/Features/Qt. PRF

 

# As order does matter for static libs, We reorder the QT variable here
Tmplibs = WebKit phonon javastestlib 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 ")
}

This section re-assigns a value to the QT variable. If the library we use is defined in the tmplibs above, it will be added to the QT variable. Otherwise, warning

The LIB file is required for connection. The settings for qtlib are as follows.

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, release): 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, callback): config + = dbusadaptors dbusinterfaces

Qtaddlibrary ($ qlib)
}
}
}

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.