Table of Contents
Abstract
This reference lists all the variables that are used within the “qt4” tool, and the available builders. It is intended for SCons tool developers and core programmers, as a normal user you should read the manual instead.
The “qt4” tool sets construction variables and registers builders for creating applications and libraries that use the Qt4 framework by Trolltech/Nokia.
It supports the following operations:
You do not have to specify moc files explicitly, the tool does it
for you. However, there are a few preconditions to do so: Your header
file must have the same filebase as your implementation file. It must
have one of the suffixes .h, .hpp,
.H, .hxx, .hh.
You can turn off automatic moc file generation by setting
QT4_AUTOSCAN to 0. See also the corresponding builder
method Moc4().
As stated in the Qt documentation, include the moc file at the end of the cxx file. Note that you have to include the file, which is generated by the transformation
${QT4_MOCCXXPREFIX}<basename>${QT4_MOCCXXSUFFIX},
by default <basename>.moc. A warning is
generated after building the moc file, if you do not include the correct
file. If you are using VariantDir, you may need to specify
duplicate=1. You can turn off automatic moc file
generation by setting QT4_AUTOSCAN to 0. See also the
corresponding Moc4 builder method.
TODO: describe in a little more detail.
See also the corresponding Uic4 builder
method.
TODO: describe in a little more detail.
See also the corresponding builder methods Ts4 and Qm4.
Builds an output file from a moc input file. Moc input files are either header files or cxx files. This builder is only available after using the tool 'qt4'.
Example:
env.Moc4('foo.h') # generates moc_foo.cc
env.Moc4('foo.cpp') # generates foo.moc
Just like the Moc4 builder, it builds an output file from a moc input file. Moc input files are either header files or cxx files. This builder is only available after using the tool 'qt4'. It is defined separately for the include driven Automoc strategy (#1) and can be controlled via the QT4_XMOC* variables.
Example:
env.XMoc4('foo.h') # generates moc_foo.cpp
env.XMoc4('foo.cpp') # generates foo.moc
Just like the Moc4 builder, it builds an output
file from a moc input file. However, it does not use any default prefix
or suffix for the filenames. You can, and have to, specify the full
source and target names explicitly. This builder is only available after
using the tool 'qt4'. It can be your last resort, when you have to moc
single files from/to exotic filenames.
Example:
env.ExplicitMoc4('moced_foo.cxx','foo.h') # generates moced_foo.cxx
Builds a header file from an .ui file, where the former contains the setup code for a GUI class. This builder is only available after using the tool 'qt4'. Using this builder lets you override the standard naming conventions (be careful: prefixes are always prepended to names of built files; if you don't want prefixes, you may set them to ``).
Example:
env.Uic4('foo.ui') # -> 'ui_foo.h'
Just like the Uic4 builder, it builds a header
file from a .ui input file. However, it does not use any default prefix
or suffix for the filenames. You can, and have to, specify the full
source and target names explicitly. This builder is only available after
using the tool 'qt4'. It can be your last resort, when you have to
convert .ui files to exotic filenames.
Example:
env.ExplicitUic4('uiced_foo.hpp','foo.ui') # generates uiced_foo.hpp
Builds a cxx file, containing all resources from the given
.qrc file. This builder is only available after using
the tool 'qt4'.
Example:
env.Qrc4('foo.qrc') # -> ['qrc_foo.cc']
Scans the source files in the given path for tr() marked strings,
that should get translated. Writes a .ts file for the
Qt Linguist. This builder is only available after using the tool
'qt4'.
Example:
env.Ts4('foo.ts','.') # -> ['foo.ts']
The Qt4 tool tries to read this from the current Environment
and os.environ. If it is not set and found, the
value of QTDIR (in Environment/os.environ) is
used as a fallback. It is used to initialize all QT4_*
construction variables listed below.
The default is '1', which means that the tool is
automatically scanning for mocable files (see also
QT4_AUTOSCAN_STRATEGY). You can set this
variable to '0' to switch it off, and then use the
Moc4 Builder to explicitly specify files to run
moc on.
The path where the Qt4 binaries are installed. The default
value is 'QT4DIR/bin'.
The path where the Qt4 header files are installed. The
default value is 'QT4DIR/include'. Note: If you
set this variable to None, the tool won't change the
CPPPATH construction variable.
Prints lots of debugging information while scanning for moc files.
The path to the Qt4 moc executable. Default value is
'QT4_BINPATH/moc'.
Default value is ''. Prefix for moc output files, when source is a cxx file and the Automoc strategy #0 (Q_OBJECT driven) is used.
Default value is '.moc'. Suffix for moc output files, when source is a cxx file and the Automoc strategy #0 (Q_OBJECT driven) is used.
Default value is '-i'. These flags are passed to moc, when moccing a C++ file.
Default value is ''. These flags are passed to moc, when moccing a header file.
Default value is 'moc_'. Prefix for moc output files, when the source file is a header and the Automoc strategy #0 (Q_OBJECT driven) is used.
Default value is 'CXXFILESUFFIX'. Suffix
for moc output files, when the source file is a header and the
Automoc strategy #0 (Q_OBJECT driven) is used.
Default value is 'QT4_BINPATH/uic'. The
path to the Qt4 uic executable.
Command to generate the required header and source files
from .ui form files. Is compiled from QT4_UIC
and QT4_UICFLAGS.
The string displayed when generating header and source files
from .ui form files. If this is not set, then
QT4_UICCOM (the command line) is
displayed.
Default value is ''. These flags are passed to the Qt4 uic executable, when creating header and source files from a .ui form file.
Default value is 'ui_'. Prefix for uic generated header files.
Default value is '.h'. Suffix for uic generated header files.
Default value is '.ui'. Suffix of designer input files (form files) in Qt4.
Default value is '0'. When using the Automoc feature of the
Qt4 tool, you can select different strategies for detecting which
files should get moced. The simple approach ('0' as the default)
scans header and source files for the Q_OBJECT macro, so the
trigger 'moc or not' is Q_OBJECT driven. If it is found, the
corresponding file gets moced with the Moc4
builder. This results in the files 'moc_foo.cc' and 'foo.moc' for
header and source file, respectively. They get added to the list
of sources, for compiling the current library or program. In older
Qt manuals, a different technique for mocing is recommended. A cxx
file includes the moced output of itself or its header at the end.
This approach is somewhat deprecated, but the 'qtsolutions' by Qt
are still based on it, for example. You also might have to switch
older Qt sources to a new version 4.x.y. Then you can set this
variable to '1', for 'include driven' mocing. This means that the
tool searches for '#include' statements in all cxx files,
containing a file pattern 'moc_foo.cpp' and 'foo.moc' for header
and source file, respectively. If the file 'foo.h/foo.cpp' then
contains a Q_OBJECT macro, it gets moced but is NOT added to the
list of sources. This is the important difference between the two
strategies. If no matching include patterns are found for the
current cxx file, the Q_OBJECT driven method (#0) is tried as
fallback.
The default is '1', meaning that the tool scans for mocable
files not only in the current directory, but also in all CPPPATH
folders (see also QT4_AUTOMOC_CPPPATH). You can
set this variable to '0' to switch it off on rare occasions, e.g.
when too many search folders give you a bad performance in large
projects.
The list of paths to scan for mocable files (see also
QT4_AUTOMOC_SCANCPPPATH), it is empty by
default which means that the CPPPATH variable is used. You can set
this variable to a subset of CPPPATH in order to improve
performance, i.e. to minimize the search space.
Default value is '0' (disabled). When you set this variable to '1', you enable the automatic removal of C/C++ comments, while searching for the Q_OBJECT keyword during the Automoc process. This can be helpful if you have the string Q_OBJECT in one of your comments, but don't want this file to get moced.
Default value is '1' (enabled). When you set this variable
to '1', all currently set CPPDEFINES get passed to the moc
executable. It does not matter which strategy you selected with
QT4_AUTOSCAN_STRATEGY or whether you call the
Moc4 builder directly.
Default value is '0' (disabled). When you set this variable
to '1', the Ts4 builder will delete your .ts
files on a 'scons -c'. Normally, these files for the QtLinguist
are treated as 'precious' (they are not removed prior to a
rebuild) and do not get cleaned.
Default value is 'moc_'. Like
QT4_MOCHPREFIX, this is the prefix for moc
output files, when the source file is a header and the Automoc
strategy #1 (include driven) is used.
Default value is '.cpp'. Like
QT4_MOCHSUFFIX, this is the suffix for moc
output files, when the source file is a header and the Automoc
strategy #1 (include driven) is used.
Default value is ''. Like
QT4_MOCCXXPREFIX, this is the prefix for moc
output files, when source is a cxx file and the Automoc strategy
#1 (include driven) is used.
Default value is '.moc'. Like
QT4_MOCCXXSUFFIX, this is the suffix for moc
output files, when source is a cxx file and the Automoc strategy
#1 (include driven) is used.
Default value is 'QT4_BINPATH/rcc'. The
path to the Qt4 rcc executable (resource file compiler).
Default value is 'QT4_BINPATH/lupdate'.
The path to the Qt4 lupdate executable (updates the .ts files from
sources).
Default value is 'QT4_BINPATH/lrelease'.
The path to the Qt4 lrelease executable (converts .ts files to
binary .qm files).
Default value is ''. These flags are passed to the Qt4 rcc executable, when compiling a resource file.
Default value is ''. These flags are passed to the Qt4 lupdate executable, when updating .ts files from sources.
Default value is ''. These flags are passed to the Qt4 lrelease executable, when compiling .ts files into binary .qm files.
Default value is '-I'. The prefix for specifying include directories to the Qt4 moc executable.
Default value is '.qrc'. Suffix of Qt4 resource files.
Default value is '$CXXFILESUFFIX'. This is the suffix for compiled .qrc resource files.
Default value is 'qrc_'. This is the prefix for compiled .qrc resource files.
List of include paths for the Qt4 moc executable, is
compiled from QT4_MOCINCPREFIX,
QT4_MOCCPPPATH and
INCSUFFIX.
List of CPP defines that are passed to the Qt4 moc
executable, is compiled from QT4_MOCDEFPREFIX,
CPPDEFINES and
QT4_MOCDEFSUFFIX.
Command to update .ts files for translation from the sources.
The string displayed when updating .ts files from the
sources. If this is not set, then
QT4_LUPDATECOM (the command line) is
displayed.
Command to convert .ts files to binary .qm files.
The string displayed when converting .ts files to binary .qm
files. If this is not set, then QT4_RCC (the
command line) is displayed.