diff options
332 files changed, 8402 insertions, 1092 deletions
diff --git a/bin/syncqt.pl b/bin/syncqt.pl index cc91a11de0..8c1e04e0d0 100755 --- a/bin/syncqt.pl +++ b/bin/syncqt.pl @@ -97,7 +97,6 @@ my $force_win = 0; my $force_relative = 0; my $check_includes = 0; my $copy_headers = 0; -my $create_uic_class_map = 0; my $create_private_headers = 1; my $minimal = 0; my $module_version = 0; @@ -508,36 +507,6 @@ sub copyFile } ###################################################################### -# Syntax: symlinkFile(file, ifile) -# Params: file, string, filename to create "symlink" for -# ifile, string, destination name of symlink -# -# Purpose: File is symlinked to ifile (or copied if filesystem doesn't -# support symlink). -# Returns: 1 on success, else 0. -###################################################################### -sub symlinkFile -{ - my ($lib, $file, $ifile) = @_; - - if ($isunix) { - print "$lib: symlink created for $file " if ($verbose_level); - if ( $force_relative && ($ifile =~ /^$quoted_basedir/)) { - my $t = getcwd(); - my $c = -1; - my $p = "../"; - $t =~ s-^$quoted_basedir/--; - $p .= "../" while( ($c = index( $t, "/", $c + 1)) != -1 ); - $file =~ s-^$quoted_basedir/-$p-; - print " ($file)\n" if($verbose_level); - } - print "\n" if($verbose_level); - return symlink($file, $ifile); - } - return copyFile($lib, $file, $ifile); -} - -###################################################################### # Syntax: findFiles(dir, match, descend) # Params: dir, string, directory to search for name # match, string, regular expression to match in dir @@ -786,7 +755,6 @@ while ( @ARGV ) { $modules{$module} = $prodir; push @modules_to_sync, $module; $moduleheaders{$module} = $headerdir; - $create_uic_class_map = 0; } elsif ($var eq "version") { if($val) { $module_version = $val; @@ -1079,34 +1047,37 @@ foreach my $lib (@modules_to_sync) { my $header_dir = dirname($header_path); make_path($header_dir, $lib, $verbose_level); - open(HEADER, ">$header_path") || die "Could not open $header_path for writing: $!\n"; - print HEADER "#ifndef $guard\n"; - print HEADER "#define $guard\n"; + my $hdrcont = + "#ifndef $guard\n" . + "#define $guard\n"; my $warning = "Header <$lib/"; $warning .= "private/" unless ($public_header); $warning .= "$header> is deprecated. Please include <$include> instead."; - print HEADER "#if defined(__GNUC__)\n"; - print HEADER "# warning $warning\n"; - print HEADER "#elif defined(_MSC_VER)\n"; - print HEADER "# pragma message (\"$warning\")\n"; - print HEADER "#endif\n"; - print HEADER "#include <$include>\n"; + $hdrcont .= + "#if defined(__GNUC__)\n" . + "# warning $warning\n" . + "#elif defined(_MSC_VER)\n" . + "# pragma message (\"$warning\")\n" . + "#endif\n" . + "#include <$include>\n"; if ($public_header) { - print HEADER "#if 0\n"; - print HEADER "#pragma qt_no_master_include\n"; - print HEADER "#endif\n"; + $hdrcont .= + "#if 0\n" . + "#pragma qt_no_master_include\n" . + "#endif\n"; } - print HEADER "#endif\n"; - close HEADER; - - if ($verbose_level < 3) { - my $line_prefix = ","; - $line_prefix = "$lib: created deprecated header(s) {" if ($first); - print "$line_prefix $header"; - } else { - print "$lib: created deprecated header $header => $include\n"; + $hdrcont .= + "#endif\n"; + if (writeFile($header_path, $hdrcont)) { + if ($verbose_level < 3) { + my $line_prefix = ","; + $line_prefix = "$lib: created deprecated header(s) {" if ($first); + print "$line_prefix $header"; + } else { + print "$lib: created deprecated header $header => $include\n"; + } + $first = 0; } - $first = 0; } my $addendum = fixPaths($header_path, $dir) . " "; @@ -1156,25 +1127,6 @@ foreach my $lib (@modules_to_sync) { writeFile($headers_pri_file, $headers_pri_contents, $lib, "headers.pri file"); } } -unless($showonly || !$create_uic_class_map) { - my $class_lib_map = "$out_basedir/src/tools/uic/qclass_lib_map.h"; - if(-e $class_lib_map) { - open CLASS_LIB_MAP, "<$class_lib_map"; - local $/; - binmode CLASS_LIB_MAP; - my $old_class_lib_map_contents = <CLASS_LIB_MAP>; - close CLASS_LIB_MAP; - $old_class_lib_map_contents =~ s/\r//g; # remove \r's , so comparison is ok on all platforms - $class_lib_map = 0 if($old_class_lib_map_contents eq $class_lib_map_contents); - } - if($class_lib_map) { - my $class_lib_map_dir = dirname($class_lib_map); - make_path($class_lib_map_dir, "<outdir>", $verbose_level); - open CLASS_LIB_MAP, ">$class_lib_map"; - print CLASS_LIB_MAP $class_lib_map_contents; - close CLASS_LIB_MAP; - } -} if($check_includes) { foreach my $lib (@modules_to_sync) { diff --git a/config.tests/unix/arch.test b/config.tests/unix/arch.test index e65541cda7..3efd6f4f25 100755 --- a/config.tests/unix/arch.test +++ b/config.tests/unix/arch.test @@ -44,8 +44,8 @@ else fi if strings - $binary 2>/dev/null | \ - awk -F: '/==Qt=magic=Qt== Architecture/ { print "'$VARPREFIX'_ARCH=\"" $2 "\"" } - /==Qt=magic=Qt== Sub-architecture/ { print "'$VARPREFIX'_CPUFEATURES=\"" $2 "\"" }' > "$RESULTFILE" + awk -F: '/\=\=Qt\=magic\=Qt\=\= Architecture/ { print "'$VARPREFIX'_ARCH=\"" $2 "\"" } + /\=\=Qt\=magic\=Qt\=\= Sub-architecture/ { print "'$VARPREFIX'_CPUFEATURES=\"" $2 "\"" }' > "$RESULTFILE" then [ "$VERBOSE" = "yes" ] && echo " Found architecture in binary" && \ cat "$RESULTFILE" @@ -61,6 +61,13 @@ if [ -f "$LICENSE_FILE" ]; then diff "${LICENSE_FILE}.tmp" "${LICENSE_FILE}" >/dev/null 2>&1 || LICENSE_FILE="${LICENSE_FILE}.tmp" fi +# do this early so we don't store it in config.status +CFG_TOPLEVEL= +if [ x"$1" = x"-top-level" ]; then + CFG_TOPLEVEL=yes + shift +fi + # later cache the command line in config.status OPT_CMDLINE=`echo $@ | sed "s,-v ,,g; s,-v$,,g"` @@ -876,6 +883,7 @@ CFG_SSE=auto CFG_FONTCONFIG=auto CFG_LIBFREETYPE=auto CFG_SQL_AVAILABLE= +QT_ALL_BUILD_PARTS=" libs tools examples tests " QT_DEFAULT_BUILD_PARTS="libs tools examples" CFG_BUILD_PARTS="" CFG_NOBUILD_PARTS="" @@ -1113,7 +1121,45 @@ while [ "$#" -gt 0 ]; do VAL=no ;; #Qt style options that pass an argument - -prefix|-docdir|-headerdir|-plugindir|-importdir|-qmldir|-archdatadir|-datadir|-libdir|-bindir|-libexecdir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-skip|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir|-hostlibdir|-qpa|-qconfig|-android-sdk|-android-ndk|-android-ndk-platform|-android-ndk-host|-android-arch|-android-toolchain-version) + -prefix| \ + -docdir| \ + -headerdir| \ + -plugindir| \ + -importdir| \ + -qmldir| \ + -archdatadir| \ + -datadir| \ + -libdir| \ + -bindir| \ + -libexecdir| \ + -translationdir| \ + -sysconfdir| \ + -examplesdir| \ + -testsdir| \ + -hostdatadir| \ + -hostbindir| \ + -hostlibdir| \ + -sysroot| \ + -depths| \ + -make| \ + -nomake| \ + -skip| \ + -platform| \ + -xplatform| \ + -device| \ + -device-option| \ + -sdk| \ + -arch| \ + -host-arch| \ + -mysql_config| \ + -qpa| \ + -qconfig| \ + -android-sdk| \ + -android-ndk| \ + -android-ndk-platform| \ + -android-ndk-host| \ + -android-arch| \ + -android-toolchain-version) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` shift VAL="$1" @@ -1392,10 +1438,22 @@ while [ "$#" -gt 0 ]; do fi ;; nomake) + if [ -n "${QT_ALL_BUILD_PARTS%%* $VAL *}" ]; then + echo "Unknown part $VAL passed to -nomake." >&2 + exit 1 + fi CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS $VAL" ;; make) - CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL" + if [ "$VAL" = "no" ]; then + UNKNOWN_OPT=yes + else + if [ -n "${QT_ALL_BUILD_PARTS%%* $VAL *}" ]; then + echo "Unknown part $VAL passed to -make." >&2 + exit 1 + fi + CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL" + fi ;; skip) VAL=qt${VAL#qt} @@ -2978,7 +3036,7 @@ gccout=`LC_ALL=C $TEST_COMPILER $SYSROOT_FLAG $TEST_COMPILER_CXXFLAGS -xc++ -E - libdirs=`echo "$gccout" | sed -n -e 's/^LIBRARY_PATH=\(.*\)/\1/p'` DEFAULT_LIBDIRS=`IFS=${HOST_DIRLIST_SEP}; for i in $libdirs; do test -d "$i" && cd "$i" && pwd; done` # extract from indented lines between '#include <...> search starts here:' and 'End of search list.' -DEFAULT_INCDIRS=`echo "$gccout" | awk ' +DEFAULT_INCDIRS=`echo "$gccout" | $AWK ' /^End of search/ { yup=0 } / \(framework directory\)$/ { next } yup { print substr($0, 2) } @@ -4017,10 +4075,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; if [ '!' -z "$D_FLAGS" ]; then EXTRA_CFLAGS="$EXTRA_CFLAGS $D_FLAGS" fi - QMAKE_BIN_DIR="$QT_INSTALL_BINS" - [ -z "$QMAKE_BIN_DIR" ] && QMAKE_BIN_DIR="${QT_INSTALL_PREFIX}/bin" - QMAKE_DATA_DIR="$QT_INSTALL_ARCHDATA" - [ -z "$QMAKE_DATA_DIR" ] && QMAKE_DATA_DIR="${QT_INSTALL_PREFIX}" echo >>"$mkfile" adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'` adjoutpath=`echo "$outpath" | sed 's/ /\\\\\\\\ /g'` @@ -4037,11 +4091,9 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; echo "QT_VERSION = $QT_VERSION" >> "$mkfile" echo "EXTRA_CFLAGS = $EXTRA_CFLAGS" >> "$mkfile" echo "EXTRA_CXXFLAGS = $EXTRA_CXXFLAGS" >> "$mkfile" - echo "QTOBJS = $EXTRA_OBJS" >> "$mkfile" - echo "QTSRCS = $EXTRA_SRCS" >> "$mkfile" + echo "QTOBJS =" $EXTRA_OBJS >> "$mkfile" + echo "QTSRCS =" $EXTRA_SRCS >> "$mkfile" echo "LFLAGS = $EXTRA_LFLAGS" >> "$mkfile" - echo "QT_INSTALL_BINS = \$(INSTALL_ROOT)$QMAKE_BIN_DIR" >> "$mkfile" - echo "QT_INSTALL_DATA = \$(INSTALL_ROOT)$QMAKE_DATA_DIR" >> "$mkfile" echo "EXEEXT = $EXEEXT" >> "$mkfile" echo "RM_F = rm -f" >> "$mkfile" echo "RM_RF = rm -rf" >> "$mkfile" @@ -6034,7 +6086,7 @@ case "$XPLATFORM" in ;; solaris-cc*) # Check the compiler version - case `${QMAKE_CONF_COMPILER} -V 2>&1 | awk '{print $4}'` in + case `${QMAKE_CONF_COMPILER} -V 2>&1 | $AWK '{print $4}'` in 5.[012345678]) canBuildWebKit="no" canBuildQtXmlPatterns="no" @@ -6421,9 +6473,7 @@ echo "#define QT_QPA_DEFAULT_PLATFORM_NAME \"$QT_QPA_DEFAULT_PLATFORM\"" >>"$out if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then rm -f "$outpath/src/corelib/global/qconfig.h.new" else - [ -f "$outpath/src/corelib/global/qconfig.h" ] && chmod +w "$outpath/src/corelib/global/qconfig.h" - mv "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h" - chmod -w "$outpath/src/corelib/global/qconfig.h" + mv -f "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h" fi # create a forwarding header @@ -6653,11 +6703,9 @@ report_support() return :; esac - local heading heading=$1 shift - local value value=$1 shift @@ -6867,14 +6915,23 @@ rm -f "$QMAKE_VARS_FILE" 2>/dev/null #------------------------------------------------------------------------------- if [ "$CFG_PROCESS" != "no" ]; then +( # fork to make the cd stay local + + relpathMangled=$relpath + if [ -n "$CFG_TOPLEVEL" ]; then + relpathMangled=`dirname "$relpath"` + cd .. + fi if [ "$CFG_PROCESS" = "full" ]; then echo "Creating makefiles. Please wait..." - "$outpath/bin/qmake" -r "$relpath" + "$outpath/bin/qmake" -r "$relpathMangled" echo "Done" else - "$outpath/bin/qmake" "$relpath" + "$outpath/bin/qmake" "$relpathMangled" fi + +) fi #------------------------------------------------------------------------------- @@ -6986,7 +7043,7 @@ fi MAKE=`basename "$MAKE"` echo echo Qt is now configured for building. Just run \'$MAKE\'. -if [ "$relpath" = "$QT_INSTALL_PREFIX" ]; then +if [ "$outpath" = "$QT_INSTALL_PREFIX" ]; then echo Once everything is built, Qt is installed. echo You should not run \'$MAKE install\'. else diff --git a/doc/global/template/images/arrow.png b/doc/global/template/images/arrow.png Binary files differindex f2a83a5740..f2a83a5740 100755..100644 --- a/doc/global/template/images/arrow.png +++ b/doc/global/template/images/arrow.png diff --git a/doc/global/template/images/bg_l.png b/doc/global/template/images/bg_l.png Binary files differindex 90b1da10b9..90b1da10b9 100755..100644 --- a/doc/global/template/images/bg_l.png +++ b/doc/global/template/images/bg_l.png diff --git a/doc/global/template/images/bg_l_blank.png b/doc/global/template/images/bg_l_blank.png Binary files differindex 5a9673d81b..5a9673d81b 100755..100644 --- a/doc/global/template/images/bg_l_blank.png +++ b/doc/global/template/images/bg_l_blank.png diff --git a/doc/global/template/images/bg_r.png b/doc/global/template/images/bg_r.png Binary files differindex f0fb121dea..f0fb121dea 100755..100644 --- a/doc/global/template/images/bg_r.png +++ b/doc/global/template/images/bg_r.png diff --git a/doc/global/template/images/bgrContent.png b/doc/global/template/images/bgrContent.png Binary files differindex 1a81b03087..1a81b03087 100755..100644 --- a/doc/global/template/images/bgrContent.png +++ b/doc/global/template/images/bgrContent.png diff --git a/doc/global/template/images/blu_dot.png b/doc/global/template/images/blu_dot.png Binary files differindex c332148f74..c332148f74 100755..100644 --- a/doc/global/template/images/blu_dot.png +++ b/doc/global/template/images/blu_dot.png diff --git a/doc/global/template/images/box_bg.png b/doc/global/template/images/box_bg.png Binary files differindex 3322f923f8..3322f923f8 100755..100644 --- a/doc/global/template/images/box_bg.png +++ b/doc/global/template/images/box_bg.png diff --git a/doc/global/template/images/breadcrumb.png b/doc/global/template/images/breadcrumb.png Binary files differindex 0ded5514d2..0ded5514d2 100755..100644 --- a/doc/global/template/images/breadcrumb.png +++ b/doc/global/template/images/breadcrumb.png diff --git a/doc/global/template/images/bullet_gt.png b/doc/global/template/images/bullet_gt.png Binary files differindex 7561b4edc4..7561b4edc4 100755..100644 --- a/doc/global/template/images/bullet_gt.png +++ b/doc/global/template/images/bullet_gt.png diff --git a/doc/global/template/images/bullet_sq.png b/doc/global/template/images/bullet_sq.png Binary files differindex a84845e3c7..a84845e3c7 100755..100644 --- a/doc/global/template/images/bullet_sq.png +++ b/doc/global/template/images/bullet_sq.png diff --git a/doc/global/template/images/feedbackground.png b/doc/global/template/images/feedbackground.png Binary files differindex 3a38d995d7..3a38d995d7 100755..100644 --- a/doc/global/template/images/feedbackground.png +++ b/doc/global/template/images/feedbackground.png diff --git a/doc/global/template/images/home.png b/doc/global/template/images/home.png Binary files differindex 8de6d0c81f..8de6d0c81f 100755..100644 --- a/doc/global/template/images/home.png +++ b/doc/global/template/images/home.png diff --git a/doc/global/template/images/horBar.png b/doc/global/template/images/horBar.png Binary files differindex 100fe91c6c..100fe91c6c 100755..100644 --- a/doc/global/template/images/horBar.png +++ b/doc/global/template/images/horBar.png diff --git a/doc/global/template/images/ico_note.png b/doc/global/template/images/ico_note.png Binary files differindex 13794046cf..13794046cf 100755..100644 --- a/doc/global/template/images/ico_note.png +++ b/doc/global/template/images/ico_note.png diff --git a/doc/global/template/images/ico_note_attention.png b/doc/global/template/images/ico_note_attention.png Binary files differindex b85b696b10..b85b696b10 100755..100644 --- a/doc/global/template/images/ico_note_attention.png +++ b/doc/global/template/images/ico_note_attention.png diff --git a/doc/global/template/images/ico_out.png b/doc/global/template/images/ico_out.png Binary files differindex 790a05e51d..790a05e51d 100755..100644 --- a/doc/global/template/images/ico_out.png +++ b/doc/global/template/images/ico_out.png diff --git a/doc/global/template/images/page_bg.png b/doc/global/template/images/page_bg.png Binary files differindex 9b3bd999df..9b3bd999df 100755..100644 --- a/doc/global/template/images/page_bg.png +++ b/doc/global/template/images/page_bg.png diff --git a/doc/global/template/images/sprites-combined.png b/doc/global/template/images/sprites-combined.png Binary files differindex 3a48b21f6b..3a48b21f6b 100755..100644 --- a/doc/global/template/images/sprites-combined.png +++ b/doc/global/template/images/sprites-combined.png diff --git a/examples/widgets/dialogs/findfiles/window.cpp b/examples/widgets/dialogs/findfiles/window.cpp index 80894bab47..908c0c0c34 100644 --- a/examples/widgets/dialogs/findfiles/window.cpp +++ b/examples/widgets/dialogs/findfiles/window.cpp @@ -63,7 +63,6 @@ Window::Window(QWidget *parent) //! [1] QGridLayout *mainLayout = new QGridLayout; - mainLayout->setSizeConstraint(QLayout::SetNoConstraint); mainLayout->addWidget(fileLabel, 0, 0); mainLayout->addWidget(fileComboBox, 0, 1, 1, 2); mainLayout->addWidget(textLabel, 1, 0); diff --git a/examples/widgets/dialogs/tabdialog/tabdialog.cpp b/examples/widgets/dialogs/tabdialog/tabdialog.cpp index 39f74f1c6c..80d8623af5 100644 --- a/examples/widgets/dialogs/tabdialog/tabdialog.cpp +++ b/examples/widgets/dialogs/tabdialog/tabdialog.cpp @@ -65,7 +65,6 @@ TabDialog::TabDialog(const QString &fileName, QWidget *parent) //! [4] QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->setSizeConstraint(QLayout::SetNoConstraint); mainLayout->addWidget(tabWidget); mainLayout->addWidget(buttonBox); setLayout(mainLayout); diff --git a/mkspecs/aix-g++-64/qmake.conf b/mkspecs/aix-g++-64/qmake.conf index 25acf04eda..176c437c45 100644 --- a/mkspecs/aix-g++-64/qmake.conf +++ b/mkspecs/aix-g++-64/qmake.conf @@ -64,6 +64,7 @@ QMAKE_LIBS_THREAD = -lpthreads QMAKE_AR = ar -X64 cq QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = ranlib -X64 include(../common/unix.conf) diff --git a/mkspecs/aix-g++/qmake.conf b/mkspecs/aix-g++/qmake.conf index 94dbbd12ef..553d9af544 100644 --- a/mkspecs/aix-g++/qmake.conf +++ b/mkspecs/aix-g++/qmake.conf @@ -64,6 +64,7 @@ QMAKE_LIBS_THREAD = -lpthreads QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/aix-xlc-64/qmake.conf b/mkspecs/aix-xlc-64/qmake.conf index d4b9718d74..42dbd18b4a 100644 --- a/mkspecs/aix-xlc-64/qmake.conf +++ b/mkspecs/aix-xlc-64/qmake.conf @@ -63,6 +63,7 @@ QMAKE_LIBS_THREAD = -lpthreads QMAKE_AR = ar -X64 cq QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = ranlib -X64 include(../common/unix.conf) diff --git a/mkspecs/aix-xlc/qmake.conf b/mkspecs/aix-xlc/qmake.conf index c4efebff24..d2de649355 100644 --- a/mkspecs/aix-xlc/qmake.conf +++ b/mkspecs/aix-xlc/qmake.conf @@ -66,6 +66,7 @@ QMAKE_LIBS_THREAD = -lpthreads QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = ranlib include(../common/unix.conf) diff --git a/mkspecs/android-g++/qmake.conf b/mkspecs/android-g++/qmake.conf index 5a056b3d00..95fa8a9786 100644 --- a/mkspecs/android-g++/qmake.conf +++ b/mkspecs/android-g++/qmake.conf @@ -137,6 +137,7 @@ QMAKE_LINK_SHLIB = $$QMAKE_LINK # modifications to linux.conf QMAKE_AR = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ar cqs QMAKE_OBJCOPY = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-objcopy +QMAKE_NM = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-nm -P QMAKE_STRIP = #$$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-strip diff --git a/mkspecs/common/g++-macx.conf b/mkspecs/common/g++-macx.conf index 2955c85f5c..bae8eb0965 100644 --- a/mkspecs/common/g++-macx.conf +++ b/mkspecs/common/g++-macx.conf @@ -16,6 +16,8 @@ QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += -g -gdwarf-2 QMAKE_LFLAGS_STATIC_LIB += -all_load +QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvmgcc42 + QMAKE_OBJCFLAGS_PRECOMPILE = -x objective-c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE QMAKE_OBJCXXFLAGS_PRECOMPILE = -x objective-c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} diff --git a/mkspecs/common/linux-android.conf b/mkspecs/common/linux-android.conf index 363dac3a34..b90a22ebef 100644 --- a/mkspecs/common/linux-android.conf +++ b/mkspecs/common/linux-android.conf @@ -65,6 +65,7 @@ QMAKE_LINK_SHLIB = $$QMAKE_LINK # modifications to linux.conf QMAKE_AR = $$NDK_TOOLCHAIN_PATH/bin/$$ANDROID_NDK_TOOLS_PREFIX-ar cqs QMAKE_OBJCOPY = $$NDK_TOOLCHAIN_PATH/bin/$$ANDROID_NDK_TOOLS_PREFIX-objcopy +QMAKE_NM = $$NDK_TOOLCHAIN_PATH/bin/$$ANDROID_NDK_TOOLS_PREFIX-nm -P QMAKE_STRIP = $$NDK_TOOLCHAIN_PATH/bin/$$ANDROID_NDK_TOOLS_PREFIX-strip QMAKE_RANLIB = $$NDK_TOOLCHAIN_PATH/bin/$$ANDROID_NDK_TOOLS_PREFIX-ranlib diff --git a/mkspecs/common/linux.conf b/mkspecs/common/linux.conf index 1c46ab7c21..c727bd9aef 100644 --- a/mkspecs/common/linux.conf +++ b/mkspecs/common/linux.conf @@ -48,6 +48,7 @@ QMAKE_DEFINES_XCB = QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = QMAKE_STRIP = strip diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf index cf54f3f580..341c74657a 100644 --- a/mkspecs/common/mac.conf +++ b/mkspecs/common/mac.conf @@ -25,5 +25,6 @@ QMAKE_LIBS_THREAD = QMAKE_AR = ar cq QMAKE_RANLIB = ranlib -s +QMAKE_NM = nm -P include(unix.conf) diff --git a/mkspecs/common/nacl/g++-nacl32.conf b/mkspecs/common/nacl/g++-nacl32.conf index 7ab48dba3a..319d3ca475 100644 --- a/mkspecs/common/nacl/g++-nacl32.conf +++ b/mkspecs/common/nacl/g++-nacl32.conf @@ -7,5 +7,6 @@ QMAKE_LINK = i686-nacl-g++ QMAKE_LINK_SHLIB = i686-nacl-g++ QMAKE_AR = i686-nacl-ar q QMAKE_OBJCOPY = i686-nacl-objcopy +QMAKE_NM = i686-nacl-nm -P QMAKE_STRIP = i686-nacl-strip diff --git a/mkspecs/common/nacl/g++-nacl64.conf b/mkspecs/common/nacl/g++-nacl64.conf index 91ffcc2310..8a20535775 100644 --- a/mkspecs/common/nacl/g++-nacl64.conf +++ b/mkspecs/common/nacl/g++-nacl64.conf @@ -7,5 +7,6 @@ QMAKE_LINK = x86_64-nacl-g++ QMAKE_LINK_SHLIB = x86_64-nacl-g++ QMAKE_AR = x86_64-nacl-ar q QMAKE_OBJCOPY = x86_64-nacl-objcopy +QMAKE_NM = x86_64-nacl-nm -P QMAKE_STRIP = x86_64-nacl-strip diff --git a/mkspecs/common/qcc-base-qnx-armv7le.conf b/mkspecs/common/qcc-base-qnx-armv7le.conf index 9bd9e288d3..331a65b2bf 100644 --- a/mkspecs/common/qcc-base-qnx-armv7le.conf +++ b/mkspecs/common/qcc-base-qnx-armv7le.conf @@ -15,6 +15,7 @@ include(qcc-base-qnx.conf) QMAKE_AR = ntoarmv7-ar cqs QMAKE_OBJCOPY = ntoarmv7-objcopy +QMAKE_NM = ntoarmv7-nm -P QMAKE_RANLIB = ntoarmv7-ranlib QMAKE_STRIP = ntoarmv7-strip diff --git a/mkspecs/common/qcc-base-qnx-x86.conf b/mkspecs/common/qcc-base-qnx-x86.conf index a2803a5c5a..b49075086d 100644 --- a/mkspecs/common/qcc-base-qnx-x86.conf +++ b/mkspecs/common/qcc-base-qnx-x86.conf @@ -15,6 +15,7 @@ include(qcc-base-qnx.conf) QMAKE_AR = ntox86-ar cqs QMAKE_OBJCOPY = ntox86-objcopy +QMAKE_NM = ntox86-nm -P QMAKE_RANLIB = ntox86-ranlib QMAKE_STRIP = ntox86-strip diff --git a/mkspecs/cygwin-g++/qmake.conf b/mkspecs/cygwin-g++/qmake.conf index a8e9d41485..06135beb30 100644 --- a/mkspecs/cygwin-g++/qmake.conf +++ b/mkspecs/cygwin-g++/qmake.conf @@ -70,6 +70,7 @@ QMAKE_EXTENSION_STATICLIB = a QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/shell-unix.conf) diff --git a/mkspecs/darwin-g++/qmake.conf b/mkspecs/darwin-g++/qmake.conf index 21a13a3bb5..24a6224b7c 100644 --- a/mkspecs/darwin-g++/qmake.conf +++ b/mkspecs/darwin-g++/qmake.conf @@ -76,6 +76,7 @@ QMAKE_LIBS_THREAD = QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = ranlib -s QMAKE_PCH_OUTPUT_EXT = .gch diff --git a/mkspecs/devices/common/linux_device_pre.conf b/mkspecs/devices/common/linux_device_pre.conf index 6d80fc7e1d..a4837a435d 100644 --- a/mkspecs/devices/common/linux_device_pre.conf +++ b/mkspecs/devices/common/linux_device_pre.conf @@ -21,4 +21,5 @@ QMAKE_LINK_SHLIB = $${QMAKE_CXX} # modifications to linux.conf QMAKE_AR = $${CROSS_COMPILE}ar cqs QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy +QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip diff --git a/mkspecs/devices/linux-archos-gen8-g++/qmake.conf b/mkspecs/devices/linux-archos-gen8-g++/qmake.conf index a2c831e7fe..6f2b4736ac 100644 --- a/mkspecs/devices/linux-archos-gen8-g++/qmake.conf +++ b/mkspecs/devices/linux-archos-gen8-g++/qmake.conf @@ -27,6 +27,7 @@ QMAKE_LINK_SHLIB = $${QMAKE_CXX} # modifications to linux.conf QMAKE_AR = $${CROSS_COMPILE}ar cqs QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy +QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip COMPILER_FLAGS = -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp diff --git a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf index 3f884ccb88..90f0d90a3c 100644 --- a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf +++ b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf @@ -19,6 +19,7 @@ QMAKE_LINK_SHLIB = $${QMAKE_CXX} QMAKE_AR = $${CROSS_COMPILE}ar cqs QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy +QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip QMAKE_CFLAGS += -mfloat-abi=softfp -mfpu=neon -mcpu=cortex-a9 diff --git a/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf b/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf index 3c8c78e0c7..d734e97e89 100644 --- a/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf +++ b/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf @@ -43,6 +43,7 @@ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS # modifications to linux.conf QMAKE_AR = $${CROSS_COMPILE}ar cqs QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy +QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip QMAKE_INCDIR += $${TRIDENT_SHINER_SDK_BUILDTREE}/target/output/objs/$${TRIDENT_SHINER_SDK_BUILDSPEC}/comps/generic_apps/usr/include diff --git a/mkspecs/devices/linux-beagleboard-g++/qmake.conf b/mkspecs/devices/linux-beagleboard-g++/qmake.conf index 54fe994bfa..0791693bbe 100644 --- a/mkspecs/devices/linux-beagleboard-g++/qmake.conf +++ b/mkspecs/devices/linux-beagleboard-g++/qmake.conf @@ -23,6 +23,7 @@ QMAKE_LINK_SHLIB = $${QMAKE_CXX} # modifications to linux.conf QMAKE_AR = $${CROSS_COMPILE}ar cqs QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy +QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip COMPILER_FLAGS = -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp diff --git a/mkspecs/devices/linux-maemo-n9-g++/qmake.conf b/mkspecs/devices/linux-maemo-n9-g++/qmake.conf index fadeb85e8c..a9e2376d7c 100644 --- a/mkspecs/devices/linux-maemo-n9-g++/qmake.conf +++ b/mkspecs/devices/linux-maemo-n9-g++/qmake.conf @@ -23,6 +23,7 @@ QMAKE_LINK_SHLIB = $${QMAKE_CXX} # modifications to linux.conf QMAKE_AR = $${CROSS_COMPILE}ar cqs QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy +QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip QMAKE_CFLAGS += -mfloat-abi=hard -mfpu=neon -march=armv7-a -mcpu=cortex-a8 diff --git a/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf b/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf index bca69c3969..bdaaa391e5 100644 --- a/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf +++ b/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf @@ -21,6 +21,7 @@ QMAKE_LINK_SHLIB = $${QMAKE_CXX} QMAKE_AR = $${CROSS_COMPILE}ar cqs QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy +QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip #TODO: Clean Qt to work with uclibc not calling itself GLIBC. diff --git a/mkspecs/devices/linux-sh4-stmicro-ST7108-g++/qmake.conf b/mkspecs/devices/linux-sh4-stmicro-ST7108-g++/qmake.conf index 526716e991..e3a28fb9c4 100644 --- a/mkspecs/devices/linux-sh4-stmicro-ST7108-g++/qmake.conf +++ b/mkspecs/devices/linux-sh4-stmicro-ST7108-g++/qmake.conf @@ -21,6 +21,7 @@ QMAKE_LINK_SHLIB = $${QMAKE_CXX} QMAKE_AR = $${CROSS_COMPILE}ar cqs QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy +QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip deviceSanityCheckCompiler() diff --git a/mkspecs/devices/linux-sh4-stmicro-ST7540-g++/qmake.conf b/mkspecs/devices/linux-sh4-stmicro-ST7540-g++/qmake.conf index caf9537f39..f8ba5937c5 100644 --- a/mkspecs/devices/linux-sh4-stmicro-ST7540-g++/qmake.conf +++ b/mkspecs/devices/linux-sh4-stmicro-ST7540-g++/qmake.conf @@ -21,6 +21,7 @@ QMAKE_LINK_SHLIB = $${QMAKE_CXX} QMAKE_AR = $${CROSS_COMPILE}ar cqs QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy +QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip deviceSanityCheckCompiler() diff --git a/mkspecs/devices/linux-snowball-g++/qmake.conf b/mkspecs/devices/linux-snowball-g++/qmake.conf index f0d77fbb4a..0d3a90d524 100644 --- a/mkspecs/devices/linux-snowball-g++/qmake.conf +++ b/mkspecs/devices/linux-snowball-g++/qmake.conf @@ -20,6 +20,7 @@ QMAKE_LINK_SHLIB = $${QMAKE_CXX} # modifications to linux.conf QMAKE_AR = $${CROSS_COMPILE}ar cqs QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy +QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \ diff --git a/mkspecs/features/ios/default_pre.prf b/mkspecs/features/ios/default_pre.prf index fa0245aa2c..7cfbc03eb5 100644 --- a/mkspecs/features/ios/default_pre.prf +++ b/mkspecs/features/ios/default_pre.prf @@ -1,5 +1,5 @@ # Unset makefile generator, so we can auto-detect value in default_post -unset(MAKEFILE_GENERATOR) +!macx-xcode: unset(MAKEFILE_GENERATOR) load(default_pre) diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf index 0da0b65d41..788fa5b362 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -24,10 +24,13 @@ sysrootified = for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val QMAKE_INCDIR_OPENGL = $$sysrootified +QMAKESPEC_NAME = $$basename(QMAKESPEC) + # Resolve SDK version of various tools for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_LINK QMAKE_LINK_SHLIB)) { - !isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.$${tool}) { - $$tool = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.$${tool}) + tool_variable = QMAKE_MAC_SDK.$${QMAKESPEC_NAME}.$${QMAKE_MAC_SDK}.$${tool} + !isEmpty($$tool_variable) { + $$tool = $$eval($$tool_variable) next() } @@ -38,7 +41,7 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_ isEmpty(sysrooted): next() $$tool = $$sysrooted $$member(value, 1, -1) - !isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.$${tool}, set, $$tool) + !isEmpty(_QMAKE_CACHE_): cache($$tool_variable, set, $$tool) } isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) { diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index bbbb5d36a3..cd74c1d7cf 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -26,11 +26,10 @@ defineTest(qtAddLibrary) { warning("qtAddLibrary() is deprecated. Use qtAddModule() or QT+= instead.") # Reverse-engineer the module name from the library name. - for(var, $$list($$find($$list($$enumerate_vars()), ^QT\\.[^.]+\\.name$))) { - isEqual($$var, $$1) { - var ~= s,^QT\\.([^.]+)\\.name$,\\1, - qtAddModule($$var, , LIBS):return(true):break() - return(false):break() # Yes, the break is insanity. But necessary. + for(var, QT_MODULES) { + isEqual(QT.$${var}.name, $$1) { + qtAddModule($$var, , LIBS) + return(true):break() # Yes, the break is insanity. But necessary. } } error("No module matching library '$$1' found.") @@ -131,7 +130,6 @@ defineTest(qtAddModule) { export(QMAKE_RPATHDIR) export(QMAKE_RPATHLINKDIR) export(PRE_TARGETDEPS) - return(true) } # qt variable, libs variable @@ -256,13 +254,15 @@ defineTest(qtAddTargetEnv) { } equals(QMAKE_HOST.os, Windows) { deppath.name = PATH - } else:contains(QMAKE_HOST.os, Linux|FreeBSD) { + } else:contains(QMAKE_HOST.os, Linux|FreeBSD|OpenBSD|NetBSD|DragonFly|SunOS|HP-UX|QNX|GNU) { deppath.name = LD_LIBRARY_PATH } else:equals(QMAKE_HOST.os, Darwin) { contains(QT_CONFIG, qt_framework): \ deppath.name = DYLD_FRAMEWORK_PATH else: \ deppath.name = DYLD_LIBRARY_PATH + } else:equals(QMAKE_HOST.os, AIX) { + deppath.name = LIBPATH } else { error("Operating system not supported.") } diff --git a/mkspecs/freebsd-g++/qmake.conf b/mkspecs/freebsd-g++/qmake.conf index 4e078ce2f2..cb6cd3131c 100644 --- a/mkspecs/freebsd-g++/qmake.conf +++ b/mkspecs/freebsd-g++/qmake.conf @@ -28,6 +28,7 @@ QMAKE_LIBS_THREAD = QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/freebsd-g++46/qmake.conf b/mkspecs/freebsd-g++46/qmake.conf index 364dcd6233..8f8e0cd21c 100644 --- a/mkspecs/freebsd-g++46/qmake.conf +++ b/mkspecs/freebsd-g++46/qmake.conf @@ -28,6 +28,7 @@ QMAKE_LIBS_THREAD = QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/freebsd-icc/qmake.conf b/mkspecs/freebsd-icc/qmake.conf index 91aeb25520..fb419f7e5b 100644 --- a/mkspecs/freebsd-icc/qmake.conf +++ b/mkspecs/freebsd-icc/qmake.conf @@ -87,6 +87,7 @@ QMAKE_LIBS_THREAD = QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/hpux-acc-64/qmake.conf b/mkspecs/hpux-acc-64/qmake.conf index 60c87c29bf..2156b448fe 100644 --- a/mkspecs/hpux-acc-64/qmake.conf +++ b/mkspecs/hpux-acc-64/qmake.conf @@ -108,6 +108,7 @@ QMAKE_LIBS_YACC = -ly QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/hpux-acc-o64/qmake.conf b/mkspecs/hpux-acc-o64/qmake.conf index c11909fb81..69c3df1375 100644 --- a/mkspecs/hpux-acc-o64/qmake.conf +++ b/mkspecs/hpux-acc-o64/qmake.conf @@ -106,6 +106,7 @@ QMAKE_LIBS_YACC = -ly QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/hpux-acc/qmake.conf b/mkspecs/hpux-acc/qmake.conf index 5d1427c1f3..eaa8888fbe 100644 --- a/mkspecs/hpux-acc/qmake.conf +++ b/mkspecs/hpux-acc/qmake.conf @@ -87,6 +87,7 @@ QMAKE_LIBS_YACC = -ly QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/hpux-g++-64/qmake.conf b/mkspecs/hpux-g++-64/qmake.conf index 8d598d7388..3e822edbfb 100644 --- a/mkspecs/hpux-g++-64/qmake.conf +++ b/mkspecs/hpux-g++-64/qmake.conf @@ -70,6 +70,7 @@ QMAKE_LIBS_YACC = -ly QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/hpux-g++/qmake.conf b/mkspecs/hpux-g++/qmake.conf index 2f02e8e904..866a3416bc 100644 --- a/mkspecs/hpux-g++/qmake.conf +++ b/mkspecs/hpux-g++/qmake.conf @@ -71,6 +71,7 @@ QMAKE_LIBS_YACC = -ly QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/hpuxi-acc-32/qmake.conf b/mkspecs/hpuxi-acc-32/qmake.conf index a469b4f34c..79bf20fbb2 100644 --- a/mkspecs/hpuxi-acc-32/qmake.conf +++ b/mkspecs/hpuxi-acc-32/qmake.conf @@ -63,6 +63,7 @@ QMAKE_LIBS_YACC = -ly QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/hpuxi-acc-64/qmake.conf b/mkspecs/hpuxi-acc-64/qmake.conf index a3b0ad0849..aaec3eab14 100644 --- a/mkspecs/hpuxi-acc-64/qmake.conf +++ b/mkspecs/hpuxi-acc-64/qmake.conf @@ -106,6 +106,7 @@ QMAKE_LIBS_YACC = -ly QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/hpuxi-g++-64/qmake.conf b/mkspecs/hpuxi-g++-64/qmake.conf index 756d361bb9..8a05a5f611 100644 --- a/mkspecs/hpuxi-g++-64/qmake.conf +++ b/mkspecs/hpuxi-g++-64/qmake.conf @@ -73,6 +73,7 @@ QMAKE_LIBS_YACC = -ly QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/hurd-g++/qmake.conf b/mkspecs/hurd-g++/qmake.conf index 9a3e83f373..ef3be3b37b 100644 --- a/mkspecs/hurd-g++/qmake.conf +++ b/mkspecs/hurd-g++/qmake.conf @@ -38,6 +38,7 @@ QMAKE_LIBS_THREAD = -lpthread QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = QMAKE_STRIP = strip diff --git a/mkspecs/irix-cc-64/qmake.conf b/mkspecs/irix-cc-64/qmake.conf index 33514486f9..05c8b6fc84 100644 --- a/mkspecs/irix-cc-64/qmake.conf +++ b/mkspecs/irix-cc-64/qmake.conf @@ -98,6 +98,7 @@ QMAKE_LIBS_THREAD = -lpthread QMAKE_AR = CC -ar -o QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = QMAKE_CLEAN = -r $(OBJECTS_DIR)so_locations $(OBJECTS_DIR)ii_files diff --git a/mkspecs/irix-cc/qmake.conf b/mkspecs/irix-cc/qmake.conf index 8073cf4012..72d4e65474 100644 --- a/mkspecs/irix-cc/qmake.conf +++ b/mkspecs/irix-cc/qmake.conf @@ -98,6 +98,7 @@ QMAKE_LIBS_THREAD = -lpthread QMAKE_AR = CC -ar -o QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = QMAKE_CLEAN = -r $(OBJECTS_DIR)so_locations $(OBJECTS_DIR)ii_files diff --git a/mkspecs/irix-g++-64/qmake.conf b/mkspecs/irix-g++-64/qmake.conf index 845ded9667..12c224b5c0 100644 --- a/mkspecs/irix-g++-64/qmake.conf +++ b/mkspecs/irix-g++-64/qmake.conf @@ -68,6 +68,7 @@ QMAKE_LIBS_THREAD = -lpthread QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = QMAKE_CLEAN = so_locations diff --git a/mkspecs/irix-g++/qmake.conf b/mkspecs/irix-g++/qmake.conf index af5f5fe91d..2c02165e0d 100644 --- a/mkspecs/irix-g++/qmake.conf +++ b/mkspecs/irix-g++/qmake.conf @@ -68,6 +68,7 @@ QMAKE_LIBS_THREAD = -lpthread QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = QMAKE_CLEAN = so_locations diff --git a/mkspecs/linux-arm-gnueabi-g++/qmake.conf b/mkspecs/linux-arm-gnueabi-g++/qmake.conf index d402f00d4d..b2653d8fea 100644 --- a/mkspecs/linux-arm-gnueabi-g++/qmake.conf +++ b/mkspecs/linux-arm-gnueabi-g++/qmake.conf @@ -19,5 +19,6 @@ QMAKE_LINK_SHLIB = arm-linux-gnueabi-g++ # modifications to linux.conf QMAKE_AR = arm-linux-gnueabi-ar cqs QMAKE_OBJCOPY = arm-linux-gnueabi-objcopy +QMAKE_NM = arm-linux-gnueabi-nm -P QMAKE_STRIP = arm-linux-gnueabi-strip load(qt_config) diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf index 4c3bbb5183..c18623b129 100644 --- a/mkspecs/linux-icc/qmake.conf +++ b/mkspecs/linux-icc/qmake.conf @@ -73,6 +73,7 @@ QMAKE_LIBS_THREAD = -lpthread QMAKE_AR = xiar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = QMAKE_CLEAN = -r $(OBJECTS_DIR)/ti_files diff --git a/mkspecs/linux-kcc/qmake.conf b/mkspecs/linux-kcc/qmake.conf index 921b4e6390..06efc8c12c 100644 --- a/mkspecs/linux-kcc/qmake.conf +++ b/mkspecs/linux-kcc/qmake.conf @@ -73,6 +73,7 @@ QMAKE_LIBS_THREAD = QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = QMAKE_CLEAN = -r $(OBJECTS_DIR)ti_files diff --git a/mkspecs/linux-pgcc/qmake.conf b/mkspecs/linux-pgcc/qmake.conf index 404c1de1e9..286f937b0e 100644 --- a/mkspecs/linux-pgcc/qmake.conf +++ b/mkspecs/linux-pgcc/qmake.conf @@ -64,6 +64,7 @@ QMAKE_LIBS_THREAD = -lpthread QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/lynxos-g++/qmake.conf b/mkspecs/lynxos-g++/qmake.conf index ab887825d6..a53d6a8ec7 100644 --- a/mkspecs/lynxos-g++/qmake.conf +++ b/mkspecs/lynxos-g++/qmake.conf @@ -68,6 +68,7 @@ QMAKE_LIBS_THREAD = -lpthread QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = QMAKE_STRIP = strip diff --git a/mkspecs/macx-xcode/qmake.conf b/mkspecs/macx-xcode/qmake.conf index 131619de32..7f65d263a3 100644 --- a/mkspecs/macx-xcode/qmake.conf +++ b/mkspecs/macx-xcode/qmake.conf @@ -4,23 +4,6 @@ # Mac OS X + XCode # -MAKEFILE_GENERATOR = XCODE -CONFIG += lib_version_first incremental plugin_no_soname app_bundle +include(../$$[QMAKE_XSPEC]/qmake.conf) -include(../common/macx.conf) -include(../common/gcc-base-mac.conf) -include(../common/g++-macx.conf) - -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 - -QMAKE_LINK = -QMAKE_LINK_C = -QMAKE_LINK_C_SHLIB = -QMAKE_LINK_SHLIB = -QMAKE_CFLAGS_HIDESYMS = -QMAKE_LFLAGS_VERSION = -QMAKE_LFLAGS_COMPAT_VERSION = -QMAKE_LFLAGS_SONAME = -QMAKE_INCDIR += /usr/local/include /System/Library/Frameworks/CarbonCore.framework/Headers - -load(qt_config) +MAKEFILE_GENERATOR = XCODE diff --git a/mkspecs/netbsd-g++/qmake.conf b/mkspecs/netbsd-g++/qmake.conf index ee36b3ac5d..6c699aac53 100644 --- a/mkspecs/netbsd-g++/qmake.conf +++ b/mkspecs/netbsd-g++/qmake.conf @@ -66,6 +66,7 @@ QMAKE_LIBS_THREAD = QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = ranlib include(../common/unix.conf) diff --git a/mkspecs/openbsd-g++/qmake.conf b/mkspecs/openbsd-g++/qmake.conf index f7b19cfe48..f0773e9d0d 100644 --- a/mkspecs/openbsd-g++/qmake.conf +++ b/mkspecs/openbsd-g++/qmake.conf @@ -67,6 +67,7 @@ QMAKE_LIBS_THREAD = QMAKE_AR = ar q QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = ranlib include(../common/unix.conf) diff --git a/mkspecs/sco-cc/qmake.conf b/mkspecs/sco-cc/qmake.conf index a1ebc5d033..fab66b4215 100644 --- a/mkspecs/sco-cc/qmake.conf +++ b/mkspecs/sco-cc/qmake.conf @@ -60,6 +60,7 @@ QMAKE_LIBS_OPENGL = -lGL -lXt QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/sco-g++/qmake.conf b/mkspecs/sco-g++/qmake.conf index 38ea4f65b7..ebf60a3954 100644 --- a/mkspecs/sco-g++/qmake.conf +++ b/mkspecs/sco-g++/qmake.conf @@ -62,6 +62,7 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/solaris-cc-64/qmake.conf b/mkspecs/solaris-cc-64/qmake.conf index fc761420d3..6e1d35ef43 100644 --- a/mkspecs/solaris-cc-64/qmake.conf +++ b/mkspecs/solaris-cc-64/qmake.conf @@ -85,6 +85,7 @@ QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl QMAKE_AR = CC -xar -o QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = QMAKE_CLEAN = -r $(OBJECTS_DIR)Templates.DB $(OBJECTS_DIR)SunWS_cache diff --git a/mkspecs/solaris-cc/qmake.conf b/mkspecs/solaris-cc/qmake.conf index 29fbec38c0..23814135b6 100644 --- a/mkspecs/solaris-cc/qmake.conf +++ b/mkspecs/solaris-cc/qmake.conf @@ -68,6 +68,7 @@ QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl QMAKE_AR = CC -xar -o QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = QMAKE_CLEAN = -r $(OBJECTS_DIR)Templates.DB $(OBJECTS_DIR)SunWS_cache diff --git a/mkspecs/solaris-g++-64/qmake.conf b/mkspecs/solaris-g++-64/qmake.conf index e0c2f2de9c..34fd044f3e 100644 --- a/mkspecs/solaris-g++-64/qmake.conf +++ b/mkspecs/solaris-g++-64/qmake.conf @@ -89,6 +89,7 @@ QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/solaris-g++/qmake.conf b/mkspecs/solaris-g++/qmake.conf index 9f714ea2d1..ccc178395b 100644 --- a/mkspecs/solaris-g++/qmake.conf +++ b/mkspecs/solaris-g++/qmake.conf @@ -72,6 +72,7 @@ QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/tru64-cxx/qmake.conf b/mkspecs/tru64-cxx/qmake.conf index 04cbe59b13..a2e0112623 100644 --- a/mkspecs/tru64-cxx/qmake.conf +++ b/mkspecs/tru64-cxx/qmake.conf @@ -62,6 +62,7 @@ QMAKE_LIBS_THREAD = -lrt QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/tru64-g++/qmake.conf b/mkspecs/tru64-g++/qmake.conf index a3f08220f6..dd7eb6c9c3 100644 --- a/mkspecs/tru64-g++/qmake.conf +++ b/mkspecs/tru64-g++/qmake.conf @@ -64,6 +64,7 @@ QMAKE_LIBS_THREAD = -lpthread -lexc -lrt QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/unixware-cc/qmake.conf b/mkspecs/unixware-cc/qmake.conf index 68018213c9..483b8c0bb3 100644 --- a/mkspecs/unixware-cc/qmake.conf +++ b/mkspecs/unixware-cc/qmake.conf @@ -66,6 +66,7 @@ QMAKE_LIBS_THREAD = QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/unixware-g++/qmake.conf b/mkspecs/unixware-g++/qmake.conf index 28f4314386..feca5a4c9e 100644 --- a/mkspecs/unixware-g++/qmake.conf +++ b/mkspecs/unixware-g++/qmake.conf @@ -65,6 +65,7 @@ QMAKE_LIBS_THREAD = -lthread QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = include(../common/unix.conf) diff --git a/mkspecs/unsupported/android-g++/qmake.conf b/mkspecs/unsupported/android-g++/qmake.conf index 71b843af7e..7ef85d4327 100644 --- a/mkspecs/unsupported/android-g++/qmake.conf +++ b/mkspecs/unsupported/android-g++/qmake.conf @@ -90,6 +90,7 @@ QMAKE_LINK_SHLIB = $$QMAKE_LINK QMAKE_AR = $${ANDROID_TOOLCHAIN_PREFIX}ar cqs QMAKE_OBJCOPY = $${ANDROID_TOOLCHAIN_PREFIX}objcopy +QMAKE_NM = $${ANDROID_TOOLCHAIN_PREFIX}nm -P QMAKE_STRIP = $${ANDROID_TOOLCHAIN_PREFIX}strip QMAKE_RANLIB = $${ANDROID_TOOLCHAIN_PREFIX}ranlib diff --git a/mkspecs/unsupported/linux-host-g++/qmake.conf b/mkspecs/unsupported/linux-host-g++/qmake.conf index 710c1876aa..586854d66c 100644 --- a/mkspecs/unsupported/linux-host-g++/qmake.conf +++ b/mkspecs/unsupported/linux-host-g++/qmake.conf @@ -107,6 +107,7 @@ QMAKE_LIBS_THREAD = -lpthread QMAKE_AR = host-ar cqs QMAKE_OBJCOPY = host-objcopy +QMAKE_NM = host-nm -P QMAKE_RANLIB = QMAKE_STRIP = host-strip diff --git a/mkspecs/unsupported/linux-scratchbox2-g++/qmake.conf b/mkspecs/unsupported/linux-scratchbox2-g++/qmake.conf index a300712d33..63f5168951 100644 --- a/mkspecs/unsupported/linux-scratchbox2-g++/qmake.conf +++ b/mkspecs/unsupported/linux-scratchbox2-g++/qmake.conf @@ -28,6 +28,7 @@ QMAKE_LINK_SHLIB = sb2 g++ # modifications to linux.conf QMAKE_AR = sb2 ar cqs QMAKE_OBJCOPY = sb2 objcopy +QMAKE_NM = sb2 nm -P QMAKE_STRIP = sb2 strip load(qt_config) diff --git a/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf b/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf index 806484369b..814b844131 100644 --- a/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf +++ b/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf @@ -82,6 +82,7 @@ QMAKE_LIBS_NETWORK = # -lnetwrap # only needed if kernel is missing gethost QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = QMAKE_STRIP = strip diff --git a/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf b/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf index d349189878..c362d098db 100644 --- a/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf +++ b/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf @@ -81,6 +81,7 @@ QMAKE_LIBS_NETWORK = # -lnet # only needed if kernel is missing gethostbyna QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P QMAKE_RANLIB = QMAKE_STRIP = strip diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf index 9c776e8655..d514b6d0d3 100644 --- a/mkspecs/win32-g++/qmake.conf +++ b/mkspecs/win32-g++/qmake.conf @@ -108,4 +108,6 @@ QMAKE_RC = $${CROSS_COMPILE}windres QMAKE_STRIP = $${CROSS_COMPILE}strip QMAKE_STRIPFLAGS_LIB += --strip-unneeded +QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy +QMAKE_NM = $${CROSS_COMPILE}nm -P load(qt_config) diff --git a/qmake/doc/qmake.qdocconf b/qmake/doc/qmake.qdocconf new file mode 100644 index 0000000000..67e6e95650 --- /dev/null +++ b/qmake/doc/qmake.qdocconf @@ -0,0 +1,26 @@ +include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) + +project = QMake +description = QMake Manual +url = http://qt-project.org/doc/qt-$QT_VER/qmake + +qhp.projects = qmake + +qhp.qmake.file = qmake.qhp +qhp.qmake.namespace = org.qt-project.qmake.$QT_VERSION_TAG +qhp.qmake.virtualFolder = qmake +qhp.qmake.indexTitle = QMake Manual +qhp.qmake.filterAttributes = qt $QT_VERSION tools qmake +qhp.qmake.customFilters.qmake.name = qmake Manual +qhp.qmake.customFilters.qmake.filterAttributes = qt tools qmake +qhp.qmake.subprojects = manual +qhp.qmake.subprojects.manual.title = Manual +qhp.qmake.subprojects.manual.indexTitle = qmake Manual +qhp.qmake.subprojects.manual.selectors = fake:page + +language = Cpp + +sources = src/qmake-manual.qdoc + +imagedirs = src/images +exampledirs = src diff --git a/qmake/doc/src/images/qmake-precompile-ui.png b/qmake/doc/src/images/qmake-precompile-ui.png Binary files differnew file mode 100644 index 0000000000..8c7b936fee --- /dev/null +++ b/qmake/doc/src/images/qmake-precompile-ui.png diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc new file mode 100644 index 0000000000..2bc6cc508f --- /dev/null +++ b/qmake/doc/src/qmake-manual.qdoc @@ -0,0 +1,4493 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qmake-manual.html + \title qmake Manual + \startpage {index.html}{Qt Reference Documentation} + \nextpage Overview + + \ingroup qttools + \keyword qmake + + The qmake tool helps simplify the build process for development projects + across different platforms. It automates the generation of Makefiles so that + only a few lines of information are needed to create each Makefile. + You can use qmake for any software project, whether it is written with Qt or + not. + + qmake generates a Makefile based on the information in a + project file. Project files are created by the developer, and are usually + simple, but more sophisticated project files can be created for complex + projects. + + qmake contains additional features to support development + with Qt, automatically including build rules for \l{moc.html}{moc} + and \l{uic.html}{uic}. + + qmake can also generate projects for Microsoft Visual studio + without requiring the developer to change the project file. + + \section1 Table of Contents + + \list + \li \l{Overview} + \li \l{Getting Started} + \li \l{Creating Project Files} + \li \l{Building Common Project Types} + \li \l{Running qmake} + \li \l{Platform Notes} + \li \l{qmake Language} + \li \l{Advanced Usage} + \li \l{Using Precompiled Headers} + \li \l{Configuring qmake} + \li \l{Reference} + \list + \li \l{Variables} + \li \l{Replace Functions} + \list + \li \l{Built-in Replace Functions} + \endlist + \li \l{Test Functions} + \list + \li \l{Built-in Test Functions} + \li \l{Test Function Library} + \endlist + \endlist + \endlist +*/ + +/*! + \page qmake-overview.html + \title Overview + \contentspage {qmake Manual}{Contents} + \previouspage qmake Manual + \nextpage Getting Started + + The qmake tool provides you with a project-oriented system for managing the + build process for applications, libraries, and other components. + This approach gives you control over the source files used, and + allows each of the steps in the process to be described concisely, + typically within a single file. qmake expands + the information in each project file to a Makefile that executes the necessary + commands for compiling and linking. + + \section1 Describing a Project + + Projects are described by the contents of project (\c .pro) files. qmake + uses the information within the files to generate Makefiles that contain + all the commands that are needed to build each project. + Project files typically contain a list of source and header files, + general configuration information, and any application-specific details, + such as a list of extra libraries to link against, or a list of extra + include paths to use. + + Project files can contain a number of different elements, including + comments, variable declarations, built-in functions, and some simple + control structures. In most simple projects, it is only necessary + to declare the source and header files that are used to build the + project with some basic configuration options. For more information about + how to create a simple project file, see \l{Getting Started}. + + You can create more sophisticated project files for complex projects. For an + overview of project files, see \l{Creating Project Files}. For detailed + information about the variables and functions that you can use in project + files, see \l{Reference}. + + You can use application or library project templates to specify specialized + configuration options to fine tune the build process. For more information, + see \l{Building Common Project Types}. + + You can use the \l{external: Qt Creator Manual}{Qt Creator} new project + wizard to create the project file. You choose the project template, and Qt + Creator creates a project file with default values that enable you to build + and run the project. You can modify the project file to suit your purposes. + + You can also use qmake to generate project files. For a full description of + qmake command line options, see \l{Running qmake}. + + The basic configuration features of qmake can handle most cross-platform + projects. However, it might be useful, or even necessary, to use some + platform-specific variables. For more information, see \l{Platform Notes}. + + \section1 Building a Project + + For simple projects, you only need to run qmake in the top level directory + of your project to generate a Makefile. You can then run your platform's + \c make tool to build the project according to the Makefile. + + For more information about the environment variables that qmake uses when + configuring the build process, see \l{Configuring qmake}. + + \section1 Using Third Party Libraries + + The guide to \l{Third Party Libraries} shows you how to use simple third + party libraries in your Qt project. + + \section1 Precompiling Headers + + In large projects, it is possible to take advantage of precompiled + header files to speed up the build process. For more information, see + \l{Using Precompiled Headers}. +*/ + +/*! + \page qmake-project-files.html + \title Creating Project Files + \contentspage {qmake Manual}{Contents} + \previouspage Getting Started + \nextpage Building Common Project Types + + Project files contain all the information required by qmake to build your + application, library, or plugin. Generally, you use a series of declarations + to specify the resources in the project, but support for simple programming + constructs enables you to describe different build processes for different + platforms and environments. + + \section1 Project File Elements + + The project file format used by qmake can be + used to support both simple and fairly complex build systems. + Simple project files use a straightforward declarative style, + defining standard variables to indicate the source and header files + that are used in the project. Complex projects may use control flow + structures to fine-tune the build process. + + The following sections describe the different types of elements used + in project files. + + \target ProjectFileElementsVariables + \section2 Variables + + In a project file, variables are used to hold lists of strings. In the + simplest projects, these variables inform qmake + about the configuration options to use, or supply filenames and paths to + use in the build process. + + qmake looks for certain variables in each + project file, and it uses the contents of these to determine what it + should write to a Makefile. For example, the lists of values in the + \l{HEADERS} and \l{SOURCES} variables are used to tell qmake about header + and source files in the same directory as the project file. + + Variables can also be used internally to store temporary lists of values, + and existing lists of values can be overwritten or extended with new + values. + + The following snippet illustrates how lists of values are assigned to + variables: + + \snippet snippets/qmake/variables.pro 0 + + The list of values in a variable is extended in the following way: + + \snippet snippets/qmake/variables.pro 1 + + \note The first assignment only includes values that are specified on + the same line as the \c HEADERS variable. The second assignment splits + the values in the \c SOURCES variable across lines by using a backslash + (\\). + + The \l{CONFIG} variable is another special variable that qmake uses when + generating a Makefile. It is discussed in \l{General Configuration}. + In the snippet above, \c console is added to the list of existing values + contained in \c CONFIG. + + The following table lists some frequently used variables and describes their + contents. For a full list of variables and their descriptions, + see \l{Variables}. + + \table + \header \li Variable \li Contents + \row \li \l{CONFIG} \li General project configuration options. + \row \li \l{DESTDIR} \li The directory in which the executable or binary file will + be placed. + \row \li \l{FORMS} \li A list of UI files to be processed by the + \l{uic}{user interface compiler (uic)}. + \row \li \l{HEADERS} \li A list of filenames of header (.h) files used when + building the project. + \row \li \l{Variables#QT}{QT} \li A list of Qt modules used in the project. + \row \li \l{RESOURCES} \li A list of resource (.qrc) files to be included in the + final project. See the \l{The Qt Resource System} for + more information about these files. + \row \li \l{SOURCES} \li A list of source code files to be used when building + the project. + \row \li \l{TEMPLATE} \li The template to use for the project. This determines + whether the output of the build process will be an + application, a library, or a plugin. + \endtable + + The contents of a variable can be read by prepending the variable name with + \c $$. This can be used to assign the contents of one variable to another: + + \snippet snippets/qmake/dereferencing.pro 0 + + The \c $$ operator is used extensively with built-in functions that operate + on strings and lists of values. For more information, see + \l{qmake Language}. + + \section3 Whitespace + + Usually, whitespace separates values in variable assignments. To specify + values that contain spaces, you must enclose the values in double quotes: + + \snippet snippets/qmake/quoting.pro 0 + + The quoted text is treated as a single item in the list of values held by + the variable. A similar approach is used to deal with paths that contain + spaces, particularly when defining the + \l{INCLUDEPATH} and \l{LIBS} variables for the Windows platform: + + \snippet snippets/qmake/spaces.pro quoting include paths with spaces + + \section2 Comments + + You can add comments to project files. Comments begin with the \c + # character and continue to the end of the same line. For example: + + \snippet snippets/qmake/comments.pro 0 + + To include the \c # character in variable assignments, it is necessary + to use the contents of the built-in \l{LITERAL_HASH} variable. + + \section2 Built-in Functions and Control Flow + + qmake provides a number of built-in functions to enable the contents of + variables to be processed. The most commonly used function in simple + project files is the \l{include(filename)}{include()} function which takes a + filename as an + argument. The contents of the given file are included in the project + file at the place where the \c include function is used. + The \c include function is most commonly used to include other project + files: + + \snippet snippets/qmake/include.pro 0 + + Support for conditional structures is made available via + \l{Scopes}{scopes} that behave like \c if statements in programming languages: + + \snippet snippets/qmake/scopes.pro 0 + + The assignments inside the braces are only made if the condition is + true. In this case, the \c win32 \l{CONFIG} option must be set. This + happens automatically on Windows. The opening brace must stand on the same + line as the condition. + + More complex operations on variables that would usually require loops + are provided by built-in functions such as \l{findfunction}{find()}, + \l{unique}{unique()}, and \l{countfunction}{count()}. These functions, and + many others are provided to manipulate + strings and paths, support user input, and call external tools. For more + information about using the functions, see \l{qmake Language}. For lists + of all functions and their descriptions, see \l{Replace Functions} and + \l{Test Functions}. + + \section1 Project Templates + + The \l{TEMPLATE} variable is used to define the type of project that will + be built. If this is not declared in the project file, + qmake assumes that an application should be + built, and will generate an appropriate Makefile (or equivalent file) + for the purpose. + + The following table summarizes the types of projects available and describes + the files that qmake will generate for each of them: + + \table + \header \li Template \li qmake Output + \row \li app (default) \li Makefile to build an application. + \row \li lib \li Makefile to build a library. + \row \li subdirs \li Makefile containing rules for the + subdirectories specified using the \l{SUBDIRS} + variable. Each subdirectory must contain its own project file. + \row \li vcapp \li Visual Studio Project file to build + an application. + \row \li vclib \li Visual Studio Project file to build a library. + \row \li vcsubdirs \li Visual Studio Solution file to build + projects in sub-directories. + \endtable + + See \l{Building Common Project Types} for advice on writing project files for + projects that use the \c app and \c lib templates. + + When the \c subdirs template is used, qmake + generates a Makefile to examine each specified subdirectory, + process any project file it finds there, and run the platform's + \c make tool on the newly-created Makefile. + The \c SUBDIRS variable is used to + contain a list of all the subdirectories to be processed. + + \target GeneralConfiguration + \section1 General Configuration + + The \l{CONFIG} variable specifies the options and features that the project + should be configured with. + + The project can be built in \e release mode or \e debug mode, or both. + If debug and release are both specified, the last one takes effect. If you + specify the \c debug_and_release option to build both the debug and release + versions of a project, the Makefile that qmake generates includes a rule + that builds both versions. This can be invoked in the following way: + + \snippet snippets/code/doc_src_qmake-manual.pro 0 + + Adding the \c build_all option to the \c CONFIG variable makes this rule + the default when building the project. + + \note Each of the options specified in the \c CONFIG variable can also be + used as a scope condition. + You can test for the presence of certain configuration options by using the + built-in \l{CONFIG(config)}{CONFIG()} function. + For example, the following lines show the function as the condition in a scope + to test whether only the \c opengl option is in use: + + \snippet snippets/qmake/configscopes.pro 4 + \snippet snippets/qmake/configscopes.pro 5 + + This enables different configurations to be defined for \c release and + \c debug builds. For more information, see \l{Scopes}{Using Scopes}. + + The following options define the type of project to be built. + + \note Some of these options only take effect when used on the relevant + platform. + + \table + \header \li Option \li Description + \row \li qt \li The project is a Qt application and should link against the Qt + library. You can use the \c QT variable to control any additional + Qt modules that are required by your application. + This value is added by default, but you can remove it to + use qmake for a non-Qt project. + \row \li x11 \li The project is an X11 application or library. + This value is not needed if the target uses Qt. + \endtable + + The \l{TEMPLATE}{application and library project templates} provide you with + more specialized configuration options to fine tune the build process. The + options are explained in detail in \l{Building Common Project Types}. + + For example, if your application uses the Qt library and you want to + build it in \c debug mode, your project file will contain the following line: + + \snippet snippets/code/doc_src_qmake-manual.pro 1 + + \note You must use "+=", not "=", or qmake + will not be able to use Qt's configuration to determine the settings + needed for your project. + + \section1 Declaring Qt Libraries + + If the \l{CONFIG} variable contains the \c 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 + \l{Variables#QT}{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: + + \snippet snippets/code/doc_src_qmake-manual.pro 2 + + \note \c QT includes the \c core and \c gui modules by default, so the + above declaration \e adds the network and XML modules to this default list. + The following assignment \e omits the default modules, and will lead to + errors when the application's source code is being compiled: + + \snippet snippets/code/doc_src_qmake-manual.pro 3 + + If you want to build a project \e without the \c gui module, you need to + exclude it with the "-=" operator. By default, \c QT contains both + \c core and \c gui, so the following line will result in a minimal + Qt project being built: + + \snippet snippets/code/doc_src_qmake-manual.pro 4 + + For a list of Qt modules that you can add to the \c QT variable, see + \l{Variables#QT}{QT}. + + \section1 Configuration Features + + qmake can be set up with extra configuration + features that are specified in feature (.prf) files. These extra features + often provide support for custom tools that are used during the build + process. To add a feature to the build process, append the feature name + (the stem of the feature filename) to the \c CONFIG variable. + + For example, qmake can configure the build + process to take advantage of external libraries that are supported by + \l{http://www.freedesktop.org/wiki/Software/pkg-config}{pkg-config}, + such as the D-Bus and ogg libraries, with the following lines: + + \snippet snippets/code/doc_src_qmake-manual.pro 5 + + For more information about adding features, see + \l{Adding New Configuration Features}. + + \section1 Declaring Other Libraries + + If you are using other libraries in your project in addition to those + supplied with Qt, you need to specify them in your project file. + + The paths that qmake searches for libraries + and the specific libraries to link against can be added to the list of values in the + \l{LIBS} variable. You can specify the paths to the libraries or use the + Unix-style notation for specifying libraries and paths. + + For example, the following lines show how a library can be specified: + + \snippet snippets/code/doc_src_qmake-manual.pro 6 + + The paths containing header files can also be specified in a similar way + using the \l{INCLUDEPATH} variable. + + For example, to add several paths to be searched for header files: + + \snippet snippets/code/doc_src_qmake-manual.pro 7 +*/ + +/*! + \page qmake-running.html + \title Running qmake + \contentspage {qmake Manual}{Contents} + \previouspage Building Common Project Types + \nextpage Platform Notes + + The behavior of qmake can be customized when it + is run by specifying various options on the command line. These allow the + build process to be fine-tuned, provide useful diagnostic + information, and can be used to specify the target platform for + your project. + + \section1 Command Syntax + + The syntax used to run qmake takes the following simple form: + + \snippet snippets/code/doc_src_qmake-manual.pro 8 + + \section1 Operating Modes + + qmake supports two different modes of operation. In the default mode, qmake + uses the information in a project file to generate a Makefile, but it is also + possible to use qmake to generate project files. + If you want to explicitly set the mode, you must specify it before all + other options. The \c mode can be either of the following two values: + + \list + \li \c -makefile \BR + qmake output will be a Makefile. + \li \c -project \BR + qmake output will be a project file. \BR + \note It is likely that the created file will need to be edited. For example, + adding the \c QT variable to suit what modules are required for the project. + \endlist + + You can use the \c options to specify both general and mode-specific + settings. Options that only apply to the Makefile mode are described in the + \l{#MakefileMode}{Makefile Mode Options} section, whereas options that influence the + creation of project files are described in the + \l{#ProjectMode}{Project Mode Options} section. + + \section1 Files + + The \c files argument represents a list of one or more project files, separated + by spaces. + + \section1 General Options + + A wide range of options can be specified on the command line to + qmake in order to customize the build process, + and to override default settings for your platform. The following basic + options provide help on using qmake, specify where qmake writes the output + file, and control the + level of debugging information that will be written to the console: + + \list + \li \c -help \BR + qmake will go over these features and give some useful help. + \li \c {-o file} \BR + qmake output will be directed to \c file. If + this option is not specified, qmake will try + to use a suitable file name for its output, depending on the mode it is + running in.\BR + If '-' is specified, output is directed to stdout. + \li \c -d \BR + qmake will output debugging information. Adding \c -d more than once + increases verbosity. + \endlist + + The template used for the project is usually specified by the \l{TEMPLATE} + variable in the project file. You can override or modify this by using the + following options: + + \list + \li \c {-t tmpl} \BR + qmake will override any set \c TEMPLATE variables with \c tmpl, but only + \e after the .pro file has been processed. + \li \c {-tp prefix} \BR + qmake will add \c prefix to the \c TEMPLATE variable. + \endlist + + The level of warning information can be fine-tuned to help you find problems in + your project file: + + \list + \li \c -Wall \BR + qmake will report all known warnings. + \li \c -Wnone \BR + No warning information will be generated by qmake. + \li \c -Wparser \BR + qmake will only generate parser warnings. + This will alert you to common pitfalls and potential problems in the + parsing of your project files. + \li \c -Wlogic \BR + qmake will warn of common pitfalls and + potential problems in your project file. For example, + qmake will report multiple occurrences of files in lists and missing + files. + \endlist + + \target MakefileMode + \section1 Makefile Mode Options + + \snippet snippets/code/doc_src_qmake-manual.pro 9 + + In Makefile mode, qmake will generate a Makefile + that is used to build the project. Additionally, the following options may + be used in this mode to influence the way the project file is generated: + + \list + \li \c -after \BR + qmake will process assignments given on the + command line after the specified files. + \li \c -nocache \BR + qmake will ignore the \c{.qmake.cache} file. + \li \c -nodepend \BR + qmake will not generate any dependency + information. + \li \c {-cache file} \BR + qmake will use \c file as the cache file, + ignoring any other .qmake.cache files found. + \li \c {-spec spec} \BR + qmake will use \c spec as a path to platform and compiler information, + and ignore the value of \l{QMAKESPEC}. + \endlist + + You may also pass qmake assignments on the command line. They are processed + before all of the files specified. For example, the following command + generates a Makefile from test.pro: + + \snippet snippets/code/doc_src_qmake-manual.pro 10 + + However, some of the specified options can be omitted as they are default + values: + + \snippet snippets/code/doc_src_qmake-manual.pro 11 + + If you are certain you want your variables processed after the + files specified, then you may pass the \c -after option. When this + is specified, all assignments on the command line after the \c -after + option will be postponed until after the specified files are parsed. + + \target ProjectMode + \section1 Project Mode Options + + \snippet snippets/code/doc_src_qmake-manual.pro 12 + + In project mode, qmake will generate a project + file. Additionally, you may supply the following options in this mode: + + \list + \li \c -r \BR + qmake will look through supplied directories recursively. + \li \c -nopwd \BR + qmake will not look in your current working directory for source code. + It will only use the specified \c files. + \endlist + + In this mode, the \c files argument can be a list of files or directories. + If a directory is specified, it will be included in the \l{DEPENDPATH} + variable, and relevant code from there will be included in the generated + project file. If a file is given, it will be appended to the correct + variable, depending on its extension. For example, UI files are added + to \l{FORMS}, and C++ files are added to \l{SOURCES}. + + You may also pass assignments on the command line in this mode. When doing + so, these assignments will be placed last in the generated project file. +*/ + +/*! + \page qmake-platform-notes.html + \title Platform Notes + \contentspage {qmake Manual}{Contents} + \previouspage Running qmake + \nextpage qmake Language + + Many cross-platform projects can be handled by the basic qmake configuration + features. However, on some platforms, it is sometimes useful, or even + necessary, to take advantage of platform-specific features. + qmake knows about many of these features, which can be accessed via specific + variables that only take effect on the platforms where they are relevant. + + \section1 Mac OS X + + Features specific to this platform include support for creating universal + binaries, frameworks and bundles. + + \section2 Source and Binary Packages + + The version of qmake supplied in source packages + is configured slightly differently to that supplied in binary packages in + that it uses a different feature specification. Where the source package + typically uses the \c macx-g++ specification, the binary package is + typically configured to use the \c macx-xcode specification. + + Users of each package can override this configuration by invoking + qmake with the \c -spec option (see \l{Running qmake} for more information). + For example, to use qmake from a binary package to create a Makefile in a + project directory, invoke the following command: + + \snippet snippets/code/doc_src_qmake-manual.pro 13 + + \section2 Using Frameworks + + qmake is able to automatically generate build + rules for linking against frameworks in the standard framework directory on + Mac OS X, located at \c{/Library/Frameworks/}. + + Directories other than the standard framework directory need to be specified + to the build system, and this is achieved by appending linker options to the + \l{QMAKE_LFLAGS} variable, as shown in the following example: + + \snippet snippets/code/doc_src_qmake-manual.pro 14 + + The framework itself is linked in by appending the \c{-framework} options and + the name of the framework to the \l{LIBS} variable: + + \snippet snippets/code/doc_src_qmake-manual.pro 15 + + \section2 Creating Frameworks + + Any given library project can be configured so that the resulting library + file is placed in a + \l{http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WhatAreFrameworks.html} + {framework}, ready for deployment. To do this, set up the project to use the + \l{TEMPLATE}{\c lib template} and add the \c lib_bundle option to the + \l{CONFIG} variable: + + \snippet snippets/code/doc_src_qmake-manual.pro 16 + + The data associated with the library is specified using the + \l{QMAKE_BUNDLE_DATA} + variable. This holds items that will be installed with a library + bundle, and is often used to specify a collection of header files, + as in the following example: + + \snippet snippets/code/doc_src_qmake-manual.pro 17 + + You use the \c FRAMEWORK_HEADERS variable to specify the headers required by + a particular framework. + Appending it to the \c QMAKE_BUNDLE_DATA variable ensures that + information about these headers is added to the collection of + resources that will be installed with the library bundle. Also, the + framework name and version are specified by the \l {QMAKE_FRAMEWORK_BUNDLE_NAME} + and \l{QMAKE_FRAMEWORK_VERSION} variables. By default, the values used for + these variables are obtained from the \l{TARGET} and \l{VERSION} variables. + + See \l{Deploying an Application on Mac OS X} for more information about + deploying applications and libraries. + + \section2 Creating and Moving Xcode Projects + + Developers on Mac OS X can take advantage of the qmake support for Xcode + project files, as described in + \l{Qt is Mac OS X Native#Development Tools}{Qt is Mac OS X Native}, + by running qmake to generate an Xcode project from an existing qmake project + file. For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 19 + + \note If a project is later moved on the disk, qmake must be run again to + process the project file and create a new Xcode project file. + + \section2 Supporting Two Build Targets Simultaneously + + Implementing this is currently not feasible, because the Xcode + concept of Active Build Configurations is conceptually different + from the qmake idea of build targets. + + The Xcode Active Build Configurations settings are for modifying + Xcode configurations, compiler flags and similar build + options. Unlike Visual Studio, Xcode does not allow for the + selection of specific library files based on whether debug or + release build configurations are selected. The qmake debug and + release settings control which library files are linked to the + executable. + + It is currently not possible to set files in Xcode configuration + settings from the qmake generated Xcode project file. The way the + libraries are linked in the \e {Frameworks & Libraries} phase in the + Xcode build system. + + Furthermore, the selected \e {Active Build Configuration} is stored + in a .pbxuser file, which is generated by Xcode on first load, not + created by qmake. + + \section1 Windows + + Features specific to this platform include support for creating Visual + Studio project files and handling manifest files when deploying Qt + applications developed using Visual Studio 2005, or later. + + \section2 Creating Visual Studio Project Files + + Developers using Visual Studio to write Qt applications can use the + Visual Studio integration facilities provided with the + \l{Qt Commercial License} + and do not need to worry about how project dependencies are managed. + + However, some developers may need to import an existing + qmake project into Visual Studio. + qmake is able to take a project file and create + a Visual Studio project that contains all the necessary information + required by the development environment. This is achieved by setting the + qmake \l{TEMPLATE}{project template} to either \c vcapp + (for application projects) or \c vclib (for library projects). + + This can also be set using a command line option, for example: + + \snippet snippets/code/doc_src_qmake-manual.pro 20 + + It is possible to recursively generate \c{.vcproj} files in subdirectories + and a \c{.sln} file in the main directory, by typing: + + \snippet snippets/code/doc_src_qmake-manual.pro 21 + + Each time you update the project file, you need to run + qmake to generate an updated Visual Studio + project. + + \note If you are using the Visual Studio Add-in, select \gui Qt > + \gui{Import from .pro file} to import \c .pro files. + + \section2 Visual Studio Manifest Files + + When deploying Qt applications built using Visual Studio 2005, or later, + make sure that the manifest file that was created when the application + was linked is handled correctly. This is handled automatically for + projects that generate DLLs. + + Removing manifest embedding for application executables can be done with + the following assignment to the \l{CONFIG} variable: + + \snippet snippets/code/doc_src_qmake-manual.pro 22 + + Also, the manifest embedding for DLLs can be removed with the following + assignment to the \c CONFIG variable: + + \snippet snippets/code/doc_src_qmake-manual.pro 23 + + This is discussed in more detail in the + \l{Deploying an Application on Windows#Manifest files} + {deployment guide for Windows}. +*/ + +/*! + \page qmake-reference.html + \title Reference + \contentspage {qmake Manual}{Contents} + \previouspage Configuring qmake + \nextpage Variables + + The reference sections describe in detail the variables and functions that + are available for use in qmake project files. + + \section1 Variable Reference + + \l{Variables} describes the variables that are recognized by qmake when + configuring the build process for projects. + + \section1 Function Reference + + There are two types of qmake functions: replace functions and test + functions. Replace functions return a value list, while test functions + return a boolean result. The functions are implemented in two places: + fundamental functionality is offered as built-in functions. More complex + functions are implemented in a library of feature files (.prf). + + The functions are divided into categories according to their type: + + \list + \li \l{Replace Functions} + \li \l{Test Functions} + \endlist +*/ + +/*! + \page qmake-variable-reference.html + \title Variables + \contentspage {qmake Manual}{Contents} + \previouspage Reference + \nextpage Replace Functions + + The fundamental behavior of qmake is influenced by variable declarations that + define the build process of each project. Some of these declare resources, + such as headers and source files, that are common to each platform. Others + are used to customize the behavior of compilers and linkers on specific + platforms. + + Platform-specific variables follow the naming pattern of the + variables which they extend or modify, but include the name of the relevant + platform in their name. For example, \c QMAKE_LIBS can be used to specify a list + of libraries that a project needs to link against, and \c QMAKE_LIBS_X11 can be + used to extend or override this list. + + \target CONFIG + \section1 CONFIG + + Specifies project configuration and compiler options. The values are + recognized internally by qmake and have special meaning. + + The following \c CONFIG values control compilation flags: + + \table + \header \li Option \li Description + \row \li release \li The project is to be built in release mode. + If \c debug is also specified, the last one takes effect. + \row \li debug \li The project is to be built in debug mode. + \row \li debug_and_release \li The project is prepared to be built in + \e both debug and release modes. + \row \li debug_and_release_target \li This option is set by default. If + \c debug_and_release is also set, the debug and release builds + end up in separate debug and release directories. + \row \li build_all \li If \c debug_and_release is specified, the project is + built in both debug and release modes by default. + \row \li autogen_precompile_source \li Automatically generates a \c .cpp + file that includes the precompiled header file specified in the .pro + file. + \row \li ordered \li When using the \c subdirs template, this option + specifies that the directories listed should be processed in the + order in which they are given. + \row \li precompile_header \li Enables support for the use of + \l{Using Precompiled Headers}{precompiled headers} in projects. + \row \li warn_on \li The compiler should output as many warnings as possible. + If \c warn_off is also specified, the last one takes effect. + \row \li warn_off \li The compiler should output as few warnings as possible. + \row \li exceptions \li Exception support is enabled. Set by default. + \row \li exceptions_off \li Exception support is disabled. + \row \li rtti \li RTTI support is enabled. By default, the compiler + default is used. + \row \li rtti_off \li RTTI support is disabled. By default, the compiler + default is used. + \row \li stl \li STL support is enabled. By default, the compiler + default is used. + \row \li stl_off \li STL support is disabled. By default, the compiler + default is used. + \row \li thread \li Thread support is enabled. This is enabled when CONFIG + includes \c qt, which is the default. + \endtable + + Since the \c debug option overrides the \c release option when both are + defined in the \c CONFIG variable, it is necessary to use the + \c debug_and_release option if you want to allow both debug and release + versions of a project to be built. In such a case, the Makefile that + qmake generates includes a rule that builds both + versions, and this can be invoked in the following way: + + \snippet snippets/code/doc_src_qmake-manual.pro 24 + + When linking a library, qmake relies on the + underlying platform to know what other libraries this library links + against. However, if linking statically, qmake + will not get this information unless we use the following \c CONFIG + options: + + \table + \header \li Option \li Description + \row \li create_prl \li This option enables + qmake to track these dependencies. When this + option is enabled, qmake will create a file + with the extension \c .prl which will save meta-information about the library + (see \l{LibDepend}{Library Dependencies} for more info). + \row \li link_prl \li When this option is enabled, + qmake will process all libraries linked to + by the application and find their meta-information (see + \l{LibDepend}{Library Dependencies} for more info). + \endtable + + \note The \c create_prl option is required when \e {building} a + static library, while \c link_prl is required when \e {using} a + static library. + + On Windows (or if Qt is configured with \c{-debug-and-release}), add the + \c build_all option to the \c CONFIG variable to build all build + configurations by default. + + Additionally, adding \c debug_and_release to the \c CONFIG variable will + cause both \c debug and \c release to be defined in the contents of + \c CONFIG. When the project file is processed, the + \l{Scopes}{scopes} that test for each value will be + processed for \e both debug and release modes. The \c{build_pass} variable + will be set for each of these modes, and you can test for this to perform + build-specific tasks. For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 25 + + As a result, it may be useful to define mode-specific variables, such as + \l{#QMAKE_LFLAGS_RELEASE}{QMAKE_LFLAGS_RELEASE}, instead of general + variables, such as \l{#QMAKE_LFLAGS}{QMAKE_LFLAGS}, where possible. + + The following options define the application or library type: + + \table + \header \li Option \li Description + \row \li qt \li The target is a Qt application or library and requires the Qt + library and header files. The proper include and library paths for the + Qt library will automatically be added to the project. This is defined + by default, and can be fine-tuned with the \c{\l{#qt}{QT}} variable. + \row \li thread \li The target is a multi-threaded application or library. The + proper defines and compiler flags will automatically be added to + the project. This value is set by default. + \row \li x11 \li The target is a X11 application or library. The proper + include paths and libraries will automatically be added to the + project. + \row \li testcase \li The target is an automated test. + \l{Building Common Project Types#building-a-testcase}{A check target} will be added + to the generated Makefile to run the test. Only relevant when generating + Makefiles. + \row \li insignificant_test \li The exit code of the automated test will be ignored. + Only relevant if \c testcase is also set. + \row \li windows \li The target is a Win32 window application (app only). The + proper include paths, compiler flags and libraries will + automatically be added to the project. + \row \li console \li The target is a Win32 console application (app only). The + proper include paths, compiler flags and libraries will + automatically be added to the project. + \row \li shared \li{1,2} The target is a shared object/DLL. The proper + include paths, compiler flags and libraries will automatically be + added to the project. Note that \c dll can also be used on all platforms; + a shared library file with the appropriate suffix for the target platform + (.dll or .so) will be created. + \row \li dll + \row \li static \li{1,2} The target is a static library (lib only). The proper + compiler flags will automatically be added to the project. + \row \li staticlib + \row \li plugin \li The target is a plugin (lib only). This enables dll as well. + \row \li designer \li The target is a plugin for \QD. + \row \li no_lflags_merge \li Ensures that the list of libraries stored in the + \c LIBS variable is not reduced to a list of unique values before it is used. + \row \li resources \li Configures qmake to run rcc on the content of \c RESOURCES + if defined. + \endtable + + These options define specific features on Windows only: + + \table + \header \li Option \li Description + \row \li flat \li When using the vcapp template this will put all the source + files into the source group and the header files into the header group + regardless of what directory they reside in. Turning this + option off will group the files within the source/header group depending + on the directory they reside. This is turned on by default. + \row \li embed_manifest_dll \li Embeds a manifest file in the DLL created + as part of a library project. + \row \li embed_manifest_exe \li Embeds a manifest file in the DLL created + as part of an application project. + \row \li incremental \li Used to enable or disable incremental linking in Visual + C++, depending on whether this feature is enabled or disabled by default. + \endtable + + See \l{Platform Notes#Visual Studio Manifest Files}{Platform Notes} + for more information about the options for embedding manifest files. + + The following options take an effect only on Mac OS X: + + \table + \header \li Option \li Description + \row \li ppc \li Builds a PowerPC binary. + \row \li x86 \li Builds an i386 compatible binary. + \row \li app_bundle \li Puts the executable into a bundle (this is the default). + \row \li lib_bundle \li Puts the library into a library bundle. + \endtable + + The build process for bundles is also influenced by + the contents of the \l{#QMAKE_BUNDLE_DATA}{QMAKE_BUNDLE_DATA} variable. + + The following options take an effect only on Linux/Unix platforms: + + \table + \header \li Option \li Description + \row \li largefile \li Includes support for large files. + \row \li separate_debug_info \li Puts debugging information for libraries in + separate files. + \endtable + + The \c CONFIG variable will also be checked when resolving scopes. You may + assign anything to this variable. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 26 + + \target DEFINES + \section1 DEFINES + + qmake adds the values of this variable as + compiler C preprocessor macros (-D option). + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 27 + + \target DEF_FILE + \section1 DEF_FILE + + \note This variable is used only on Windows when using the \c app template. + + Specifies a \c .def file to be included in the project. + + \target DEPENDPATH + \section1 DEPENDPATH + + Specifies a list of all directories to look in to resolve dependencies. This + variable is used when crawling through \c included files. + + \target DEPLOYMENT + \section1 DEPLOYMENT + + \note This variable is used only on the Windows CE platform. + + Specifies which additional files will be deployed. Deployment means the + transfer of files from the development system to the target device or + emulator. + + Files can be deployed by either creating a Visual Studio project or using + the \l {Using Qt Test remotely on Windows CE}{cetest} executable. + + For example, the following definition uploads all PNG images in \c path to + the directory where the build target is deployed: + + \snippet snippets/code/doc_src_qmake-manual.pro 28 + + The default deployment target path for Windows CE is + \c{%CSIDL_PROGRAM_FILES%\target}, which usually gets expanded to + \c{\Program Files\target}. + + It is also possible to specify multiple \c sources to be deployed on + target \c paths. In addition, different variables can be used for + deployment to different directories. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 29 + + \note In Windows CE all linked Qt libraries will be deployed to the path + specified by \c{myFiles.path}. + + \target DEPLOYMENT_PLUGIN + \section1 DEPLOYMENT_PLUGIN + + \note This variable is used only on the Windows CE platform. + + Specifies the Qt plugins that will be deployed. All plugins + available in Qt can be explicitly deployed to the device. See + \l{Static Plugins}{Static Plugins} for a complete list. + + \note No plugins will be deployed automatically to Windows CE devices. + If the application depends on plugins, these plugins have to be specified + manually. + + For example, the following definition uploads the jpeg imageformat plugin to + the plugins directory on the Windows CE device: + + \snippet snippets/code/doc_src_qmake-manual.pro 142 + + \target DESTDIR + \section1 DESTDIR + + Specifies where to put the \l{#TARGET}{target} file. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 30 + + \target DISTFILES + \section1 DISTFILES + + Specifies a list of files to be included in the dist + target. This feature is supported by UnixMake specs only. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 31 + + \target DLLDESTDIR + \section1 DLLDESTDIR + + \note This variable applies only to Windows targets. + + Specifies where to copy the \l{#TARGET}{target} dll. + + \target FORMS + \section1 FORMS + + Specifies the UI files (see \l{Qt Designer Manual}) to be processed by \c uic + before compiling. All dependencies, headers and source files required + to build these UI files will automatically be added to the project. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 32 + + \target GUID + \section1 GUID + + Specifies the GUID that is set inside a \c{.vcproj} file. The GUID is + usually randomly determined. However, should you require a fixed GUID, + it can be set using this variable. + + This variable is specific to \c{.vcproj} files only; it is ignored + otherwise. + + \target HEADERS + \section1 HEADERS + + Defines the header files for the project. + + qmake automatically detects whether \l{moc} is required by the classes in + the headers, and adds the appropriate dependencies and files to the project + for generating and linking the moc files. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 34 + + See also \l{#SOURCES}{SOURCES}. + + \target ICON + \section1 ICON + + This variable is used only on Mac OS to set the application icon. + Please see \l{Setting the Application Icon}{the application icon documentation} + for more information. + + \target INCLUDEPATH + \section1 INCLUDEPATH + + Specifies the #include directories which should be + searched when compiling the project. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 35 + + To specify a path containing spaces, quote the path using the technique + described in \l{Whitespace}. + + \snippet snippets/qmake/spaces.pro quoting include paths with spaces + + \target INSTALLS + \section1 INSTALLS + + Specifies a list of resources that will be installed when + \c{make install} or a similar installation procedure is executed. Each + item in the list is typically defined with attributes that provide + information about where it will be installed. + + For example, the following \c{target.path} definition describes where the + build target will be installed, and the \c INSTALLS assignment adds the + build target to the list of existing resources to be installed: + + \snippet snippets/code/doc_src_qmake-manual.pro 36 + + For more information, see \l{Installing Files}. + + \target LEXIMPLS + \section1 LEXIMPLS + + Specifies a list of Lex implementation files. The value + of this variable is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \target LEXOBJECTS + \section1 LEXOBJECTS + + Specifies the names of intermediate Lex object + files.The value of this variable is typically handled by + qmake and rarely needs to be modified. + + \target LEXSOURCES + \section1 LEXSOURCES + + Specifies a list of Lex source files. All + dependencies, headers and source files will automatically be added to + the project for building these lex files. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 37 + + \target LIBS + \section1 LIBS + + Specifies a list of libraries to be linked into the project. + If you use the Unix \c -l (library) and -L (library path) flags, qmake + handles the libraries correctly on Windows (that is, passes the full path of + the library to the linker). The library must exist for + qmake to find the directory where a \c -l lib is located. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 38 + + To specify a path containing spaces, quote the path using the technique + described in \l{Whitespace}. + + \snippet snippets/qmake/spaces.pro quoting library paths with spaces + + By default, the list of libraries stored in \c LIBS is reduced to a list of + unique names before it is used. To change this behavior, add the + \c no_lflags_merge option to the \l{CONFIG} variable: + + \snippet snippets/code/doc_src_qmake-manual.pro 39 + + \target LITERAL_HASH + \section1 LITERAL_HASH + + This variable is used whenever a literal hash character (\c{#}) is needed in + a variable declaration, perhaps as part of a file name or in a string passed + to some external application. + + For example: + + \snippet snippets/qmake/comments.pro 1 + + By using \c LITERAL_HASH in this way, the \c # character can be used + to construct a URL for the \c message() function to print to the console. + + \target MAKEFILE + \section1 MAKEFILE + + Specifies the name of the generated Makefile. The value of this variable is + typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to + be modified. + + \target MAKEFILE_GENERATOR + \section1 MAKEFILE_GENERATOR + + Specifies the name of the Makefile generator to use + when generating a Makefile. The value of this variable is typically + handled internally by qmake and rarely needs to + be modified. + + \target MOC_DIR + \section1 MOC_DIR + + Specifies the directory where all intermediate moc + files should be placed. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 40 + + \target OBJECTS + \section1 OBJECTS + + This variable is automatically populated from the \l{SOURCES} variable. + The extension of each source file is replaced by .o (Unix) or .obj (Win32). + You can add objects to the list. + + \target OBJECTS_DIR + \section1 OBJECTS_DIR + + Specifies the directory where all intermediate + objects should be placed. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 41 + + \target POST_TARGETDEPS + \section1 POST_TARGETDEPS + + Lists the libraries that the \l{#TARGET}{target} depends on. Some backends, + such as the generators for Visual Studio and Xcode project files, do not + support this variable. Generally, this variable is supported internally by + these build tools, and it is useful for explicitly listing dependent static + libraries. + + This list is placed after all builtin (and \link #PRE_TARGETDEPS + $$PRE_TARGETDEPS \endlink) dependencies. + + \target PRE_TARGETDEPS + \section1 PRE_TARGETDEPS + + Lists libraries that the \l{#TARGET}{target} depends on. Some backends, + such as the generators for Visual Studio and Xcode project files, do not + support this variable. Generally, this variable is supported internally by + these build tools, and it is useful for explicitly listing dependent static + libraries. + + This list is placed before all builtin dependencies. + + \target PRECOMPILED_HEADER + \section1 PRECOMPILED_HEADER + + Indicates the header file for creating a precompiled + header file, to increase the compilation speed of a project. + Precompiled headers are currently only supported on some platforms + (Windows - all MSVC project types, Mac OS X - Xcode, Makefile, + Unix - gcc 3.3 and up). + + \target PWD + \section1 PWD + + Specifies the full path leading to the directory + containing the current file being parsed. This can be useful + to refer to files within the source tree when writing project files to + support shadow builds. + + See also \l{#_PRO_FILE_PWD_}{_PRO_FILE_PWD_}. + + \note Do not attempt to overwrite the value of this variable. + + \target OUT_PWD + \section1 OUT_PWD + + Specifies the full path leading to the directory where qmake places the + generated Makefile. + + \note Do not attempt to overwrite the value of this variable. + + \target QMAKE_systemvariable + \section1 QMAKE + + Specifies the name of the qmake program itself and is placed in generated + Makefiles. The value of this variable is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \target QMAKESPEC_systemvariable + \section1 QMAKESPEC + + A system variable that contains the full path of the qmake configuration that is used + when generating Makefiles. The value of this variable is automatically computed. + + \note Do not attempt to overwrite the value of this variable. + + \target QMAKE_AR_CMD + \section1 QMAKE_AR_CMD + + \note This variable is used on Unix platforms only. + + Specifies the command to execute when creating a shared library. The value of this variable + is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \target QMAKE_BUNDLE_DATA + \section1 QMAKE_BUNDLE_DATA + + \note This variable is used on Mac OS X only. + + Specifies the data that will be installed with a library + bundle, and is often used to specify a collection of header files. + + For example, the following lines add \c path/to/header_one.h + and \c path/to/header_two.h to a group containing information about the + headers supplied with the framework: + + \snippet snippets/code/doc_src_qmake-manual.pro 43 + + The last line adds the information about the headers to the collection of + resources that will be installed with the library bundle. + + Library bundles are created when the \c lib_bundle option is added to the + \l{#CONFIG}{CONFIG} variable. + + See \l{Platform Notes#Creating Frameworks}{Platform Notes} for + more information about creating library bundles. + + \section1 QMAKE_BUNDLE_EXTENSION + + \note This variable is used on Mac OS X only. + + Specifies the extension to be used for library bundles. + This allows frameworks to be created with custom extensions instead of the + standard \c{.framework} directory name extension. + + For example, the following definition will result in a framework with the + \c{.myframework} extension: + + \snippet snippets/code/doc_src_qmake-manual.pro 44 + + \section1 QMAKE_CC + + Specifies the C compiler that will be used when building + projects containing C source code. Only the file name of the compiler + executable needs to be specified as long as it is on a path contained + in the \c PATH variable when the Makefile is processed. + + \target QMAKE_CFLAGS_DEBUG + \section1 QMAKE_CFLAGS_DEBUG + + Specifies the C compiler flags for debug builds. + The value of this variable is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} and + rarely needs to be modified. + + \target QMAKE_CFLAGS_RELEASE + \section1 QMAKE_CFLAGS_RELEASE + + Specifies the C compiler flags for release builds. + The value of this variable is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} + and rarely needs to be modified. + + \target QMAKE_CFLAGS_SHLIB + \section1 QMAKE_CFLAGS_SHLIB + + \note This variable is used on Unix platforms only. + + Specifies the compiler flags for creating a shared + library. The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \target QMAKE_CFLAGS_THREAD + \section1 QMAKE_CFLAGS_THREAD + + Specifies the compiler flags for creating a multi-threaded + application. The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \target QMAKE_CFLAGS_WARN_OFF + \section1 QMAKE_CFLAGS_WARN_OFF + + This variable is used only when the \c {warn_off} \l{#CONFIG}{CONFIG} option + is set. The value of this variable is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \target QMAKE_CFLAGS_WARN_ON + \section1 QMAKE_CFLAGS_WARN_ON + + This variable is used only when the \c {warn_on} \l{#CONFIG}{CONFIG} option + is set. The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \target QMAKE_CLEAN + \section1 QMAKE_CLEAN + + Specifies a list of generated files (by \l{moc} and \l{uic}, for example) and + object files to be removed by \c {make clean}. + + \section1 QMAKE_CXX + + Specifies the C++ compiler that will be used when building + projects containing C++ source code. Only the file name of the compiler + executable needs to be specified as long as it is on a path contained + in the \c PATH variable when the Makefile is processed. + + \section1 QMAKE_CXXFLAGS + + Specifies the C++ compiler flags for building + a project. The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. The flags specific to debug and release modes can be + adjusted by modifying the \c QMAKE_CXXFLAGS_DEBUG and + \c QMAKE_CXXFLAGS_RELEASE variables, respectively. + + \target QMAKE_CXXFLAGS_DEBUG + \section1 QMAKE_CXXFLAGS_DEBUG + + Specifies the C++ compiler flags for debug builds. + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \target QMAKE_CXXFLAGS_RELEASE + \section1 QMAKE_CXXFLAGS_RELEASE + + Specifies the C++ compiler flags for release builds. + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \target QMAKE_CXXFLAGS_SHLIB + \section1 QMAKE_CXXFLAGS_SHLIB + + Specifies the C++ compiler flags for creating a shared library. + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \target QMAKE_CXXFLAGS_THREAD + \section1 QMAKE_CXXFLAGS_THREAD + + Specifies the C++ compiler flags for creating a multi-threaded application. + The value of this variable is typically handled by qmake or \l{#QMAKESPEC} + {qmake.conf} and rarely needs to be modified. + + \target QMAKE_CXXFLAGS_WARN_OFF + \section1 QMAKE_CXXFLAGS_WARN_OFF + + Specifies the C++ compiler flags for suppressing compiler + warnings. The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \target QMAKE_CXXFLAGS_WARN_ON + \section1 QMAKE_CXXFLAGS_WARN_ON + + Specifies C++ compiler flags for generating compiler warnings. + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \target QMAKE_DISTCLEAN + \section1 QMAKE_DISTCLEAN + + Specifies a list of files to be removed by \c{make distclean}. + + \target QMAKE_EXTENSION_SHLIB + \section1 QMAKE_EXTENSION_SHLIB + + Contains the extension for shared libraries. The value of + this variable is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \note Platform-specific variables that change the extension override + the contents of this variable. + + \section1 QMAKE_EXT_MOC + + Contains the extension used on included moc files. + + See also \l{Configuring qmake#Extensions}{File Extensions}. + + \section1 QMAKE_EXT_UI + + Contains the extension used on \QD UI files. + + See also \l{Configuring qmake#Extensions}{File Extensions}. + + \section1 QMAKE_EXT_PRL + + Contains the extension used on created PRL files. + + See also \l{Configuring qmake#Extensions}{File Extensions}, + \l{LibDepend}{Library Dependencies}. + + \section1 QMAKE_EXT_LEX + + Contains the extension used on files given to Lex. + + See also \l{Configuring qmake#Extensions}{File Extensions}, + \l{#LEXSOURCES}{LEXSOURCES}. + + \section1 QMAKE_EXT_YACC + Contains the extension used on files given to Yacc. + + See also \l{Configuring qmake#Extensions}{File Extensions}, + \l{#YACCSOURCES}{YACCSOURCES}. + + \section1 QMAKE_EXT_OBJ + + Contains the extension used on generated object files. + + See also \l{Configuring qmake#Extensions}{File Extensions}. + + \section1 QMAKE_EXT_CPP + + Contains suffixes for files that should be interpreted as C++ source code. + + See also \l{Configuring qmake#Extensions}{File Extensions}. + + \section1 QMAKE_EXT_H + + Contains suffixes for files which should be interpreted as C header files. + + See also \l{Configuring qmake#Extensions}{File Extensions}. + + \section1 QMAKE_EXTRA_COMPILERS + + Specifies a list of additional compilers or preprocessors. + + See also \l{Adding Compilers}. + + \section1 QMAKE_EXTRA_TARGETS + + Specifies a list of additional qmake targets. + + See also \l{Adding Custom Targets}. + + \target QMAKE_FAILED_REQUIREMENTS + \section1 QMAKE_FAILED_REQUIREMENTS + + Contains the list of failed requirements. + The value of this variable is set by qmake and cannot be modified. + + See also \l{requires(condition)}{requires()} and \l{REQUIRES}. + + \section1 QMAKE_FRAMEWORK_BUNDLE_NAME + + \note This variable is used on Mac OS X only. + + In a framework project, this variable contains the name to be used for the + framework that is built. + + By default, this variable contains the same value as the \l{#TARGET}{TARGET} + variable. + + See \l{Creating Frameworks} for + more information about creating frameworks and library bundles. + + \target QMAKE_FRAMEWORK_VERSION + \section1 QMAKE_FRAMEWORK_VERSION + + \note This variable is used on Mac OS X only. + + For projects where the build target is a Mac OS X framework, this variable + is used to specify the version number that will be applied to the framework + that is built. + + By default, this variable contains the same value as the \l{#VERSION}{VERSION} + variable. + + See \l{Creating Frameworks} for more information about creating frameworks. + + \target QMAKE_INCDIR + \section1 QMAKE_INCDIR + + Specifies the list of system header paths that are appended to \l{INCLUDEPATH}. + The value of this variable is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \target QMAKE_INCDIR_EGL + \section1 QMAKE_INCDIR_EGL + + Specifies the location of EGL header files to be added to + \l{INCLUDEPATH} when building a target with OpenGL/ES or OpenVG support. + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \target QMAKE_INCDIR_OPENGL + \section1 QMAKE_INCDIR_OPENGL + + Specifies the location of OpenGL header files to be added + to \l{INCLUDEPATH} when building a target with OpenGL support. The + value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + If the OpenGL implementation uses EGL (most OpenGL/ES systems), + then QMAKE_INCDIR_EGL may also need to be set. + + \section1 QMAKE_INCDIR_OPENGL_ES1, QMAKE_INCDIR_OPENGL_ES2 + + These variables specify the location of OpenGL headers files to be added + to \l{INCLUDEPATH} when building a target with OpenGL ES 1 + or OpenGL ES 2 support respectively. + + The value of this variable is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + If the OpenGL implementation uses EGL (most OpenGL/ES systems), + then QMAKE_INCDIR_EGL may also need to be set. + + \target QMAKE_INCDIR_OPENVG + \section1 QMAKE_INCDIR_OPENVG + + Specifies the location of OpenVG header files to be added + to \l{INCLUDEPATH} when building a target with OpenVG support. The + value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + If the OpenVG implementation uses EGL then QMAKE_INCDIR_EGL may also + need to be set. + + \target QMAKE_INCDIR_X11 + \section1 QMAKE_INCDIR_X11 + + \note This variable is used on Unix platforms only. + + Specifies the location of X11 header file paths to be added + to \l{INCLUDEPATH} when building a X11 target. The value of this variable + is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \target QMAKE_INFO_PLIST + \section1 QMAKE_INFO_PLIST + + \note This variable is used on Mac OS X platforms only. + + Specifies the name of the property list file, \c{.plist}, you + would like to include in your Mac OS X application bundle. + + In the \c{.plist} file, you can define some variables, e.g., @EXECUTABLE@, + which qmake will replace with the actual executable name. Other variables + include @ICON@, @TYPEINFO@, @LIBRARY@, and @SHORT_VERSION@. + + \note Most of the time, the default \c{Info.plist} is good enough. + + \section1 QMAKE_LFLAGS + + Specifies a general set of flags that are passed to + the linker. If you need to change the flags used for a particular + platform or type of project, use one of the specialized variables + for that purpose instead of this variable. + + \target QMAKE_LFLAGS_CONSOLE + \section1 QMAKE_LFLAGS_CONSOLE + + \note This variable is used on Windows only. + + Specifies the linker flags for building console programs. The value + of this variable is typically handled by qmake + or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QMAKE_LFLAGS_DEBUG + + Specifies the linker flags for debug builds. + The value of this variable is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} + and rarely needs to be modified. + + \section1 QMAKE_LFLAGS_PLUGIN + + Specifies the linker flags for building plugins. The value of this + variable is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QMAKE_LFLAGS_RPATH + + \note This variable is used on Unix platforms only. + + Specifies the linker flags needed to use the values from \l{QMAKE_RPATHDIR}. + + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QMAKE_LFLAGS_RPATHLINK + + Specifies the linker flags needed to use the values from + \l{QMAKE_RPATHLINKDIR}. + + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QMAKE_LFLAGS_RELEASE + + Specifies the linker flags for release builds. + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QMAKE_LFLAGS_APP + + Specifies the linker flags for building applications. + The value of this variable is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QMAKE_LFLAGS_SHLIB + + Specifies the linker flags used for building shared libraries. + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \section1 QMAKE_LFLAGS_SONAME + + Specifies the linker flags for setting the name of shared objects, + such as .so or .dll. The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \section1 QMAKE_LFLAGS_THREAD + + Specifies the linker flags for building multi-threaded projects. + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \section1 QMAKE_LFLAGS_WINDOWS + + \note This variable is used on Windows only. + + Specifies the linker flags for building Windows GUI projects (that is, + non-console applications). The value of this variable is typically handled + by qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \section1 QMAKE_LIBDIR + + Specifies a list of system library paths. + The value of this variable is typically handled by qmake + or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QMAKE_LIBDIR_FLAGS + + \note This variable is used on Unix platforms only. + + Specifies the location of all library directories with -L + prefixed. The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \section1 QMAKE_LIBDIR_EGL + + Specifies the location of the EGL library directory, when EGL + is used with OpenGL/ES or OpenVG. The value of this variable is typically + handled by qmake or \l{#QMAKESPEC}{qmake.conf} + and rarely needs to be modified. + + \section1 QMAKE_LIBDIR_OPENGL + + Specifies the location of the OpenGL library directory. The + value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + If the OpenGL implementation uses EGL (most OpenGL/ES systems), + then QMAKE_LIBDIR_EGL may also need to be set. + + \section1 QMAKE_LIBDIR_OPENVG + + Specifies the location of the OpenVG library directory. The + value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + If the OpenVG implementation uses EGL, then QMAKE_LIBDIR_EGL + may also need to be set. + + \section1 QMAKE_LIBDIR_X11 + + \note This variable is used on Unix platforms only. + + Specifies the location of the X11 library directory. The value + of this variable is typically handled by qmake + or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QMAKE_LIBS + + Specifies all project libraries. The value of this variable + is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QMAKE_LIBS_EGL + + Specifies all EGL libraries when building Qt with OpenGL/ES + or OpenVG. The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. The usual value is \c{-lEGL}. + + \section1 QMAKE_LIBS_OPENGL + + Specifies all OpenGL libraries. The value of this variable + is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + If the OpenGL implementation uses EGL (most OpenGL/ES systems), + then QMAKE_LIBS_EGL may also need to be set. + + \section1 QMAKE_LIBS_OPENGL_ES1, QMAKE_LIBS_OPENGL_ES2 + + These variables specify all the OpenGL libraries for OpenGL ES 1 + and OpenGL ES 2. + + The value of these variables is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + If the OpenGL implementation uses EGL (most OpenGL/ES systems), + then QMAKE_LIBS_EGL may also need to be set. + + \section1 QMAKE_LIBS_OPENVG + + Specifies all OpenVG libraries. The value of this variable + is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. The usual + value is \c{-lOpenVG}. + + Some OpenVG engines are implemented on top of OpenGL. This will + be detected at configure time and QMAKE_LIBS_OPENGL will be implicitly + added to QMAKE_LIBS_OPENVG wherever the OpenVG libraries are linked. + + If the OpenVG implementation uses EGL, then QMAKE_LIBS_EGL may also + need to be set. + + \section1 QMAKE_LIBS_THREAD + + \note This variable is used on Unix platforms only. + + Specifies all libraries that need to be linked against when + building a multi-threaded target. The value of this variable is + typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QMAKE_LIBS_X11 + + \note This variable is used on Unix platforms only. + + Specifies all X11 libraries. The value of this variable is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QMAKE_LIB_FLAG + + This variable is not empty if the \c lib template is specified. The value + of this variable is typically handled by qmake + or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QMAKE_LINK_SHLIB_CMD + + Specifies the command to execute when creating a shared + library. The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \section1 QMAKE_LN_SHLIB + + Specifies the command to execute when creating a link to a shared library. The + value of this variable is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QMAKE_POST_LINK + + Specifies the command to execute after linking the \l{TARGET} + together. This variable is normally empty and therefore nothing is + executed. + + \note This variable takes no effect on Xcode projects. + + \section1 QMAKE_PRE_LINK + + Specifies the command to execute before linking the \l{TARGET} + together. This variable is normally empty and therefore nothing is + executed. + + \note This variable takes no effect on Xcode projects. + + \section1 QMAKE_PROJECT_NAME + + \note This variable is used for Visual Studio project files only. + + Determines the name of the project when generating project + files for IDEs. The default value is the target name. The value of this + variable is typically handled by qmake and rarely needs to be modified. + + \section1 QMAKE_MAC_SDK + + This variable is used on Mac OS X when building universal binaries. + + \section1 QMAKE_MACOSX_DEPLOYMENT_TARGET + + This variable only takes effect when building on Mac OS X. On that + platform, the variable will be forwarded to the MACOSX_DEPLOYMENT_TARGET + environment variable, which is interpreted by the compiler or linker. + For more information, see the + \l{Deploying an Application on Mac OS X#Mac OS X Version Dependencies}{Deploying + an Application on Mac OS X} document. + + \section1 QMAKE_MAKEFILE + + Specifies the name of the Makefile to create. The value of + this variable is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QMAKE_QMAKE + + Contains the abosolute path of the qmake executable. + + \note Do not attempt to overwrite the value of this variable. + + \section1 QMAKE_RESOURCE_FLAGS + + This variable is used to customize the list of options passed to the + \l{rcc}{Resource Compiler} in each of the build rules where it is used. + For example, the following line ensures that the \c{-threshold} and + \c{-compress} options are used with particular values each time that + \c rcc is invoked: + + \snippet snippets/code/doc_src_qmake-manual.pro 45 + + \section1 QMAKE_RPATHDIR + + \note This variable is used on Unix platforms only. + + Specifies a list of library paths that are added to the + executable at link time so that the paths will be preferentially + searched at runtime. + + \section1 QMAKE_RPATHLINKDIR + + Specifies a list of library paths for the static linker to search for implicit + dependencies of shared libraries. For more information, see the manual page + for \c ld(1). + + \section1 QMAKE_RUN_CC + + Specifies the individual rule needed to build an object. The + value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \section1 QMAKE_RUN_CC_IMP + + Specifies the individual rule needed to build an object. The + value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \section1 QMAKE_RUN_CXX + + Specifies the individual rule needed to build an object. The + value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \section1 QMAKE_RUN_CXX_IMP + + Specifies the individual rule needed to build an object. The + value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \section1 QMAKE_TARGET + + Specifies the name of the project target. The value of this + variable is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 QT + + Specifies the Qt modules that are used by your project. + + The table below shows the options that can be used with the \c QT variable + and the Qt modules that are associated with each of them: + + \table + \header \li Option \li Module Enabled + \row \li axcontainer \li \l{Using ActiveX controls and COM in Qt} + {QAxContainer}, which is + part of the \l{Active Qt} framework + \row \li axserver \li \l{Building ActiveX servers in Qt} + {QAxServer}, which is + part of the \l{Active Qt} framework + \row \li concurrent \li \l{Qt Concurrent} + \row \li core (included by default) \li \l{Qt Core} + \row \li dbus \li \l{Qt D-Bus} + \row \li declarative \li \l{Qt Quick 1} (deprecated) + \row \li designer \li \l{Qt Designer} + \row \li designercomponents \li \l{Qt Designer Components} + \row \li gui (included by default) \li \l{Qt GUI} + \row \li help \li \l{Qt Help} + \row \li multimedia \li \l{Qt Multimedia} + \row \li multimediawidgets \li \l{Qt Multimedia Widgets} + \row \li network \li \l{Qt Network} + \row \li opengl \li \l{Qt OpenGL} (deprecated) + \row \li printsupport \li \l{Qt Print Support} + \row \li qml \li \l{Qt QML} + \row \li qmltest \li \l{Qt QML Test} + \row \li x11extras \li \l{Qt X11 Extras} + \row \li quick \li \l{Qt Quick} + \row \li script \li \l{Qt Script} (deprecated) + \row \li scripttools \li \l{Qt Script Tools} (deprecated) + \row \li sensors \li \l{Qt Sensors} + \row \li serialport \li \l{Qt Serial Port} + \row \li sql \li \l{Qt SQL} + \row \li svg \li \l{Qt SVG} + \row \li testlib \li \l{Qt Test} + \row \li uitools \li \l{Qt UI Tools} + \row \li webkit \li \l{Qt WebKit} + \row \li webkitwidgets \li \l{Qt WebKit Widgets} + \row \li widgets \li \l{Qt Widgets} + \row \li xml \li \l{Qt XML} (deprecated) + \row \li xmlpatterns \li \l{Qt XML Patterns} + \endtable + + By default, \c QT contains both \c core and \c gui, ensuring that standard + GUI applications can be built without further configuration. + + If you want to build a project \e without the \l{Qt GUI} module, you need to + exclude the \c gui value with the "-=" operator. The following line will + result in a minimal Qt project being built: + + \snippet snippets/code/doc_src_qmake-manual.pro 47 + + \section1 QTPLUGIN + + Specifies a list of names of static Qt plugins that are to be + linked with an application so that they are available as built-in + resources. + + \target QT_VERSION_variable + \section1 QT_VERSION + + Contains the current version of Qt. + + \target QT_MAJOR_VERSION + \section1 QT_MAJOR_VERSION + + Contains the current major version of Qt. + + \target QT_MINOR_VERSION + \section1 QT_MINOR_VERSION + + Contains the current minor version of Qt. + + \target QT_PATCH_VERSION + \section1 QT_PATCH_VERSION + + Contains the current patch version of Qt. + + \section1 RC_FILE + + Specifies the name of the resource file for the application. + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \section1 RC_INCLUDEPATH + + Specifies include paths that are passed to the Windows Resource Compiler. + + \target RCC_DIR + \section1 RCC_DIR + + Specifies the directory for Qt Resource Compiler output files. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 48 + + \target REQUIRES + \section1 REQUIRES + + Specifies a list of values that are evaluated as conditions. If any of the conditions is false, + qmake skips this project (and its \l{SUBDIRS}) when building. + + \note We recommend using the \l{requires(condition)}{requires()} function + instead if you want to skip projects or subprojects when building. + + \target RESOURCES + \section1 RESOURCES + + Specifies the name of the resource collection files (qrc) + for the target. For more information about the resource collection + file, see \l{The Qt Resource System}. + + \section1 RES_FILE + + Specifies the name of the compiled Windows resource file for the target. + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \target SIGNATURE_FILE + \section1 SIGNATURE_FILE + + \note This variable is only used on Windows CE. + + Specifies which signature file should be used to sign the project target. + + \note This variable will overwrite the setting you have specified in configure, + with the \c -signature option. + + \target SOURCES + \section1 SOURCES + + Specifies the names of all source files in the project. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 49 + + See also \l{#HEADERS}{HEADERS}. + + \target SUBDIRS + \section1 SUBDIRS + + This variable, when used with the \l{#TEMPLATE}{\c subdirs template} + Specifies the names of all subdirectories or project files that contain + parts of the project that need be built. Each subdirectory specified + using this variable must contain its own project file. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 50 + + It is essential that the project file in each subdirectory has the same + name as the subdirectory itself, so that qmake + can find it. For example, if the subdirectory is called \c myapp then the + project file in that directory should be called \c myapp.pro. + + If you need to ensure that the subdirectories are built in the order in + which they are specified, update the \l{#CONFIG}{CONFIG} variable to + include the \c ordered option: + + \snippet snippets/code/doc_src_qmake-manual.pro 51 + + It is possible to modify this default behavior of \c SUBDIRS by giving + additional modifiers to \c SUBDIRS elements. Supported modifiers are: + + \table + \header \li Modifier \li Effect + \row \li .subdir \li Use the specified subdirectory instead of \c SUBDIRS value. + \row \li .file \li Specify the subproject \c pro file explicitly. Cannot be + used in conjunction with \c .subdir modifier. + \row \li .depends \li This subproject depends on specified subproject. + Available only on platforms that use makefiles. + \row \li .makefile \li The makefile of subproject. + Available only on platforms that use makefiles. + \row \li .target \li Base string used for makefile targets related to this + subproject. + Available only on platforms that use makefiles. + \endtable + + For example, define two subdirectories, both of which reside in a different directory + than the \c SUBDIRS value, and one of the subdirectories must be built before the other: + + \snippet snippets/code/doc_src_qmake-manual.pro 149 + + \target TARGET + \section1 TARGET + + Specifies the name of the target file. Contains the base name of the project + file by default. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 52 + + The project file above would produce an executable named \c myapp on + unix and \c{myapp.exe} on Windows. + + \section1 TARGET_EXT + + Specifies the extension of \c TARGET. The value of this variable + is typically handled by qmake or + \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. + + \section1 TARGET_x + + Specifies the extension of \c TARGET with a major version number. + The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \section1 TARGET_x.y.z + + Specifies the extension of \c TARGET with version number. The + value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. + + \target TEMPLATE + \section1 TEMPLATE + + Specifies the name of the template to use when generating the project. The + allowed values are: + + \table + \header \li Option \li Description + \row \li app \li Creates a Makefile for building applications + (the default). See \l{Building an Application} for more information. + \row \li lib \li Creates a Makefile for building libraries. See + \l{Building a Library} for more information. + \row \li subdirs \li Creates a Makefile for building targets in subdirectories. + The subdirectories are specified using the \l{#SUBDIRS}{SUBDIRS} + variable. + \row \li vcapp \li Windows only. Creates an application project for + Visual Studio. See \l{Creating Visual Studio Project Files} for more + information. + \row \li vclib \li Windows only. Creates a library project for Visual Studio. + \endtable + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 53 + + The template can be overridden by specifying a new template type with the + \c -t command line option. This overrides the template type \e after the .pro + file has been processed. With .pro files that use the template type to + determine how the project is built, it is necessary to declare TEMPLATE on + the command line rather than use the \c -t option. + + \section1 TRANSLATIONS + + Specifies a list of translation (.ts) files that contain + translations of the user interface text into non-native languages. + + See the \l{Qt Linguist Manual} for more information about + internationalization (i18n) and localization (l10n) with Qt. + + \target UI_DIR + \section1 UI_DIR + + Specifies the directory where all intermediate files from uic + should be placed. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 54 + + \target VERSION + \section1 VERSION + + Specifies the version number of the application if the \c app \l{#TEMPLATE}{template} is + specified or the version number of the library if the \c lib template is specified. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 57 + + \section1 VER_MAJ + + Specifies the major version number of the library if the + \c lib \l{#TEMPLATE}{template} is specified. + + \section1 VER_MIN + + Specifies the minor version number of the library if the + \c lib \l{#TEMPLATE}{template} is specified. + + \section1 VER_PAT + + Specifies the patch version number of the library if the + \c lib \l{#TEMPLATE}{template} is specified. + + \section1 VPATH + + Tells qmake where to search for files it cannot open. For example, if qmake + looks for \c SOURCES and finds an entry that it cannot open, it looks + through the entire VPATH list to see if it can find the file on its own. + + See also \l{#DEPENDPATH}{DEPENDPATH}. + + \target YACCSOURCES + \section1 YACCSOURCES + + Specifies a list of Yacc source files to be included + in the project. All dependencies, headers and source files will + automatically be included in the project. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 58 + + \section1 _PRO_FILE_ + + Contains the path to the project file in use. + + For example, the following line causes the location of the project + file to be written to the console: + + \snippet snippets/qmake/project_location.pro project file + + \note Do not attempt to overwrite the value of this variable. + + \section1 _PRO_FILE_PWD_ + + Contains the path to the directory containing the project file in use. + + For example, the following line causes the location of the directory + containing the project file to be written to the console: + + \snippet snippets/qmake/project_location.pro project file directory + + \note Do not attempt to overwrite the value of this variable. +*/ + +/*! + \page qmake-function-reference.html + \title Replace Functions + \contentspage {qmake Manual}{Contents} + \previouspage Variables + \nextpage Test Functions + + qmake provides functions for processing the contents of variables + during the configuration process. These functions are called + \e {replace functions}. Typically, they return values that you can + assign to other variables. You can obtain these values by prefixing a + function with the \c $$ operator. Replace functions can be divided into + built-in functions and function libraries. + + See also \l{Test Functions}. + + \section1 Built-in Replace Functions + + Basic replace functions are implemented as built-in functions. + + \section2 absolute_path(path[, base]) + + Returns the absolute path of \c path. + + If \c base is not specified, uses the current directory as the base + directory. + + For example, the following call returns the string + \c {"/home/johndoe/myproject/readme.txt"}: + + \snippet snippets/code/doc_src_qmake-manual.pro 159 + + See also \l{clean_path(path)}{clean_path()}, + \l{relative_path(filePath[, base])}{relative_path()}. + + \section2 basename(variablename) + + Returns the basename of the file specified in \c variablename. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 59 + + \section2 cat(filename[, mode]) + + Returns the contents of \c filename. You can specify the following options + for \c mode: + + \list + \li \c blob returns the entire contents of the file as one value + \li \c lines returns each line as a separate value (without line + endings) + \li \c true (default value) and \c false return file contents as + separate values, split according to qmake value list splitting rules + (as in variable assignments). If \c mode is \c false, values that + contain only a newline character are inserted into the list to + indicate where line breaks were in the file. + \endlist + + \section2 clean_path(path) + + Returns \c path with directory separators normalized (converted to "/") and + redundant ones removed, and "."s and ".."s resolved (as far as possible). + This function is a wrapper around QDir::cleanPath. + + See also \l{absolute_path(path[, base])}{absolute_path()}, + \l{relative_path(filePath[, base])}{relative_path()}, + \l{shell_path(path)}{shell_path()}, \l{system_path(path)}{system_path()}. + + \section2 dirname(file) + + Returns the directory name part of the specified file. For example: + + \snippet snippets/qmake/dirname.pro 0 + + \section2 enumerate_vars + + Returns a list of all defined variable names. + + \section2 escape_expand(arg1 [, arg2 ..., argn]) + + Accepts an arbitrary number of arguments. It expands the + escape sequences \c {\n}, \c {\r}, \c {\t} for each argument and returns + the arguments as a list. + + \note If you specify the string to expand literally, you need to escape the + backslashes, as illustrated by the following code snippet: + + \snippet snippets/code/doc_src_qmake-manual.pro 173 + + \target findfunction + \section2 find(variablename, substr) + + Returns all the values in \c variablename that match the regular expression + \c substr. + + \snippet snippets/code/doc_src_qmake-manual.pro 64 + + MY_VAR2 will contain '-Lone -Ltwo -Lthree -Lfour -Lfive', and MY_VAR3 will + contain 'three two three'. + + \section2 first(variablename) + + Returns the first value of \c variablename. + + For example, the following call returns \c firstname: + + \snippet snippets/code/doc_src_qmake-manual.pro 161 + + See also \l{last(variablename)}{last()}. + + \section2 format_number(number[, options...]) + + Returns \c number in the format specified by \c options. You can specify the + following options: + + \list + \li \c ibase=n sets the base of the input to \c n + \li \c obase=n sets the base of the output to \c n + \li \c width=n sets the minimum width of the output to \c n. If the + output is shorter than \c width, it is padded with spaces + \li \c zeropad pads the output with zeroes instead of spaces + \li \c padsign prepends a space to positive values in the output + \li \c alwayssign prepends a plus sign to positive values in the output + \li \c leftalign places the padding to the right of the value in the + output + \endlist + + Floating-point numbers are currently not supported. + + For example, the following call converts the hexadecimal number \c BAD to + \c 002989: + + \snippet snippets/code/doc_src_qmake-manual.pro 163 + + \section2 fromfile(filename, variablename) + + Evaluates \c filename as a qmake project file and returns the value assigned + to \c variablename. + + See also \l{infile(filename, var, val)}{infile()}. + + \section2 join(variablename, glue, before, after) + + Joins the value of \c variablename with \c glue. If this value is + not empty, this function prefixes the value with \c before and suffixes it + with \c after. \c variablename is the only required field, the others default + to empty strings. If you need to encode spaces in \c glue, \c before, or \c + after, you must quote them. + + \section2 last(variablename) + + Returns the last value of \c variablename. + + For example, the following call returns \c phone: + + \snippet snippets/code/doc_src_qmake-manual.pro 162 + + See also \l{first(variablename)}{first()}. + + \section2 list(arg1 [, arg2 ..., argn]) + + Takes an arbitrary number of arguments. It creates a uniquely + named variable that contains a list of the arguments, and returns the name + of that variable. You can use the variable to write a loop as illustrated by + the following code snippet + + \snippet snippets/code/doc_src_qmake-manual.pro 170 + + instead of: + + \snippet snippets/code/doc_src_qmake-manual.pro 171 + + \section2 lower(arg1 [, arg2 ..., argn]) + + Takes an arbitrary number of arguments and converts them to lower case. + + See also \l{upper(arg1 [, arg2 ..., argn])}{upper()}. + + \section2 member(variablename, position) + + Returns the value at the given \c position in the list of items in + \c variablename. + If an item cannot be found at the position specified, an empty string is + returned. \c variablename is the only required field. If not specified, + \c position defaults to 0, causing the first value in the list to be + returned. + + \section2 prompt(question) + + Displays the specified \c question, and returns a value read from stdin. + + \section2 quote(string) + + Converts a whole \c string into a single entity and returns the result. + This is just a fancy way of enclosing the string into double quotes. + + \section2 re_escape(string) + + Returns the \c string with every special regular expression character + escaped with a backslash. This function is a wrapper around QRegExp::escape. + + \section2 relative_path(filePath[, base]) + + Returns the path to \c filePath relative to \c base. If \c base is not + specified, it is the current project directory. This function is a wrapper + around QDir::relativeFilePath. + + See also \l{absolute_path(path[, base])}{absolute_path()}, + \l{clean_path(path)}{clean_path()}. + + \section2 replace(string, old_string, new_string) + + Replaces each instance of \c old_string with \c new_string in the + contents of the variable supplied as \c string. For example, the + code + + \snippet snippets/qmake/replace.pro 0 + + prints the message: + + \snippet snippets/code/doc_src_qmake-manual.pro 70 + + \section2 sprintf(string, arguments...) + + Replaces %1-%9 with the arguments passed in the comma-separated list + of function \c arguments and returns the processed string. + + \section2 resolve_depends(variablename, prefix) + + This is an internal function that you will typically not need. + + \section2 reverse(variablename) + + Returns the values of \c variablename in reverse order. + + \section2 section(variablename, separator, begin, end) + + Returns a section of the value of \c variablename. This function is a + wrapper around QString::section. + + For example, the following call outputs \c surname: + + \snippet snippets/code/doc_src_qmake-manual.pro 167 + + \section2 shadowed(path) + + Maps the path from the project source directory to the build directory. + This function returns \c path for in-source builds. It returns an empty + string if \c path points outside of the source tree. + + \section2 shell_path(path) + + Converts all directory separators within \c path to separators that are + compatible with the shell that is used while building the project (that is, + the shell that is invoked by the make tool). For example, slashes are + converted to backslashes when the Windows shell is used. + + See also \l{system_path(path)}{system_path()}. + + \section2 shell_quote(arg) + + Quotes \c arg for the shell that is used while building the project. + + See also \l{system_quote(arg)}{system_quote()}. + + \section2 size(variablename) + + Returns the number of values of \c variablename. + + \section2 sort_depends(variablename, prefix) + + This is an internal function that you will typically not need. + + \section2 split(variablename, separator) + + Splits the value of \c variablename into separate values, and returns them + as a list. This function is a wrapper around QString::split. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 168 + + \section2 system(command[, mode]) + + You can use this variant of the \c system function to obtain stdout from the + command and assign it to a variable. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 72 + + See also the test variant of \l{system(command)}{system()}. + + \section2 system_path(path) + + Converts all directory separators within \c path to separators that are + compatible with the shell that is used by the \c{system()} functions to + invoke commands. For example, slashes are converted to backslashes for the + Windows shell. + + See also \l{shell_path(path)}{shell_path()}. + + \section2 system_quote(arg) + + Quotes \c arg for the for the shell that is used by the \c{system()} + functions. + + See also \l{shell_quote(arg)}{shell_quote()}. + + \target unique + \section2 unique(variablename) + + Returns the list of values in \c variablename with duplicate entries removed. + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 73 + + \section2 upper(arg1 [, arg2 ..., argn]) + + Takes an arbitrary number of arguments and converts them to upper case. + + See also \l{lower(arg1 [, arg2 ..., argn])}{lower()}. + + \section2 val_escape(variablename) + + Escapes the values of \c variablename in a way that enables parsing them as + qmake code. +*/ + +/*! + \page qmake-test-function-reference.html + \title Test Functions + \contentspage {qmake Manual}{Contents} + \previouspage Replace Functions + + Test functions return a boolean value that you can test for in the + conditional parts of scopes. Test functions can be divided into + built-in functions and function libraries. + + See also \l{Replace Functions}. + + \section1 Built-in Test Functions + + Basic test functions are implemented as built-in functions. + + \section2 cache(variablename, [set|add|sub] [transient] [super], [source variablename]) + + This is an internal function that you will typically not need. + + \section2 CONFIG(config) + + This function can be used to test for variables placed into the + \l{CONFIG} variable. This is the same as scopes, + but has the added advantage that a second parameter can be passed to test for + the active config. As the order of values is important in \c CONFIG + variables (that is, the last one set will be considered the active config for + mutually exclusive values) a second parameter can be used to specify a set + of values to consider. For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 60 + + Because release is considered the active setting (for feature parsing) + it will be the CONFIG used to generate the build file. In the common + case a second parameter is not needed, but for specific mutual + exclusive tests it is invaluable. + + \section2 contains(variablename, value) + + Succeeds if the variable \c variablename contains the value \c value; + otherwise fails. It is possible to specify a regular expression for + parameter \e value. + + You can check the return value of this function using a scope. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 61 + + The contents of the scope are only processed if the \c drivers + variable contains the value \c network. If this is the case, the + appropriate files are added to the \l{SOURCES} and \l{HEADERS} + variables. + + \target countfunction + \section2 count(variablename, number) + + Succeeds if the variable \c variablename contains a list with the + specified \c number of values; otherwise fails. + + This function is used to ensure that declarations inside a scope are + only processed if the variable contains the correct number of values. + For example: + + \snippet snippets/qmake/functions.pro 2 + + \section2 debug(level, message) + + Checks whether qmake runs at the specified debug level. If yes, it returns + true and prints a debug message. + + \section2 defined(name[, type]) + + Tests whether the function or variable \c name is defined. If \c type is + omitted, checks all functions. To check only variables or particular type of + functions, specify \c type. It can have the following values: + + \list + \li \c test only checks test functions + \li \c replace only checks replace functions + \li \c var only checks variables + \endlist + + \section2 equals(variablename, value) + + Tests whether \c variablename equals the string \c value. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 160 + + \section2 error(string) + + This function never returns a value. qmake displays \c string as an error + message to the user and exits. This function should only be used for + unrecoverable errors. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 62 + + \section2 eval(string) + + Evaluates the contents of the string using + qmake syntax rules and returns true. + Definitions and assignments can be used in the string to modify the + values of existing variables or create new definitions. + + For example: + \snippet snippets/qmake/functions.pro 4 + + \note Quotation marks can be used to delimit the string, and + the return value can be discarded if it is not needed. + + \section2 exists(filename) + + Tests whether a file with the given \c filename exists. + If the file exists, the function succeeds; otherwise it fails. + If a regular expression is specified for the filename, this function + succeeds if any file matches the regular expression specified. + + For example: + \snippet snippets/code/doc_src_qmake-manual.pro 63 + + \note "/" should be used as a directory separator, regardless of the + platform in use. + + \section2 export(variablename) + + Exports the current value of \c variablename from the local context of a + function to the global context. + + \section2 files(pattern[, recursive=false]) + + Expands the specified wildcard pattern and returns a list of filenames. + If \c recursive is true, this function descends into subdirectories. + + \target forfunction + \section2 for(iterate, list) + + Starts a loop that iterates over all values in \c list, setting \c iterate to each + value in turn. As a convenience, if \c list is 1..10 then iterate will + iterate over the values 1 through 10. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 65 + + \section2 greaterThan(variablename, value) + + Tests that the value of \c variablename is greater than \c value. First, + this function attempts a numerical comparison. If at least one of the + operands fails to convert, this function does a string comparison. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 164 + + It is impossible to compare two numbers as strings directly. As a + workaround, construct temporary values with a non-numeric prefix and compare + these. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 172 + + See also \l{lessThan(variablename, value)}{lessThan()}. + + \section2 if(condition) + + Evaluates \c condition. It is used to group boolean expressions. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 166 + + \section2 include(filename) + + Includes the contents of the file specified by \c filename into the + current project at the point where it is included. This function + succeeds if \c filename is included; otherwise it fails. The included + file is processed immediately. + + You can check whether the file was included by using this function as + the condition for a scope. For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 66 + + \section2 infile(filename, var, val) + + Succeeds if the file \c filename (when parsed by qmake itself) contains the + variable \c var with a value of \c val; otherwise fails. If you do not + specify \c val, the function tests whether \c var has been assigned in + the file. + + \section2 isActiveConfig + + This is an alias for the \c CONFIG function. + + \section2 isEmpty(variablename) + + Succeeds if the variable \c variablename is empty; otherwise fails. + This is the equivalent of \c{count( variablename, 0 )}. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 67 + + \section2 isEqual + + This is an alias for the \c equals function. + + \section2 lessThan(variablename, value) + + Tests that the value of \c variablename is less than \c value. Works as + \l{greaterThan(variablename, value)}{greaterThan()}. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 165 + + \section2 load(feature) + + Loads the feature file (\c .prf) specified by \c feature, + unless the feature has already been loaded. + + \section2 log(message) + + Prints a message on the console. Unlike the \c message function, neither + prepends text nor appends a line break. + + See also \l{message(string)}{message()}. + + \section2 message(string) + + Always succeeds, and displays \c string as a general message to the user. + Unlike the \c error() function, this function allows processing to continue. + + \snippet snippets/code/doc_src_qmake-manual.pro 68 + + The above line causes "This is a message" to be written to the console. + The use of quotation marks is optional, but recommended. + + \note By default, messages are written out for each Makefile generated by + qmake for a given project. If you want to ensure that messages only appear + once for each project, test the \c build_pass variable + \l{Scopes}{in conjunction with a scope} to filter out + messages during builds. For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 69 + + \section2 mkpath(dirPath) + + Creates the directory path \c dirPath. This function is a wrapper around the + QDir::makepath function. + + \section2 requires(condition) + + Evaluates \c condition. If the condition is false, qmake skips this + project (and its \l{SUBDIRS}) when building. + + \note You can also use the \l{REQUIRES} variable for this purpose. However, we + recommend using this function, instead. + + \section2 system(command) + + Executes the given \c command in a secondary shell. Succeeds + if the command returns with a zero exit status; otherwise fails. + You can check the return value of this function using a scope. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 71 + + See also the replace variant of \l{system(command[, mode])}{system()}. + + \target touchfunction + \section2 touch(filename, reference_filename) + + Updates the time stamp of \c filename to match the time stamp of + \c reference_filename. + + \section2 unset(variablename) + + Removes \c variablename from the current context. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 169 + + \section2 warning(string) + + Always succeeds, and displays \c string as a warning message to the user. + + \section2 write_file(filename, [variablename, [mode]]) + + Writes the values of \c variablename to a file with the name \c filename, + each value on a separate line. If \c variablename is not specified, creates + an empty file. If \c mode is \c append and the file already exists, appends + to it instead of replacing it. + + \section1 Test Function Library + + Complex test functions are implemented in a library of .prf files. + + \section2 packagesExist(packages) + + Uses the PKGCONFIG mechanism to determine whether or not the given packages + exist at the time of project parsing. + + This can be useful to optionally enable or disable features. For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 157 + + And then, in the code: + + \snippet snippets/code/doc_src_qmake-manual.pro 158 +*/ + +/*! + \page qmake-environment-reference.html + \contentspage {qmake Manual}{Contents} + \previouspage Using Precompiled Headers + \nextpage Reference + + \title Configuring qmake + + \section1 Properties + + qmake has a system for persistent configuration, which allows you to set a + property in qmake once, and query it each time qmake is invoked. You can set + a property in qmake as follows: + + \snippet snippets/code/doc_src_qmake-manual.pro 74 + + The appropriate property and value should be substituted for + \c PROPERTY and \c VALUE. + + You can retrieve this information back from qmake as follows: + + \snippet snippets/code/doc_src_qmake-manual.pro 75 + + \note \c{qmake -query} lists built-in properties in addition to the + properties that you set with \c{qmake -set PROPERTY VALUE}. + + This information will be saved into a QSettings object (meaning it + will be stored in different places for different platforms). + + The following list summarizes the \c built-in properties: + + \list + \li QMAKE_SPEC - the shortname of the host \c mkspec that is resolved + and stored in the \l{QMAKESPEC} variable during a host build + \li QMAKE_VERSION - the current version of qmake + \li QMAKE_XSPEC - the shortname of the target \c mkspec that is resolved + and stored in the \l{QMAKESPEC} variable during a target build + \li QT_HOST_BINS - location of host executables + \li QT_HOST_DATA - location of data for host executables used by qmake + \li QT_HOST_PREFIX - default prefix for all host paths + \li QT_INSTALL_ARCHDATA - location of general architecture-dependent Qt + data + \li QT_INSTALL_BINS - location of Qt binaries (tools and applications) + \li QT_INSTALL_CONFIGURATION - location for Qt settings. Not applicable + on Windows + \li QT_INSTALL_DATA - location of general architecture-independent Qt + data + \li QT_INSTALL_DOCS - location of documentation + \li QT_INSTALL_EXAMPLES - location of examples + \li QT_INSTALL_HEADERS - location for all header files + \li QT_INSTALL_IMPORTS - location of QML 1.x extensions + \li QT_INSTALL_LIBEXECS - location of executables required by libraries at runtime + \li QT_INSTALL_LIBS - location of libraries + \li QT_INSTALL_PLUGINS - location of Qt plugins + \li QT_INSTALL_PREFIX - default prefix for all paths + \li QT_INSTALL_QML - location of QML 2.x extensions + \li QT_INSTALL_TESTS - location of Qt test cases + \li QT_INSTALL_TRANSLATIONS - location of translation information for + Qt strings + \li QT_SYSROOT - the sysroot used by the target build environment + \li QT_VERSION - the Qt version. We recommend that you query Qt module specific + version numbers by using $$QT.<module>.version variables instead. + \endlist + + For example, you can query the installation of Qt for this version of qmake with the + \c QT_INSTALL_PREFIX property: + + \snippet snippets/code/doc_src_qmake-manual.pro 77 + + You can query the values of properties in a project file as follows: + + \snippet snippets/code/doc_src_qmake-manual.pro 78 + + \target QMAKESPEC + \section1 QMAKESPEC + + qmake requires a platform and compiler + description file which contains many default values used to generate + appropriate Makefiles. The standard Qt distribution comes with many of + these files, located in the \c mkspecs subdirectory of the Qt installation. + + The \c QMAKESPEC environment variable can contain any of the following: + + \list + \li A complete path to a directory containing a \c{qmake.conf} file. + In this case qmake will open the + \c{qmake.conf} file from within that directory. If the file does not + exist, qmake will exit with an error. + \li The name of a platform-compiler combination. In this case, + qmake will search in the directory specified + by the \c mkspecs subdirectory of the data path specified when Qt was + compiled (see QLibraryInfo::DataPath). + \endlist + + \note The \c QMAKESPEC path will automatically be added to the + \l{INCLUDEPATH} system variable. + + \target cache + \section1 Cache File + + The cache file is a special file qmake reads to + find settings not specified in the \c qmake.conf file, project files, or + at the command line. When qmake is run, it looks for a file called + \c{.qmake.cache} in parent directories of the current directory, unless you + specify \c -nocache. If qmake + fails to find this file, it will silently ignore this step of processing. + + If qmake finds a \c{.qmake.cache} file then it will process this file first before + it processes the project file. + + \target Extensions + \section1 File Extensions + + Under normal circumstances qmake will try to + use appropriate file extensions for your platform. However, it is + sometimes necessary to override the default choices for each platform and + explicitly define file extensions for qmake to + use. This is achieved by redefining certain built-in variables. For + example, the extension used for \l moc files can be redefined with the + following assignment in a project file: + + \snippet snippets/code/doc_src_qmake-manual.pro 85 + + The following variables can be used to redefine common file extensions recognized + by qmake: + + \list + \li \l{QMAKE_EXT_MOC} modifies the extension placed on included moc files. + \li \l{QMAKE_EXT_UI} modifies the extension used for \QD UI files + (usually in \l{FORMS}). + \li \l{QMAKE_EXT_PRL} modifies the extension placed on + \l{#LibDepend}{library dependency files}. + \li \l{QMAKE_EXT_LEX} changes the suffix used in Lex files (usually in + \l{LEXSOURCES}). + \li \l{QMAKE_EXT_YACC} changes the suffix used in Yacc files (usually in + \l{YACCSOURCES}). + \li \l{QMAKE_EXT_OBJ} changes the suffix used on generated object files. + \endlist + + All of the above accept just the first value, so you must assign to it just one + value that will be used throughout your project file. There are two variables that + accept a list of values: + + \list + \li \l{QMAKE_EXT_CPP} causes qmake to interpret + all files with these suffixes as C++ source files. + \li \l{QMAKE_EXT_H} causes qmake to interpret + all files with these suffixes as C and C++ header files. + \endlist +*/ + +/*! + \page qmake-language.html + \title qmake Language + \contentspage {qmake Manual}{Contents} + \previouspage Platform Notes + \nextpage Advanced Usage + + Many qmake project files simply describe the + sources and header files used by the project, using a list of + \c{name = value} and \c{name += value} definitions. + qmake also provides other operators, functions, + and scopes that can be used to process the information supplied in + variable declarations. These advanced features allow Makefiles to be + generated for multiple platforms from a single project file. + + \section1 Operators + + In many project files, the assignment (\c{=}) and append (\c{+=}) operators can + be used to include all the information about a project. The typical pattern of + use is to assign a list of values to a variable, and append more values + depending on the result of various tests. Since + qmake defines certain variables using default + values, it is sometimes necessary to use the removal (\c{-=}) operator to + filter out values that are not required. The following sections describe how + to use operators to manipulate the contents of variables. + + \section2 Assigning Values + + The \c = operator assigns a value to a variable: + + \snippet snippets/code/doc_src_qmake-manual.pro 89 + + The above line sets the \l{TARGET} variable to \c myapp. This will overwrite any + values previously set for \c TARGET with \c myapp. + + \section2 Appending Values + + The \c += operator appends a new value to the list of values in a variable: + + \snippet snippets/code/doc_src_qmake-manual.pro 90 + + The above line appends \c USE_MY_STUFF to the list of pre-processor defines to be put + in the generated Makefile. + + \section2 Removing Values + + The \c -= operator removes a value from the list of values in a variable: + + \snippet snippets/code/doc_src_qmake-manual.pro 91 + + The above line removes \c USE_MY_STUFF from the list of pre-processor defines to be + put in the generated Makefile. + + \section2 Adding Unique Values + + The \c *= operator adds a value to the list of values in a variable, but only + if it is not already present. This prevents values from being included many + times in a variable. For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 92 + + In the above line, \c USE_MY_STUFF will only be added to the list of pre-processor + defines if it is not already defined. Note that the \l{unique}{unique()} + function can also be used to ensure that a variable only contains one + instance of each value. + + \section2 Replacing Values + + The \c ~= operator replaces any values that match a regular expression with + the specified value: + + \snippet snippets/code/doc_src_qmake-manual.pro 93 + + In the above line, any values in the list that start with \c QT_D or \c QT_T are + replaced with \c QT. + + \section2 Variable Expansion + + The \c $$ operator is used to extract the contents of a variable, and can be + used to pass values between variables or supply them to functions: + + \snippet snippets/code/doc_src_qmake-manual.pro 94 + + Variables can be used to store the contents of environment variables. + These can be evaluated at the time when qmake + is run, or included in the generated Makefile for evaluation when the + project is built. + + To obtain the contents of an environment value when + qmake is run, use the \c $$(...) operator: + + \snippet snippets/qmake/environment.pro 0 + + In the above assignment, the value of the \c PWD environment variable + is read when the project file is processed. + + To obtain the contents of an environment value at the time when the + generated Makefile is processed, use the \c $(...) operator: + + \snippet snippets/qmake/environment.pro 1 + + In the above assignment, the value of \c PWD is read immediately + when the project file is processed, but \c $(PWD) is assigned to + \c DESTDIR in the generated Makefile. This makes the build process + more flexible as long as the environment variable is set correctly + when the Makefile is processed. + + \section2 Accessing qmake Properties + + The special \c $$[...] operator can be used to access qmake properties: + + \snippet snippets/qmake/qtconfiguration.pro 0 + + For more information, see \l{Configuring qmake}. + + The properties accessible with this operator are typically used to + enable third party plugins and components to be integrated in Qt. + For example, a \QD plugin can be installed alongside \QD's built-in + plugins if the following declaration is made in its project file: + + \snippet snippets/code/doc_src_qmake-manual.pro 101 + + \target Scopes + \section1 Scopes + + Scopes are similar to \c if statements in procedural programming languages. + If a certain condition is true, the declarations inside the scope are processed. + + \section2 Scope Syntax + + Scopes consist of a condition followed by an opening brace on the same line, + a sequence of commands and definitions, and a closing brace on a new line: + + \snippet snippets/qmake/scopes.pro syntax + + The opening brace \e{must be written on the same line as the condition}. + Scopes may be concatenated to include more than one condition, as described + in the following sections. + + \section2 Scopes and Conditions + + A scope is written as a condition followed by a series of declarations + contained within a pair of braces. For example: + + \snippet snippets/qmake/scopes.pro 0 + + The above code will add the \c paintwidget_win.cpp file to the sources listed + in the generated Makefile when building for a Windows platform. When + building for other platforms, the define will be ignored. + + The conditions used in a given scope can also be negated to provide an + alternative set of declarations that will be processed only if the + original condition is false. For example, to process something when building + for all platforms \e except Windows, negate the scope like this: + + \snippet snippets/qmake/scopes.pro 1 + + Scopes can be nested to combine more than one condition. For instance, to + include a particular file for a certain platform only if + debugging is enabled, write the following: + + \snippet snippets/qmake/scopes.pro 2 + + To save writing many nested scopes, you can nest scopes using the \c : + operator. The nested scopes in the above example can be rewritten in + the following way: + + \snippet snippets/qmake/scopes.pro 3 + + You may also use the \c : operator to perform single line conditional + assignments. For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 95 + + The above line adds \c USE_MY_STUFF to the \l{DEFINES} variable only when + building for the Windows platform. + Generally, the \c : operator behaves like a logical AND operator, joining + together a number of conditions, and requiring all of them to be true. + + There is also the \c | operator to act like a logical OR operator, joining + together a number of conditions, and requiring only one of them to be true. + + \snippet snippets/qmake/scopes.pro 4 + + You can also provide alternative declarations to those within a scope by + using an \c else scope. Each \c else scope is processed if the conditions + for the preceding scopes are false. + This allows you to write complex tests when combined with other scopes + (separated by the \c : operator as above). For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 96 + + \section2 Configuration and Scopes + + The values stored in the \l{CONFIG} variable are + treated specially by qmake. Each of the possible + values can be used as the condition for a scope. For example, the list of + values held by \c CONFIG can be extended with the \c opengl value: + + \snippet snippets/qmake/configscopes.pro 0 + + As a result of this operation, any scopes that test for \c opengl will + be processed. We can use this feature to give the final executable an + appropriate name: + + \snippet snippets/qmake/configscopes.pro 1 + \snippet snippets/qmake/configscopes.pro 2 + \snippet snippets/qmake/configscopes.pro 3 + + This feature makes it easy to change the configuration for a project + without losing all the custom settings that might be needed for a specific + configuration. In the above code, the declarations in the first scope are + processed, and the final executable will be called \c application-gl. + However, if \c opengl is not specified, the declarations in the second + scope are processed instead, and the final executable will be called + \c application. + + Since it is possible to put your own values on the \c CONFIG + line, this provides you with a convenient way to customize project files + and fine-tune the generated Makefiles. + + \section2 Platform Scope Values + + In addition to the \c win32, \c macx, and \c unix values used in many + scope conditions, various other built-in platform and compiler-specific + values can be tested with scopes. These are based on platform + specifications provided in Qt's \c mkspecs directory. For example, the + following lines from a project file show the current specification in + use and test for the \c linux-g++ specification: + + \snippet snippets/qmake/specifications.pro 0 + + You can test for any other platform-compiler combination as long as a + specification exists for it in the \c mkspecs directory. + + \target UsingVariables + \section1 Variables + + Many of the variables used in project files are special variables that + qmake uses when generating Makefiles, such as \l{DEFINES}, \l{SOURCES}, and + \l{HEADERS}. In addition, you can create variables for your own use. qmake + creates new + variables with a given name when it encounters an assignment to that name. + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 97 + + There are no restricitions on what you do to your own variables, as + qmake will ignore them unless it needs to evaluate them when processing + a scope. + + You can also assign the value of a current variable to another + variable by prefixing $$ to the variable name. For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 98 + + Now the MY_DEFINES variable contains what is in the DEFINES variable at + this point in the project file. This is also equivalent to: + + \snippet snippets/code/doc_src_qmake-manual.pro 99 + + The second notation allows you to append the contents of the variable to + another value without separating the two with a space. For example, the + following will ensure that the final executable will be given a name + that includes the project template being used: + + \snippet snippets/code/doc_src_qmake-manual.pro 100 + + \target UsingReplaceFunctions + \section1 Replace Functions + + qmake provides a selection of built-in + functions to allow the contents of variables to be processed. These + functions process the arguments supplied to them and return a value, or + list of values, as a result. To assign a result to a variable, use the \c $$ + operator with this type of function as you would to assign contents of one + variable to another: + + \snippet snippets/qmake/functions.pro 1 + + This type of function should be used on the right-hand side of + assignments (that is, as an operand). + + You can define your own functions for processing the contents of variables + as follows: + + \snippet snippets/code/doc_src_qmake-manual.pro 102 + + The following example function takes a variable name as its only + argument, extracts a list of values from the variable with the + \l{eval(string)}{eval()} built-in function, and compiles a list of files: + + \snippet snippets/qmake/replacefunction.pro 0 + + \target UsingTestFunctions + \section1 Test Functions + + qmake provides built-in functions that can be + used as conditions when writing scopes. These functions do not return a + value, but instead indicate \e success or \e failure: + + \snippet snippets/qmake/functions.pro 3 + + This type of function should be used in conditional expressions + only. + + It is possible to define your own functions to provide conditions + for scopes. The following example tests whether each file in a list + exists and returns true if they all exist, or false if not: + + \snippet snippets/qmake/testfunction.pro 0 +*/ + +/*! + \page qmake-advanced-usage.html + \title Advanced Usage + \contentspage {qmake Manual}{Contents} + \previouspage qmake Language + \nextpage Using Precompiled Headers + + \section1 Adding New Configuration Features + + qmake lets you create your own \c features that + can be included in project files by adding their names to the list of + values specified by the \l{CONFIG} variable. Features are collections of + custom functions and definitions in \c{.prf} files that can reside in one + of many standard directories. The locations of these directories are + defined in a number of places, and qmake checks + each of them in the following order when it looks for \c{.prf} files: + + \omit + TODO: Fix the list, as it is incomplete and partly incorrect. + \endomit + + \list 1 + \li In a directory listed in the \c QMAKEFEATURES environment variable that + contains a colon-separated list of directories. + \li In a directory listed in the \c QMAKEFEATURES property variable that + contains a colon-spearated list of directories. + \omit + \li In a features directory beneath the project's root directory (where + the \c{.qmake.cache} file is generated). + \endomit + \li In a features directory residing within a \c mkspecs directory. + \c mkspecs directories can be located beneath any of the directories + listed in the \c QMAKEPATH environment variable that contains a + colon-separated list of directories. For example: + \c{$QMAKEPATH/mkspecs/<features>}. + \li In a features directory residing beneath the directory provided by the + \l{QMAKESPEC} environment variable. For example: \c{$QMAKESPEC/<features>}. + \li In a features directory residing in the \c data_install/mkspecs directory. + For example: \c{data_install/mkspecs/<features>}. + \li In a features directory that exists as a sibling of the directory + specified by the \c QMAKESPEC environment variable. + For example: \c{$QMAKESPEC/../<features>}. + \endlist + + The following features directories are searched for features files: + + \list 1 + \li \c{features/unix}, \c{features/win32}, or \c{features/macx}, depending on + the platform in use + \li \c features/ + \endlist + + For example, consider the following assignment in a project file: + + \snippet snippets/code/doc_src_qmake-manual.pro 103 + + With this addition to the \c CONFIG variable, + qmake will search the locations listed above for + the \c myfeatures.prf file after it has finished parsing your project file. + On Unix systems, it will look for the following file: + + \list 1 + \li \c $QMAKEFEATURES/myfeatures.prf (for each directory listed in the + \c QMAKEFEATURES environment variable) + \li \c $$QMAKEFEATURES/myfeatures.prf (for each directory listed in the + \c QMAKEFEATURES property variable) + \li \c myfeatures.prf (in the project's root directory) + \li \c $QMAKEPATH/mkspecs/features/unix/myfeatures.prf and + \c $QMAKEPATH/mkspecs/features/myfeatures.prf (for each directory + listed in the \c QMAKEPATH environment variable) + \li \c $QMAKESPEC/features/unix/myfeatures.prf and + \c $QMAKESPEC/features/myfeatures.prf + \li \c data_install/mkspecs/features/unix/myfeatures.prf and + \c data_install/mkspecs/features/myfeatures.prf + \li \c $QMAKESPEC/../features/unix/myfeatures.prf and + \c $QMAKESPEC/../features/myfeatures.prf + \endlist + + \note The \c{.prf} files must have names in lower case. + + \section1 Installing Files + + It is common on Unix to also use the build tool to install applications + and libraries; for example, by invoking \c{make install}. For this reason, + qmake has the concept of an \c {install set}, an + object which contains instructions about the way a part of a project is to + be installed. For example, a collection of documentation files can be + described in the following way: + + \snippet snippets/code/doc_src_qmake-manual.pro 79 + + The \c path member informs qmake that the files + should be installed in \c /usr/local/program/doc (the path member), and the + \c files member specifies the files that should be copied to the + installation directory. In this case, everything in the \c docs directory + will be copied to \c /usr/local/program/doc. + + Once an install set has been fully described, you can append it to the + install list with a line like this: + + \snippet snippets/code/doc_src_qmake-manual.pro 80 + + qmake will ensure that the specified files are + copied to the installation directory. If you require more control over + this process, you can also provide a definition for the \c extra member of + the object. For example, the following line tells + qmake to execute a series of commands for this + install set: + + \snippet snippets/code/doc_src_qmake-manual.pro 81 + + The \c unix \l{Scopes and Conditions}{scope} + ensures that these particular commands are only executed on Unix platforms. + Appropriate commands for other platforms can be defined using other scope + rules. + + Commands specified in the \c extra member are executed before the instructions + in the other members of the object are performed. + + If you append a built-in install set to the \c INSTALLS variable and do + not specify \c files or \c extra members, qmake + will decide what needs to be copied for you. Currently, the \c target and \c dlltarget + install sets are supported. For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 82 + + In the above lines, qmake knows what needs to + be copied, and will handle the installation process automatically. + + \section1 Adding Custom Targets + + qmake tries to do everything expected of a + cross-platform build tool. This is often less than ideal when you really + need to run special platform-dependent commands. This can be achieved with + specific instructions to the different qmake backends. + + Customization of the Makefile output is performed through an object-style + API as found in other places in qmake. Objects are defined automatically by + specifying their \e members. For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 86 + + The definitions above define a qmake target called \c mytarget, containing a + Makefile target called \c{.buildfile} which in turn is generated with the + \l{touchfunction}{touch()} function. Finally, the + \c{.depends} member specifies that \c mytarget depends on \c mytarget2, + another target that is defined afterwards. \c mytarget2 is a dummy target. + It is only defined to echo some text to the console. + + The final step is to use the \c QMAKE_EXTRA_TARGETS variable to instruct + qmake that this object is a target to be built: + + \snippet snippets/code/doc_src_qmake-manual.pro 87 + + This is all you need to do to actually build custom targets. Of course, + you may want to tie one of these targets to the + \l{TARGET}{qmake build target}. To do this, you + simply need to include your Makefile target in the list of + \l{PRE_TARGETDEPS}. + + Custom target specifications support the following members: + + \table + \header + \li Member + \li Description + \row + \li commands + \li The commands for generating the custom build target. + \row + \li CONFIG + \li Specific configuration options for the custom build target. Can be + set to \c recursive to indicate that rules should be created in the + Makefile to call the relevant target inside the sub-target specific + Makefile. This member defaults to creating an entry for each of the + sub-targets. + \row + \li depends + \li The existing build targets that the custom build target depends on. + \row + \li recurse + \li Specifies which sub-targets should be used when creating the rules + in the Makefile to call in the sub-target specific Makefile. This + member is used only when \c recursive is set in \c CONFIG. Typical + values are "Debug" and "Release". + \row + \li recurse_target + \li Specifies the target that should be built via the sub-target + Makefile for the rule in the Makefile. This member adds something + like \c {$(MAKE) -f Makefile.[subtarget] [recurse_target]}. This + member is used only when \c recursive is set in \c CONFIG. + \row + \li target + \li The name of the custom build target. + \endtable + + \section1 Adding Compilers + + It is possible to customize qmake to support new compilers and + preprocessors: + + \snippet snippets/code/doc_src_qmake-manual.pro 88 + + With the above definitions, you can use a drop-in replacement for moc if one + is available. The command is executed on all arguments given to the + \c NEW_HEADERS variable (from the \c input member), and the result is written + to the file defined by the \c output member. This file is added to the + other source files in the project. Additionally, qmake will execute + \c depend_command to generate dependency information, and place this + information in the project as well. + + Custom compiler specifications support the following members: + + \table + \header + \li Member + \li Description + \row + \li commands + \li The commands used for for generating the output from the input. + \row + \li CONFIG + \li Specific configuration options for the custom compiler. See the + CONFIG table for details. + \row + \li depend_command + \li Specifies a command used to generate the list of dependencies for + the output. + \row + \li dependency_type + \li Specifies the type of file the output is. If it is a known type + (such as TYPE_C, TYPE_UI, TYPE_QRC), it is handled as one of those + type of files. + \row + \li depends + \li Specifies the dependencies of the output file. + \row + \li input + \li The variable that specifies the files that should be processed with + the custom compiler. + \row + \li name + \li A description of what the custom compiler is doing. This is only + used in some backends. + \row + \li output + \li The filename that is created from the custom compiler. + \row + \li output_function + \li Specifies a custom qmake function that is used to specify the + filename to be created. + \row + \li variables + \li Indicates that the variables specified here are replaced with + $(QMAKE_COMP_VARNAME) when referred to in the pro file as + $(VARNAME). + \row + \li variable_out + \li The variable that the files created from the output should be added + to. + \endtable + + The CONFIG member supports the following options: + + \table + \header + \li Option + \li Description + \row + \li combine + \li Indicates that all of the input files are combined into a single + output file. + \row + \li target_predeps + \li Indicates that the output should be added to the list of + \l{PRE_TARGETDEPS}. + \row + \li explicit_dependencies + \li The dependencies for the output only get generated from the depends + member and from nowhere else. + \row + \li no_link + \li Indicates that the output should not be added to the list of objects + to be linked in. + \endtable + + \target LibDepend + \section1 Library Dependencies + + Often when linking against a library, qmake + relies on the underlying platform to know what other libraries this + library links against, and lets the platform pull them in. In many cases, + however, this is not sufficient. For example, when statically linking a + library, no other libraries are linked to, and therefore no dependencies + to those libraries are created. However, an application that later links + against this library will need to know where to find the symbols that + the static library will require. qmake attempts to keep track of the + dependencies of a library, where appropriate, if you explicitly enable + tracking. + + The first step is to enable dependency tracking in the library itself. + To do this you must tell qmake to save information about the library: + + \snippet snippets/code/doc_src_qmake-manual.pro 83 + + This is only relevant to the \c lib template, and will be ignored for all + others. When this option is enabled, qmake will create a file ending in .prl + which will save some meta-information about the library. This metafile is + just like an ordinary project file, but only contains internal variable + declarations. When installing this library, by specifying it as a target in + an \l{INSTALLS} declaration, qmake will automatically copy the .prl file to + the installation path. + + The second step in this process is to enable reading of this meta + information in the applications that use the static library: + + \snippet snippets/code/doc_src_qmake-manual.pro 84 + + When this is enabled, qmake will process all + libraries linked to by the application and find their meta-information. + qmake will use this to determine the relevant + linking information, specifically adding values to the application project + file's list of \l{DEFINES} as well as \l{LIBS}. Once + qmake has processed this file, it will then + look through the newly introduced libraries in the \c LIBS variable, and + find their dependent .prl files, continuing until all libraries have been + resolved. At this point, the Makefile is created as usual, and the + libraries are linked explicitly against the application. + + The .prl files should be created by qmake only, and should not be + transferred between operating systems, as they may contain + platform-dependent information. +*/ + +/*! + \page qmake-precompiledheaders.html + \title Using Precompiled Headers + \contentspage {qmake Manual}{Contents} + \previouspage Advanced Usage + \nextpage Configuring qmake + + \target Introduction + + Precompiled headers (PCH) are a performance feature supported by some + compilers to compile a stable body of code, and store the compiled + state of the code in a binary file. During subsequent compilations, + the compiler will load the stored state, and continue compiling the + specified file. Each subsequent compilation is faster because the + stable code does not need to be recompiled. + + qmake supports the use of precompiled headers + on some platforms and build environments, including: + \list + \li Windows + \list + \li nmake + \li Visual Studio projects (VS 2008 and later) + \endlist + \li Mac OS X + \list + \li Makefile + \li Xcode + \endlist + \li Unix + \list + \li GCC 3.4 and above + \endlist + \endlist + + \target ADD_PCH + \section1 Adding Precompiled Headers to Your Project + + The precompiled header must contain code which is \e stable + and \e static throughout your project. A typical precompiled header might + look like this: + + \snippet snippets/code/doc_src_qmake-manual.cpp 104 + + \note A precompiled header file needs to separate C includes from + C++ includes, since the precompiled header file for C files may not + contain C++ code. + + \target PROJECT_OPTIONS + \section2 Project Options + + To make your project use precompiled headers, you only need to define the + \l{PRECOMPILED_HEADER} variable in your project file: + + \snippet snippets/code/doc_src_qmake-manual.pro 105 + + qmake will handle the rest, to ensure the + creation and use of the precompiled header file. You do not need to + include the precompiled header file in \c HEADERS, as + qmake will do this if the configuration supports precompiled headers. + + All platforms that support precompiled headers have the configuration + option \c precompile_header set. Using this option, you may trigger + conditional blocks in your project file to add settings when using + precompiled headers. + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 106 + + \section1 Notes on Possible Issues + + On some platforms, the file name suffix for precompiled header files is + the same as that for other object files. For example, the following + declarations may cause two different object files with the same name to + be generated: + + \snippet snippets/code/doc_src_qmake-manual.pro 107 + + To avoid potential conflicts like these, give distinctive names to header + files that will be precompiled. + + \target EXAMPLE_PROJECT + \section1 Example Project + + You can find the following source code in the + \c{examples/qmake/precompile} directory in the Qt distribution: + + \section2 \c mydialog.ui + + The following image displays the mydialog.ui file in Qt Creator Design mode. + You can view the code in the Edit mode. + + \image qmake-precompile-ui.png + + \section2 \c stable.h + + \snippet snippets/qmake/precompile-stable.h 0 + + \omit + ##Keeping the snippet in qtdoc is a workaround, because it contains code + that would tell qdoc to start a new page. Remove it and put the + following snippet back after modularizing the docs. + \snippet examples/qmake/precompile/stable.h 0 + \endomit + + \section2 \c myobject.h + + \code + #include <QObject> + + class MyObject : public QObject + { + public: + MyObject(); + ~MyObject(); + }; + \endcode + + \omit + ##Remove the code and put the snippets back after modularizing the docs. + \snippet examples/qmake/precompile/myobject.h 0 + \endomit + + \section2 \c myobject.cpp + + \code + #include <iostream> + #include <QDebug> + #include <QObject> + #include "myobject.h" + + MyObject::MyObject() + : QObject() + { + std::cout << "MyObject::MyObject()\n"; + } + \endcode + + \omit + \snippet examples/qmake/precompile/myobject.cpp 0 + \endomit + + \section2 \c util.cpp + + \code + void util_function_does_nothing() + { + // Nothing here... + int x = 0; + ++x; + } + \endcode + + \omit + \snippet examples/qmake/precompile/util.cpp 0 + \endomit + + \section2 \c main.cpp + + \code + #include <QApplication> + #include <QPushButton> + #include <QLabel> + #include "myobject.h" + #include "mydialog.h" + + int main(int argc, char **argv) + { + QApplication app(argc, argv); + + MyObject obj; + MyDialog dialog; + + dialog.connect(dialog.aButton, SIGNAL(clicked()), SLOT(close())); + dialog.show(); + + return app.exec(); + } + \endcode + + \omit + \snippet examples/qmake/precompile/main.cpp 0 + \endomit + + \section2 \c precompile.pro + + \code + TEMPLATE = app + LANGUAGE = C++ + CONFIG += console precompile_header + CONFIG -= app_bundle + + # Use Precompiled headers (PCH) + PRECOMPILED_HEADER = stable.h + + HEADERS = stable.h \ + mydialog.h \ + myobject.h + SOURCES = main.cpp \ + mydialog.cpp \ + myobject.cpp \ + util.cpp + FORMS = mydialog.ui + \endcode + + \omit + \snippet examples/qmake/precompile/precompile.pro 0 + \endomit +*/ + +/*! + \page qmake-tutorial.html + \title Getting Started + \contentspage {qmake Manual}{Contents} + \previouspage Overview + \nextpage Creating Project Files + + This tutorial teaches you the basics of qmake. The other topics in this + manual contain more detailed information about using qmake. + + \section1 Starting off Simple + + Let's assume that you have just finished a basic implementation of + your application, and you have created the following files: + + \list + \li hello.cpp + \li hello.h + \li main.cpp + \endlist + + You will find these files in the \c{examples/qmake/tutorial} directory + of the Qt distribution. The only other thing you know about the setup of + the application is that it's written in Qt. First, using your favorite + plain text editor, create a file called \c hello.pro in + \c{examples/qmake/tutorial}. The first thing you need to do is add the + lines that tell qmake about the source and + header files that are part of your development project. + + We'll add the source files to the project file first. To do this you + need to use the \l{SOURCES} variable. + Just start a new line with \c {SOURCES +=} and put hello.cpp after it. + You should have something like this: + + \snippet snippets/code/doc_src_qmake-manual.pro 108 + + We repeat this for each source file in the project, until we end up + with the following: + + \snippet snippets/code/doc_src_qmake-manual.pro 109 + + If you prefer to use a Make-like syntax, with all the files listed in + one go you can use the newline escaping like this: + + \snippet snippets/code/doc_src_qmake-manual.pro 110 + + Now that the source files are listed in the project file, the header + files must be added. These are added in exactly the same way as source + files, except that the variable name we use is \l{HEADERS}. + + Once you have done this, your project file should look something like + this: + + \snippet snippets/code/doc_src_qmake-manual.pro 111 + + The target name is set automatically. It is the same as the project + filename, but with the suffix appropriate for the platform. For example, if + the project file is called \c hello.pro, the target will be \c hello.exe + on Windows and \c hello on Unix. If you want to use a different name + you can set it in the project file: + + \snippet snippets/code/doc_src_qmake-manual.pro 112 + + The finished project file should look like this: + + \snippet snippets/code/doc_src_qmake-manual.pro 113 + + You can now use qmake to generate a Makefile + for your application. On the command line, in your project directory, + type the following: + + \snippet snippets/code/doc_src_qmake-manual.pro 114 + + Then type \c make or \c nmake depending on the compiler you use. + + For Visual Studio users, qmake can also generate Visual Studio project + files. For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 115 + + \section1 Making an Application Debuggable + + The release version of an application does not contain any debugging + symbols or other debugging information. During development, it is useful + to produce a debugging version of the application that has the + relevant information. This is easily achieved by adding \c debug to the + \l{CONFIG} variable in the project file. + + For example: + + \snippet snippets/code/doc_src_qmake-manual.pro 116 + + Use qmake as before to generate a Makefile. You will now obtain useful + information about your application when running it in a debugging + environment. + + \section1 Adding Platform-Specific Source Files + + After a few hours of coding, you might have made a start on the + platform-specific part of your application, and decided to keep the + platform-dependent code separate. So you now have two new files to + include into your project file: \c hellowin.cpp and \c + hellounix.cpp. We cannot just add these to the \c SOURCES + variable since that would place both files in the Makefile. So, what we + need to do here is to use a scope which will be processed depending on + which platform we are building for. + + A simple scope that adds the platform-dependent file for + Windows looks like this: + + \snippet snippets/code/doc_src_qmake-manual.pro 117 + + When building for Windows, qmake adds \c hellowin.cpp to the list of source + files. When building for any other platform, qmake simply ignores it. Now + all that is left to be done is to create a scope for the Unix-specific file. + + When you have done that, your project file should look + something like this: + + \snippet snippets/code/doc_src_qmake-manual.pro 118 + + Use qmake as before to generate a Makefile. + + \section1 Stopping qmake If a File Does Not Exist + + You may not want to create a Makefile if a certain file does not exist. + We can check if a file exists by using the \l{exists(filename)}{exists()} + function. We can stop qmake from processing by using the \l{error(string)} + {error()} function. This works in the same way as scopes do. Simply replace + the scope condition with the function. A check for a file called main.cpp looks + like this: + + \snippet snippets/code/doc_src_qmake-manual.pro 119 + + The \c{!} symbol is used to negate the test. That is, \c{exists( main.cpp )} + is true if the file exists, and \c{!exists( main.cpp )} is true if the + file does not exist. + + \snippet snippets/code/doc_src_qmake-manual.pro 120 + + Use qmake as before to generate a makefile. + If you rename \c main.cpp temporarily, you will see the message and + qmake will stop processing. + + \section1 Checking for More than One Condition + + Suppose you use Windows and you want to be able to see statement + output with \c {qDebug()} when you run your application on the command line. + To see the output, you must build your application with the appropriate + console setting. We can easily put \c console on the \c CONFIG + line to include this setting in the Makefile on Windows. However, + let's say that we only want to add the \c CONFIG line when we are running + on Windows \e and when \c debug is already on the \c CONFIG line. + This requires using two nested scopes. First create one scope, then create + the other inside it. Put the settings to be processed inside the second + scope, like this: + + \snippet snippets/code/doc_src_qmake-manual.pro 121 + + Nested scopes can be joined together using colons, so the final + project file looks like this: + + \snippet snippets/code/doc_src_qmake-manual.pro 122 + + That's it! You have now completed the tutorial for + qmake, and are ready to write project files for + your development projects. +*/ + +/*! + \page qmake-common-projects.html + \title Building Common Project Types + \contentspage {qmake Manual}{Contents} + \previouspage Creating Project Files + \nextpage Running qmake + + This chapter describes how to set up qmake project files for three common + project types that are based on Qt: application, library, and plugin. + Although all project types use many of the same variables, each of + them uses project-specific variables to customize output files. + + Platform-specific variables are not described here. For more information, + see \l{Deploying an Application on Windows} and + \l{Developing Qt Applications for Mac OS X}. + + \target Application + \section1 Building an Application + + The \c app template tells qmake to generate a + Makefile that will build an application. With this template, the type of + application can be specified by adding one of the following options to the + \l{CONFIG} variable definition: + + \table + \header \li Option \li Description + \row \li windows \li The application is a Windows GUI application. + \row \li console \li \c app template only: the application is a Windows console + application. + \row \li testcase \li The application is \l{Building a Testcase}{an automated test}. + \endtable + + When using this template, the following qmake + system variables are recognized. You should use these in your .pro file to + specify information about your application. + + \list + \li \l{HEADERS} - A list of header files for the application. + \li \l{SOURCES} - A list of C++ source files for the application. + \li \l{FORMS} - A list of UI files for the application (created using + Qt Designer). + \li \l{LEXSOURCES} - A list of Lex source files for the application. + \li \l{YACCSOURCES} - A list of Yacc source files for the + application. + \li \l{TARGET} - Name of the executable for the application. This defaults + to the name of the project file. (The extension, if any, is added + automatically). + \li \l{DESTDIR} - The directory in which the target executable is placed. + \li \l{DEFINES} - A list of any additional pre-processor defines needed for + the application. + \li \l{INCLUDEPATH} - A list of any additional include paths needed for the + application. + \li \l{DEPENDPATH} - The dependency search path for the application. + \li \l{VPATH} - The search path to find supplied files. + \li \l{DEF_FILE} - Windows only: A .def file to be linked against for the + application. + \li \l{RC_FILE} - Windows only: A resource file for the application. + \li \l{RES_FILE} - Windows only: A resource file to be linked against for + the application. + \endlist + + You only need to use the system variables that you have values for. For + example, if you do not have any extra INCLUDEPATHs then you do not need + to specify any. qmake will add the necessary default values. + An example project file might look like this: + + \snippet snippets/code/doc_src_qmake-manual.pro 123 + + For items that are single valued, such as the template or the destination + directory, we use "="; but for multi-valued items we use "+=" to \e + add to the existing items of that type. Using "=" replaces the variable + value with the new value. For example, if we write \c{DEFINES=USE_MY_STUFF}, + all other definitions are deleted. + + \section1 Building a Testcase + + A testcase project is an \c app project intended to be run as an automated + test. Any \c app may be marked as a testcase by adding the value \c testcase + to the \c CONFIG variable. + + For testcase projects, qmake will insert a \c check + target into the generated Makefile. This target will run the application. + The test is considered to pass if it terminates with an exit code equal to zero. + + The \c check target automatically recurses through + \l{SUBDIRS} projects. This means it is + possible to issue a \c{make check} command from within a SUBDIRS project + to run an entire test suite. + + The execution of the \c check target may be customized by certain Makefile + variables. These variables are: + + \table + \header + \li Variable + \li Description + \row + \li TESTRUNNER + \li A command or shell fragment prepended to each test command. An example + use-case is a "timeout" script which will terminate a test if it does not + complete within a specified time. + \row + \li TESTARGS + \li Additional arguments appended to each test command. For example, it may + be useful to pass additional arguments to set the output file and format + from the test (such as the \c{-o filename,format} option supported by + \l{QTestLib}). + \endtable + + \note The variables must be set while invoking the \c make tool, not in the + .pro file. Most \c make tools support the setting of Makefile variables directly + on the command-line: + + \code + # Run tests through test-wrapper and use xunitxml output format. + # In this example, test-wrapper is a fictional wrapper script which terminates + # a test if it does not complete within the amount of seconds set by "--timeout". + # The "-o result.xml,xunitxml" options are interpreted by QTestLib. + make check TESTRUNNER="test-wrapper --timeout 120" TESTARGS="-o result.xml,xunitxml" + \endcode + + Testcase projects may be further customized with the following \c CONFIG options: + + \table + \header + \li Option + \li Description + \row + \li insignificant_test + \li The exit code of the test will be ignored during \c{make check}. + \endtable + + Testcases will often be written with \l{QTest} or \l{TestCase}, but + that is not a requirement to make use of \c{CONFIG+=testcase} and \c{make check}. + The only primary requirement is that the test program exit with a zero exit code + on success, and a non-zero exit code on failure. + + \target Library + \section1 Building a Library + + The \c lib template tells qmake to generate a Makefile that will build a + library. When using this template, the \l{VERSION} variable is supported, + in addition to the system variables that the \c app template supports. Use + the variables in your .pro file to specify information about the library. + + When using the \c lib template, the following options can be added to the + \l{CONFIG} variable to determine the type of library that is built: + + \table + \header \li Option \li Description + \row \li dll \li The library is a shared library (dll). + \row \li staticlib \li The library is a static library. + \row \li plugin \li The library is a plugin. + \endtable + + The following option can also be defined to provide additional information about + the library. + + \list + \li VERSION - The version number of the target library. For example, 2.3.1. + \endlist + + The target file name for the library is platform-dependent. For example, on + X11 and Mac OS X, the library name will be prefixed by \c lib. On Windows, + no prefix is added to the file name. + + \target Plugin + \section1 Building a Plugin + + Plugins are built using the \c lib template, as described in the previous + section. This tells qmake to generate a + Makefile for the project that will build a plugin in a suitable form for + each platform, usually in the form of a library. As with ordinary + libraries, the \l{VERSION} variable is used to specify information about the + plugin. + + \list + \li VERSION - The version number of the target library. For example, 2.3.1. + \endlist + + \section2 Building a Qt Designer Plugin + + \QD plugins are built using a specific set of configuration settings that + depend on the way Qt was configured for your system. For convenience, these + settings can be enabled by adding \c designer to the \l{Variables#QT}{QT} + variable. For example: + + \code + QT += widgets designer + \endcode + + See the \l{Qt Designer Examples} for more examples of plugin-based projects. + + \section1 Building and Installing in Debug and Release Modes + + Sometimes, it is necessary to build a project in both debug and release + modes. Although the \l{CONFIG} variable can hold both \c debug and \c release + options, the \c debug option overrides the \c release option. + + \section2 Building in Both Modes + + To enable a project to be built in both modes, you must add the + \c debug_and_release option to the \c CONFIG variable: + + \snippet snippets/qmake/debug_and_release.pro 0 + \snippet snippets/qmake/debug_and_release.pro 1 + + The scope in the above snippet modifies the build target in each mode to + ensure that the resulting targets have different names. Providing different + names for targets ensures that one will not overwrite the other. + + When qmake processes the project file, it will + generate a Makefile rule to allow the project to be built in both modes. + This can be invoked in the following way: + + \snippet snippets/code/doc_src_qmake-manual.pro 124 + + The \c build_all option can be added to the \c CONFIG variable in the + project file to ensure that the project is built in both modes by default: + + \snippet snippets/qmake/debug_and_release.pro 2 + + This allows the Makefile to be processed using the default rule: + + \snippet snippets/code/doc_src_qmake-manual.pro 125 + + \section2 Installing in Both Modes + + The \c build_all option also ensures that both versions of the target + will be installed when the installation rule is invoked: + + \snippet snippets/code/doc_src_qmake-manual.pro 126 + + It is possible to customize the names of the build targets depending on + the target platform. For example, a library or plugin may be named using a + different convention on Windows from the one used on Unix platforms: + + \omit + Note: This was originally used in the customwidgetplugin.pro file, but is + no longer needed there. + \endomit + \snippet snippets/code/doc_src_qmake-manual.pro 127 + + The default behavior in the above snippet is to modify the name used for + the build target when building in debug mode. An \c else clause could be + added to the scope to do the same for release mode. Left as it is, the + target name remains unmodified. +*/ + diff --git a/qmake/doc/src/snippets/code/doc_src_qmake-manual.cpp b/qmake/doc/src/snippets/code/doc_src_qmake-manual.cpp new file mode 100644 index 0000000000..bd63e600cd --- /dev/null +++ b/qmake/doc/src/snippets/code/doc_src_qmake-manual.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [104] +// Add C includes here + +#if defined __cplusplus +// Add C++ includes here +#include <stdlib> +#include <iostream> +#include <vector> +#include <QApplication> // Qt includes +#include <QPushButton> +#include <QLabel> +#include "thirdparty/include/libmain.h" +#include "my_stable_class.h" +... +#endif +//! [104] + + diff --git a/qmake/doc/src/snippets/code/doc_src_qmake-manual.pro b/qmake/doc/src/snippets/code/doc_src_qmake-manual.pro new file mode 100644 index 0000000000..0ee4785887 --- /dev/null +++ b/qmake/doc/src/snippets/code/doc_src_qmake-manual.pro @@ -0,0 +1,917 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#! [0] +make all +#! [0] + + +#! [1] +CONFIG += qt debug +#! [1] + + +#! [2] +QT += network xml +#! [2] + + +#! [3] +QT = network xml # This will omit the core and gui modules. +#! [3] + + +#! [4] +QT -= gui # Only the core module is used. +#! [4] + + +#! [5] +CONFIG += link_pkgconfig +PKGCONFIG += ogg dbus-1 +#! [5] + + +#! [6] +LIBS += -L/usr/local/lib -lmath +#! [6] + + +#! [7] +INCLUDEPATH = c:/msdev/include d:/stl/include +#! [7] + + +#! [8] +qmake [mode] [options] files +#! [8] + + +#! [9] +qmake -makefile [options] files +#! [9] + + +#! [10] +qmake -makefile -o Makefile "CONFIG+=test" test.pro +#! [10] + + +#! [11] +qmake "CONFIG+=test" test.pro +#! [11] + + +#! [12] +qmake -project [options] files +#! [12] + + +#! [13] +qmake -spec macx-g++ +#! [13] + + +#! [14] +QMAKE_LFLAGS += -F/path/to/framework/directory/ +#! [14] + + +#! [15] +LIBS += -framework TheFramework +#! [15] + + +#! [16] +TEMPLATE = lib +CONFIG += lib_bundle +#! [16] + + +#! [17] +FRAMEWORK_HEADERS.version = Versions +FRAMEWORK_HEADERS.files = path/to/header_one.h path/to/header_two.h +FRAMEWORK_HEADERS.path = Headers +QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS +#! [17] + + +#! [19] +qmake -spec macx-xcode project.pro +#! [19] + + +#! [20] +qmake -tp vc +#! [20] + + +#! [21] +qmake -tp vc -r +#! [21] + + +#! [22] +CONFIG -= embed_manifest_exe +#! [22] + + +#! [23] +CONFIG -= embed_manifest_dll +#! [23] + + +#! [24] +make all +#! [24] + + +#! [25] +build_pass:CONFIG(debug, debug|release) { + unix: TARGET = $$join(TARGET,,,_debug) + else: TARGET = $$join(TARGET,,,d) +} +#! [25] + + +#! [26] +CONFIG += console newstuff +... +newstuff { + SOURCES += new.cpp + HEADERS += new.h +} +#! [26] + + +#! [27] +DEFINES += USE_MY_STUFF +#! [27] + + +#! [28] +myFiles.files = path\*.png +DEPLOYMENT += myFiles +#! [28] + + +#! [29] +myFiles.files = path\file1.ext1 path2\file2.ext1 path3\* +myFiles.path = \some\path\on\device +someother.files = C:\additional\files\* +someother.path = \myFiles\path2 +DEPLOYMENT += myFiles someother +#! [29] + + +#! [30] +DESTDIR = ../../lib +#! [30] + + +#! [31] +DISTFILES += ../program.txt +#! [31] + + +#! [32] +FORMS = mydialog.ui \ + mywidget.ui \ + myconfig.ui +#! [32] + + +#! [33] +FORMS3 = my_uic3_dialog.ui \ + my_uic3_widget.ui \ + my_uic3_config.ui +#! [33] + + +#! [34] +HEADERS = myclass.h \ + login.h \ + mainwindow.h +#! [34] + + +#! [35] +INCLUDEPATH = c:/msdev/include d:/stl/include +#! [35] + + +#! [36] +target.path += $$[QT_INSTALL_PLUGINS]/imageformats +INSTALLS += target +#! [36] + + +#! [37] +LEXSOURCES = lexer.l +#! [37] + + +#! [38] +unix:LIBS += -L/usr/local/lib -lmath +win32:LIBS += c:/mylibs/math.lib +#! [38] + + +#! [39] +CONFIG += no_lflags_merge +#! [39] + + +#! [40] +unix:MOC_DIR = ../myproject/tmp +win32:MOC_DIR = c:/myproject/tmp +#! [40] + + +#! [41] +unix:OBJECTS_DIR = ../myproject/tmp +win32:OBJECTS_DIR = c:/myproject/tmp +#! [41] + + +#! [43] +FRAMEWORK_HEADERS.version = Versions +FRAMEWORK_HEADERS.files = path/to/header_one.h path/to/header_two.h +FRAMEWORK_HEADERS.path = Headers +QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS +#! [43] + + +#! [44] +QMAKE_BUNDLE_EXTENSION = .myframework +#! [44] + + +#! [45] +QMAKE_RESOURCE_FLAGS += -threshold 0 -compress 9 +#! [45] + + +#! [47] +QT -= gui # Only the core module is used. +#! [47] + + +#! [48] +unix:RCC_DIR = ../myproject/resources +win32:RCC_DIR = c:/myproject/resources +#! [48] + + +#! [49] +SOURCES = myclass.cpp \ + login.cpp \ + mainwindow.cpp +#! [49] + + +#! [50] +SUBDIRS = kernel \ + tools +#! [50] + + +#! [51] +CONFIG += ordered +#! [51] + + +#! [52] +TEMPLATE = app +TARGET = myapp +SOURCES = main.cpp +#! [52] + + +#! [53] +TEMPLATE = lib +SOURCES = main.cpp +TARGET = mylib +#! [53] + + +#! [54] +unix:UI_DIR = ../myproject/ui +win32:UI_DIR = c:/myproject/ui +#! [54] + + +#! [57] +VERSION = 1.2.3 +#! [57] + + +#! [58] +YACCSOURCES = moc.y +#! [58] + + +#! [59] +FILE = /etc/passwd +FILENAME = $$basename(FILE) #passwd +#! [59] + + +#! [60] +CONFIG = debug +CONFIG += release +CONFIG(release, debug|release):message(Release build!) #will print +CONFIG(debug, debug|release):message(Debug build!) #no print +#! [60] + + +#! [61] +contains( drivers, network ) { + # drivers contains 'network' + message( "Configuring for network build..." ) + HEADERS += network.h + SOURCES += network.cpp +} +#! [61] + + +#! [62] +error(An error has occurred in the configuration process.) +#! [62] + + +#! [63] +exists( $(QTDIR)/lib/libqt-mt* ) { + message( "Configuring for multi-threaded Qt..." ) + CONFIG += thread +} +#! [63] + + +#! [64] +MY_VAR = one two three four +MY_VAR2 = $$join(MY_VAR, " -L", -L) -Lfive +MY_VAR3 = $$member(MY_VAR, 2) $$find(MY_VAR, t.*) +#! [64] + + +#! [65] +LIST = 1 2 3 +for(a, LIST):exists(file.$${a}):message(I see a file.$${a}!) +#! [65] + + +#! [66] +include( shared.pri ) +OPTIONS = standard custom +!include( options.pri ) { + message( "No custom build options specified" ) +OPTIONS -= custom +} +#! [66] + + +#! [67] +isEmpty( CONFIG ) { +CONFIG += warn_on debug +} +#! [67] + + +#! [68] +message( "This is a message" ) +#! [68] + + +#! [69] +!build_pass:message( "This is a message" ) +#! [69] + + +#! [70] +This is a test. +#! [70] + + +#! [71] +system(ls /bin):HAS_BIN=FALSE +#! [71] + + +#! [72] +UNAME = $$system(uname -s) +contains( UNAME, [lL]inux ):message( This looks like Linux ($$UNAME) to me ) +#! [72] + + +#! [73] +ARGS = 1 2 3 2 5 1 +ARGS = $$unique(ARGS) #1 2 3 5 +#! [73] + + +#! [74] +qmake -set PROPERTY VALUE +#! [74] + + +#! [75] +qmake -query PROPERTY +qmake -query #queries all current PROPERTY/VALUE pairs +#! [75] + + +#! [77] +qmake -query "QT_INSTALL_PREFIX" +#! [77] + + +#! [78] +QMAKE_VERS = $$[QMAKE_VERSION] +#! [78] + + +#! [79] +documentation.path = /usr/local/program/doc +documentation.files = docs/* +#! [79] + + +#! [80] +INSTALLS += documentation +#! [80] + + +#! [81] +unix:documentation.extra = create_docs; mv master.doc toc.doc +#! [81] + + +#! [82] +target.path = /usr/local/myprogram +INSTALLS += target +#! [82] + + +#! [83] +CONFIG += create_prl +#! [83] + + +#! [84] +CONFIG += link_prl +#! [84] + + +#! [85] +QMAKE_EXT_MOC = .mymoc +#! [85] + + +#! [86] +mytarget.target = .buildfile +mytarget.commands = touch $$mytarget.target +mytarget.depends = mytarget2 + +mytarget2.commands = @echo Building $$mytarget.target +#! [86] + + +#! [87] +QMAKE_EXTRA_TARGETS += mytarget mytarget2 +#! [87] + + +#! [88] +new_moc.output = moc_${QMAKE_FILE_BASE}.cpp +new_moc.commands = moc ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT} +new_moc.depend_command = g++ -E -M ${QMAKE_FILE_NAME} | sed "s,^.*: ,," +new_moc.input = NEW_HEADERS +QMAKE_EXTRA_COMPILERS += new_moc +#! [88] + + +#! [89] +TARGET = myapp +#! [89] + + +#! [90] +DEFINES += USE_MY_STUFF +#! [90] + + +#! [91] +DEFINES -= USE_MY_STUFF +#! [91] + + +#! [92] +DEFINES *= USE_MY_STUFF +#! [92] + + +#! [93] +DEFINES ~= s/QT_[DT].+/QT +#! [93] + + +#! [94] +EVERYTHING = $$SOURCES $$HEADERS +message("The project contains the following files:") +message($$EVERYTHING) +#! [94] + + +#! [95] +win32:DEFINES += USE_MY_STUFF +#! [95] + + +#! [96] +win32:xml { + message(Building for Windows) + SOURCES += xmlhandler_win.cpp +} else:xml { + SOURCES += xmlhandler.cpp +} else { + message("Unknown configuration") +} +#! [96] + + +#! [97] +MY_VARIABLE = value +#! [97] + + +#! [98] +MY_DEFINES = $$DEFINES +#! [98] + + +#! [99] +MY_DEFINES = $${DEFINES} +#! [99] + + +#! [100] +TARGET = myproject_$${TEMPLATE} +#! [100] + + +#! [101] +target.path = $$[QT_INSTALL_PLUGINS]/designer +INSTALLS += target +#! [101] + + +#! [102] +defineReplace(functionName){ + #function code +} +#! [102] + + +#! [103] +CONFIG += myfeatures +#! [103] + + +#! [105] +PRECOMPILED_HEADER = stable.h +#! [105] + + +#! [106] +precompile_header:!isEmpty(PRECOMPILED_HEADER) { +DEFINES += USING_PCH +} +#! [106] + + +#! [107] +PRECOMPILED_HEADER = window.h +SOURCES = window.cpp +#! [107] + + +#! [108] +SOURCES += hello.cpp +#! [108] + + +#! [109] +SOURCES += hello.cpp +SOURCES += main.cpp +#! [109] + + +#! [110] +SOURCES = hello.cpp \ + main.cpp +#! [110] + + +#! [111] +HEADERS += hello.h +SOURCES += hello.cpp +SOURCES += main.cpp +#! [111] + + +#! [112] +TARGET = helloworld +#! [112] + + +#! [113] +HEADERS += hello.h +SOURCES += hello.cpp +SOURCES += main.cpp +#! [113] + + +#! [114] +qmake -o Makefile hello.pro +#! [114] + + +#! [115] +qmake -tp vc hello.pro +#! [115] + + +#! [116] +CONFIG += debug +HEADERS += hello.h +SOURCES += hello.cpp +SOURCES += main.cpp +#! [116] + + +#! [117] +win32 { + SOURCES += hellowin.cpp +} +#! [117] + + +#! [118] +CONFIG += debug +HEADERS += hello.h +SOURCES += hello.cpp +SOURCES += main.cpp +win32 { + SOURCES += hellowin.cpp +} +unix { + SOURCES += hellounix.cpp +} +#! [118] + + +#! [119] +!exists( main.cpp ) { + error( "No main.cpp file found" ) +} +#! [119] + + +#! [120] +CONFIG += debug +HEADERS += hello.h +SOURCES += hello.cpp +SOURCES += main.cpp +win32 { + SOURCES += hellowin.cpp +} +unix { + SOURCES += hellounix.cpp +} +!exists( main.cpp ) { + error( "No main.cpp file found" ) +} +#! [120] + + +#! [121] +win32 { + debug { + CONFIG += console + } +} +#! [121] + + +#! [122] +CONFIG += debug +HEADERS += hello.h +SOURCES += hello.cpp +SOURCES += main.cpp +win32 { + SOURCES += hellowin.cpp +} +unix { + SOURCES += hellounix.cpp +} +!exists( main.cpp ) { + error( "No main.cpp file found" ) +} +win32:debug { + CONFIG += console +} +#! [122] + + +#! [123] +TEMPLATE = app +DESTDIR = c:/helloapp +HEADERS += hello.h +SOURCES += hello.cpp +SOURCES += main.cpp +DEFINES += USE_MY_STUFF +CONFIG += release +#! [123] + + +#! [124] +make all +#! [124] + + +#! [125] +make +#! [125] + + +#! [126] +make install +#! [126] + + +#! [127] +CONFIG(debug, debug|release) { + mac: TARGET = $$join(TARGET,,,_debug) + win32: TARGET = $$join(TARGET,,d) +} +#! [127] + +#! [142] +DEPLOYMENT_PLUGIN += qjpeg +#! [142] + +#! [149] +SUBDIRS += my_executable my_library +my_executable.subdir = app +my_executable.depends = my_library +my_library.subdir = lib +#! [149] + +#! [157] +packagesExist(sqlite3 QtNetwork QtDeclarative) { + DEFINES += USE_FANCY_UI +} +#! [157] + +#! [158] +#ifdef USE_FANCY_UI + // Use the fancy UI, as we have extra packages available +#endif +#! [158] + +#! [159] +message($$absolute_path("readme.txt", "/home/johndoe/myproject")) +#! [159] + + +#! [160] +TARGET = helloworld +equals(TARGET, "helloworld") { + message("The target assignment was successful.") +} +#! [160] + + +#! [161] +CONTACT = firstname middlename surname phone +message($$first(CONTACT)) +#! [161] + + +#! [162] +CONTACT = firstname middlename surname phone +message($$last(CONTACT)) +#! [162] + + +#! [163] +message($$format_number(BAD, ibase=16 width=6 zeropad)) +#! [163] + + +#! [164] +ANSWER = 42 +greaterThan(ANSWER, 1) { + message("The answer might be correct.") +} +#! [164] + + +#! [165] +ANSWER = 42 +lessThan(ANSWER, 1) { + message("The answer might be wrong.") +} +#! [165] + + +#! [166] +if(linux-g++*|macx-g++*):CONFIG(debug, debug|release) { + message("We are on Linux or Mac OS, and we are in debug mode.") +} +#! [166] + + +#! [167] +CONTACT = firstname:middlename:surname:phone +message($$section(CONTACT, :, 2, 2)) +#! [167] + + +#! [168] +CONTACT = firstname:middlename:surname:phone +message($$split(CONTACT, :)) +#! [168] + +#! [169] +NARF = zort +unset(NARF) +!defined(NARF, var) { + message("NARF is not defined.") +} +#! [169] + + +#! [170] +for(var, $$list(foo bar baz)) { + ... +} +#! [170] + + +#! [171] +values = foo bar baz +for(var, values) { + ... +} +#! [171] + + +#! [172] +VALUE = 123 +TMP_VALUE = x$$VALUE +greaterThan(TMP_VALUE, x456): message("Condition may be true.") +#! [172] + + +#! [173] +message("First line$$escape_expand(\\n)Second line") +#! [173] diff --git a/qmake/doc/src/snippets/qmake/comments.pro b/qmake/doc/src/snippets/qmake/comments.pro new file mode 100644 index 0000000000..957052c81d --- /dev/null +++ b/qmake/doc/src/snippets/qmake/comments.pro @@ -0,0 +1,10 @@ +#! [0] +# Comments usually start at the beginning of a line, but they +# can also follow other content on the same line. +#! [0] + +#! [1] +# To include a literal hash character, use the $$LITERAL_HASH variable: +urlPieces = http://qt-project.org/doc/qt-5.0/qtgui/qtextdocument.html pageCount +message($$join(urlPieces, $$LITERAL_HASH)) +#! [1] diff --git a/qmake/doc/src/snippets/qmake/configscopes.pro b/qmake/doc/src/snippets/qmake/configscopes.pro new file mode 100644 index 0000000000..6ab7f7c428 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/configscopes.pro @@ -0,0 +1,23 @@ +SOURCES = main.cpp +#! [0] +CONFIG += opengl +#! [0] + +#! [1] +opengl { + TARGET = application-gl +} else { +#! [1] #! [2] + TARGET = application +#! [2] #! [3] +} +#! [3] + +#! [4] +CONFIG(opengl) { + message(Building with OpenGL support.) +} else { +#! [4] #! [5] + message(OpenGL support is not available.) +} +#! [5] diff --git a/qmake/doc/src/snippets/qmake/debug_and_release.pro b/qmake/doc/src/snippets/qmake/debug_and_release.pro new file mode 100644 index 0000000000..92e8dbf76a --- /dev/null +++ b/qmake/doc/src/snippets/qmake/debug_and_release.pro @@ -0,0 +1,14 @@ +#! [0] +CONFIG += debug_and_release + +CONFIG(debug, debug|release) { + TARGET = debug_binary +} else { +#! [0] #! [1] + TARGET = release_binary +} +#! [1] + +#! [2] +CONFIG += build_all +#! [2] diff --git a/qmake/doc/src/snippets/qmake/delegate.h b/qmake/doc/src/snippets/qmake/delegate.h new file mode 100644 index 0000000000..92c7eb6a48 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/delegate.h @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + diff --git a/qmake/doc/src/snippets/qmake/dereferencing.pro b/qmake/doc/src/snippets/qmake/dereferencing.pro new file mode 100644 index 0000000000..ff0c97995c --- /dev/null +++ b/qmake/doc/src/snippets/qmake/dereferencing.pro @@ -0,0 +1,5 @@ +#! [0] +TEMP_SOURCES = $$SOURCES +#! [0] +# Do something with the SOURCES variable then restore its old value. +SOURCES = $$TEMP_SOURCES diff --git a/qmake/doc/src/snippets/qmake/destdir.pro b/qmake/doc/src/snippets/qmake/destdir.pro new file mode 100644 index 0000000000..b2f943904a --- /dev/null +++ b/qmake/doc/src/snippets/qmake/destdir.pro @@ -0,0 +1,2 @@ +SOURCES = main.cpp +DESTDIR = output diff --git a/qmake/doc/src/snippets/qmake/dirname.pro b/qmake/doc/src/snippets/qmake/dirname.pro new file mode 100644 index 0000000000..59e1f20b3f --- /dev/null +++ b/qmake/doc/src/snippets/qmake/dirname.pro @@ -0,0 +1,6 @@ +#! [0] +FILE = /etc/X11R6/XF86Config +DIRNAME = $$dirname(FILE) #/etc/X11R6 +#! [0] +message($$FILE) +message($$DIRNAME) diff --git a/qmake/doc/src/snippets/qmake/environment.pro b/qmake/doc/src/snippets/qmake/environment.pro new file mode 100644 index 0000000000..808bdeba47 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/environment.pro @@ -0,0 +1,9 @@ +#! [0] #! [1] +DESTDIR = $$(PWD) +message(The project will be installed in $$DESTDIR) +#! [0] + +DESTDIR = $(PWD) +message(The project will be installed in the value of PWD) +message(when the Makefile is processed.) +#! [1] diff --git a/qmake/doc/src/snippets/qmake/functions.pro b/qmake/doc/src/snippets/qmake/functions.pro new file mode 100644 index 0000000000..2766120719 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/functions.pro @@ -0,0 +1,34 @@ +#! [0] +EXTRAS = handlers tests docs +for(dir, EXTRAS) { + exists($$dir) { + SUBDIRS += $$dir + } +} +#! [0] + +SOURCES = paintwidget_mac.cpp paintwidget_unix.cpp paintwidget_win.cpp +macx { + SOURCES = $$find(SOURCES, "_mac") +} + +#! [1] +HEADERS = model.h +HEADERS += $$OTHER_HEADERS +HEADERS = $$unique(HEADERS) +#! [1] + +CONFIG += debug +#! [2] +options = $$find(CONFIG, "debug") $$find(CONFIG, "release") +#! [3] +count(options, 2) { + message(Both release and debug specified.) +} +#! [2] #! [3] + +#! [4] +eval(TARGET = myapp) { + message($$TARGET) +} +#! [4] diff --git a/qmake/doc/src/snippets/qmake/include.pro b/qmake/doc/src/snippets/qmake/include.pro new file mode 100644 index 0000000000..37e7156957 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/include.pro @@ -0,0 +1,3 @@ +#! [0] +include(other.pro) +#! [0] diff --git a/qmake/doc/src/snippets/qmake/main.cpp b/qmake/doc/src/snippets/qmake/main.cpp new file mode 100644 index 0000000000..92c7eb6a48 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/main.cpp @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + diff --git a/qmake/doc/src/snippets/qmake/model.cpp b/qmake/doc/src/snippets/qmake/model.cpp new file mode 100644 index 0000000000..92c7eb6a48 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/model.cpp @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + diff --git a/qmake/doc/src/snippets/qmake/model.h b/qmake/doc/src/snippets/qmake/model.h new file mode 100644 index 0000000000..92c7eb6a48 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/model.h @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + diff --git a/qmake/doc/src/snippets/qmake/other.pro b/qmake/doc/src/snippets/qmake/other.pro new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/other.pro diff --git a/qmake/doc/src/snippets/qmake/paintwidget_mac.cpp b/qmake/doc/src/snippets/qmake/paintwidget_mac.cpp new file mode 100644 index 0000000000..92c7eb6a48 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/paintwidget_mac.cpp @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + diff --git a/qmake/doc/src/snippets/qmake/paintwidget_unix.cpp b/qmake/doc/src/snippets/qmake/paintwidget_unix.cpp new file mode 100644 index 0000000000..c39fc2cbf6 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/paintwidget_unix.cpp @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +int main(int argc, char *argv[]) +{ + return 0; +} diff --git a/qmake/doc/src/snippets/qmake/paintwidget_win.cpp b/qmake/doc/src/snippets/qmake/paintwidget_win.cpp new file mode 100644 index 0000000000..92c7eb6a48 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/paintwidget_win.cpp @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + diff --git a/qmake/doc/src/snippets/qmake/precompile-stable.h b/qmake/doc/src/snippets/qmake/precompile-stable.h new file mode 100644 index 0000000000..eef8cef728 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/precompile-stable.h @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +/* Add C includes here */ + +#if defined __cplusplus +/* Add C++ includes here */ + +# include <iostream> +# include <QApplication> +# include <QPushButton> +# include <QLabel> +#endif +//! [0] diff --git a/qmake/doc/src/snippets/qmake/project_location.pro b/qmake/doc/src/snippets/qmake/project_location.pro new file mode 100644 index 0000000000..09d9b3d9d0 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/project_location.pro @@ -0,0 +1,6 @@ +#! [project file] +message($$_PRO_FILE_) +#! [project file] +#! [project file directory] +message($$_PRO_FILE_PWD_) +#! [project file directory] diff --git a/qmake/doc/src/snippets/qmake/qtconfiguration.pro b/qmake/doc/src/snippets/qmake/qtconfiguration.pro new file mode 100644 index 0000000000..55e13be352 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/qtconfiguration.pro @@ -0,0 +1,18 @@ +# Show information about the Qt installation. +#! [0] +message(Qt version: $$[QT_VERSION]) +message(Qt is installed in $$[QT_INSTALL_PREFIX]) +message(Qt resources can be found in the following locations:) +message(Documentation: $$[QT_INSTALL_DOCS]) +message(Header files: $$[QT_INSTALL_HEADERS]) +message(Libraries: $$[QT_INSTALL_LIBS]) +message(Binary files (executables): $$[QT_INSTALL_BINS]) +message(Plugins: $$[QT_INSTALL_PLUGINS]) +message(Data files: $$[QT_INSTALL_DATA]) +message(Translation files: $$[QT_INSTALL_TRANSLATIONS]) +message(Settings: $$[QT_INSTALL_SETTINGS]) +message(Examples: $$[QT_INSTALL_EXAMPLES]) +#! [0] + +# Show configuration information. +message(CONFIG = $$CONFIG) diff --git a/qmake/doc/src/snippets/qmake/quoting.pro b/qmake/doc/src/snippets/qmake/quoting.pro new file mode 100644 index 0000000000..62efb2042e --- /dev/null +++ b/qmake/doc/src/snippets/qmake/quoting.pro @@ -0,0 +1,8 @@ +#! [0] +DEST = "Program Files" +#! [0] +count(DEST, 1) { + message(Only one item found in DEST.) +} else { + message(More than one item found in DEST.) +} diff --git a/qmake/doc/src/snippets/qmake/replace.pro b/qmake/doc/src/snippets/qmake/replace.pro new file mode 100644 index 0000000000..504e01a018 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/replace.pro @@ -0,0 +1,4 @@ +#! [0] +MESSAGE = This is a tent. +message($$replace(MESSAGE, tent, test)) +#! [0] diff --git a/qmake/doc/src/snippets/qmake/replacefunction.pro b/qmake/doc/src/snippets/qmake/replacefunction.pro new file mode 100644 index 0000000000..98013ba42d --- /dev/null +++ b/qmake/doc/src/snippets/qmake/replacefunction.pro @@ -0,0 +1,46 @@ +#! [0] +defineReplace(headersAndSources) { + variable = $$1 + names = $$eval($$variable) + headers = + sources = + + for(name, names) { + header = $${name}.h + exists($$header) { + headers += $$header + } + source = $${name}.cpp + exists($$source) { + sources += $$source + } + } + return($$headers $$sources) +} +#! [0] + +defineReplace(matchingFiles) { + names = $$ARGS + files = + + for(name, names) { + header = $${name}.h + source = $${name}.cpp + exists($$header):exists($$source) { + files += $$header + files += $$source + } + } + return($$files) +} + +names = delegate model view main +message(Finding all headers and sources from the following list of names:) +message($$names) +allFiles = $$headersAndSources(names) +message(Found: $$allFiles) + +message(Finding only matching headers and sources from the following list of names:) +message($$names) +matching = $$matchingFiles($$names) +message(Found: $$matching) diff --git a/qmake/doc/src/snippets/qmake/scopes.pro b/qmake/doc/src/snippets/qmake/scopes.pro new file mode 100644 index 0000000000..63b9b3aa55 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/scopes.pro @@ -0,0 +1,42 @@ +#! [syntax] +<condition> { + <command or definition> + ... +} +#! [syntax] + +#! [0] +win32 { + SOURCES += paintwidget_win.cpp +} +#! [0] + +#! [1] +!win32 { + SOURCES -= paintwidget_win.cpp +} +#! [1] + +unix { + SOURCES += paintwidget_unix.cpp +} + +#! [2] +macx { + CONFIG(debug, debug|release) { + HEADERS += debugging.h + } +} +#! [2] + +#! [3] +macx:CONFIG(debug, debug|release) { + HEADERS += debugging.h +} +#! [3] + +#! [4] +win32|macx { + HEADERS += debugging.h +} +#! [4] diff --git a/qmake/doc/src/snippets/qmake/shared_or_static.pro b/qmake/doc/src/snippets/qmake/shared_or_static.pro new file mode 100644 index 0000000000..31c25ea44b --- /dev/null +++ b/qmake/doc/src/snippets/qmake/shared_or_static.pro @@ -0,0 +1,8 @@ +TEMPLIBS = $$[QT_INSTALL_LIBS] libQtGui.prl +include($$join(TEMPLIBS, "/")) + +contains(QMAKE_PRL_CONFIG, shared) { + message(Shared Qt) +} else { + message(Static Qt) +} diff --git a/qmake/doc/src/snippets/qmake/spaces.pro b/qmake/doc/src/snippets/qmake/spaces.pro new file mode 100644 index 0000000000..614d4c553d --- /dev/null +++ b/qmake/doc/src/snippets/qmake/spaces.pro @@ -0,0 +1,9 @@ +#! [quoting library paths with spaces] +win32:LIBS += "C:/mylibs/extra libs/extra.lib" +unix:LIBS += "-L/home/user/extra libs" -lextra +#! [quoting library paths with spaces] + +#! [quoting include paths with spaces] +win32:INCLUDEPATH += "C:/mylibs/extra headers" +unix:INCLUDEPATH += "/home/user/extra headers" +#! [quoting include paths with spaces] diff --git a/qmake/doc/src/snippets/qmake/specifications.pro b/qmake/doc/src/snippets/qmake/specifications.pro new file mode 100644 index 0000000000..f9a0d0a1cb --- /dev/null +++ b/qmake/doc/src/snippets/qmake/specifications.pro @@ -0,0 +1,7 @@ +#! [0] +message($$QMAKESPEC) + +linux-g++ { + message(Linux) +} +#! [0] diff --git a/qmake/doc/src/snippets/qmake/testfunction.pro b/qmake/doc/src/snippets/qmake/testfunction.pro new file mode 100644 index 0000000000..785ffed6be --- /dev/null +++ b/qmake/doc/src/snippets/qmake/testfunction.pro @@ -0,0 +1,20 @@ +#! [0] +defineTest(allFiles) { + files = $$ARGS + + for(file, files) { + !exists($$file) { + return(false) + } + } + return(true) +} +#! [0] + +files = delegate.h model.h view.h + +allFiles($$files) { + message(All files are present: $$files) +} else { + message(Not all files are present: $$files) +} diff --git a/qmake/doc/src/snippets/qmake/variables.pro b/qmake/doc/src/snippets/qmake/variables.pro new file mode 100644 index 0000000000..c1439ba68b --- /dev/null +++ b/qmake/doc/src/snippets/qmake/variables.pro @@ -0,0 +1,7 @@ +#! [0] +HEADERS = mainwindow.h paintwidget.h +#! [0] #! [1] +SOURCES = main.cpp mainwindow.cpp \ + paintwidget.cpp +CONFIG += console +#! [1] diff --git a/qmake/doc/src/snippets/qmake/view.h b/qmake/doc/src/snippets/qmake/view.h new file mode 100644 index 0000000000..92c7eb6a48 --- /dev/null +++ b/qmake/doc/src/snippets/qmake/view.h @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + diff --git a/qmake/generators/integrity/gbuild.cpp b/qmake/generators/integrity/gbuild.cpp index 2266a3c06d..ace3558d7d 100644 --- a/qmake/generators/integrity/gbuild.cpp +++ b/qmake/generators/integrity/gbuild.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the qmake application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/qmake/generators/integrity/gbuild.h b/qmake/generators/integrity/gbuild.h index 234a2be9af..e69d634abb 100644 --- a/qmake/generators/integrity/gbuild.h +++ b/qmake/generators/integrity/gbuild.h @@ -3,7 +3,7 @@ ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the qmake application of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index a09e10c55e..9f83d7a898 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -1340,7 +1340,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) ProString dir = project->first("DESTDIR"); if (QDir::isRelativePath(dir.toQString())) dir.prepend(qmake_getpwd() + Option::dir_sep); - t << "\t\t\t\t" << writeSettings("TARGET_BUILD_DIR", dir) << ";" << "\n"; + t << "\t\t\t\t" << writeSettings("INSTALL_DIR", dir) << ";" << "\n"; } if (project->first("TEMPLATE") == "lib") diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 44fbf20f81..49b601e7e5 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE const char _CLCompile[] = "ClCompile"; const char _ItemGroup[] = "ItemGroup"; const char _Link[] = "Link"; +const char _ManifestTool[] = "ManifestTool"; const char _Midl[] = "Midl"; const char _ResourceCompile[] = "ResourceCompile"; @@ -104,6 +105,7 @@ const char _DisableSpecificWarnings[] = "DisableSpecificWarnings"; const char _DisplayLibrary[] = "DisplayLibrary"; const char _DLLDataFileName[] = "DLLDataFileName"; const char _EmbedManagedResourceFile[] = "EmbedManagedResourceFile"; +const char _EmbedManifest[] = "EmbedManifest"; const char _EnableCOMDATFolding[] = "EnableCOMDATFolding"; const char _EnableUAC[] = "EnableUAC"; const char _EnableErrorChecks[] = "EnableErrorChecks"; @@ -1657,6 +1659,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCConfiguration &tool) << attrTagS(_UseOfATL, toString(tool.UseOfATL)) << attrTagS(_UseOfMfc, toString(tool.UseOfMfc)) << attrTagT(_WholeProgramOptimization, tool.WholeProgramOptimization) + << attrTagT(_EmbedManifest, tool.manifestTool.EmbedManifest) << closetag(); } diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 99f69bfa72..4dbba6d974 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -97,6 +97,7 @@ const char _Description[] = "Description"; const char _Detect64BitPortabilityProblems[] = "Detect64BitPortabilityProblems"; const char _DisableLanguageExtensions[] = "DisableLanguageExtensions"; const char _DisableSpecificWarnings[] = "DisableSpecificWarnings"; +const char _EmbedManifest[] = "EmbedManifest"; const char _EnableCOMDATFolding[] = "EnableCOMDATFolding"; const char _EnableErrorChecks[] = "EnableErrorChecks"; const char _EnableEnhancedInstructionSet[] = "EnableEnhancedInstructionSet"; @@ -224,6 +225,7 @@ const char _ValidateParameters[] = "ValidateParameters"; const char _VCCLCompilerTool[] = "VCCLCompilerTool"; const char _VCLibrarianTool[] = "VCLibrarianTool"; const char _VCLinkerTool[] = "VCLinkerTool"; +const char _VCManifestTool[] = "VCManifestTool"; const char _VCCustomBuildTool[] = "VCCustomBuildTool"; const char _VCResourceCompilerTool[] = "VCResourceCompilerTool"; const char _VCMIDLTool[] = "VCMIDLTool"; @@ -1718,6 +1720,23 @@ bool VCLinkerTool::parseOption(const char* option) return found; } +// VCManifestTool --------------------------------------------------- +VCManifestTool::VCManifestTool() + : EmbedManifest(unset) +{ +} + +VCManifestTool::~VCManifestTool() +{ +} + +bool VCManifestTool::parseOption(const char *option) +{ + Q_UNUSED(option); + // ### implement if we introduce QMAKE_MT_FLAGS + return false; +} + // VCMIDLTool ------------------------------------------------------- VCMIDLTool::VCMIDLTool() : DefaultCharType(midlCharUnsigned), @@ -2335,7 +2354,6 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) CustomBuildTool.Outputs += out; deps += CustomBuildTool.AdditionalDependencies; - deps += cmd.left(cmd.indexOf(' ')); // Make sure that all deps are only once QHash<QString, bool> uniqDeps; for (int c = 0; c < deps.count(); ++c) { @@ -2634,6 +2652,14 @@ void VCProjectWriter::write(XmlOutput &xml, const VCLinkerTool &tool) << closetag(_Tool); } +void VCProjectWriter::write(XmlOutput &xml, const VCManifestTool &tool) +{ + xml << tag(_Tool) + << attrS(_Name, _VCManifestTool) + << attrT(_EmbedManifest, tool.EmbedManifest) + << closetag(_Tool); +} + void VCProjectWriter::write(XmlOutput &xml, const VCMIDLTool &tool) { xml << tag(_Tool) @@ -2765,6 +2791,7 @@ void VCProjectWriter::write(XmlOutput &xml, const VCConfiguration &tool) write(xml, tool.librarian); else write(xml, tool.linker); + write(xml, tool.manifestTool); write(xml, tool.idl); write(xml, tool.postBuild); write(xml, tool.preBuild); diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index d289afe366..e60fb1dfca 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -675,6 +675,16 @@ public: VCConfiguration* config; }; +class VCManifestTool : public VCToolBase +{ +public: + VCManifestTool(); + ~VCManifestTool(); + bool parseOption(const char* option); + + triState EmbedManifest; +}; + class VCMIDLTool : public VCToolBase { public: @@ -874,6 +884,7 @@ public: VCCLCompilerTool compiler; VCLinkerTool linker; VCLibrarianTool librarian; + VCManifestTool manifestTool; VCCustomBuildTool custom; VCMIDLTool idl; VCPostBuildEventTool postBuild; @@ -1127,6 +1138,7 @@ public: virtual void write(XmlOutput &, const VCCLCompilerTool &); virtual void write(XmlOutput &, const VCLinkerTool &); + virtual void write(XmlOutput &, const VCManifestTool &); virtual void write(XmlOutput &, const VCMIDLTool &); virtual void write(XmlOutput &, const VCCustomBuildTool &); virtual void write(XmlOutput &, const VCLibrarianTool &); diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index fb4bf08431..20ff9073f9 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -200,8 +200,9 @@ const char _slnSolutionConf[] = "\n\tGlobalSection(SolutionConfiguration) = pr "\n\t\tConfigName.0 = Debug|Win32" "\n\t\tConfigName.1 = Release|Win32" "\n\tEndGlobalSection"; -const char _slnProjDepBeg[] = "\n\tGlobalSection(ProjectDependencies) = postSolution"; -const char _slnProjDepEnd[] = "\n\tEndGlobalSection"; + +const char _slnProjDepBeg[] = "\n\tProjectSection(ProjectDependencies) = postProject"; +const char _slnProjDepEnd[] = "\n\tEndProjectSection"; const char _slnProjConfBeg[] = "\n\tGlobalSection(ProjectConfiguration) = postSolution"; const char _slnProjRelConfTag1[]= ".Release|%1.ActiveCfg = Release|"; const char _slnProjRelConfTag2[]= ".Release|%1.Build.0 = Release|"; @@ -571,10 +572,6 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt #endif solution_cleanup.append(newDep); solution_depends.insert(newDep->target, newDep); - t << _slnProjectBeg << _slnMSVCvcprojGUID << _slnProjectMid - << "\"" << newDep->orig_target << "\", \"" << newDep->vcprojFile - << "\", \"" << newDep->uuid << "\""; - t << _slnProjectEnd; } nextfile: qmake_setpwd(oldpwd); @@ -634,6 +631,30 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QHash<QString, ProStringList> subdirProjectLookup; collectDependencies(project, profileLookup, projGuids, extraSubdirs, solution_depends, solution_cleanup, t, subdirProjectLookup); + // write out projects + for (QList<VcsolutionDepend*>::Iterator it = solution_cleanup.begin(); it != solution_cleanup.end(); ++it) { + t << _slnProjectBeg << _slnMSVCvcprojGUID << _slnProjectMid + << "\"" << (*it)->orig_target << "\", \"" << (*it)->vcprojFile + << "\", \"" << (*it)->uuid << "\""; + + debug_msg(1, "Project %s has dependencies: %s", (*it)->target.toLatin1().constData(), (*it)->dependencies.join(" ").toLatin1().constData()); + + bool hasDependency = false; + for (QStringList::iterator dit = (*it)->dependencies.begin(); dit != (*it)->dependencies.end(); ++dit) { + if (VcsolutionDepend *vc = solution_depends[*dit]) { + if (!hasDependency) { + hasDependency = true; + t << _slnProjDepBeg; + } + t << "\n\t\t" << vc->uuid << " = " << vc->uuid; + } + } + if (hasDependency) + t << _slnProjDepEnd; + + t << _slnProjectEnd; + } + t << _slnGlobalBeg; QHashIterator<VcsolutionDepend *, QStringList> extraIt(extraSubdirs); @@ -657,20 +678,9 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) } t << slnConf; - t << _slnProjDepBeg; - // Restore previous after_user_var options Option::globals->postcmds = old_after_vars; - // Figure out dependencies - for(QList<VcsolutionDepend*>::Iterator it = solution_cleanup.begin(); it != solution_cleanup.end(); ++it) { - int cnt = 0; - for(QStringList::iterator dit = (*it)->dependencies.begin(); dit != (*it)->dependencies.end(); ++dit) { - if(VcsolutionDepend *vc = solution_depends[*dit]) - t << "\n\t\t" << (*it)->uuid << "." << cnt++ << " = " << vc->uuid; - } - } - t << _slnProjDepEnd; t << _slnProjConfBeg; for(QList<VcsolutionDepend*>::Iterator it = solution_cleanup.begin(); it != solution_cleanup.end(); ++it) { QString platform = is64Bit ? "x64" : "Win32"; @@ -915,6 +925,7 @@ void VcprojGenerator::initConfiguration() conf.linker.GenerateDebugInformation = isDebug ? _True : _False; initLinkerTool(); } + initManifestTool(); initResourceTool(); initIDLTool(); @@ -1035,6 +1046,19 @@ void VcprojGenerator::initLibrarianTool() conf.librarian.AdditionalOptions += project->values("QMAKE_LIBFLAGS").toQStringList(); } +void VcprojGenerator::initManifestTool() +{ + VCManifestTool &tool = vcProject.Configuration.manifestTool; + const ProString tmplt = project->first("TEMPLATE"); + if ((tmplt == "vclib" + && !project->isActiveConfig("embed_manifest_dll") + && !project->isActiveConfig("static")) + || (tmplt == "vcapp" + && !project->isActiveConfig("embed_manifest_exe"))) { + tool.EmbedManifest = _False; + } +} + void VcprojGenerator::initLinkerTool() { VCConfiguration &conf = vcProject.Configuration; diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index f36d1632cf..62a2da9629 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -102,6 +102,7 @@ protected: void initCompilerTool(); void initLinkerTool(); void initLibrarianTool(); + void initManifestTool(); void initResourceTool(); void initIDLTool(); void initCustomBuildTool(); diff --git a/qmake/generators/xmloutput.cpp b/qmake/generators/xmloutput.cpp index 9cd0995a92..80008cae8c 100644 --- a/qmake/generators/xmloutput.cpp +++ b/qmake/generators/xmloutput.cpp @@ -183,7 +183,7 @@ XmlOutput& XmlOutput::operator<<(const xml_output& o) addRaw(QString("</%1>").arg(o.xo_text)); break; case tValueTag: - addRaw(QString("%1").arg(doConversion(o.xo_text))); + addRaw(doConversion(o.xo_text)); setFormat(NoNewLine); closeTag(); setFormat(NewLine); diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 6fb9c05ae5..01f008c3cf 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -1037,7 +1037,7 @@ void QMakeEvaluator::loadDefaults() # endif #elif defined(Q_OS_UNIX) struct utsname name; - if (!uname(&name)) { + if (uname(&name) != -1) { vars[ProKey("QMAKE_HOST.os")] << ProString(name.sysname); vars[ProKey("QMAKE_HOST.name")] << ProString(QString::fromLocal8Bit(name.nodename)); vars[ProKey("QMAKE_HOST.version")] << ProString(name.release); diff --git a/qmake/qmake-docs.pro b/qmake/qmake-docs.pro new file mode 100644 index 0000000000..3123f7c5d8 --- /dev/null +++ b/qmake/qmake-docs.pro @@ -0,0 +1,2 @@ +TEMPLATE = aux +QMAKE_DOCS = $$PWD/doc/qmake.qdocconf diff --git a/qmake/qmake.pro b/qmake/qmake.pro index 0d92ac21ae..a81d0cdf77 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -1,7 +1,6 @@ -#This is a project file for building qmake, of course it presents a problem - -# it is very hard to make qmake build this, when qmake is the thing it builds, -#once you are boot strapped though, the qmake.pro will offer better coverage of a -#platform than either of the generic makefiles +# This project is not actually used to build qmake, but to support development +# with Qt Creator. The real build system is made up by the Makefile templates +# and the configures. option(host_build) CONFIG += console bootstrap diff --git a/qtbase.pro b/qtbase.pro index 6ab032e30f..d6726b5e93 100644 --- a/qtbase.pro +++ b/qtbase.pro @@ -4,6 +4,8 @@ load(qt_parts) +SUBDIRS += qmake/qmake-docs.pro + cross_compile: CONFIG += nostrip confclean.depends += clean diff --git a/src/3rdparty/pcre/patches/README b/src/3rdparty/pcre/patches/README new file mode 100644 index 0000000000..1d2bc389dd --- /dev/null +++ b/src/3rdparty/pcre/patches/README @@ -0,0 +1,3 @@ +These patches are landed in upstream PCRE (they're marked with +their SVN revision number). When upgrading PCRE remember check +if the version you're upgrading to already contains them or not. diff --git a/src/3rdparty/pcre/patches/r1340_fix_jit_on_android.patch b/src/3rdparty/pcre/patches/r1340_fix_jit_on_android.patch new file mode 100644 index 0000000000..41699d4882 --- /dev/null +++ b/src/3rdparty/pcre/patches/r1340_fix_jit_on_android.patch @@ -0,0 +1,18 @@ +Index: sljit/sljitConfigInternal.h +=================================================================== +--- sljit/sljitConfigInternal.h (revision 1339) ++++ sljit/sljitConfigInternal.h (working copy) +@@ -221,6 +221,13 @@ + #define SLJIT_CACHE_FLUSH(from, to) \ + sys_icache_invalidate((char*)(from), (char*)(to) - (char*)(from)) + ++#elif defined __ANDROID__ ++ ++/* Android lacks __clear_cache; instead, cacheflush should be used. */ ++ ++#define SLJIT_CACHE_FLUSH(from, to) \ ++ cacheflush((long)(from), (long)(to), 0) ++ + #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) + + /* The __clear_cache() implementation of GCC is a dummy function on PowerPC. */ diff --git a/src/3rdparty/pcre/sljit/sljitConfigInternal.h b/src/3rdparty/pcre/sljit/sljitConfigInternal.h index 2b6616ef66..bc945fbcab 100644 --- a/src/3rdparty/pcre/sljit/sljitConfigInternal.h +++ b/src/3rdparty/pcre/sljit/sljitConfigInternal.h @@ -217,6 +217,13 @@ #define SLJIT_CACHE_FLUSH(from, to) \ sys_icache_invalidate((char*)(from), (char*)(to) - (char*)(from)) +#elif defined __ANDROID__ + +/* Android lacks __clear_cache; instead, cacheflush should be used. */ + +#define SLJIT_CACHE_FLUSH(from, to) \ + cacheflush((long)(from), (long)(to), 0) + #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) /* The __clear_cache() implementation of GCC is a dummy function on PowerPC. */ diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index a80427893d..e01b448351 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -83,6 +83,8 @@ list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE) set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE) !!ENDIF +set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>) + !!IF contains(QT_CONFIG, reduce_exports) set(QT_VISIBILITY_AVAILABLE \"True\") !!ENDIF diff --git a/src/corelib/arch/qatomic_alpha.h b/src/corelib/arch/qatomic_alpha.h index 71cb112d47..5008a1acda 100644 --- a/src/corelib/arch/qatomic_alpha.h +++ b/src/corelib/arch/qatomic_alpha.h @@ -114,7 +114,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() inline bool QBasicAtomicInt::ref() { - register int old, tmp; + int old, tmp; asm volatile("1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ "addl %0,1,%1\n" /* tmp=old+1; */ @@ -131,7 +131,7 @@ inline bool QBasicAtomicInt::ref() inline bool QBasicAtomicInt::deref() { - register int old, tmp; + int old, tmp; asm volatile("1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ "subl %0,1,%1\n" /* tmp=old-1; */ @@ -148,7 +148,7 @@ inline bool QBasicAtomicInt::deref() inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) { - register int ret; + int ret; asm volatile("1:\n" "ldl_l %0,%1\n" /* ret=*ptr; */ "cmpeq %0,%2,%0\n"/* if (ret==expected) ret=0; else ret=1; */ @@ -167,7 +167,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) { - register int ret; + int ret; asm volatile("1:\n" "ldl_l %0,%1\n" /* ret=*ptr; */ "cmpeq %0,%2,%0\n"/* if (ret==expected) ret=0; else ret=1; */ @@ -187,7 +187,7 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) { - register int ret; + int ret; asm volatile("mb\n" "1:\n" "ldl_l %0,%1\n" /* ret=*ptr; */ @@ -207,7 +207,7 @@ inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) { - register int old, tmp; + int old, tmp; asm volatile("1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ "mov %3,%1\n" /* tmp=newval; */ @@ -224,7 +224,7 @@ inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) { - register int old, tmp; + int old, tmp; asm volatile("1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ "mov %3,%1\n" /* tmp=newval; */ @@ -242,7 +242,7 @@ inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) { - register int old, tmp; + int old, tmp; asm volatile("mb\n" "1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ @@ -260,7 +260,7 @@ inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) { - register int old, tmp; + int old, tmp; asm volatile("1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ "addl %0,%3,%1\n"/* tmp=old+value; */ @@ -277,7 +277,7 @@ inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) { - register int old, tmp; + int old, tmp; asm volatile("1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ "addl %0,%3,%1\n"/* tmp=old+value; */ @@ -295,7 +295,7 @@ inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) { - register int old, tmp; + int old, tmp; asm volatile("mb\n" "1:\n" "ldl_l %0,%2\n" /* old=*ptr; */ @@ -314,7 +314,7 @@ inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) { - register void *ret; + void *ret; asm volatile("1:\n" "ldq_l %0,%1\n" /* ret=*ptr; */ "cmpeq %0,%2,%0\n"/* if (ret==expected) tmp=0; else tmp=1; */ @@ -334,7 +334,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) { - register void *ret; + void *ret; asm volatile("1:\n" "ldq_l %0,%1\n" /* ret=*ptr; */ "cmpeq %0,%2,%0\n"/* if (ret==expected) tmp=0; else tmp=1; */ @@ -355,7 +355,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) { - register void *ret; + void *ret; asm volatile("mb\n" "1:\n" "ldq_l %0,%1\n" /* ret=*ptr; */ @@ -376,7 +376,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValu template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) { - register T *old, *tmp; + T *old, *tmp; asm volatile("1:\n" "ldq_l %0,%2\n" /* old=*ptr; */ "mov %3,%1\n" /* tmp=newval; */ @@ -394,7 +394,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) { - register T *old, *tmp; + T *old, *tmp; asm volatile("1:\n" "ldq_l %0,%2\n" /* old=*ptr; */ "mov %3,%1\n" /* tmp=newval; */ @@ -413,7 +413,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) { - register T *old, *tmp; + T *old, *tmp; asm volatile("mb\n" "1:\n" "ldq_l %0,%2\n" /* old=*ptr; */ @@ -432,7 +432,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) { - register T *old, *tmp; + T *old, *tmp; asm volatile("1:\n" "ldq_l %0,%2\n" /* old=*ptr; */ "addq %0,%3,%1\n"/* tmp=old+value; */ @@ -450,7 +450,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueTo template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) { - register T *old, *tmp; + T *old, *tmp; asm volatile("1:\n" "ldq_l %0,%2\n" /* old=*ptr; */ "addq %0,%3,%1\n"/* tmp=old+value; */ @@ -469,7 +469,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueTo template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) { - register T *old, *tmp; + T *old, *tmp; asm volatile("mb\n" "1:\n" "ldq_l %0,%2\n" /* old=*ptr; */ diff --git a/src/corelib/arch/qatomic_armv5.h b/src/corelib/arch/qatomic_armv5.h index e0a50b3c24..b583ec662c 100644 --- a/src/corelib/arch/qatomic_armv5.h +++ b/src/corelib/arch/qatomic_armv5.h @@ -114,8 +114,8 @@ template <typename T> struct QAtomicOps : QBasicAtomicOps<sizeof(T)> template<> template<typename T> inline bool QBasicAtomicOps<4>::ref(T &_q_value) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; do { originalValue = _q_value; newValue = originalValue + 1; @@ -126,8 +126,8 @@ bool QBasicAtomicOps<4>::ref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; do { originalValue = _q_value; newValue = originalValue - 1; @@ -138,7 +138,7 @@ bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { - register T originalValue; + T originalValue; do { originalValue = _q_value; if (originalValue != expectedValue) @@ -165,7 +165,7 @@ template<> template <typename T> inline T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { #if defined(__thumb__) - register T originalValue; + T originalValue; do { originalValue = _q_value; } while (_q_cmpxchg(originalValue, newValue, &_q_value) != 0); @@ -184,8 +184,8 @@ T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR template<> template <typename T> inline T QBasicAtomicOps<4>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; do { originalValue = _q_value; newValue = originalValue + valueToAdd; diff --git a/src/corelib/arch/qatomic_armv6.h b/src/corelib/arch/qatomic_armv6.h index 7f5939e391..08b2b02133 100644 --- a/src/corelib/arch/qatomic_armv6.h +++ b/src/corelib/arch/qatomic_armv6.h @@ -117,8 +117,8 @@ template <typename T> struct QAtomicOps : QBasicAtomicOps<sizeof(T)> template<> template<typename T> inline bool QBasicAtomicOps<4>::ref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrex %[newValue], [%[_q_value]]\n" "add %[newValue], %[newValue], #1\n" @@ -136,8 +136,8 @@ bool QBasicAtomicOps<4>::ref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrex %[newValue], [%[_q_value]]\n" "sub %[newValue], %[newValue], #1\n" @@ -155,7 +155,7 @@ bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { - register int result; + int result; asm volatile("0:\n" "ldrex %[result], [%[_q_value]]\n" "eors %[result], %[result], %[expectedValue]\n" @@ -175,8 +175,8 @@ bool QBasicAtomicOps<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa template<> template <typename T> inline T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { - register T originalValue; - register int result; + T originalValue; + int result; asm volatile("0:\n" "ldrex %[originalValue], [%[_q_value]]\n" "strex %[result], %[newValue], [%[_q_value]]\n" @@ -194,9 +194,9 @@ T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR template<> template <typename T> inline T QBasicAtomicOps<4>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; - register int result; + T originalValue; + T newValue; + int result; asm volatile("0:\n" "ldrex %[originalValue], [%[_q_value]]\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" @@ -256,8 +256,8 @@ template<> struct QAtomicIntegerTraits<char32_t> { enum { IsInteger = 1 }; }; template<> template<typename T> inline bool QBasicAtomicOps<1>::ref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrexb %[newValue], [%[_q_value]]\n" "add %[newValue], %[newValue], #1\n" @@ -275,8 +275,8 @@ bool QBasicAtomicOps<1>::ref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<1>::deref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrexb %[newValue], [%[_q_value]]\n" "sub %[newValue], %[newValue], #1\n" @@ -294,7 +294,7 @@ bool QBasicAtomicOps<1>::deref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<1>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { - register T result; + T result; asm volatile("0:\n" "ldrexb %[result], [%[_q_value]]\n" "eors %[result], %[result], %[expectedValue]\n" @@ -314,8 +314,8 @@ bool QBasicAtomicOps<1>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa template<> template <typename T> inline T QBasicAtomicOps<1>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { - register T originalValue; - register int result; + T originalValue; + int result; asm volatile("0:\n" "ldrexb %[originalValue], [%[_q_value]]\n" "strexb %[result], %[newValue], [%[_q_value]]\n" @@ -333,9 +333,9 @@ T QBasicAtomicOps<1>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR template<> template <typename T> inline T QBasicAtomicOps<1>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; - register int result; + T originalValue; + T newValue; + int result; asm volatile("0:\n" "ldrexb %[originalValue], [%[_q_value]]\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" @@ -355,8 +355,8 @@ T QBasicAtomicOps<1>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveTy template<> template<typename T> inline bool QBasicAtomicOps<2>::ref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrexh %[newValue], [%[_q_value]]\n" "add %[newValue], %[newValue], #1\n" @@ -374,8 +374,8 @@ bool QBasicAtomicOps<2>::ref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<2>::deref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrexh %[newValue], [%[_q_value]]\n" "sub %[newValue], %[newValue], #1\n" @@ -393,7 +393,7 @@ bool QBasicAtomicOps<2>::deref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { - register T result; + T result; asm volatile("0:\n" "ldrexh %[result], [%[_q_value]]\n" "eors %[result], %[result], %[expectedValue]\n" @@ -413,8 +413,8 @@ bool QBasicAtomicOps<2>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa template<> template <typename T> inline T QBasicAtomicOps<2>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { - register T originalValue; - register int result; + T originalValue; + int result; asm volatile("0:\n" "ldrexh %[originalValue], [%[_q_value]]\n" "strexh %[result], %[newValue], [%[_q_value]]\n" @@ -432,9 +432,9 @@ T QBasicAtomicOps<2>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR template<> template <typename T> inline T QBasicAtomicOps<2>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; - register int result; + T originalValue; + T newValue; + int result; asm volatile("0:\n" "ldrexh %[originalValue], [%[_q_value]]\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" @@ -462,8 +462,8 @@ T QBasicAtomicOps<2>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveTy template<> template<typename T> inline bool QBasicAtomicOps<8>::ref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrexd %[newValue], %H[newValue], [%[_q_value]]\n" "adds %Q[newValue], %Q[newValue], #1\n" @@ -482,8 +482,8 @@ bool QBasicAtomicOps<8>::ref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<8>::deref(T &_q_value) Q_DECL_NOTHROW { - register T newValue; - register int result; + T newValue; + int result; asm volatile("0:\n" "ldrexd %[newValue], %H[newValue], [%[_q_value]]\n" "subs %Q[newValue], %Q[newValue], #1\n" @@ -502,7 +502,7 @@ bool QBasicAtomicOps<8>::deref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { - register T result; + T result; asm volatile("0:\n" "ldrexd %[result], %H[result], [%[_q_value]]\n" "eor %[result], %[result], %[expectedValue]\n" @@ -524,8 +524,8 @@ bool QBasicAtomicOps<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa template<> template <typename T> inline T QBasicAtomicOps<8>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { - register T originalValue; - register int result; + T originalValue; + int result; asm volatile("0:\n" "ldrexd %[originalValue], %H[originalValue], [%[_q_value]]\n" "strexd %[result], %[newValue], %H[newValue], [%[_q_value]]\n" @@ -543,9 +543,9 @@ T QBasicAtomicOps<8>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR template<> template <typename T> inline T QBasicAtomicOps<8>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; - register int result; + T originalValue; + T newValue; + int result; asm volatile("0:\n" "ldrexd %[originalValue], %H[originalValue], [%[_q_value]]\n" "adds %Q[newValue], %Q[originalValue], %Q[valueToAdd]\n" @@ -588,8 +588,8 @@ T QBasicAtomicOps<8>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveTy inline bool QBasicAtomicInt::ref() Q_DECL_NOTHROW { - register int newValue; - register int result; + int newValue; + int result; retry: __asm { ldrex newValue, [&_q_value] @@ -603,8 +603,8 @@ inline bool QBasicAtomicInt::ref() Q_DECL_NOTHROW inline bool QBasicAtomicInt::deref() Q_DECL_NOTHROW { - register int newValue; - register int result; + int newValue; + int result; retry: __asm { ldrex newValue, [&_q_value] @@ -618,7 +618,7 @@ inline bool QBasicAtomicInt::deref() Q_DECL_NOTHROW inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) Q_DECL_NOTHROW { - register int result; + int result; retry: __asm { ldrex result, [&_q_value] @@ -632,8 +632,8 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) Q_DECL_NOTHROW { - register int originalValue; - register int result; + int originalValue; + int result; retry: __asm { ldrex originalValue, [&_q_value] @@ -646,9 +646,9 @@ inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) Q_DECL_NOTHROW inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) Q_DECL_NOTHROW { - register int originalValue; - register int newValue; - register int result; + int originalValue; + int newValue; + int result; retry: __asm { ldrex originalValue, [&_q_value] @@ -663,7 +663,7 @@ inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) Q_DECL_NOTHROW template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) Q_DECL_NOTHROW { - register T *result; + T *result; retry: __asm { ldrex result, [&_q_value] @@ -678,8 +678,8 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) Q_DECL_NOTHROW { - register T *originalValue; - register int result; + T *originalValue; + int result; retry: __asm { ldrex originalValue, [&_q_value] @@ -693,9 +693,9 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) Q template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) Q_DECL_NOTHROW { - register T *originalValue; - register T *newValue; - register int result; + T *originalValue; + T *newValue; + int result; retry: __asm { ldrex originalValue, [&_q_value] diff --git a/src/corelib/arch/qatomic_ia64.h b/src/corelib/arch/qatomic_ia64.h index ed72036076..98937c7551 100644 --- a/src/corelib/arch/qatomic_ia64.h +++ b/src/corelib/arch/qatomic_ia64.h @@ -192,7 +192,7 @@ template <typename T> struct QAtomicOps : QBasicAtomicOps<sizeof(T)> typedef T Type; }; -inline bool _q_ia64_fetchadd_immediate(register int value) +inline bool _q_ia64_fetchadd_immediate(int value) { return value == 1 || value == -1 || value == 4 || value == -4 @@ -218,7 +218,7 @@ inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) { - register int expectedValueCopy = expectedValue; + int expectedValueCopy = expectedValue; return (static_cast<int>(_InterlockedCompareExchange(&_q_value, newValue, expectedValueCopy)) @@ -227,7 +227,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) { - register int expectedValueCopy = expectedValue; + int expectedValueCopy = expectedValue; return (static_cast<int>(_InterlockedCompareExchange_acq(reinterpret_cast<volatile uint *>(&_q_value), newValue, expectedValueCopy)) @@ -236,7 +236,7 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) { - register int expectedValueCopy = expectedValue; + int expectedValueCopy = expectedValue; return (static_cast<int>(_InterlockedCompareExchange_rel(reinterpret_cast<volatile uint *>(&_q_value), newValue, expectedValueCopy)) @@ -285,7 +285,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) { - register T *expectedValueCopy = expectedValue; + T *expectedValueCopy = expectedValue; return (_InterlockedCompareExchangePointer(reinterpret_cast<void * volatile*>(&_q_value), newValue, expectedValueCopy) @@ -300,7 +300,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu volatile unsigned long *p; }; x = &_q_value; - register T *expectedValueCopy = expectedValue; + T *expectedValueCopy = expectedValue; return (_InterlockedCompareExchange64_acq(p, quintptr(newValue), quintptr(expectedValueCopy)) == quintptr(expectedValue)); } @@ -313,7 +313,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValu volatile unsigned long *p; }; x = &_q_value; - register T *expectedValueCopy = expectedValue; + T *expectedValueCopy = expectedValue; return (_InterlockedCompareExchange64_rel(p, quintptr(newValue), quintptr(expectedValueCopy)) == quintptr(expectedValue)); } @@ -912,7 +912,7 @@ T QBasicAtomicOps<1>::fetchAndAddAcquire(T &_q_value, typename QAtomicAdditiveTy { valueToAdd *= QAtomicAdditiveType<T>::AddScale; // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint8)old, FENCE); @@ -926,7 +926,7 @@ template<> template <typename T> inline T QBasicAtomicOps<1>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint8)old, FENCE); @@ -941,7 +941,7 @@ T QBasicAtomicOps<2>::fetchAndAddAcquire(T &_q_value, typename QAtomicAdditiveTy { valueToAdd *= QAtomicAdditiveType<T>::AddScale; // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint16)old, FENCE); @@ -955,7 +955,7 @@ template<> template <typename T> inline T QBasicAtomicOps<2>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint16)old, FENCE); @@ -970,7 +970,7 @@ T QBasicAtomicOps<4>::fetchAndAddAcquire(T &_q_value, typename QAtomicAdditiveTy { valueToAdd *= QAtomicAdditiveType<T>::AddScale; // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (unsigned)old, FENCE); @@ -984,7 +984,7 @@ template<> template <typename T> inline T QBasicAtomicOps<4>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (unsigned)old, FENCE); @@ -999,7 +999,7 @@ T QBasicAtomicOps<8>::fetchAndAddAcquire(T &_q_value, typename QAtomicAdditiveTy { valueToAdd *= QAtomicAdditiveType<T>::AddScale; // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint64)old, FENCE); @@ -1013,7 +1013,7 @@ template<> template <typename T> inline T QBasicAtomicOps<8>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { // implement the test-and-set loop - register T old, ret; + T old, ret; do { old = _q_value; _Asm_mov_to_ar((_Asm_app_reg)_AREG_CCV, (quint64)old, FENCE); diff --git a/src/corelib/arch/qatomic_mips.h b/src/corelib/arch/qatomic_mips.h index 7716750332..6eb9613e31 100644 --- a/src/corelib/arch/qatomic_mips.h +++ b/src/corelib/arch/qatomic_mips.h @@ -137,8 +137,8 @@ void QBasicAtomicOps<size>::orderedMemoryFence(const T &) Q_DECL_NOTHROW template<> template<typename T> inline bool QBasicAtomicOps<4>::ref(T &_q_value) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; asm volatile("0:\n" "ll %[originalValue], %[_q_value]\n" "addiu %[newValue], %[originalValue], %[one]\n" @@ -156,8 +156,8 @@ bool QBasicAtomicOps<4>::ref(T &_q_value) Q_DECL_NOTHROW template<> template<typename T> inline bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; asm volatile("0:\n" "ll %[originalValue], %[_q_value]\n" "addiu %[newValue], %[originalValue], %[minusOne]\n" @@ -175,8 +175,8 @@ bool QBasicAtomicOps<4>::deref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { - register T result; - register T tempValue; + T result; + T tempValue; asm volatile("0:\n" "ll %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" @@ -199,8 +199,8 @@ bool QBasicAtomicOps<4>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa template<> template <typename T> inline T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { - register T originalValue; - register T tempValue; + T originalValue; + T tempValue; asm volatile("0:\n" "ll %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" @@ -218,8 +218,8 @@ T QBasicAtomicOps<4>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR template<> template <typename T> inline T QBasicAtomicOps<4>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; asm volatile("0:\n" "ll %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" @@ -254,8 +254,8 @@ template<> struct QAtomicIntegerTraits<char32_t> { enum { IsInteger = 1 }; }; template<> template<typename T> inline bool QBasicAtomicOps<8>::ref(T &_q_value) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; asm volatile("0:\n" "lld %[originalValue], %[_q_value]\n" "addiu %[newValue], %[originalValue], %[one]\n" @@ -273,8 +273,8 @@ bool QBasicAtomicOps<8>::ref(T &_q_value) Q_DECL_NOTHROW template<> template<typename T> inline bool QBasicAtomicOps<8>::deref(T &_q_value) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; asm volatile("0:\n" "lld %[originalValue], %[_q_value]\n" "addiu %[newValue], %[originalValue], %[minusOne]\n" @@ -292,8 +292,8 @@ bool QBasicAtomicOps<8>::deref(T &_q_value) Q_DECL_NOTHROW template<> template <typename T> inline bool QBasicAtomicOps<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newValue) Q_DECL_NOTHROW { - register T result; - register T tempValue; + T result; + T tempValue; asm volatile("0:\n" "lld %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" @@ -316,8 +316,8 @@ bool QBasicAtomicOps<8>::testAndSetRelaxed(T &_q_value, T expectedValue, T newVa template<> template <typename T> inline T QBasicAtomicOps<8>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHROW { - register T originalValue; - register T tempValue; + T originalValue; + T tempValue; asm volatile("0:\n" "lld %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" @@ -335,8 +335,8 @@ T QBasicAtomicOps<8>::fetchAndStoreRelaxed(T &_q_value, T newValue) Q_DECL_NOTHR template<> template <typename T> inline T QBasicAtomicOps<8>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveType<T>::AdditiveT valueToAdd) Q_DECL_NOTHROW { - register T originalValue; - register T newValue; + T originalValue; + T newValue; asm volatile("0:\n" "lld %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" diff --git a/src/corelib/arch/qatomic_power.h b/src/corelib/arch/qatomic_power.h index ad1c619d56..3ddd303795 100644 --- a/src/corelib/arch/qatomic_power.h +++ b/src/corelib/arch/qatomic_power.h @@ -124,8 +124,8 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() inline bool QBasicAtomicInt::ref() { - register int originalValue; - register int newValue; + int originalValue; + int newValue; asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" "addi %[newValue], %[originalValue], %[one]\n" "stwcx. %[newValue]," _Q_VALUE "\n" @@ -141,8 +141,8 @@ inline bool QBasicAtomicInt::ref() inline bool QBasicAtomicInt::deref() { - register int originalValue; - register int newValue; + int originalValue; + int newValue; asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" "addi %[newValue], %[originalValue], %[minusOne]\n" "stwcx. %[newValue]," _Q_VALUE "\n" @@ -158,7 +158,7 @@ inline bool QBasicAtomicInt::deref() inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) { - register int result; + int result; asm volatile("lwarx %[result]," _Q_VALUE "\n" "xor. %[result], %[result], %[expectedValue]\n" "bne $+12\n" @@ -175,7 +175,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) { - register int result; + int result; asm volatile("lwarx %[result]," _Q_VALUE "\n" "xor. %[result], %[result], %[expectedValue]\n" "bne $+16\n" @@ -193,7 +193,7 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) { - register int result; + int result; asm volatile("eieio\n" "lwarx %[result]," _Q_VALUE "\n" "xor. %[result], %[result], %[expectedValue]\n" @@ -211,7 +211,7 @@ inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) { - register int originalValue; + int originalValue; asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" "stwcx. %[newValue]," _Q_VALUE "\n" "bne- $-8\n" @@ -225,7 +225,7 @@ inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) { - register int originalValue; + int originalValue; asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" "stwcx. %[newValue]," _Q_VALUE "\n" "bne- $-8\n" @@ -240,7 +240,7 @@ inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) { - register int originalValue; + int originalValue; asm volatile("eieio\n" "lwarx %[originalValue]," _Q_VALUE "\n" "stwcx. %[newValue]," _Q_VALUE "\n" @@ -255,8 +255,8 @@ inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) { - register int originalValue; - register int newValue; + int originalValue; + int newValue; asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" "stwcx. %[newValue]," _Q_VALUE "\n" @@ -272,8 +272,8 @@ inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) { - register int originalValue; - register int newValue; + int originalValue; + int newValue; asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" "stwcx. %[newValue]," _Q_VALUE "\n" @@ -290,8 +290,8 @@ inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) { - register int originalValue; - register int newValue; + int originalValue; + int newValue; asm volatile("eieio\n" "lwarx %[originalValue]," _Q_VALUE "\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" @@ -317,7 +317,7 @@ inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) { - register void *result; + void *result; asm volatile(LPARX" %[result]," _Q_VALUE "\n" "xor. %[result], %[result], %[expectedValue]\n" "bne $+12\n" @@ -335,7 +335,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) { - register void *result; + void *result; asm volatile(LPARX" %[result]," _Q_VALUE "\n" "xor. %[result], %[result], %[expectedValue]\n" "bne $+16\n" @@ -354,7 +354,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) { - register void *result; + void *result; asm volatile("eieio\n" LPARX" %[result]," _Q_VALUE "\n" "xor. %[result], %[result], %[expectedValue]\n" @@ -373,7 +373,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValu template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) { - register T *originalValue; + T *originalValue; asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" STPCX" %[newValue]," _Q_VALUE "\n" "bne- $-8\n" @@ -388,7 +388,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) { - register T *originalValue; + T *originalValue; asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" STPCX" %[newValue]," _Q_VALUE "\n" "bne- $-8\n" @@ -404,7 +404,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) { - register T *originalValue; + T *originalValue; asm volatile("eieio\n" LPARX" %[originalValue]," _Q_VALUE "\n" STPCX" %[newValue]," _Q_VALUE "\n" @@ -420,8 +420,8 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) { - register T *originalValue; - register T *newValue; + T *originalValue; + T *newValue; asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" STPCX" %[newValue]," _Q_VALUE "\n" @@ -438,8 +438,8 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueTo template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) { - register T *originalValue; - register T *newValue; + T *originalValue; + T *newValue; asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" STPCX" %[newValue]," _Q_VALUE "\n" @@ -457,8 +457,8 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueTo template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) { - register T *originalValue; - register T *newValue; + T *originalValue; + T *newValue; asm volatile("eieio\n" LPARX" %[originalValue]," _Q_VALUE "\n" "add %[newValue], %[originalValue], %[valueToAdd]\n" diff --git a/src/corelib/arch/qatomic_sh4a.h b/src/corelib/arch/qatomic_sh4a.h index 08f75e44f2..6e59279f3e 100644 --- a/src/corelib/arch/qatomic_sh4a.h +++ b/src/corelib/arch/qatomic_sh4a.h @@ -147,7 +147,7 @@ inline bool QBasicAtomicInt::deref() inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) { - register int result; + int result; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "xor %[expectedValue], r0\n" @@ -169,7 +169,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) { - register int result; + int result; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "xor %[expectedValue], r0\n" @@ -192,7 +192,7 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) { - register int result; + int result; asm volatile("synco\n" "0:\n" "movli.l @%[_q_value], r0\n" @@ -220,7 +220,7 @@ inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) { - register int originalValue; + int originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -237,7 +237,7 @@ inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) { - register int originalValue; + int originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -255,7 +255,7 @@ inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) { - register int originalValue; + int originalValue; asm volatile("synco\n" "0:\n" "movli.l @%[_q_value], r0\n" @@ -278,7 +278,7 @@ inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) { - register int originalValue; + int originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -295,7 +295,7 @@ inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) { - register int originalValue; + int originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -313,7 +313,7 @@ inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) { - register int originalValue; + int originalValue; asm volatile("synco\n" "0:\n" "movli.l @%[_q_value], r0\n" @@ -337,7 +337,7 @@ inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) { - register T *result; + T *result; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "xor %[expectedValue], r0\n" @@ -360,7 +360,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) { - register T *result; + T *result; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "xor %[expectedValue], r0\n" @@ -384,7 +384,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu template <typename T> Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) { - register T *result; + T *result; asm volatile("synco\n" "0:\n" "movli.l @%[_q_value], r0\n" @@ -414,7 +414,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValu template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) { - register T *originalValue; + T *originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -432,7 +432,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) { - register T *originalValue; + T *originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -451,7 +451,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) { - register T *originalValue; + T *originalValue; asm volatile("synco\n" "0:\n" "movli.l @%[_q_value], r0\n" @@ -476,7 +476,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) { - register T *originalValue; + T *originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -494,7 +494,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueTo template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) { - register T *originalValue; + T *originalValue; asm volatile("0:\n" "movli.l @%[_q_value], r0\n" "mov r0, %[originalValue]\n" @@ -513,7 +513,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueTo template <typename T> Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) { - register T *originalValue; + T *originalValue; asm volatile("synco\n" "0:\n" "movli.l @%[_q_value], r0\n" diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 1cedd3a28d..4ed7b00e53 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -99,9 +99,9 @@ Q_GLOBAL_STATIC_WITH_ARGS(QMutex, textCodecsMutex, (QMutex::Recursive)); QMutex *qTextCodecsMutex() { return textCodecsMutex(); } #if !defined(QT_USE_ICU) -static char qtolower(register char c) +static char qtolower(char c) { if (c >= 'A' && c <= 'Z') return c + 0x20; return c; } -static bool qisalnum(register char c) +static bool qisalnum(char c) { return (c >= '0' && c <= '9') || ((c | 0x20) >= 'a' && (c | 0x20) <= 'z'); } bool qTextCodecNameMatch(const char *n, const char *h) diff --git a/src/corelib/codecs/qtextcodec_p.h b/src/corelib/codecs/qtextcodec_p.h index 0fec1e80c7..00c067821e 100644 --- a/src/corelib/codecs/qtextcodec_p.h +++ b/src/corelib/codecs/qtextcodec_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_TEXTCODEC -#if defined(Q_OS_MAC) || defined(Q_OS_IOS) || defined(Q_OS_ANDROID) || defined(Q_OS_QNX) +#if defined(Q_OS_MAC) || defined(Q_OS_ANDROID) || defined(Q_OS_QNX) #define QT_LOCALE_IS_UTF8 #endif diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 0a5cc04a17..44a3f06f50 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -58,7 +58,7 @@ QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtCore.dynlist contains(DEFINES,QT_EVAL):include(eval.pri) -HOST_BINS = $$[QT_HOST_BINS/raw] +HOST_BINS = $$[QT_HOST_BINS] host_bins.name = host_bins host_bins.variable = HOST_BINS diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index f2e5dc7633..2cadea59c1 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -311,6 +311,11 @@ #define QT_NO_LOCALSERVER #endif +// QPdf +#if !defined(QT_NO_PDF) && (defined(QT_NO_TEMPORARYFILE)) +#define QT_NO_PDF +#endif + // QMenu #if !defined(QT_NO_MENU) && (defined(QT_NO_ACTION)) #define QT_NO_MENU @@ -386,11 +391,6 @@ #define QT_NO_CONTEXTMENU #endif -// Qt D-Bus module -#if !defined(QT_NO_DBUS) && (defined(QT_NO_PROPERTIES) || defined(QT_NO_DOM)) -#define QT_NO_DBUS -#endif - // QPrinter #if !defined(QT_NO_PRINTER) && (defined(QT_NO_PICTURE) || defined(QT_NO_TEMPORARYFILE)) #define QT_NO_PRINTER @@ -446,6 +446,11 @@ #define QT_NO_BEARERMANAGEMENT #endif +// Qt D-Bus module +#if !defined(QT_NO_DBUS) && (defined(QT_NO_PROPERTIES) || defined(QT_NO_XMLSTREAMREADER)) +#define QT_NO_DBUS +#endif + // QGraphicsView #if !defined(QT_NO_GRAPHICSVIEW) && (defined(QT_NO_SCROLLAREA)) #define QT_NO_GRAPHICSVIEW diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 43db585643..814e95c256 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -851,6 +851,13 @@ Requires: Name: Color Names SeeAlso: ??? +Feature: PDF +Description: Supports pdf format +Section: Painting +Requires: TEMPORARYFILE +Name: QPdf +SeeAlso: ??? + Feature: PRINTER Description: Supports printing Section: Painting @@ -1095,7 +1102,7 @@ SeeAlso: ??? Feature: DBUS Description: Provides classes for D-Bus. Section: D-Bus -Requires: PROPERTIES DOM +Requires: PROPERTIES XMLSTREAMREADER Name: Qt D-Bus module SeeAlso: ??? diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 7a00e4eb32..c085dbaa4d 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -511,7 +511,7 @@ Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n); the application is compiled using Forte Developer, or Sun Studio C++. The header file also declares a range of macros (Q_OS_*) that are defined for the specified platforms. For example, - Q_OS_X11 which is defined for the X Window System. + Q_OS_UNIX which is defined for the Unix-based systems. The purpose of these macros is to enable programmers to add compiler or platform specific code to their application. @@ -1696,7 +1696,7 @@ Q_CORE_EXPORT QString qt_mac_from_pascal_string(const Str255 pstr) { QSysInfo::MacVersion QSysInfo::macVersion() { -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX SInt32 gestalt_version; if (Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) { return QSysInfo::MacVersion(((gestalt_version & 0x00F0) >> 4) + 2); diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 79e32fe793..4e63e5d0ba 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -45,11 +45,11 @@ #include <stddef.h> -#define QT_VERSION_STR "5.1.0" +#define QT_VERSION_STR "5.1.1" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x050100 +#define QT_VERSION 0x050101 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index c8293beb4e..a37fc15b61 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -501,7 +501,7 @@ Q_AUTOTEST_EXPORT QByteArray qCleanupFuncinfo(QByteArray info) templatecount = 1; --pos; while (pos && templatecount) { - register char c = info.at(pos); + char c = info.at(pos); if (c == '>') ++templatecount; else if (c == '<') @@ -917,21 +917,19 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex static void qt_message_fatal(QtMsgType, const QMessageLogContext &context, const QString &message) { #if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR) - wchar_t contextFileL[256]; - // we probably should let the compiler do this for us, by - // declaring QMessageLogContext::file to be const wchar_t * in - // the first place, but the #ifdefery above is very complex - // and we wouldn't be able to change it later on... - convert_to_wchar_t_elided(contextFileL, sizeof contextFileL / sizeof *contextFileL, context.file); + wchar_t contextFileL[256]; + // we probably should let the compiler do this for us, by declaring QMessageLogContext::file to + // be const wchar_t * in the first place, but the #ifdefery above is very complex and we + // wouldn't be able to change it later on... + convert_to_wchar_t_elided(contextFileL, sizeof contextFileL / sizeof *contextFileL, + context.file); // get the current report mode int reportMode = _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_WNDW); _CrtSetReportMode(_CRT_ERROR, reportMode); - int ret = _CrtDbgReportW(_CRT_ERROR, contextFileL, - context.line, _CRT_WIDE(QT_VERSION_STR), - reinterpret_cast<const wchar_t *> ( - message.utf16())); - if (ret == 0 && reportMode & _CRTDBG_MODE_WNDW) + int ret = _CrtDbgReportW(_CRT_ERROR, contextFileL, context.line, _CRT_WIDE(QT_VERSION_STR), + reinterpret_cast<const wchar_t *>(message.utf16())); + if ((ret == 0) && (reportMode & _CRTDBG_MODE_WNDW)) return; // ignore else if (ret == 1) _CrtDbgBreak(); diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index 8e34c9792d..58736ac2b8 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -110,7 +110,7 @@ public: To create a proper QTypeInfo specialization for A struct, we have to check all sub-components; B, C and D, then take the lowest common denominator and call - Q_DECLATE_TYPEINFO with the resulting flags. An easier and less fragile approach is to + Q_DECLARE_TYPEINFO with the resulting flags. An easier and less fragile approach is to use QTypeInfoMerger, which does that automatically. So struct A would have the following QTypeInfo definition: diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index 18f3404c5d..024af79c33 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -220,7 +220,7 @@ QT_BEGIN_NAMESPACE QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create(QObject *parent) { - register int fd = -1; + int fd = -1; #ifdef IN_CLOEXEC fd = inotify_init1(IN_CLOEXEC); #endif diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index fca1a446ce..2b38019674 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -255,6 +255,7 @@ qint64 QFSFileEnginePrivate::nativeSize() const if (!filled) { thatQ->setError(QFile::UnspecifiedError, qt_error_string(errno)); + return 0; } return metaData.size(); } diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index ed3b399fbf..db81d65565 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -45,6 +45,7 @@ #include "QtCore/qcoreapplication.h" #include "QtCore/qfileinfo.h" #include "QtCore/qdebug.h" +#include "QtCore/qdatetime.h" #include "private/qcore_unix_p.h" // qt_safe_open #include "private/qabstractfileengine_p.h" @@ -80,12 +81,13 @@ static qint64 qt_write_loop(int fd, const char *data, qint64 len) int QLockFilePrivate::checkFcntlWorksAfterFlock() { +#ifndef QT_NO_TEMPORARYFILE QTemporaryFile file; if (!file.open()) - return -2; + return 0; const int fd = file.d_func()->engine()->handle(); if (flock(fd, LOCK_EX | LOCK_NB) == -1) // other threads, and other processes on a local fs - return -3; + return 0; struct flock flockData; flockData.l_type = F_WRLCK; flockData.l_whence = SEEK_SET; @@ -95,6 +97,9 @@ int QLockFilePrivate::checkFcntlWorksAfterFlock() if (fcntl(fd, F_SETLK, &flockData) == -1) // for networked filesystems return 0; return 1; +#else + return 0; +#endif } static QBasicAtomicInt fcntlOK = Q_BASIC_ATOMIC_INITIALIZER(-1); diff --git a/src/corelib/io/qsavefile.cpp b/src/corelib/io/qsavefile.cpp index f8b5ebcabd..5ed429c464 100644 --- a/src/corelib/io/qsavefile.cpp +++ b/src/corelib/io/qsavefile.cpp @@ -39,8 +39,11 @@ ** ****************************************************************************/ -#include "qplatformdefs.h" #include "qsavefile.h" + +#ifndef QT_NO_TEMPORARYFILE + +#include "qplatformdefs.h" #include "private/qsavefile_p.h" #include "qfileinfo.h" #include "qabstractfileengine_p.h" @@ -381,3 +384,5 @@ bool QSaveFile::directWriteFallback() const } QT_END_NAMESPACE + +#endif // QT_NO_TEMPORARYFILE diff --git a/src/corelib/io/qsavefile.h b/src/corelib/io/qsavefile.h index 6d81f58d42..ad18417124 100644 --- a/src/corelib/io/qsavefile.h +++ b/src/corelib/io/qsavefile.h @@ -42,6 +42,10 @@ #ifndef QSAVEFILE_H #define QSAVEFILE_H +#include <QtCore/qglobal.h> + +#ifndef QT_NO_TEMPORARYFILE + #include <QtCore/qfiledevice.h> #include <QtCore/qstring.h> @@ -51,7 +55,6 @@ QT_BEGIN_NAMESPACE - class QAbstractFileEngine; class QSaveFilePrivate; @@ -90,4 +93,6 @@ private: QT_END_NAMESPACE +#endif // QT_NO_TEMPORARYFILE + #endif // QSAVEFILE_H diff --git a/src/corelib/io/qsavefile_p.h b/src/corelib/io/qsavefile_p.h index 53a8b5eb34..b9efd1ee7c 100644 --- a/src/corelib/io/qsavefile_p.h +++ b/src/corelib/io/qsavefile_p.h @@ -53,6 +53,10 @@ // We mean it. // +#include <QtCore/qglobal.h> + +#ifndef QT_NO_TEMPORARYFILE + #include "private/qfiledevice_p.h" QT_BEGIN_NAMESPACE @@ -75,4 +79,6 @@ protected: QT_END_NAMESPACE +#endif // QT_NO_TEMPORARYFILE + #endif // QSAVEFILE_P_H diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h index d274f60ecc..fe637c8dfd 100644 --- a/src/corelib/io/qtemporaryfile_p.h +++ b/src/corelib/io/qtemporaryfile_p.h @@ -42,6 +42,10 @@ #ifndef QTEMPORARYFILE_P_H #define QTEMPORARYFILE_P_H +#include <QtCore/qglobal.h> + +#ifndef QT_NO_TEMPORARYFILE + #include "private/qfsfileengine_p.h" #include "private/qfilesystemengine_p.h" #include "private/qfile_p.h" @@ -99,5 +103,7 @@ public: QT_END_NAMESPACE +#endif // QT_NO_TEMPORARYFILE + #endif /* QTEMPORARYFILE_P_H */ diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 02e7b967ea..f2e1f9bbc7 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -882,7 +882,7 @@ inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetErro // schemes are ASCII only, so we don't need the full Unicode toLower QChar *schemeData = scheme.data(); // force detaching here for (int i = needsLowercasing; i >= 0; --i) { - register ushort c = schemeData[i].unicode(); + ushort c = schemeData[i].unicode(); if (c >= 'A' && c <= 'Z') schemeData[i] = c + 0x20; } @@ -1244,7 +1244,7 @@ inline void QUrlPrivate::parse(const QString &url, QUrl::ParsingMode parsingMode const ushort *const data = reinterpret_cast<const ushort *>(begin); for (int i = 0; i < len; ++i) { - register uint uc = data[i]; + uint uc = data[i]; if (uc == '#' && hash == -1) { hash = i; @@ -1472,7 +1472,7 @@ inline QUrlPrivate::ErrorCode QUrlPrivate::validityError(QString *source, int *p // check for a path of "text:text/" for (int i = 0; i < path.length(); ++i) { - register ushort c = path.at(i).unicode(); + ushort c = path.at(i).unicode(); if (c == '/') { // found the slash before the colon return NoError; @@ -1512,7 +1512,7 @@ bool QUrlPrivate::validateComponent(QUrlPrivate::Section section, const QString const ushort *const data = reinterpret_cast<const ushort *>(input.constData()); for (uint i = uint(begin); i < uint(end); ++i) { - register uint uc = data[i]; + uint uc = data[i]; if (uc >= 0x80) continue; diff --git a/src/corelib/io/qurlidna.cpp b/src/corelib/io/qurlidna.cpp index fac1703da8..70db9e09eb 100644 --- a/src/corelib/io/qurlidna.cpp +++ b/src/corelib/io/qurlidna.cpp @@ -1468,11 +1468,12 @@ static void mapToLowerCase(QString *str, int from) int l = 1; while (l < 4 && entry->mapping[l]) ++l; - if (l > 1) { + if (l > 1 || uc > 0xffff) { if (uc <= 0xffff) str->replace(i, 1, reinterpret_cast<const QChar *>(&entry->mapping[0]), l); else - str->replace(i-1, 2, reinterpret_cast<const QChar *>(&entry->mapping[0]), l); + str->replace(--i, 2, reinterpret_cast<const QChar *>(&entry->mapping[0]), l); + i += l - 1; d = 0; } else { if (!d) @@ -1501,18 +1502,20 @@ static bool isMappedToNothing(uint uc) } -static void stripProhibitedOutput(QString *str, int from) +static bool containsProhibitedOuptut(const QString *str, int from) { - ushort *out = (ushort *)str->data() + from; - const ushort *in = out; + const ushort *in = reinterpret_cast<const ushort *>(str->begin() + from); const ushort *end = (ushort *)str->data() + str->size(); - while (in < end) { + for ( ; in < end; ++in) { uint uc = *in; if (QChar(uc).isHighSurrogate() && in < end - 1) { ushort low = *(in + 1); if (QChar(low).isLowSurrogate()) { ++in; uc = QChar::surrogateToUcs4(uc, low); + } else { + // unpaired surrogates are prohibited + return true; } } if (uc <= 0xFFFF) { @@ -1537,7 +1540,7 @@ static void stripProhibitedOutput(QString *str, int from) || (uc >= 0xFDD0 && uc <= 0xFDEF) || uc == 0xFEFF || (uc >= 0xFFF9 && uc <= 0xFFFF))) { - *out++ = *in; + continue; } } else { if (!((uc >= 0x1D173 && uc <= 0x1D17A) @@ -1561,14 +1564,12 @@ static void stripProhibitedOutput(QString *str, int from) || (uc >= 0xFFFFE && uc <= 0xFFFFF) || (uc >= 0x100000 && uc <= 0x10FFFD) || (uc >= 0x10FFFE && uc <= 0x10FFFF))) { - *out++ = QChar::highSurrogate(uc); - *out++ = QChar::lowSurrogate(uc); + continue; } } - ++in; + return true; } - if (in != out) - str->truncate(out - str->utf16()); + return false; } static bool isBidirectionalRorAL(uint uc) @@ -2027,8 +2028,8 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) const QChar *e = src + source->size(); for ( ; out < e; ++out) { - register ushort uc = out->unicode(); - if (uc > 0x80) { + ushort uc = out->unicode(); + if (uc >= 0x80) { break; } else if (uc >= 'A' && uc <= 'Z') { *out = QChar(uc | 0x20); @@ -2065,8 +2066,8 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) if (uc <= 0xFFFF) { *out++ = *in; } else { - *out++ = QChar::highSurrogate(uc); - *out++ = QChar::lowSurrogate(uc); + *out++ = in[-1]; + *out++ = in[0]; } } } @@ -2083,7 +2084,10 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) firstNonAscii > from ? firstNonAscii - 1 : from); // Strip prohibited output - stripProhibitedOutput(source, firstNonAscii); + if (containsProhibitedOuptut(source, firstNonAscii)) { + source->resize(from); + return; + } // Check for valid bidirectional characters bool containsLCat = false; @@ -2117,7 +2121,7 @@ Q_AUTOTEST_EXPORT bool qt_check_std3rules(const QChar *uc, int len) return false; for (int i = 0; i < len; ++i) { - register ushort c = uc[i].unicode(); + ushort c = uc[i].unicode(); if (c == '-' && (i == 0 || i == len - 1)) return false; @@ -2500,7 +2504,7 @@ QString qt_ACE_do(const QString &domain, AceOperation op) const QChar *in = domain.constData() + lastIdx; const QChar *e = in + labelLength; for (; in < e; ++in, ++out) { - register ushort uc = in->unicode(); + ushort uc = in->unicode(); if (uc > 0x7f) simple = false; if (uc >= 'A' && uc <= 'Z') @@ -2529,7 +2533,7 @@ QString qt_ACE_do(const QString &domain, AceOperation op) // That means we need one or two temporaries qt_nameprep(&result, prevLen); labelLength = result.length() - prevLen; - register int toReserve = labelLength + 4 + 6; // "xn--" plus some extra bytes + int toReserve = labelLength + 4 + 6; // "xn--" plus some extra bytes aceForm.resize(0); if (toReserve > aceForm.capacity()) aceForm.reserve(toReserve); diff --git a/src/corelib/io/qurlrecode.cpp b/src/corelib/io/qurlrecode.cpp index 6e01272831..5ff0c40a4f 100644 --- a/src/corelib/io/qurlrecode.cpp +++ b/src/corelib/io/qurlrecode.cpp @@ -464,7 +464,7 @@ static int recode(QString &result, const ushort *begin, const ushort *end, QUrl: ushort *output = 0; for ( ; input != end; ++input) { - register ushort c; + ushort c; EncodingAction action; // try a run where no change is necessary @@ -483,7 +483,7 @@ static int recode(QString &result, const ushort *begin, const ushort *end, QUrl: break; non_trivial: - register uint decoded; + uint decoded; if (c == '%' && retryBadEncoding) { // always write "%25" ensureDetached(result, output, begin, input, end); diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index 4211a23e0f..f0899c6dee 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -65,7 +65,7 @@ #include "qglobal.h" -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX #include <CoreServices/CoreServices.h> #endif diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index 241658acb1..98e697eb57 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp @@ -79,7 +79,7 @@ int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, { if (!orig_timeout) { // no timeout -> block forever - register int ret; + int ret; EINTR_LOOP(ret, select(nfds, fdread, fdwrite, fdexcept, 0)); return ret; } diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index b68146cd6c..8c0589fdc6 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -168,7 +168,7 @@ static inline int qt_safe_open(const char *pathname, int flags, mode_t mode = 07 #ifdef O_CLOEXEC flags |= O_CLOEXEC; #endif - register int fd; + int fd; EINTR_LOOP(fd, QT_OPEN(pathname, flags, mode)); // unknown flags are ignored, so we have no way of verifying if @@ -191,7 +191,7 @@ static inline int qt_safe_pipe(int pipefd[2], int flags = 0) Q_ASSERT((flags & ~O_NONBLOCK) == 0); #endif - register int ret; + int ret; #if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC && defined(O_CLOEXEC) // use pipe2 flags |= O_CLOEXEC; @@ -223,7 +223,7 @@ static inline int qt_safe_dup(int oldfd, int atleast = 0, int flags = FD_CLOEXEC { Q_ASSERT(flags == FD_CLOEXEC || flags == 0); - register int ret; + int ret; #ifdef F_DUPFD_CLOEXEC // use this fcntl if (flags & FD_CLOEXEC) { @@ -247,7 +247,7 @@ static inline int qt_safe_dup2(int oldfd, int newfd, int flags = FD_CLOEXEC) { Q_ASSERT(flags == FD_CLOEXEC || flags == 0); - register int ret; + int ret; #if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC && defined(O_CLOEXEC) // use dup3 if (flags & FD_CLOEXEC) { @@ -291,7 +291,7 @@ static inline qint64 qt_safe_write_nosignal(int fd, const void *data, qint64 len static inline int qt_safe_close(int fd) { - register int ret; + int ret; EINTR_LOOP(ret, QT_CLOSE(fd)); return ret; } @@ -303,28 +303,28 @@ static inline int qt_safe_close(int fd) static inline int qt_safe_execve(const char *filename, char *const argv[], char *const envp[]) { - register int ret; + int ret; EINTR_LOOP(ret, ::execve(filename, argv, envp)); return ret; } static inline int qt_safe_execv(const char *path, char *const argv[]) { - register int ret; + int ret; EINTR_LOOP(ret, ::execv(path, argv)); return ret; } static inline int qt_safe_execvp(const char *file, char *const argv[]) { - register int ret; + int ret; EINTR_LOOP(ret, ::execvp(file, argv)); return ret; } static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options) { - register int ret; + int ret; EINTR_LOOP(ret, ::waitpid(pid, status, options)); return ret; } diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 100e014e99..e49d5f961c 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -938,7 +938,7 @@ bool QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject *receiv if (receiver->d_func()->threadData == this->threadData && extraData) { // application event filters are only called for objects in the GUI thread for (int i = 0; i < extraData->eventFilters.size(); ++i) { - register QObject *obj = extraData->eventFilters.at(i); + QObject *obj = extraData->eventFilters.at(i); if (!obj) continue; if (obj->d_func()->threadData != threadData) { @@ -957,7 +957,7 @@ bool QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject *receiver, Q Q_Q(QCoreApplication); if (receiver != q && receiver->d_func()->extraData) { for (int i = 0; i < receiver->d_func()->extraData->eventFilters.size(); ++i) { - register QObject *obj = receiver->d_func()->extraData->eventFilters.at(i); + QObject *obj = receiver->d_func()->extraData->eventFilters.at(i); if (!obj) continue; if (obj->d_func()->threadData != receiver->d_func()->threadData) { diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index b9f7462b12..50f3a1814b 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -90,6 +90,7 @@ struct DefinedTypesFilter { /*! \macro Q_DECLARE_OPAQUE_POINTER(PointerType) \relates QMetaType + \since 5.0 This macro enables pointers to forward-declared types (\a PointerType) to be registered with QMetaType using either Q_DECLARE_METATYPE() diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index aed998f2e2..d9b286e691 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -686,7 +686,7 @@ struct QMetaTypeIdQObject<T*, /* isPointerToTypeDerivedFromQObject */ true> template <typename T> inline int qRegisterMetaTypeStreamOperators() { - register int id = qMetaTypeId<T>(); + int id = qMetaTypeId<T>(); QMetaType::registerStreamOperators(id, QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Save, QtMetaTypePrivate::QMetaTypeFunctionHelper<T>::Load); return id; @@ -830,8 +830,8 @@ struct QMetaTypeId_ ## SMART_POINTER ## _QObjectStar<T, true> \ return id; \ const char * const cName = T::staticMetaObject.className(); \ QByteArray typeName; \ - typeName.reserve(sizeof(#SMART_POINTER) + 1 + strlen(cName) + 1); \ - typeName.append(#SMART_POINTER, sizeof(#SMART_POINTER) - 1) \ + typeName.reserve(int(sizeof(#SMART_POINTER) + 1 + strlen(cName) + 1)); \ + typeName.append(#SMART_POINTER, int(sizeof(#SMART_POINTER)) - 1) \ .append('<').append(cName).append('>'); \ const int newId = qRegisterNormalizedMetaType< SMART_POINTER<T> >( \ typeName, \ diff --git a/src/corelib/kernel/qsystemsemaphore_unix.cpp b/src/corelib/kernel/qsystemsemaphore_unix.cpp index 6e2838a8a5..073bd020ba 100644 --- a/src/corelib/kernel/qsystemsemaphore_unix.cpp +++ b/src/corelib/kernel/qsystemsemaphore_unix.cpp @@ -212,7 +212,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) operation.sem_op = count; operation.sem_flg = SEM_UNDO; - register int res; + int res; EINTR_LOOP(res, semop(semaphore, &operation, 1)); if (-1 == res) { // If the semaphore was removed be nice and create it and then modifySemaphore again diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp index 0e33fa697a..f1bbbe5338 100644 --- a/src/corelib/kernel/qtimerinfo_unix.cpp +++ b/src/corelib/kernel/qtimerinfo_unix.cpp @@ -153,7 +153,7 @@ void QTimerInfoList::timerRepair(const timespec &diff) { // repair all timers for (int i = 0; i < size(); ++i) { - register QTimerInfo *t = at(i); + QTimerInfo *t = at(i); t->timeout = t->timeout + diff; } } @@ -182,7 +182,7 @@ void QTimerInfoList::timerInsert(QTimerInfo *ti) { int index = size(); while (index--) { - register const QTimerInfo * const t = at(index); + const QTimerInfo * const t = at(index); if (!(ti->timeout < t->timeout)) break; } @@ -244,8 +244,8 @@ static void calculateCoarseTimerTimeout(QTimerInfo *t, timespec currentTime) // // The objective is to make most timers wake up at the same time, thereby reducing CPU wakeups. - register uint interval = uint(t->interval); - register uint msec = uint(t->timeout.tv_nsec) / 1000 / 1000; + uint interval = uint(t->interval); + uint msec = uint(t->timeout.tv_nsec) / 1000 / 1000; Q_ASSERT(interval >= 20); // Calculate how much we can round and still keep within 5% error @@ -256,14 +256,14 @@ static void calculateCoarseTimerTimeout(QTimerInfo *t, timespec currentTime) if (interval < 50) { // round to even // round towards multiples of 50 ms - register bool roundUp = (msec % 50) >= 25; + bool roundUp = (msec % 50) >= 25; msec >>= 1; msec |= uint(roundUp); msec <<= 1; } else { // round to multiple of 4 // round towards multiples of 100 ms - register bool roundUp = (msec % 100) >= 50; + bool roundUp = (msec % 100) >= 50; msec >>= 2; msec |= uint(roundUp); msec <<= 2; @@ -423,7 +423,7 @@ int QTimerInfoList::timerRemainingTime(int timerId) timespec tm = {0, 0}; for (int i = 0; i < count(); ++i) { - register QTimerInfo *t = at(i); + QTimerInfo *t = at(i); if (t->id == timerId) { if (currentTime < t->timeout) { // time to wait @@ -509,7 +509,7 @@ bool QTimerInfoList::unregisterTimer(int timerId) { // set timer inactive for (int i = 0; i < count(); ++i) { - register QTimerInfo *t = at(i); + QTimerInfo *t = at(i); if (t->id == timerId) { // found it removeAt(i); @@ -530,7 +530,7 @@ bool QTimerInfoList::unregisterTimers(QObject *object) if (isEmpty()) return false; for (int i = 0; i < count(); ++i) { - register QTimerInfo *t = at(i); + QTimerInfo *t = at(i); if (t->obj == object) { // object found removeAt(i); @@ -550,7 +550,7 @@ QList<QAbstractEventDispatcher::TimerInfo> QTimerInfoList::registeredTimers(QObj { QList<QAbstractEventDispatcher::TimerInfo> list; for (int i = 0; i < count(); ++i) { - register const QTimerInfo * const t = at(i); + const QTimerInfo * const t = at(i); if (t->obj == object) { list << QAbstractEventDispatcher::TimerInfo(t->id, (t->timerType == Qt::VeryCoarseTimer diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 9243d093df..903ab2e2cd 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -1084,8 +1084,6 @@ void QTranslatorPrivate::clear() } /*! - \overload translate() - Returns the translation for the key (\a context, \a sourceText, \a disambiguation). If none is found, also tries (\a context, \a sourceText, ""). If that still fails, returns a null string. diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index bae4a837a0..276257ddcf 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -162,6 +162,10 @@ static qlonglong qMetaTypeNumber(const QVariant::Private *d) return qRound64(d->data.f); case QVariant::Double: return qRound64(d->data.d); +#ifndef QT_BOOTSTRAPPED + case QMetaType::QJsonValue: + return v_cast<QJsonValue>(d)->toDouble(); +#endif } Q_ASSERT(false); return 0; @@ -206,12 +210,14 @@ static qlonglong qConvertToNumber(const QVariant::Private *d, bool *ok) case QMetaType::Long: case QMetaType::Float: case QMetaType::LongLong: + case QMetaType::QJsonValue: return qMetaTypeNumber(d); case QVariant::ULongLong: case QVariant::UInt: case QMetaType::UChar: case QMetaType::UShort: case QMetaType::ULong: + return qlonglong(qMetaTypeUNumber(d)); } @@ -240,6 +246,7 @@ static qulonglong qConvertToUnsignedNumber(const QVariant::Private *d, bool *ok) case QMetaType::Long: case QMetaType::Float: case QMetaType::LongLong: + case QMetaType::QJsonValue: return qulonglong(qMetaTypeNumber(d)); case QVariant::ULongLong: case QVariant::UInt: @@ -340,6 +347,9 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QVariant::Url: *str = v_cast<QUrl>(d)->toString(); break; + case QMetaType::QJsonValue: + *str = v_cast<QJsonValue>(d)->toString(); + break; #endif case QVariant::Uuid: *str = v_cast<QUuid>(d)->toString(); @@ -580,6 +590,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QMetaType::ULong: *b = qMetaTypeUNumber(d) != Q_UINT64_C(0); break; +#ifndef QT_BOOTSTRAPPED + case QMetaType::QJsonValue: + *b = v_cast<QJsonValue>(d)->toBool(); + break; +#endif default: *b = false; return false; @@ -616,6 +631,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QMetaType::ULong: *f = double(qMetaTypeUNumber(d)); break; +#ifndef QT_BOOTSTRAPPED + case QMetaType::QJsonValue: + *f = v_cast<QJsonValue>(d)->toDouble(); + break; +#endif default: *f = 0.0; return false; @@ -652,6 +672,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) case QMetaType::ULong: *f = float(qMetaTypeUNumber(d)); break; +#ifndef QT_BOOTSTRAPPED + case QMetaType::QJsonValue: + *f = v_cast<QJsonValue>(d)->toDouble(); + break; +#endif default: *f = 0.0f; return false; @@ -2731,6 +2756,29 @@ bool QVariant::canConvert(int targetTypeId) const if (targetTypeId >= QMetaType::User) return canConvertMetaObject(currentType, targetTypeId, d.data.o); + if (currentType == QMetaType::QJsonValue) { + switch (targetTypeId) { + case QMetaType::QString: + case QMetaType::Bool: + case QMetaType::Int: + case QMetaType::UInt: + case QMetaType::Double: + case QMetaType::Float: + case QMetaType::ULong: + case QMetaType::Long: + case QMetaType::LongLong: + case QMetaType::ULongLong: + case QMetaType::UShort: + case QMetaType::UChar: + case QMetaType::Char: + case QMetaType::SChar: + case QMetaType::Short: + return true; + default: + return false; + } + } + // FIXME It should be LastCoreType intead of Uuid if (currentType > int(QMetaType::QUuid) || targetTypeId > int(QMetaType::QUuid)) { switch (uint(targetTypeId)) { diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 1288643e32..c617325e9e 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -120,6 +120,10 @@ void QFactoryLoader::update() d->loadedPaths << pluginDir; QString path = pluginDir + d->suffix; + + if (qt_debug_component()) + qDebug() << "QFactoryLoader::QFactoryLoader() checking directory path" << path << "..."; + if (!QDir(path).exists(QLatin1String("."))) continue; diff --git a/src/corelib/thread/qgenericatomic.h b/src/corelib/thread/qgenericatomic.h index a0a851eabb..3a213f6a25 100644 --- a/src/corelib/thread/qgenericatomic.h +++ b/src/corelib/thread/qgenericatomic.h @@ -172,7 +172,7 @@ template <typename BaseClass> struct QGenericAtomicOps { // implement fetchAndStore on top of testAndSet Q_FOREVER { - register T tmp = load(_q_value); + T tmp = load(_q_value); if (BaseClass::testAndSetRelaxed(_q_value, tmp, newValue)) return tmp; } @@ -207,7 +207,7 @@ template <typename BaseClass> struct QGenericAtomicOps { // implement fetchAndAdd on top of testAndSet Q_FOREVER { - register T tmp = BaseClass::load(_q_value); + T tmp = BaseClass::load(_q_value); if (BaseClass::testAndSetRelaxed(_q_value, tmp, T(tmp + valueToAdd))) return tmp; } diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index 1ed4a77950..378813c889 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE static inline bool isRecursive(QMutexData *d) { - register quintptr u = quintptr(d); + quintptr u = quintptr(d); if (Q_LIKELY(u <= 0x3)) return false; #ifdef QT_LINUX_FUTEX diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index f123e1813b..6a91193785 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -83,9 +83,9 @@ # define old_qDebug qDebug # undef qDebug # endif -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX # include <CoreServices/CoreServices.h> -#endif //Q_OS_IOS +#endif // Q_OS_MACX # ifdef old_qDebug # undef qDebug @@ -172,6 +172,12 @@ static void destroy_current_thread_data_key() { pthread_once(¤t_thread_data_once, create_current_thread_data_key); pthread_key_delete(current_thread_data_key); + + // Reset current_thread_data_once in case we end up recreating + // the thread-data in the rare case of QObject construction + // after destroying the QThreadData. + pthread_once_t pthread_once_init = PTHREAD_ONCE_INIT; + current_thread_data_once = pthread_once_init; } Q_DESTRUCTOR_FUNCTION(destroy_current_thread_data_key) diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index cc544af868..ad6c3d913c 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -33,7 +33,7 @@ \brief The <QtAlgorithms> header includes the generic, template-based algorithms. Qt provides a number of global template functions in \c - <QtAlgorithms> that work on containers and perform well-know + <QtAlgorithms> that work on containers and perform well-known algorithms. You can use these algorithms with any \l {container class} that provides STL-style iterators, including Qt's QList, QLinkedList, QVector, QMap, and QHash classes. diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index 3cd8c51c07..c8a0825480 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -62,7 +62,7 @@ struct QPodArrayOps Q_ASSERT(newSize <= this->alloc); ::memset(this->end(), 0, (newSize - this->size) * sizeof(T)); - this->size = newSize; + this->size = int(newSize); } void copyAppend(const T *b, const T *e) @@ -84,7 +84,7 @@ struct QPodArrayOps const T *const end = iter + n; for (; iter != end; ++iter) ::memcpy(iter, &t, sizeof(T)); - this->size += n; + this->size += int(n); } void truncate(size_t newSize) @@ -92,7 +92,7 @@ struct QPodArrayOps Q_ASSERT(!this->ref.isShared()); Q_ASSERT(newSize < size_t(this->size)); - this->size = newSize; + this->size = int(newSize); } void destroyAll() // Call from destructors, ONLY! diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index 2b459b2b1b..b04c4f9c3d 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -122,7 +122,8 @@ QT_BEGIN_NAMESPACE */ QBitArray::QBitArray(int size, bool value) { - if (!size) { + Q_ASSERT_X(size >= 0, "QBitArray::QBitArray", "Size must be greater than or equal to 0."); + if (size <= 0) { d.resize(0); return; } diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index dc3f5f3be9..75900e9775 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -261,8 +261,8 @@ int qstrcmp(const char *str1, const char *str2) int qstricmp(const char *str1, const char *str2) { - register const uchar *s1 = reinterpret_cast<const uchar *>(str1); - register const uchar *s2 = reinterpret_cast<const uchar *>(str2); + const uchar *s1 = reinterpret_cast<const uchar *>(str1); + const uchar *s2 = reinterpret_cast<const uchar *>(str2); int res; uchar c; if (!s1 || !s2) @@ -295,8 +295,8 @@ int qstricmp(const char *str1, const char *str2) int qstrnicmp(const char *str1, const char *str2, uint len) { - register const uchar *s1 = reinterpret_cast<const uchar *>(str1); - register const uchar *s2 = reinterpret_cast<const uchar *>(str2); + const uchar *s1 = reinterpret_cast<const uchar *>(str1); + const uchar *s2 = reinterpret_cast<const uchar *>(str2); int res; uchar c; if (!s1 || !s2) @@ -321,7 +321,7 @@ int qstrcmp(const QByteArray &str1, const char *str2) const char *str1data = str1.constData(); const char *str1end = str1data + str1.length(); for ( ; str1data < str1end && *str2; ++str1data, ++str2) { - register int diff = int(uchar(*str1data)) - uchar(*str2); + int diff = int(uchar(*str1data)) - uchar(*str2); if (diff) // found a difference return diff; @@ -357,8 +357,8 @@ int qstrcmp(const QByteArray &str1, const QByteArray &str2) #if 0 static void createCRC16Table() // build CRC16 lookup table { - register unsigned int i; - register unsigned int j; + unsigned int i; + unsigned int j; unsigned short crc_tbl[16]; unsigned int v0, v1, v2, v3; for (i = 0; i < 16; i++) { @@ -410,7 +410,7 @@ static const quint16 crc_tbl[16] = { quint16 qChecksum(const char *data, uint len) { - register quint16 crc = 0xffff; + quint16 crc = 0xffff; uchar c; const uchar *p = reinterpret_cast<const uchar *>(data); while (len--) { @@ -2671,7 +2671,7 @@ QByteArray QByteArray::mid(int pos, int len) const QByteArray QByteArray::toLower() const { QByteArray s(*this); - register uchar *p = reinterpret_cast<uchar *>(s.data()); + uchar *p = reinterpret_cast<uchar *>(s.data()); if (p) { while (*p) { *p = QChar::toLower((ushort)*p); @@ -2694,7 +2694,7 @@ QByteArray QByteArray::toLower() const QByteArray QByteArray::toUpper() const { QByteArray s(*this); - register uchar *p = reinterpret_cast<uchar *>(s.data()); + uchar *p = reinterpret_cast<uchar *>(s.data()); if (p) { while (*p) { *p = QChar::toUpper((ushort)*p); diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp index bcd6a56aad..d030192117 100644 --- a/src/corelib/tools/qbytearraymatcher.cpp +++ b/src/corelib/tools/qbytearraymatcher.cpp @@ -61,7 +61,7 @@ static inline int bm_find(const uchar *cc, int l, int index, const uchar *puc, u return index > l ? -1 : index; const uint pl_minus_one = pl - 1; - register const uchar *current = cc + index + pl_minus_one; + const uchar *current = cc + index + pl_minus_one; const uchar *end = cc + l; while (current < end) { uint skip = skiptable[*current]; diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index 8545276dac..9ab7155c2d 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -1739,10 +1739,10 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, int from) if (from < 0 || s.length() - from < 2) return; - int starter = 0; // starter position uint stcode = 0; // starter code point - int next = -1; - int lastCombining = 0; + int starter = -1; // starter position + int next = -1; // to prevent i == next + int lastCombining = 255; // to prevent combining > lastCombining int pos = from; while (pos < s.length()) { @@ -1766,8 +1766,7 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, int from) } int combining = p->combiningClass; - if (i == next || combining > lastCombining) { - Q_ASSERT(starter >= from); + if ((i == next || combining > lastCombining) && starter >= from) { // allowed to form ligature with S uint ligature = ligatureHelper(stcode, uc); if (ligature) { diff --git a/src/corelib/tools/qlocale_blackberry.cpp b/src/corelib/tools/qlocale_blackberry.cpp index 6d60a97062..e2dfa6c801 100644 --- a/src/corelib/tools/qlocale_blackberry.cpp +++ b/src/corelib/tools/qlocale_blackberry.cpp @@ -289,9 +289,9 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const case DateToStringShort: return lc_region.toString(in.toDate(), QLocale::ShortFormat); case TimeToStringLong: - return lc_region.toString(in.toTime(), QLocale::LongFormat); + return lc_region.toString(in.toTime(), d->timeFormat(QLocale::LongFormat).toString()); case TimeToStringShort: - return lc_region.toString(in.toTime(), QLocale::ShortFormat); + return lc_region.toString(in.toTime(), d->timeFormat(QLocale::ShortFormat).toString()); case DateTimeToStringShort: return lc_region.toString(in.toDateTime(), d->dateTimeFormat(QLocale::ShortFormat).toString()); case DateTimeToStringLong: diff --git a/src/corelib/tools/qlocale_tools.cpp b/src/corelib/tools/qlocale_tools.cpp index 24ca628b5a..6b716b356f 100644 --- a/src/corelib/tools/qlocale_tools.cpp +++ b/src/corelib/tools/qlocale_tools.cpp @@ -300,13 +300,13 @@ bool removeGroupSeparators(QLocalePrivate::CharBuff *num) * Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ -qulonglong qstrtoull(const char *nptr, const char **endptr, register int base, bool *ok) +qulonglong qstrtoull(const char *nptr, const char **endptr, int base, bool *ok) { - register const char *s = nptr; - register qulonglong acc; - register unsigned char c; - register qulonglong qbase, cutoff; - register int any, cutlim; + const char *s = nptr; + qulonglong acc; + unsigned char c; + qulonglong qbase, cutoff; + int any, cutlim; if (ok != 0) *ok = true; @@ -381,13 +381,13 @@ qulonglong qstrtoull(const char *nptr, const char **endptr, register int base, b * Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ -qlonglong qstrtoll(const char *nptr, const char **endptr, register int base, bool *ok) +qlonglong qstrtoll(const char *nptr, const char **endptr, int base, bool *ok) { - register const char *s; - register qulonglong acc; - register unsigned char c; - register qulonglong qbase, cutoff; - register int neg, any, cutlim; + const char *s; + qulonglong acc; + unsigned char c; + qulonglong qbase, cutoff; + int neg, any, cutlim; /* * Skip white space and pick up leading +/- sign if any. diff --git a/src/corelib/tools/qlocale_tools_p.h b/src/corelib/tools/qlocale_tools_p.h index 3c4e9b5bd5..cb47bfcb5e 100644 --- a/src/corelib/tools/qlocale_tools_p.h +++ b/src/corelib/tools/qlocale_tools_p.h @@ -110,8 +110,8 @@ bool removeGroupSeparators(QLocalePrivate::CharBuff *num); Q_CORE_EXPORT char *qdtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **digits_str); Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok); -qlonglong qstrtoll(const char *nptr, const char **endptr, register int base, bool *ok); -qulonglong qstrtoull(const char *nptr, const char **endptr, register int base, bool *ok); +qlonglong qstrtoll(const char *nptr, const char **endptr, int base, bool *ok); +qulonglong qstrtoull(const char *nptr, const char **endptr, int base, bool *ok); QT_END_NAMESPACE diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp index e197fd9178..41b2b266ee 100644 --- a/src/corelib/tools/qrect.cpp +++ b/src/corelib/tools/qrect.cpp @@ -201,6 +201,12 @@ QT_BEGIN_NAMESPACE function to manipulate the rectangle's coordinates and dimensions in one go. + \section1 Constraints + + QRect is limited to the minimum and maximum values for the \c int type. + Operations on a QRect that could potentially result in values outside this + range will result in undefined behavior. + \sa QRectF, QRegion */ diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index a50c7da6cc..a2a58f8926 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -1031,7 +1031,7 @@ void QRegularExpressionPrivate::getPatternInfo() */ class QPcreJitStackPointer { - Q_DISABLE_COPY(QPcreJitStackPointer); + Q_DISABLE_COPY(QPcreJitStackPointer) public: /*! diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 5e30cf3ecb..1423449a69 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -506,7 +506,7 @@ public: if (o) { // increase the strongref, but never up from zero // or less (-1 is used by QWeakPointer on untracked QObject) - register int tmp = o->strongref.load(); + int tmp = o->strongref.load(); while (tmp > 0) { // try to increment from "tmp" to "tmp + 1" if (o->strongref.testAndSetRelaxed(tmp, tmp + 1)) @@ -801,7 +801,7 @@ namespace QtSharedPointer { template <class X, class T> Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerCast(const QSharedPointer<T> &src) { - register X *ptr = static_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid + X *ptr = static_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid return QtSharedPointer::copyAndSetPointer(ptr, src); } template <class X, class T> @@ -813,7 +813,7 @@ Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerCast(const QWeakPointer<T> &sr template <class X, class T> Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerDynamicCast(const QSharedPointer<T> &src) { - register X *ptr = dynamic_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid + X *ptr = dynamic_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid if (!ptr) return QSharedPointer<X>(); return QtSharedPointer::copyAndSetPointer(ptr, src); @@ -827,7 +827,7 @@ Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerDynamicCast(const QWeakPointer template <class X, class T> Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerConstCast(const QSharedPointer<T> &src) { - register X *ptr = const_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid + X *ptr = const_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid return QtSharedPointer::copyAndSetPointer(ptr, src); } template <class X, class T> @@ -847,7 +847,7 @@ QWeakPointer<X> qWeakPointerCast(const QSharedPointer<T> &src) template <class X, class T> Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerObjectCast(const QSharedPointer<T> &src) { - register X *ptr = qobject_cast<X *>(src.data()); + X *ptr = qobject_cast<X *>(src.data()); return QtSharedPointer::copyAndSetPointer(ptr, src); } template <class X, class T> diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 97a64eb5bb..c81df7a6f2 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -240,14 +240,14 @@ inline quint64 _xgetbv(__int64) { return 0; } #endif static void xgetbv(uint in, uint &eax, uint &edx) { -#ifdef Q_OS_WIN - quint64 result = _xgetbv(in); - eax = result; - edx = result >> 32; -#elif defined(Q_CC_GNU) +#if defined(Q_CC_GNU) asm (".byte 0x0F, 0x01, 0xD0" // xgetbv instruction : "=a" (eax), "=d" (edx) : "c" (in)); +#elif defined(Q_OS_WIN) + quint64 result = _xgetbv(in); + eax = result; + edx = result >> 32; #endif } diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 54b1a084b2..de09e5bbe0 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -266,7 +266,7 @@ static bool qMemEquals(const quint16 *a, const quint16 *b, int length) if (a == b || !length) return true; - register union { + union { const quint16 *w; const quint32 *d; quintptr value; @@ -291,7 +291,7 @@ static bool qMemEquals(const quint16 *a, const quint16 *b, int length) // both addresses are 4-bytes aligned // do a fast 32-bit comparison - register const quint32 *e = sa.d + (length >> 1); + const quint32 *e = sa.d + (length >> 1); for ( ; sa.d != e; ++sa.d, ++sb.d) { if (*sa.d != *sb.d) return false; @@ -301,7 +301,7 @@ static bool qMemEquals(const quint16 *a, const quint16 *b, int length) return (length & 1) ? *sa.w == *sb.w : true; } else { // one of the addresses isn't 4-byte aligned but the other is - register const quint16 *e = sa.w + length; + const quint16 *e = sa.w + length; for ( ; sa.w != e; ++sa.w, ++sb.w) { if (*sa.w != *sb.w) return false; @@ -4908,8 +4908,8 @@ int QString::compare_helper(const QChar *data1, int length1, const QChar *data2, { if (cs == Qt::CaseSensitive) return ucstrcmp(data1, length1, data2, length2); - register const ushort *s1 = reinterpret_cast<const ushort *>(data1); - register const ushort *s2 = reinterpret_cast<const ushort *>(data2); + const ushort *s1 = reinterpret_cast<const ushort *>(data1); + const ushort *s2 = reinterpret_cast<const ushort *>(data2); return ucstricmp(s1, s1 + length1, s2, s2 + length2); } diff --git a/src/corelib/tools/qstringmatcher.cpp b/src/corelib/tools/qstringmatcher.cpp index d54e9c7ba7..1b8a40ef2f 100644 --- a/src/corelib/tools/qstringmatcher.cpp +++ b/src/corelib/tools/qstringmatcher.cpp @@ -69,7 +69,7 @@ static inline int bm_find(const ushort *uc, uint l, int index, const ushort *puc return index > (int)l ? -1 : index; const uint pl_minus_one = pl - 1; - register const ushort *current = uc + index + pl_minus_one; + const ushort *current = uc + index + pl_minus_one; const ushort *end = uc + l; if (cs == Qt::CaseSensitive) { while (current < end) { diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 3a2028057d..825e05ae1b 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -197,6 +197,8 @@ private: template <class T, int Prealloc> Q_INLINE_TEMPLATE QVarLengthArray<T, Prealloc>::QVarLengthArray(int asize) : s(asize) { + Q_STATIC_ASSERT_X(Prealloc > 0, "QVarLengthArray Prealloc must be greater than 0."); + Q_ASSERT_X(s >= 0, "QVarLengthArray::QVarLengthArray()", "Size must be greater than or equal to 0."); if (s > Prealloc) { ptr = reinterpret_cast<T *>(malloc(s * sizeof(T))); Q_CHECK_PTR(ptr); diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 816e1f15f6..489ee821b9 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -398,7 +398,8 @@ QVector<T> &QVector<T>::operator=(const QVector<T> &v) template <typename T> QVector<T>::QVector(int asize) { - if (Q_LIKELY(asize)) { + Q_ASSERT_X(asize >= 0, "QVector::QVector", "Size must be greater than or equal to 0."); + if (Q_LIKELY(asize > 0)) { d = Data::allocate(asize); d->size = asize; defaultConstruct(d->begin(), d->end()); @@ -410,7 +411,8 @@ QVector<T>::QVector(int asize) template <typename T> QVector<T>::QVector(int asize, const T &t) { - if (asize) { + Q_ASSERT_X(asize >= 0, "QVector::QVector", "Size must be greater than or equal to 0."); + if (asize > 0) { d = Data::allocate(asize); d->size = asize; T* i = d->end(); diff --git a/src/dbus/qdbusutil.cpp b/src/dbus/qdbusutil.cpp index df5e272a1e..c90490df7f 100644 --- a/src/dbus/qdbusutil.cpp +++ b/src/dbus/qdbusutil.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE static inline bool isValidCharacterNoDash(QChar c) { - register ushort u = c.unicode(); + ushort u = c.unicode(); return (u >= 'a' && u <= 'z') || (u >= 'A' && u <= 'Z') || (u >= '0' && u <= '9') @@ -63,7 +63,7 @@ static inline bool isValidCharacterNoDash(QChar c) static inline bool isValidCharacter(QChar c) { - register ushort u = c.unicode(); + ushort u = c.unicode(); return (u >= 'a' && u <= 'z') || (u >= 'A' && u <= 'Z') || (u >= '0' && u <= '9') @@ -72,7 +72,7 @@ static inline bool isValidCharacter(QChar c) static inline bool isValidNumber(QChar c) { - register ushort u = c.unicode(); + ushort u = c.unicode(); return (u >= '0' && u <= '9'); } @@ -259,7 +259,7 @@ static bool isFixedType(int c) // returns NULL if it isn't valid. static const char *validateSingleType(const char *signature) { - register char c = *signature; + char c = *signature; if (c == DBUS_TYPE_INVALID) return 0; diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 6abde5e420..cb4e45f1d0 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -53,7 +53,7 @@ static void swapPixel01(QImage *image) // 1-bpp: swap 0 and 1 pixels { int i; if (image->depth() == 1 && image->colorCount() == 2) { - register uint *p = (uint *)image->bits(); + uint *p = (uint *)image->bits(); int nbytes = image->byteCount(); for (i=0; i<nbytes/4; i++) { *p = ~*p; @@ -368,7 +368,7 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int if (comp == BMP_RLE4) { // run length compression int x=0, y=0, c, i; quint8 b; - register uchar *p = data + (h-1)*bpl; + uchar *p = data + (h-1)*bpl; const uchar *endp = p + w; while (y < h) { if (!d->getChar((char *)&b)) @@ -440,7 +440,7 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int while (--h >= 0) { if (d->read((char*)buf,buflen) != buflen) break; - register uchar *p = data + h*bpl; + uchar *p = data + h*bpl; uchar *b = buf; for (int i=0; i<w/2; i++) { // convert nibbles to bytes *p++ = *b >> 4; @@ -457,7 +457,7 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int if (comp == BMP_RLE8) { // run length compression int x=0, y=0; quint8 b; - register uchar *p = data + (h-1)*bpl; + uchar *p = data + (h-1)*bpl; const uchar *endp = p + w; while (y < h) { if (!d->getChar((char *)&b)) @@ -520,7 +520,7 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int } else if (nbits == 16 || nbits == 24 || nbits == 32) { // 16,24,32 bit BMP image - register QRgb *p; + QRgb *p; QRgb *end; uchar *buf24 = new uchar[bpl]; int bpl24 = ((w*nbits+31)/32)*4; @@ -632,7 +632,7 @@ bool qt_write_dib(QDataStream &s, QImage image) uchar *buf = new uchar[bpl_bmp]; uchar *b, *end; - register const uchar *p; + const uchar *p; memset(buf, 0, bpl_bmp); for (y=image.height()-1; y>=0; y--) { // write the image bits diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 0efb9c2646..98f3aeeeb9 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2270,7 +2270,7 @@ static void dither_to_Mono(QImageData *dst, const QImageData *src, int *b1, *b2; int wbytes = w * (d/8); - register const uchar *p = src->data; + const uchar *p = src->data; const uchar *end = p + wbytes; b2 = line2; if (use_gray) { // 8 bit image @@ -2830,7 +2830,7 @@ static void convert_Mono_to_X32(QImageData *dest, const QImageData *src, Qt::Ima uchar *dest_data = dest->data; if (src->format == QImage::Format_Mono) { for (int y = 0; y < dest->height; y++) { - register uint *p = (uint *)dest_data; + uint *p = (uint *)dest_data; for (int x = 0; x < dest->width; x++) *p++ = colorTable.at((src_data[x>>3] >> (7 - (x & 7))) & 1); @@ -2839,7 +2839,7 @@ static void convert_Mono_to_X32(QImageData *dest, const QImageData *src, Qt::Ima } } else { for (int y = 0; y < dest->height; y++) { - register uint *p = (uint *)dest_data; + uint *p = (uint *)dest_data; for (int x = 0; x < dest->width; x++) *p++ = colorTable.at((src_data[x>>3] >> (x & 7)) & 1); @@ -2873,7 +2873,7 @@ static void convert_Mono_to_Indexed8(QImageData *dest, const QImageData *src, Qt uchar *dest_data = dest->data; if (src->format == QImage::Format_Mono) { for (int y = 0; y < dest->height; y++) { - register uchar *p = dest_data; + uchar *p = dest_data; for (int x = 0; x < dest->width; x++) *p++ = (src_data[x>>3] >> (7 - (x & 7))) & 1; src_data += src->bytes_per_line; @@ -2881,7 +2881,7 @@ static void convert_Mono_to_Indexed8(QImageData *dest, const QImageData *src, Qt } } else { for (int y = 0; y < dest->height; y++) { - register uchar *p = dest_data; + uchar *p = dest_data; for (int x = 0; x < dest->width; x++) *p++ = (src_data[x>>3] >> (x & 7)) & 1; src_data += src->bytes_per_line; diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp index e425eca521..6fc41df77c 100644 --- a/src/gui/image/qppmhandler.cpp +++ b/src/gui/image/qppmhandler.cpp @@ -188,7 +188,7 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q } } } else { // read ascii data - register uchar *p; + uchar *p; int n; for (y=0; y<h; y++) { p = outImage->scanLine(y); diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp index 498f6ce767..aceb6623ea 100644 --- a/src/gui/image/qxbmhandler.cpp +++ b/src/gui/image/qxbmhandler.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE X bitmap image read/write functions *****************************************************************************/ -static inline int hex2byte(register char *p) +static inline int hex2byte(char *p) { return ((isdigit((uchar) *p) ? *p - '0' : toupper((uchar) *p) - 'A' + 10) << 4) | (isdigit((uchar) *(p+1)) ? *(p+1) - '0' : toupper((uchar) *(p+1)) - 'A' + 10); @@ -215,7 +215,7 @@ static bool write_xbm_image(const QImage &sourceImage, QIODevice *device, const } } int bcnt = 0; - register char *p = buf; + char *p = buf; int bpl = (w+7)/8; for (int y = 0; y < h; ++y) { uchar *b = image.scanLine(y); diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 79dcc6d250..82276c5342 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -860,7 +860,14 @@ public: void setContentPos(const QPointF &pos); private: - QObject* m_target; +#ifdef Q_CC_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wunused-private-field" +#endif // Q_CC_CLANG + QObject* m_target; // Qt 6 remove. +#ifdef Q_CC_CLANG +# pragma clang diagnostic pop +#endif // Q_CC_CLANG QPointF m_startPos; QSizeF m_viewportSize; QRectF m_contentPosRange; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 29a7e87d46..89664447c4 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -94,9 +94,12 @@ #include <QtGui/QClipboard> #endif -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) # include "private/qcore_mac_p.h" -#endif +#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +# include <QtCore/qt_windows.h> +# include <QtCore/QLibraryInfo> +#endif // Q_OS_WIN && !Q_OS_WINCE QT_BEGIN_NAMESPACE @@ -782,12 +785,20 @@ static void init_platform(const QString &pluginArgument, const QString &platform QGuiApplicationPrivate::platform_name = new QString(name); } else { QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath); - QString fatalMessage = - QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name); - foreach(const QString &key, keys) { - fatalMessage.append(key + QLatin1Char('\n')); - } - qFatal("%s", fatalMessage.toLocal8Bit().constData()); + + QString fatalMessage + = QStringLiteral("Failed to find or load platform plugin \"%1\".\n").arg(name); + if (!keys.isEmpty()) + fatalMessage += QStringLiteral("Available platforms are: %1\n").arg( + keys.join(QStringLiteral(", "))); + fatalMessage += QStringLiteral("GUI applications require a platform plugin. Terminating."); +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + // Windows: Display message box unless it is a console application + // or debug build showing an assert box. + if (!QLibraryInfo::isDebugBuild() && !GetConsoleWindow()) + MessageBox(0, (LPCTSTR)fatalMessage.utf16(), (LPCTSTR)(QCoreApplication::applicationName().utf16()), MB_OK | MB_ICONERROR); +#endif // Q_OS_WIN && !Q_OS_WINCE + qFatal("%s", qPrintable(fatalMessage)); return; } @@ -2477,10 +2488,18 @@ void QGuiApplicationPrivate::emitLastWindowClosed() bool QGuiApplicationPrivate::shouldQuit() { + const QWindowList processedWindows; + return shouldQuitInternal(processedWindows); +} + +bool QGuiApplicationPrivate::shouldQuitInternal(const QWindowList &processedWindows) +{ /* if there is no visible top-level window left, we allow the quit */ QWindowList list = QGuiApplication::topLevelWindows(); for (int i = 0; i < list.size(); ++i) { QWindow *w = list.at(i); + if (processedWindows.contains(w)) + continue; if (w->isVisible() && !w->transientParent()) return false; } diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index cd8dfff103..3a4b692b69 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -91,6 +91,8 @@ public: virtual bool shouldQuit(); + bool shouldQuitInternal(const QWindowList &processedWindows); + static Qt::KeyboardModifiers modifier_buttons; static Qt::MouseButtons mouse_buttons; diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index 8a36df3e7c..3cbcd1c06d 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -96,7 +96,7 @@ private: friend class QOpenGLContextGroupPrivate; friend class QOpenGLMultiGroupSharedResource; - Q_DISABLE_COPY(QOpenGLSharedResource); + Q_DISABLE_COPY(QOpenGLSharedResource) }; class Q_GUI_EXPORT QOpenGLSharedResourceGuard : public QOpenGLSharedResource diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index 25b603bb9c..9b8ed4a289 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -119,7 +119,7 @@ public: the size of the alpha buffer; the size of the depth and stencil buffers; and number of samples per pixel for multisampling. In addition, the format contains surface configuration parameters such as OpenGL profile and - version for rendering, whether or not enable stereo buffers, and swap + version for rendering, whether or not to enable stereo buffers, and swap behaviour. */ @@ -361,7 +361,7 @@ int QSurfaceFormat::depthBufferSize() const Set the swap \a behavior of the surface. The swap behavior specifies whether single, double, or triple - buffering is desired. The default, SwapBehavior::DefaultSwapBehavior, + buffering is desired. The default, DefaultSwapBehavior, gives the default swap behavior of the platform. */ void QSurfaceFormat::setSwapBehavior(SwapBehavior behavior) diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index c4968f8ca6..398df0a96f 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -441,7 +441,7 @@ public: } } private: - Q_DISABLE_COPY(WindowSystemEventList); + Q_DISABLE_COPY(WindowSystemEventList) }; static WindowSystemEventList windowSystemEventQueue; diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 8d6b05d0b4..90416db72b 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -1064,7 +1064,6 @@ QImage QOpenGLFramebufferObject::toImage() const /*! \fn bool QOpenGLFramebufferObject::bindDefault() - \internal Switches rendering back to the default, windowing system provided framebuffer. diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index 83f407575e..7d49c03f5b 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -147,6 +147,9 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) return; } + GLint oldFbo; + glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFbo); + int oldWidth = m_textureResource->m_width; int oldHeight = m_textureResource->m_height; @@ -265,7 +268,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) glDeleteTextures(1, &tmp_texture); glDeleteTextures(1, &oldTexture); - funcs.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->current_fbo); + funcs.glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)oldFbo); if (pex != 0) { glViewport(0, 0, pex->width, pex->height); diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 2ebba967ed..de0ab53c1b 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1121,13 +1121,13 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c fx &= fixed_scale - 1; Q_ASSERT((fx >> 16) == 0); while (b < end) { - register int x1 = (fx >> 16); - register int x2 = x1 + 1; + int x1 = (fx >> 16); + int x2 = x1 + 1; Q_ASSERT(x1 >= 0); Q_ASSERT(x2 < count); - register int distx = (fx & 0x0000ffff) >> 8; - register int idistx = 256 - distx; + int distx = (fx & 0x0000ffff) >> 8; + int idistx = 256 - distx; int rb = ((intermediate_buffer[0][x1] * idistx + intermediate_buffer[0][x2] * distx) >> 8) & 0xff00ff; int ag = (intermediate_buffer[1][x1] * idistx + intermediate_buffer[1][x2] * distx) & 0xff00ff00; *b = rb | ag; @@ -1533,13 +1533,13 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper fx &= fixed_scale - 1; Q_ASSERT((fx >> 16) == 0); for (int i = 0; i < length; ++i) { - register int x1 = (fx >> 16); - register int x2 = x1 + 1; + int x1 = (fx >> 16); + int x2 = x1 + 1; Q_ASSERT(x1 >= 0); Q_ASSERT(x2 < count); - register int distx = (fx & 0x0000ffff) >> 8; - register int idistx = 256 - distx; + int distx = (fx & 0x0000ffff) >> 8; + int idistx = 256 - distx; int rb = ((buf1[x1] * idistx + buf1[x2] * distx) >> 8) & 0xff00ff; int ag = (buf2[x1] * idistx + buf2[x2] * distx) & 0xff00ff00; buffer[i] = rb | ag; diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 5d9867012f..0b8a41c904 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -759,7 +759,7 @@ do { \ /* Duff's device */ \ uint *_d = (uint*)(dest) + length; \ const uint *_s = (uint*)(src) + length; \ - register int n = ((length) + 7) / 8; \ + int n = ((length) + 7) / 8; \ switch ((length) & 0x07) \ { \ case 0: do { *--_d = *--_s; \ @@ -779,7 +779,7 @@ do { \ /* Duff's device */ \ ushort *_d = (ushort*)(dest); \ const ushort *_s = (ushort*)(src); \ - register int n = ((length) + 7) / 8; \ + int n = ((length) + 7) / 8; \ switch ((length) & 0x07) \ { \ case 0: do { *_d++ = *_s++; \ diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 5d9a743dac..345ebefea7 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -38,9 +38,13 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#include "qpdf_p.h" + +#ifndef QT_NO_PDF + #include "qplatformdefs.h" #include <qdebug.h> -#include "qpdf_p.h" #include <qfile.h> #include <qtemporaryfile.h> #include <private/qmath_p.h> @@ -2624,5 +2628,6 @@ void QPdfEnginePrivate::newPage() << "q q\n"; } - QT_END_NAMESPACE + +#endif // QT_NO_PDF diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index 44e1446fff..560621775b 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -52,6 +52,11 @@ // // We mean it. // + +#include <QtCore/qglobal.h> + +#ifndef QT_NO_PDF + #include "QtGui/qmatrix.h" #include "QtCore/qstring.h" #include "QtCore/qvector.h" @@ -328,5 +333,7 @@ void QPdfEngine::setResolution(int resolution) QT_END_NAMESPACE +#endif // QT_NO_PDF + #endif // QPDF_P_H diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp index ad6b66ae09..136654cb5d 100644 --- a/src/gui/painting/qpdfwriter.cpp +++ b/src/gui/painting/qpdfwriter.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include <qpdfwriter.h> + +#ifndef QT_NO_PDF + #include <QtCore/private/qobject_p.h> #include "private/qpdf_p.h" #include <QtCore/qfile.h> @@ -214,3 +217,5 @@ void QPdfWriter::setMargins(const Margins &m) } QT_END_NAMESPACE + +#endif // QT_NO_PDF diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h index 45bb5ad4b4..f5c25de5e9 100644 --- a/src/gui/painting/qpdfwriter.h +++ b/src/gui/painting/qpdfwriter.h @@ -42,12 +42,15 @@ #ifndef QPDFWRITER_H #define QPDFWRITER_H +#include <QtCore/qglobal.h> + +#ifndef QT_NO_PDF + #include <QtCore/qobject.h> #include <QtGui/qpagedpaintdevice.h> QT_BEGIN_NAMESPACE - class QIODevice; class QPdfWriterPrivate; @@ -83,4 +86,6 @@ private: QT_END_NAMESPACE +#endif // QT_NO_PDF + #endif diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp index 5398387bcf..34215b53b0 100644 --- a/src/gui/painting/qpolygon.cpp +++ b/src/gui/painting/qpolygon.cpp @@ -218,8 +218,8 @@ void QPolygon::translate(int dx, int dy) if (dx == 0 && dy == 0) return; - register QPoint *p = data(); - register int i = size(); + QPoint *p = data(); + int i = size(); QPoint pt(dx, dy); while (i--) { *p += pt; @@ -447,7 +447,7 @@ QRect QPolygon::boundingRect() const { if (isEmpty()) return QRect(0, 0, 0, 0); - register const QPoint *pd = constData(); + const QPoint *pd = constData(); int minx, maxx, miny, maxy; minx = maxx = pd->x(); miny = maxy = pd->y(); @@ -599,8 +599,8 @@ void QPolygonF::translate(const QPointF &offset) if (offset.isNull()) return; - register QPointF *p = data(); - register int i = size(); + QPointF *p = data(); + int i = size(); while (i--) { *p += offset; ++p; @@ -660,7 +660,7 @@ QRectF QPolygonF::boundingRect() const { if (isEmpty()) return QRectF(0, 0, 0, 0); - register const QPointF *pd = constData(); + const QPointF *pd = constData(); qreal minx, maxx, miny, maxy; minx = maxx = pd->x(); miny = maxy = pd->y(); diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index ce5abdbbd9..47668c62b6 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -1585,14 +1585,14 @@ void QRegionPrivate::selfTest() const static QRegionPrivate qrp; QRegion::QRegionData QRegion::shared_empty = {Q_BASIC_ATOMIC_INITIALIZER(1), &qrp}; -typedef void (*OverlapFunc)(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, - register const QRect *r2, const QRect *r2End, register int y1, register int y2); -typedef void (*NonOverlapFunc)(register QRegionPrivate &dest, register const QRect *r, const QRect *rEnd, - register int y1, register int y2); +typedef void (*OverlapFunc)(QRegionPrivate &dest, const QRect *r1, const QRect *r1End, + const QRect *r2, const QRect *r2End, int y1, int y2); +typedef void (*NonOverlapFunc)(QRegionPrivate &dest, const QRect *r, const QRect *rEnd, + int y1, int y2); static bool EqualRegion(const QRegionPrivate *r1, const QRegionPrivate *r2); static void UnionRegion(const QRegionPrivate *reg1, const QRegionPrivate *reg2, QRegionPrivate &dest); -static void miRegionOp(register QRegionPrivate &dest, const QRegionPrivate *reg1, const QRegionPrivate *reg2, +static void miRegionOp(QRegionPrivate &dest, const QRegionPrivate *reg1, const QRegionPrivate *reg2, OverlapFunc overlapFunc, NonOverlapFunc nonOverlap1Func, NonOverlapFunc nonOverlap2Func); @@ -1789,7 +1789,7 @@ SOFTWARE. */ /* $XFree86: xc/lib/X11/Region.c,v 1.1.1.2.2.2 1998/10/04 15:22:50 hohndel Exp $ */ -static void UnionRectWithRegion(register const QRect *rect, const QRegionPrivate *source, +static void UnionRectWithRegion(const QRect *rect, const QRegionPrivate *source, QRegionPrivate &dest) { if (rect->isEmpty()) @@ -1824,9 +1824,9 @@ static void UnionRectWithRegion(register const QRect *rect, const QRegionPrivate */ static void miSetExtents(QRegionPrivate &dest) { - register const QRect *pBox, + const QRect *pBox, *pBoxEnd; - register QRect *pExtents; + QRect *pExtents; dest.innerRect.setCoords(0, 0, -1, -1); dest.innerArea = -1; @@ -1871,11 +1871,11 @@ static void miSetExtents(QRegionPrivate &dest) added by raymond */ -static void OffsetRegion(register QRegionPrivate ®ion, register int x, register int y) +static void OffsetRegion(QRegionPrivate ®ion, int x, int y) { if (region.rects.size()) { - register QRect *pbox = region.rects.data(); - register int nbox = region.numRects; + QRect *pbox = region.rects.data(); + int nbox = region.numRects; while (nbox--) { pbox->translate(x, y); @@ -1902,12 +1902,12 @@ static void OffsetRegion(register QRegionPrivate ®ion, register int x, regist * *----------------------------------------------------------------------- */ -static void miIntersectO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, - register const QRect *r2, const QRect *r2End, int y1, int y2) +static void miIntersectO(QRegionPrivate &dest, const QRect *r1, const QRect *r1End, + const QRect *r2, const QRect *r2End, int y1, int y2) { - register int x1; - register int x2; - register QRect *pNextRect; + int x1; + int x2; + QRect *pNextRect; pNextRect = dest.rects.data() + dest.numRects; @@ -1967,11 +1967,11 @@ static void miIntersectO(register QRegionPrivate &dest, register const QRect *r1 * *----------------------------------------------------------------------- */ -static int miCoalesce(register QRegionPrivate &dest, int prevStart, int curStart) +static int miCoalesce(QRegionPrivate &dest, int prevStart, int curStart) { - register QRect *pPrevBox; /* Current box in previous band */ - register QRect *pCurBox; /* Current box in current band */ - register QRect *pRegEnd; /* End of region */ + QRect *pPrevBox; /* Current box in previous band */ + QRect *pCurBox; /* Current box in current band */ + QRect *pRegEnd; /* End of region */ int curNumRects; /* Number of rectangles in current band */ int prevNumRects; /* Number of rectangles in previous band */ int bandY1; /* Y1 coordinate for current band */ @@ -2096,21 +2096,21 @@ static int miCoalesce(register QRegionPrivate &dest, int prevStart, int curStart * *----------------------------------------------------------------------- */ -static void miRegionOp(register QRegionPrivate &dest, +static void miRegionOp(QRegionPrivate &dest, const QRegionPrivate *reg1, const QRegionPrivate *reg2, OverlapFunc overlapFunc, NonOverlapFunc nonOverlap1Func, NonOverlapFunc nonOverlap2Func) { - register const QRect *r1; // Pointer into first region - register const QRect *r2; // Pointer into 2d region + const QRect *r1; // Pointer into first region + const QRect *r2; // Pointer into 2d region const QRect *r1End; // End of 1st region const QRect *r2End; // End of 2d region - register int ybot; // Bottom of intersection - register int ytop; // Top of intersection + int ybot; // Bottom of intersection + int ytop; // Top of intersection int prevBand; // Index of start of previous band in dest int curBand; // Index of start of current band in dest - register const QRect *r1BandEnd; // End of current band in r1 - register const QRect *r2BandEnd; // End of current band in r2 + const QRect *r1BandEnd; // End of current band in r1 + const QRect *r2BandEnd; // End of current band in r2 int top; // Top of non-overlapping band int bot; // Bottom of non-overlapping band @@ -2312,10 +2312,10 @@ static void miRegionOp(register QRegionPrivate &dest, *----------------------------------------------------------------------- */ -static void miUnionNonO(register QRegionPrivate &dest, register const QRect *r, const QRect *rEnd, - register int y1, register int y2) +static void miUnionNonO(QRegionPrivate &dest, const QRect *r, const QRect *rEnd, + int y1, int y2) { - register QRect *pNextRect; + QRect *pNextRect; pNextRect = dest.rects.data() + dest.numRects; @@ -2348,10 +2348,10 @@ static void miUnionNonO(register QRegionPrivate &dest, register const QRect *r, *----------------------------------------------------------------------- */ -static void miUnionO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, - register const QRect *r2, const QRect *r2End, register int y1, register int y2) +static void miUnionO(QRegionPrivate &dest, const QRect *r1, const QRect *r1End, + const QRect *r2, const QRect *r2End, int y1, int y2) { - register QRect *pNextRect; + QRect *pNextRect; pNextRect = dest.rects.data() + dest.numRects; @@ -2437,10 +2437,10 @@ static void UnionRegion(const QRegionPrivate *reg1, const QRegionPrivate *reg2, *----------------------------------------------------------------------- */ -static void miSubtractNonO1(register QRegionPrivate &dest, register const QRect *r, - const QRect *rEnd, register int y1, register int y2) +static void miSubtractNonO1(QRegionPrivate &dest, const QRect *r, + const QRect *rEnd, int y1, int y2) { - register QRect *pNextRect; + QRect *pNextRect; pNextRect = dest.rects.data() + dest.numRects; @@ -2471,11 +2471,11 @@ static void miSubtractNonO1(register QRegionPrivate &dest, register const QRect *----------------------------------------------------------------------- */ -static void miSubtractO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, - register const QRect *r2, const QRect *r2End, register int y1, register int y2) +static void miSubtractO(QRegionPrivate &dest, const QRect *r1, const QRect *r1End, + const QRect *r2, const QRect *r2End, int y1, int y2) { - register QRect *pNextRect; - register int x1; + QRect *pNextRect; + int x1; x1 = r1->left(); @@ -2573,7 +2573,7 @@ static void miSubtractO(register QRegionPrivate &dest, register const QRect *r1, */ static void SubtractRegion(QRegionPrivate *regM, QRegionPrivate *regS, - register QRegionPrivate &dest) + QRegionPrivate &dest) { Q_ASSERT(!isEmptyHelper(regM)); Q_ASSERT(!isEmptyHelper(regS)); @@ -2668,12 +2668,12 @@ static bool PointInRegion(QRegionPrivate *pRegion, int x, int y) return false; } -static bool RectInRegion(register QRegionPrivate *region, int rx, int ry, uint rwidth, uint rheight) +static bool RectInRegion(QRegionPrivate *region, int rx, int ry, uint rwidth, uint rheight) { - register const QRect *pbox; - register const QRect *pboxEnd; + const QRect *pbox; + const QRect *pboxEnd; QRect rect(rx, ry, rwidth, rheight); - register QRect *prect = ▭ + QRect *prect = ▭ int partIn, partOut; if (!region || region->numRects == 0 || !EXTENTCHECK(®ion->extents, prect)) @@ -3094,8 +3094,8 @@ SOFTWARE. static void InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline, ScanLineListBlock **SLLBlock, int *iSLLBlock) { - register EdgeTableEntry *start, *prev; - register ScanLineList *pSLL, *pPrevSLL; + EdgeTableEntry *start, *prev; + ScanLineList *pSLL, *pPrevSLL; ScanLineListBlock *tmpSLLBlock; /* @@ -3172,11 +3172,11 @@ static void InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline, * */ -static void CreateETandAET(register int count, register const QPoint *pts, - EdgeTable *ET, EdgeTableEntry *AET, register EdgeTableEntry *pETEs, +static void CreateETandAET(int count, const QPoint *pts, + EdgeTable *ET, EdgeTableEntry *AET, EdgeTableEntry *pETEs, ScanLineListBlock *pSLLBlock) { - register const QPoint *top, + const QPoint *top, *bottom, *PrevPt, *CurrPt; @@ -3259,10 +3259,10 @@ static void CreateETandAET(register int count, register const QPoint *pts, * */ -static void loadAET(register EdgeTableEntry *AET, register EdgeTableEntry *ETEs) +static void loadAET(EdgeTableEntry *AET, EdgeTableEntry *ETEs) { - register EdgeTableEntry *pPrevAET; - register EdgeTableEntry *tmp; + EdgeTableEntry *pPrevAET; + EdgeTableEntry *tmp; pPrevAET = AET; AET = AET->next; @@ -3303,11 +3303,11 @@ static void loadAET(register EdgeTableEntry *AET, register EdgeTableEntry *ETEs) * V-------------------> V---> ... * */ -static void computeWAET(register EdgeTableEntry *AET) +static void computeWAET(EdgeTableEntry *AET) { - register EdgeTableEntry *pWETE; - register int inside = 1; - register int isInside = 0; + EdgeTableEntry *pWETE; + int inside = 1; + int isInside = 0; AET->nextWETE = 0; pWETE = AET; @@ -3337,12 +3337,12 @@ static void computeWAET(register EdgeTableEntry *AET) * */ -static int InsertionSort(register EdgeTableEntry *AET) +static int InsertionSort(EdgeTableEntry *AET) { - register EdgeTableEntry *pETEchase; - register EdgeTableEntry *pETEinsert; - register EdgeTableEntry *pETEchaseBackTMP; - register int changed = 0; + EdgeTableEntry *pETEchase; + EdgeTableEntry *pETEinsert; + EdgeTableEntry *pETEchaseBackTMP; + int changed = 0; AET = AET->next; while (AET) { @@ -3370,9 +3370,9 @@ static int InsertionSort(register EdgeTableEntry *AET) /* * Clean up our act. */ -static void FreeStorage(register ScanLineListBlock *pSLLBlock) +static void FreeStorage(ScanLineListBlock *pSLLBlock) { - register ScanLineListBlock *tmpSLLBlock; + ScanLineListBlock *tmpSLLBlock; while (pSLLBlock) { tmpSLLBlock = pSLLBlock->next; @@ -3436,7 +3436,7 @@ static inline void flushRow(const QRegionSpan *spans, int y, int numSpans, QRegi * stack by the calling procedure. * */ -static void PtsToRegion(register int numFullPtBlocks, register int iCurPtBlock, +static void PtsToRegion(int numFullPtBlocks, int iCurPtBlock, POINTBLOCK *FirstPtBlock, QRegionPrivate *reg) { int lastRow = 0; @@ -3512,12 +3512,12 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) //int rule; /* winding rule */ { QRegionPrivate *region; - register EdgeTableEntry *pAET; /* Active Edge Table */ - register int y; /* current scanline */ - register int iPts = 0; /* number of pts in buffer */ - register EdgeTableEntry *pWETE; /* Winding Edge Table Entry*/ - register ScanLineList *pSLL; /* current scanLineList */ - register QPoint *pts; /* output buffer */ + EdgeTableEntry *pAET; /* Active Edge Table */ + int y; /* current scanline */ + int iPts = 0; /* number of pts in buffer */ + EdgeTableEntry *pWETE; /* Winding Edge Table Entry*/ + ScanLineList *pSLL; /* current scanLineList */ + QPoint *pts; /* output buffer */ EdgeTableEntry *pPrevAET; /* ptr to previous AET */ EdgeTable ET; /* header node for ET */ EdgeTableEntry AET; /* header node for AET */ diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp index 649c6ec36d..3c39272d11 100644 --- a/src/gui/text/qfontsubset.cpp +++ b/src/gui/text/qfontsubset.cpp @@ -91,6 +91,8 @@ static const unsigned short symbol_map[0x100] = { // ---------------------------- PS/PDF helper methods ----------------------------------- +#ifndef QT_NO_PDF + QByteArray QFontSubset::glyphName(unsigned short unicode, bool symbol) { if (symbol && unicode < 0x100) @@ -311,6 +313,7 @@ int QFontSubset::addGlyph(int index) return idx; } +#endif // QT_NO_PDF // ------------------------------ Truetype generation ---------------------------------------------- diff --git a/src/gui/text/qfontsubset_p.h b/src/gui/text/qfontsubset_p.h index 00054dfe39..df5e72ab7d 100644 --- a/src/gui/text/qfontsubset_p.h +++ b/src/gui/text/qfontsubset_p.h @@ -62,13 +62,19 @@ class QFontSubset public: explicit QFontSubset(QFontEngine *fe, int obj_id = 0) : object_id(obj_id), noEmbed(false), fontEngine(fe), downloaded_glyphs(0), standard_font(false) - { fontEngine->ref.ref(); addGlyph(0); } + { + fontEngine->ref.ref(); +#ifndef QT_NO_PDF + addGlyph(0); +#endif + } ~QFontSubset() { if (!fontEngine->ref.deref()) delete fontEngine; } QByteArray toTruetype() const; +#ifndef QT_NO_PDF QByteArray widthArray() const; QByteArray createToUnicodeMap() const; QVector<int> getReverseMap() const; @@ -77,6 +83,7 @@ public: static QByteArray glyphName(unsigned short unicode, bool symbol); int addGlyph(int index); +#endif const int object_id; bool noEmbed; QFontEngine *fontEngine; diff --git a/src/network/access/qnetworkcookie_p.h b/src/network/access/qnetworkcookie_p.h index 2c099ac922..6bf8a059a4 100644 --- a/src/network/access/qnetworkcookie_p.h +++ b/src/network/access/qnetworkcookie_p.h @@ -73,7 +73,7 @@ public: bool httpOnly; }; -static inline bool isLWS(register char c) +static inline bool isLWS(char c) { return c == ' ' || c == '\t' || c == '\r' || c == '\n'; } diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index c04421e5c7..c7d3846465 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE class QNetworkProxy; -static inline bool isSeparator(register char c) +static inline bool isSeparator(char c) { static const char separators[] = "()<>@,;:\\\"/[]?={}"; return isLWS(c) || strchr(separators, c) != 0; @@ -123,7 +123,7 @@ static QHash<QByteArray, QByteArray> parseHttpOptionHeader(const QByteArray &hea // quoted-pair = "\" CHAR ++pos; while (pos < header.length()) { - register char c = header.at(pos); + char c = header.at(pos); if (c == '"') { // end of quoted text break; @@ -141,7 +141,7 @@ static QHash<QByteArray, QByteArray> parseHttpOptionHeader(const QByteArray &hea } else { // case: token while (pos < header.length()) { - register char c = header.at(pos); + char c = header.at(pos); if (isSeparator(c)) break; value += c; diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 4f74936ac7..933bebe2ad 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -62,6 +62,7 @@ static void connManager_cleanup() // this is not atomic or thread-safe! int shutdown = appShutdown.fetchAndStoreAcquire(1); Q_ASSERT(shutdown == 0); + Q_UNUSED(shutdown); QNetworkConfigurationManagerPrivate *cmp = connManager_ptr.fetchAndStoreAcquire(0); if (cmp) cmp->cleanup(); diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h index 5e6a1cac54..80e23075d3 100644 --- a/src/network/socket/qnet_unix_p.h +++ b/src/network/socket/qnet_unix_p.h @@ -84,7 +84,7 @@ static inline int qt_safe_socket(int domain, int type, int protocol, int flags = { Q_ASSERT((flags & ~O_NONBLOCK) == 0); - register int fd; + int fd; #if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK) int newtype = type | SOCK_CLOEXEC; if (flags & O_NONBLOCK) @@ -112,7 +112,7 @@ static inline int qt_safe_accept(int s, struct sockaddr *addr, QT_SOCKLEN_T *add { Q_ASSERT((flags & ~O_NONBLOCK) == 0); - register int fd; + int fd; #if QT_UNIX_SUPPORTS_THREADSAFE_CLOEXEC && defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK) // use accept4 int sockflags = SOCK_CLOEXEC; @@ -144,7 +144,7 @@ static inline int qt_safe_listen(int s, int backlog) static inline int qt_safe_connect(int sockfd, const struct sockaddr *addr, QT_SOCKLEN_T addrlen) { - register int ret; + int ret; // Solaris e.g. expects a non-const 2nd parameter EINTR_LOOP(ret, QT_SOCKET_CONNECT(sockfd, const_cast<struct sockaddr *>(addr), addrlen)); return ret; @@ -192,7 +192,7 @@ static inline int qt_safe_sendto(int sockfd, const void *buf, size_t len, int fl qt_ignore_sigpipe(); #endif - register int ret; + int ret; #ifdef Q_OS_VXWORKS EINTR_LOOP(ret, ::sendto(sockfd, (char *) buf, len, flags, (struct sockaddr *) to, tolen)); #else diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index fbd836f763..1e15a9e62c 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -41,7 +41,7 @@ #include "qglobal.h" -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX #import <Cocoa/Cocoa.h> #import <IOKit/graphics/IOGraphicsLib.h> #endif @@ -107,7 +107,7 @@ static NSInteger languageMapSort(id obj1, id obj2, void *context) QCoreTextFontDatabase::QCoreTextFontDatabase() { -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX QSettings appleSettings(QLatin1String("apple.com")); QVariant appleValue = appleSettings.value(QLatin1String("AppleAntiAliasingThreshold")); if (appleValue.isValid()) @@ -408,7 +408,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo static bool didPopulateStyleFallbacks = false; if (!didPopulateStyleFallbacks) { -#if !defined(Q_OS_IOS) +#if defined(Q_OS_MACX) // Ensure we have the psNameToFamily mapping set up const_cast<QCoreTextFontDatabase*>(this)->populateFontDatabase(); @@ -457,7 +457,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo return fallbackLists[styleLookupKey.arg(styleHint)]; } -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) { #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index 5b9b8e2329..8536ad9123 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -55,7 +55,7 @@ public: QFontEngine *fontEngine(const QFontDef &fontDef, QChar::Script script, void *handle); QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference); QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const; -#ifndef Q_OS_IOS +#ifdef Q_OS_MACX QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName); #endif void releaseHandle(void *handle); diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp index 2c93da147e..5e493ac68c 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp @@ -125,6 +125,7 @@ public: bool m_forceToActiveWindow; QTouchDevice *m_device; bool m_typeB; + QTransform m_rotate; }; QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, const QStringList &args) @@ -177,10 +178,24 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, QStringList args = spec.split(QLatin1Char(':')); + int rotationAngle = 0; for (int i = 0; i < args.count(); ++i) { - if (args.at(i).startsWith(QLatin1String("/dev/"))) { + if (args.at(i).startsWith(QLatin1String("/dev/")) && dev.isEmpty()) { dev = args.at(i); - break; + } else if (args.at(i).startsWith(QLatin1String("rotate"))) { + QString rotateArg = args.at(i).section(QLatin1Char('='), 1, 1); + bool ok; + uint argValue = rotateArg.toUInt(&ok); + if (ok) { + switch (argValue) { + case 90: + case 180: + case 270: + rotationAngle = argValue; + default: + break; + } + } } } @@ -265,6 +280,9 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, #endif qDebug("Protocol type %c %s", d->m_typeB ? 'B' : 'A', mtdevStr); + if (rotationAngle) + d->m_rotate = QTransform::fromTranslate(0.5, 0.5).rotate(rotationAngle).translate(-0.5, -0.5); + d->registerDevice(); } @@ -421,6 +439,11 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) tp.normalPosition = QPointF((contact.x - hw_range_x_min) / qreal(hw_range_x_max - hw_range_x_min), (contact.y - hw_range_y_min) / qreal(hw_range_y_max - hw_range_y_min)); + if (!m_rotate.isIdentity()) + tp.normalPosition = m_rotate.map(tp.normalPosition); + + tp.rawPositions.append(QPointF(contact.x, contact.y)); + m_touchPoints.append(tp); if (contact.state == Qt::TouchPointReleased) @@ -513,9 +536,10 @@ void QEvdevTouchScreenData::reportPoints() QWindowSystemInterface::TouchPoint &tp(m_touchPoints[i]); // Generate a screen position that is always inside the active window - // or the primary screen. - const qreal wx = winRect.left() + tp.normalPosition.x() * winRect.width(); - const qreal wy = winRect.top() + tp.normalPosition.y() * winRect.height(); + // or the primary screen. Even though we report this as a QRectF, internally + // Qt uses QRect/QPoint so we need to bound the size to winRect.size() - QSize(1, 1) + const qreal wx = winRect.left() + tp.normalPosition.x() * (winRect.width() - 1); + const qreal wy = winRect.top() + tp.normalPosition.y() * (winRect.height() - 1); const qreal sizeRatio = (winRect.width() + winRect.height()) / qreal(hw_w + hw_h); if (tp.area.width() == -1) // touch major was not provided tp.area = QRectF(0, 0, 8, 8); diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index cabddcc815..fdd45a49c5 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -164,6 +164,7 @@ public: , kdeVersion(kdeVersion) , toolButtonStyle(Qt::ToolButtonTextBesideIcon) , toolBarIconSize(0) + , singleClick(true) { } QString globalSettingsFile() const @@ -186,6 +187,7 @@ public: QStringList styleNames; int toolButtonStyle; int toolBarIconSize; + bool singleClick; }; void QKdeThemePrivate::refresh() @@ -217,6 +219,8 @@ void QKdeThemePrivate::refresh() styleNames.push_front(style); } + singleClick = kdeSettings.value(QStringLiteral("KDE/SingleClick"), true).toBool(); + const QVariant themeValue = kdeSettings.value(QStringLiteral("Icons/Theme")); if (themeValue.isValid()) iconThemeName = themeValue.toString(); @@ -261,6 +265,14 @@ static inline bool kdeColor(QPalette *pal, QPalette::ColorRole role, void QKdeThemePrivate::readKdeSystemPalette(const QSettings &kdeSettings, QPalette *pal) { + if (!kdeSettings.contains(QStringLiteral("Colors:Button/BackgroundNormal"))) { + // kcolorscheme.cpp: SetDefaultColors + const QColor defaultWindowBackground(214, 210, 208); + const QColor defaultButtonBackground(223, 220, 217); + *pal = QPalette(defaultButtonBackground, defaultWindowBackground); + return; + } + kdeColor(pal, QPalette::Button, kdeSettings, QStringLiteral("Colors:Button/BackgroundNormal")); kdeColor(pal, QPalette::Window, kdeSettings, QStringLiteral("Colors:Window/BackgroundNormal")); kdeColor(pal, QPalette::Text, kdeSettings, QStringLiteral("Colors:View/ForegroundNormal")); @@ -272,6 +284,34 @@ void QKdeThemePrivate::readKdeSystemPalette(const QSettings &kdeSettings, QPalet kdeColor(pal, QPalette::ButtonText, kdeSettings, QStringLiteral("Colors:Button/ForegroundNormal")); kdeColor(pal, QPalette::Link, kdeSettings, QStringLiteral("Colors:View/ForegroundLink")); kdeColor(pal, QPalette::LinkVisited, kdeSettings, QStringLiteral("Colors:View/ForegroundVisited")); + kdeColor(pal, QPalette::ToolTipBase, kdeSettings, QStringLiteral("Colors:Tooltip/BackgroundNormal")); + kdeColor(pal, QPalette::ToolTipText, kdeSettings, QStringLiteral("Colors:Tooltip/ForegroundNormal")); + + // The above code sets _all_ color roles to "normal" colors. In KDE, the disabled + // color roles are calculated by applying various effects described in kdeglobals. + // We use a bit simpler approach here, similar logic than in qt_palette_from_color(). + const QColor button = pal->color(QPalette::Button); + int h, s, v; + button.getHsv(&h, &s, &v); + + const QBrush whiteBrush = QBrush(Qt::white); + const QBrush buttonBrush = QBrush(button); + const QBrush buttonBrushDark = QBrush(button.darker(v > 128 ? 200 : 50)); + const QBrush buttonBrushDark150 = QBrush(button.darker(v > 128 ? 150 : 75)); + const QBrush buttonBrushLight150 = QBrush(button.lighter(v > 128 ? 150 : 75)); + + pal->setBrush(QPalette::Disabled, QPalette::WindowText, buttonBrushDark); + pal->setBrush(QPalette::Disabled, QPalette::ButtonText, buttonBrushDark); + pal->setBrush(QPalette::Disabled, QPalette::Button, buttonBrush); + pal->setBrush(QPalette::Disabled, QPalette::Light, buttonBrushLight150); + pal->setBrush(QPalette::Disabled, QPalette::Dark, buttonBrushDark); + pal->setBrush(QPalette::Disabled, QPalette::Mid, buttonBrushDark150); + pal->setBrush(QPalette::Disabled, QPalette::Text, buttonBrushDark); + pal->setBrush(QPalette::Disabled, QPalette::BrightText, whiteBrush); + pal->setBrush(QPalette::Disabled, QPalette::Base, buttonBrush); + pal->setBrush(QPalette::Disabled, QPalette::Window, buttonBrush); + pal->setBrush(QPalette::Disabled, QPalette::Highlight, buttonBrushDark150); + pal->setBrush(QPalette::Disabled, QPalette::HighlightedText, buttonBrushLight150); } /*! @@ -360,6 +400,8 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const return QVariant(d->styleNames); case QPlatformTheme::KeyboardScheme: return QVariant(int(KdeKeyboardScheme)); + case QPlatformTheme::ItemViewActivateItemOnSingleClick: + return QVariant(d->singleClick); default: break; } diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index 59dc03666b..cbb3092b1d 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -430,8 +430,9 @@ QAccessible::State QAccessibleMdiSubWindow::state() const state.focused = true; if (!mdiSubWindow()->isVisible()) state.invisible = true; - if (!mdiSubWindow()->parentWidget()->contentsRect().contains(mdiSubWindow()->geometry())) - state.offscreen = true; + if (const QWidget *parent = mdiSubWindow()->parentWidget()) + if (!parent->contentsRect().contains(mdiSubWindow()->geometry())) + state.offscreen = true; if (!mdiSubWindow()->isEnabled()) state.disabled = true; return state; diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index 4efecc5464..380cf92a24 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -74,7 +74,6 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &map) return argument; } -static QDBusConnection dbusConnection = QDBusConnection::systemBus(); QConnmanManagerInterface::QConnmanManagerInterface( QObject *parent) : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), QLatin1String(CONNMAN_MANAGER_PATH), @@ -98,7 +97,7 @@ void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal) QLatin1String(CONNMAN_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), this,SIGNAL(propertyChanged(QString,QDBusVariant)))) { - qWarning() << "PropertyCHanged not connected"; + qWarning() << "PropertyChanged not connected"; } } @@ -118,7 +117,7 @@ void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal) QConnmanDBusHelper *helper; helper = new QConnmanDBusHelper(this); - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), QLatin1String(CONNMAN_MANAGER_PATH), QLatin1String(CONNMAN_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), @@ -379,7 +378,7 @@ void QConnmanProfileInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanProfileInterface::propertyChanged); if (signal == propertyChangedSignal) { - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_PROFILE_INTERFACE), QLatin1String("PropertyChanged"), @@ -449,7 +448,7 @@ void QConnmanServiceInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanServiceInterface::propertyChanged); if (signal == propertyChangedSignal) { - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_SERVICE_INTERFACE), QLatin1String("PropertyChanged"), @@ -460,7 +459,7 @@ void QConnmanServiceInterface::connectNotify(const QMetaMethod &signal) QConnmanDBusHelper *helper; helper = new QConnmanDBusHelper(this); - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_SERVICE_INTERFACE), QLatin1String("PropertyChanged"), @@ -514,9 +513,6 @@ void QConnmanServiceInterface::remove() QDBusReply<QVariantMap> reply = this->call(QLatin1String("Remove")); } -// void moveBefore(QDBusObjectPath &service); -// void moveAfter(QDBusObjectPath &service); - // properties QString QConnmanServiceInterface::getState() { @@ -779,7 +775,7 @@ void QConnmanTechnologyInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanTechnologyInterface::propertyChanged); if (signal == propertyChangedSignal) { - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE), QLatin1String("PropertyChanged"), @@ -790,7 +786,7 @@ void QConnmanTechnologyInterface::connectNotify(const QMetaMethod &signal) QConnmanDBusHelper *helper; helper = new QConnmanDBusHelper(this); - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE), QLatin1String("PropertyChanged"), @@ -861,23 +857,11 @@ QConnmanAgentInterface::~QConnmanAgentInterface() void QConnmanAgentInterface::connectNotify(const QMetaMethod &signal) { Q_UNUSED(signal); -// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanAgentInterface::propertyChanged); -// if (signal == propertyChangedSignal) { -// dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), -// this->path(), -// QLatin1String(CONNMAN_NETWORK_INTERFACE), -// QLatin1String("PropertyChanged"), -// this,SIGNAL(propertyChanged(QString,QVariant&))); -// } } void QConnmanAgentInterface::disconnectNotify(const QMetaMethod &signal) { Q_UNUSED(signal); -// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanAgentInterface::propertyChanged); -// if (signal == propertyChangedSignal) { - -// } } @@ -889,10 +873,6 @@ void QConnmanAgentInterface::reportError(QDBusObjectPath &/*path*/, const QStrin { } -//dict QConnmanAgentInterface::requestInput(QDBusObjectPath &path, dict fields) -//{ -//} - void QConnmanAgentInterface::cancel() { } diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp index a45c3875bc..b1a674365d 100644 --- a/src/plugins/imageformats/ico/qicohandler.cpp +++ b/src/plugins/imageformats/ico/qicohandler.cpp @@ -448,7 +448,7 @@ void ICOReader::read4BitBMP(QImage & image) image = QImage(); break; } - register uchar *p = image.scanLine(h); + uchar *p = image.scanLine(h); uchar *b = buf; for (int i=0; i<icoAttrib.w/2; i++) { // convert nibbles to bytes *p++ = *b >> 4; @@ -487,7 +487,7 @@ void ICOReader::read16_24_32BMP(QImage & image) { if (iod) { int h = icoAttrib.h; - register QRgb *p; + QRgb *p; QRgb *end; uchar *buf = new uchar[image.bytesPerLine()]; int bpl = ((icoAttrib.w*icoAttrib.nbits+31)/32)*4; diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.h b/src/plugins/platforms/cocoa/qcocoaaccessibility.h index 3f0367d36a..86bb5323a7 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.h +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.h @@ -46,11 +46,11 @@ #include <QtGui> #include <qpa/qplatformaccessibility.h> -class QCococaAccessibility : public QPlatformAccessibility +class QCocoaAccessibility : public QPlatformAccessibility { public: - QCococaAccessibility(); - ~QCococaAccessibility(); + QCocoaAccessibility(); + ~QCocoaAccessibility(); void notifyAccessibilityUpdate(QAccessibleEvent *event); void setRootObject(QObject *o); void initialize(); @@ -79,6 +79,7 @@ namespace QCocoaAccessible { NSString *macRole(QAccessibleInterface *interface); bool shouldBeIgnored(QAccessibleInterface *interface); +NSArray *unignoredChildren(id parentObject, QAccessibleInterface *interface); NSString *getTranslatedAction(const QString &qtAction); NSMutableArray *createTranslatedActionsList(const QStringList &qtActions); QString translateAction(NSString *nsAction); diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index 9c38a874e5..5649f3ad73 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -44,17 +44,17 @@ #include <QtGui/private/qaccessible2_p.h> #include <private/qcore_mac_p.h> -QCococaAccessibility::QCococaAccessibility() +QCocoaAccessibility::QCocoaAccessibility() { } -QCococaAccessibility::~QCococaAccessibility() +QCocoaAccessibility::~QCocoaAccessibility() { } -void QCococaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) +void QCocoaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) { QObject *object = event->object(); if (!object) @@ -78,17 +78,17 @@ void QCococaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) } } -void QCococaAccessibility::setRootObject(QObject *o) +void QCocoaAccessibility::setRootObject(QObject *o) { Q_UNUSED(o) } -void QCococaAccessibility::initialize() +void QCocoaAccessibility::initialize() { } -void QCococaAccessibility::cleanup() +void QCocoaAccessibility::cleanup() { } @@ -223,6 +223,26 @@ bool shouldBeIgnored(QAccessibleInterface *interface) return false; } +NSArray *unignoredChildren(id parentObject, QAccessibleInterface *interface) +{ + int numKids = interface->childCount(); + // qDebug() << "Children for: " << axid << iface << " are: " << numKids; + + NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids]; + for (int i = 0; i < numKids; ++i) { + QAccessibleInterface *child = interface->child(i); + Q_ASSERT(child); + if (child->state().invalid || child->state().invisible) + continue; + + QAccessible::Id childId = QAccessible::uniqueId(child); + //qDebug() << " kid: " << childId << child; + QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId:childId parent:parentObject]; + [kids addObject: element]; + [element release]; + } + return NSAccessibilityUnignoredChildren(kids); +} /* Translates a predefined QAccessibleActionInterface action to a Mac action constant. Returns 0 if the Qt Action has no mac equivalent. Ownership of the NSString is diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index f7c945c50d..7eae22f720 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -137,23 +137,7 @@ } else if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) { return NSAccessibilityRoleDescription(role, nil); } else if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) { - - int numKids = iface->childCount(); - // qDebug() << "Children for: " << axid << iface << " are: " << numKids; - - NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids]; - for (int i = 0; i < numKids; ++i) { - QAccessibleInterface *child = iface->child(i); - Q_ASSERT(child); - QAccessible::Id childId = QAccessible::uniqueId(child); - //qDebug() << " kid: " << childId << child; - QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId:childId parent:self]; - [kids addObject: element]; - [element release]; - } - // ### maybe we should use NSAccessibilityUnignoredChildren(kids); this needs more profiling - return kids; - + return QCocoaAccessible::unignoredChildren(self, iface); } else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) { // Just check if the app thinks we're focused. id focusedElement = [NSApp accessibilityAttributeValue:NSAccessibilityFocusedUIElementAttribute]; @@ -272,8 +256,7 @@ // No child found, meaning we hit this element. if (!childInterface) { // qDebug() << "Hit test returns: " << id << iface; - return self; - //return NSAccessibilityUnignoredAncestor(self); + return NSAccessibilityUnignoredAncestor(self); } QAccessible::Id childId = QAccessible::uniqueId(childInterface); diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index 7dad4271b5..a37552d844 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -123,7 +123,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o) if (pm.isNull()) pm = defaultPixmap(); - NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(pm)); + NSImage *nsimage = qt_mac_create_nsimage(pm); QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacPasteboardMime::MIME_DND); m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy")); @@ -145,6 +145,8 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o) source:m_lastView slideBack:YES]; + [nsimage release]; + m_drag = 0; return m_executed_drop_action; } diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 071edb5b60..76cd235514 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -168,7 +168,7 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions; mSelectedNameFilter = new QStringList([self findStrippedFilterWithVisualFilterName:selectedVisualNameFilter]); QFileInfo sel(selectFile); - if (sel.isDir()){ + if (sel.isDir() && !sel.isBundle()){ mCurrentDir = [QCFString::toNSString(sel.absoluteFilePath()) retain]; mCurrentSelection = new QString; } else { @@ -244,15 +244,15 @@ static QString strippedText(QString s) - (void)showModelessPanel { if (mOpenPanel){ - QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir)); + QFileInfo info(*mCurrentSelection); NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath()); bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave) || [self panel:nil shouldShowFilename:filepath]; [self updateProperties]; [mOpenPanel setAllowedFileTypes:nil]; - [mOpenPanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())] - : [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]]; + [mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : @""]; + [mOpenPanel beginWithCompletionHandler:^(NSInteger result){ mReturnCode = result; if (mHelper) @@ -263,13 +263,12 @@ static QString strippedText(QString s) - (BOOL)runApplicationModalPanel { - QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir)); + QFileInfo info(*mCurrentSelection); NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath()); bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave) || [self panel:nil shouldShowFilename:filepath]; - [mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())] - : [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]]; + [mSavePanel setDirectoryURL: [NSURL fileURLWithPath:mCurrentDir]]; [mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : @""]; // Call processEvents in case the event dispatcher has been interrupted, and needs to do @@ -289,14 +288,14 @@ static QString strippedText(QString s) - (void)showWindowModalSheet:(QWindow *)parent { - QFileInfo info(!mCurrentSelection->isEmpty() ? *mCurrentSelection : QT_PREPEND_NAMESPACE(QCFString::toQString)(mCurrentDir)); + QFileInfo info(*mCurrentSelection); NSString *filepath = QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath()); bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave) || [self panel:nil shouldShowFilename:filepath]; [self updateProperties]; - [mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())] - : [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]]; + [mSavePanel setDirectoryURL: [NSURL fileURLWithPath:mCurrentDir]]; + [mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : @""]; NSWindow *nsparent = static_cast<NSWindow *>(qGuiApp->platformNativeInterface()->nativeResourceForWindow("nswindow", parent)); diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 45038ee578..fad743439e 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -219,7 +219,7 @@ QCocoaIntegration::QCocoaIntegration() , mEventDispatcher(new QCocoaEventDispatcher()) , mInputContext(new QCocoaInputContext) #ifndef QT_NO_ACCESSIBILITY - , mAccessibility(new QCococaAccessibility) + , mAccessibility(new QCocoaAccessibility) #endif , mCocoaClipboard(new QCocoaClipboard) , mCocoaDrag(new QCocoaDrag) diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index 73331db40d..8d1ca88b8e 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -203,6 +203,11 @@ void QCocoaMenuBar::updateMenuBarImmediately() QCocoaAutoReleasePool pool; QCocoaMenuBar *mb = findGlobalMenubar(); QCocoaWindow *cw = findWindowForMenubar(); + + QWindow *win = cw ? cw->window() : 0; + if (win && (win->flags() & Qt::Popup) == Qt::Popup) + return; // context menus, comboboxes, etc. don't need to update the menubar + if (cw && cw->menubar()) mb = cw->menubar(); diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 36d7a49746..9c10bc26dd 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -281,7 +281,7 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const sizes << 16 << 32 << 64 << 128; return QVariant::fromValue(sizes); } - case QPlatformTheme::PasswordMaskDelay: + case QPlatformTheme::PasswordMaskCharacter: return QVariant(QChar(kBulletUnicode)); default: break; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 19c4faf369..057eb7e144 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -235,6 +235,8 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) setGeometry(tlw->geometry()); recreateWindow(parent()); tlw->setGeometry(geometry()); + if (tlw->isTopLevel()) + setWindowIcon(tlw->icon()); m_inConstructor = false; } diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 92215b9e67..3ee994427b 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -115,6 +115,7 @@ QT_END_NAMESPACE - (void)handleKeyEvent:(NSEvent *)theEvent eventType:(int)eventType; - (void)keyDown:(NSEvent *)theEvent; - (void)keyUp:(NSEvent *)theEvent; +- (BOOL)performKeyEquivalent:(NSEvent *)theEvent; - (void)registerDragTypes; - (NSDragOperation)handleDrag:(id <NSDraggingInfo>)sender; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 94b414a882..66a1b95ad8 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -113,6 +113,8 @@ static QTouchDevice *touchDevice = 0; name:NSViewGlobalFrameDidChangeNotification object:self]; } + delete currentCustomDragTypes; + [super dealloc]; } @@ -984,6 +986,23 @@ static QTouchDevice *touchDevice = 0; [self handleKeyEvent:nsevent eventType:int(QEvent::KeyRelease)]; } +- (BOOL)performKeyEquivalent:(NSEvent *)nsevent +{ + NSString *chars = [nsevent charactersIgnoringModifiers]; + + if ([nsevent type] == NSKeyDown && [chars length] > 0) { + QChar ch = [chars characterAtIndex:0]; + Qt::Key qtKey = qt_mac_cocoaKey2QtKey(ch); + // check for Command + Key_Period + if ([nsevent modifierFlags] & NSCommandKeyMask + && qtKey == Qt::Key_Period) { + [self handleKeyEvent:nsevent eventType:int(QEvent::KeyPress)]; + return YES; + } + } + return [super performKeyEquivalent:nsevent]; +} + - (void)flagsChanged:(NSEvent *)nsevent { ulong timestamp = [nsevent timestamp] * 1000; @@ -1276,7 +1295,7 @@ static QTouchDevice *touchDevice = 0; NSFilenamesPboardType, NSPostScriptPboardType, NSTIFFPboardType, NSRTFPboardType, NSTabularTextPboardType, NSFontPboardType, NSRulerPboardType, NSFileContentsPboardType, NSColorPboardType, - NSRTFDPboardType, NSHTMLPboardType, NSPICTPboardType, + NSRTFDPboardType, NSHTMLPboardType, NSURLPboardType, NSPDFPboardType, NSVCardPboardType, NSFilesPromisePboardType, NSInkTextPboardType, NSMultipleTextSelectionPboardType, mimeTypeGeneric, nil]; diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm index 6ebb1f6ba8..86e5066fbb 100644 --- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm +++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm @@ -74,21 +74,7 @@ } else if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) { if (!m_window->accessibleRoot()) return [super accessibilityAttributeValue:attribute]; - - // Create QCocoaAccessibleElements for each child if the - // root accessible interface. - int numKids = m_window->accessibleRoot()->childCount(); - NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids]; - for (int i = 0; i < numKids; ++i) { - QAccessibleInterface *child = m_window->accessibleRoot()->child(i); - Q_ASSERT(child); - QAccessible::Id childAxid = QAccessible::uniqueId(child); - QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId:childAxid parent:self]; - [kids addObject: element]; - [element release]; - } - - return kids; + return QCocoaAccessible::unignoredChildren(self, m_window->accessibleRoot()); } else { return [super accessibilityAttributeValue:attribute]; } diff --git a/src/plugins/platforms/qnx/qqnxrootwindow.cpp b/src/plugins/platforms/qnx/qqnxrootwindow.cpp index 5d58890c51..ff5866d1b7 100644 --- a/src/plugins/platforms/qnx/qqnxrootwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxrootwindow.cpp @@ -162,6 +162,16 @@ QQnxRootWindow::QQnxRootWindow(const QQnxScreen *screen) if (result != 0) qFatal("QQnxRootWindow: failed to set window source position, errno=%d", errno); + // Optionally disable the screen power save + bool ok = false; + const int disablePowerSave = qgetenv("QQNX_DISABLE_POWER_SAVE").toInt(&ok); + if (ok && disablePowerSave) { + const int mode = SCREEN_IDLE_MODE_KEEP_AWAKE; + result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_IDLE_MODE, &mode); + if (result != 0) + qWarning("QQnxRootWindow: failed to disable power saving mode"); + } + createWindowGroup(); // Don't post yet. This will be lazily done from QQnxScreen upon first posting of diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 7daab24d3c..87e59dac61 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -77,7 +77,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) #endif m_screen(0), m_parentWindow(0), - m_visible(true), + m_visible(false), m_windowState(Qt::WindowNoState), m_requestedBufferSize(window->geometry().size()) { @@ -153,7 +153,6 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) if (window->parent() && window->parent()->handle()) setParent(window->parent()->handle()); setGeometryHelper(window->geometry()); - setVisible(window->isVisible()); } QQnxWindow::~QQnxWindow() @@ -273,6 +272,9 @@ void QQnxWindow::setVisible(bool visible) { qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "visible =" << visible; + if (m_visible == visible) + return; + m_visible = visible; QQnxWindow *root = this; @@ -283,13 +285,13 @@ void QQnxWindow::setVisible(bool visible) window()->requestActivate(); - if (window()->isTopLevel()) { - QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); + QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); - if (!visible) { - // Flush the context, otherwise it won't disappear immediately - screen_flush_context(m_screenContext, 0); - } + if (visible) { + applyWindowState(); + } else { + // Flush the context, otherwise it won't disappear immediately + screen_flush_context(m_screenContext, 0); } } @@ -626,35 +628,10 @@ void QQnxWindow::setWindowState(Qt::WindowState state) if (m_windowState == state) return; - switch (state) { - - // WindowActive is not an accepted parameter according to the docs - case Qt::WindowActive: - return; - - case Qt::WindowMinimized: - minimize(); - - if (m_unmaximizedGeometry.isValid()) - setGeometry(m_unmaximizedGeometry); - else - setGeometry(m_screen->geometry()); - - break; - - case Qt::WindowMaximized: - case Qt::WindowFullScreen: - m_unmaximizedGeometry = geometry(); - setGeometry(state == Qt::WindowMaximized ? m_screen->availableGeometry() : m_screen->geometry()); - break; - - case Qt::WindowNoState: - if (m_unmaximizedGeometry.isValid()) - setGeometry(m_unmaximizedGeometry); - break; - } - m_windowState = state; + + if (m_visible) + applyWindowState(); } void QQnxWindow::gainedFocus() @@ -735,6 +712,37 @@ void QQnxWindow::updateZorder(int &topZorder) childWindow->updateZorder(topZorder); } +void QQnxWindow::applyWindowState() +{ + switch (m_windowState) { + + // WindowActive is not an accepted parameter according to the docs + case Qt::WindowActive: + return; + + case Qt::WindowMinimized: + minimize(); + + if (m_unmaximizedGeometry.isValid()) + setGeometry(m_unmaximizedGeometry); + else + setGeometry(m_screen->geometry()); + + break; + + case Qt::WindowMaximized: + case Qt::WindowFullScreen: + m_unmaximizedGeometry = geometry(); + setGeometry(m_windowState == Qt::WindowMaximized ? m_screen->availableGeometry() : m_screen->geometry()); + break; + + case Qt::WindowNoState: + if (m_unmaximizedGeometry.isValid()) + setGeometry(m_unmaximizedGeometry); + break; + } +} + void QQnxWindow::blitHelper(QQnxBuffer &source, QQnxBuffer &target, const QPoint &sourceOffset, const QPoint &targetOffset, const QRegion ®ion, bool flush) { diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h index 4a327fd54b..63d5dc0979 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.h +++ b/src/plugins/platforms/qnx/qqnxwindow.h @@ -124,6 +124,7 @@ private: void setOffset(const QPoint &setOffset); void updateVisibility(bool parentVisible); void updateZorder(int &topZorder); + void applyWindowState(); void fetchBuffers(); diff --git a/src/plugins/platforms/windows/qplatformfunctions_wince.h b/src/plugins/platforms/windows/qplatformfunctions_wince.h index 3190e39ec5..30fc66563e 100644 --- a/src/plugins/platforms/windows/qplatformfunctions_wince.h +++ b/src/plugins/platforms/windows/qplatformfunctions_wince.h @@ -74,6 +74,7 @@ #ifndef CWP_SKIPINVISIBLE #define CWP_SKIPINVISIBLE 0x0001 +#define CWP_SKIPTRANSPARENT 0x0004 #define findPlatformWindowAt(a, b, c) findPlatformWindowAt(a, b) #endif diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index f7ccb00233..12dd00f104 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -1720,7 +1720,9 @@ int QWindowsXpNativeFileDialog::existingDirCallback(HWND hwnd, UINT uMsg, LPARAM { switch (uMsg) { case BFFM_INITIALIZED: { - const QString initialFile = m_data.selectedFile(); + if (!m_title.isEmpty()) + SetWindowText(hwnd, (wchar_t *)m_title.utf16()); + const QString initialFile = QDir::toNativeSeparators(m_data.directory()); if (!initialFile.isEmpty()) SendMessage(hwnd, BFFM_SETSELECTION, TRUE, LPARAM(initialFile.utf16())); } @@ -1743,8 +1745,7 @@ QStringList QWindowsXpNativeFileDialog::execExistingDir(HWND owner) initPath[0] = 0; bi.hwndOwner = owner; bi.pidlRoot = NULL; - //### This does not seem to be respected? - the dialog always displays "Browse for folder" - bi.lpszTitle = (wchar_t*)m_title.utf16(); + bi.lpszTitle = 0; bi.pszDisplayName = initPath; bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE; bi.lpfn = xpFileDialogGetExistingDirCallbackProc; diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 924d604641..47c136991a 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -664,7 +664,7 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 bool QWindowsKeyMapper::isADeadKey(unsigned int vk_key, unsigned int modifiers) { if ((vk_key < NumKeyboardLayoutItems) && keyLayout[vk_key].exists) { - for (register size_t i = 0; i < NumMods; ++i) { + for (size_t i = 0; i < NumMods; ++i) { if (uint(ModsTbl[i]) == modifiers) return bool(keyLayout[vk_key].deadkeys & 1<<i); } @@ -793,7 +793,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms // A multi-character key or a Input method character // not found by our look-ahead if (msgType == WM_CHAR || msgType == WM_IME_CHAR) { - sendExtendedPressRelease(receiver, 0, Qt::KeyboardModifier(state), scancode, vk_key, nModifiers, messageKeyText(msg), false, 0); + sendExtendedPressRelease(receiver, 0, Qt::KeyboardModifier(state), scancode, vk_key, nModifiers, messageKeyText(msg), false); return true; } @@ -822,13 +822,13 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms if (dirStatus == VK_LSHIFT && ((msg.wParam == VK_SHIFT && GetKeyState(VK_LCONTROL)) || (msg.wParam == VK_CONTROL && GetKeyState(VK_LSHIFT)))) { - sendExtendedPressRelease(receiver, Qt::Key_Direction_L, 0, scancode, msg.wParam, nModifiers, QString(), false, 0); + sendExtendedPressRelease(receiver, Qt::Key_Direction_L, 0, scancode, msg.wParam, nModifiers, QString(), false); result = true; dirStatus = 0; } else if (dirStatus == VK_RSHIFT && ( (msg.wParam == VK_SHIFT && GetKeyState(VK_RCONTROL)) || (msg.wParam == VK_CONTROL && GetKeyState(VK_RSHIFT)))) { - sendExtendedPressRelease(receiver, Qt::Key_Direction_R, 0, scancode, msg.wParam, nModifiers, QString(), false, 0); + sendExtendedPressRelease(receiver, Qt::Key_Direction_R, 0, scancode, msg.wParam, nModifiers, QString(), false); result = true; dirStatus = 0; } else { @@ -1020,9 +1020,9 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms if (rec) { if (code < Qt::Key_Shift || code > Qt::Key_ScrollLock) { QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyRelease, code, - Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true, 0); + Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true); QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyPress, code, - Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true, 0); + Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true); result = true; } } @@ -1033,7 +1033,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms const char a = uch.row() ? 0 : uch.cell(); key_recorder.storeKey(msg.wParam, a, state, text); QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyPress, code, - Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, text, false, 0); + Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, text, false); result =true; bool store = true; #ifndef Q_OS_WINCE @@ -1077,7 +1077,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms code = Qt::Key_Backtab; QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyRelease, code, Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, - (rec ? rec->text : QString()), false, 0); + (rec ? rec->text : QString()), false); result = true; #ifndef Q_OS_WINCE // don't pass Alt to Windows unless we are embedded in a non-Qt window diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp index 629da4fd0d..c1d75c2ad0 100644 --- a/src/plugins/platforms/windows/qwindowsmime.cpp +++ b/src/plugins/platforms/windows/qwindowsmime.cpp @@ -277,7 +277,7 @@ static bool qt_read_dibv5(QDataStream &s, QImage &image) int bpl = image.bytesPerLine(); uchar *data = image.bits(); - register QRgb *p; + QRgb *p; QRgb *end; uchar *buf24 = new uchar[bpl]; int bpl24 = ((w*nbits+31)/32)*4; diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index 5c096b7eca..c6cfa4dbbc 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -232,8 +232,10 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, } const QPoint globalPosition = QWindowsGeometryHint::mapToGlobal(hwnd, winEventPosition); + // In this context, neither an invisible nor a transparent window (transparent regarding mouse + // events, "click-through") can be considered as the window under mouse. QWindow *currentWindowUnderMouse = platformWindow->hasMouseCapture() ? - QWindowsScreen::windowAt(globalPosition) : window; + QWindowsScreen::windowAt(globalPosition, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT) : window; compressMouseMove(&msg); // Qt expects the platform plugin to capture the mouse on diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 9d817c2043..08ff7123eb 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -837,6 +837,8 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : const qreal opacity = qt_window_private(aWindow)->opacity; if (!qFuzzyCompare(opacity, qreal(1.0))) setOpacity(opacity); + if (aWindow->isTopLevel()) + setWindowIcon(aWindow->icon()); clearFlag(WithinCreate); } diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index db53e7471e..6e5a9ccbb4 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -885,13 +885,19 @@ int QXcbKeyboard::keysymToQtKey(xcb_keysym_t key) const int QXcbKeyboard::keysymToQtKey(xcb_keysym_t keysym, Qt::KeyboardModifiers &modifiers, QString text) const { int code = 0; +#ifndef QT_NO_TEXTCODEC QTextCodec *systemCodec = QTextCodec::codecForLocale(); +#endif // Commentary in X11/keysymdef says that X codes match ASCII, so it // is safe to use the locale functions to process X codes in ISO8859-1. // This is mainly for compatibility - applications should not use the // Qt keycodes between 128 and 255 (extended ACSII codes), but should // rather use the QKeyEvent::text(). - if (keysym < 128 || (keysym < 256 && systemCodec->mibEnum() == 4)) { + if (keysym < 128 || (keysym < 256 +#ifndef QT_NO_TEXTCODEC + && systemCodec->mibEnum() == 4 +#endif + )) { // upper-case key, if known code = isprint((int)keysym) ? toupper((int)keysym) : 0; } else if (keysym >= XK_F1 && keysym <= XK_F35) { diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp index bc8c559c6e..b205a63267 100644 --- a/src/plugins/platforms/xcb/qxcbmime.cpp +++ b/src/plugins/platforms/xcb/qxcbmime.cpp @@ -170,11 +170,13 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, if (!encoding.isEmpty() && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) { +#ifndef QT_NO_TEXTCODEC if (requestedType == QVariant::String) { QTextCodec *codec = QTextCodec::codecForName(encoding); if (codec) return codec->toUnicode(data); } +#endif return data; } diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index e1bc7d36eb..3a19788316 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -239,7 +239,7 @@ void QXcbWindow::create() // XCB_CW_BACK_PIXMAP XCB_NONE, // XCB_CW_OVERRIDE_REDIRECT - type == Qt::Popup || type == Qt::ToolTip, + type == Qt::Popup || type == Qt::ToolTip || (window()->flags() & Qt::BypassWindowManagerHint), // XCB_CW_SAVE_UNDER type == Qt::Popup || type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip || type == Qt::Drawer, // XCB_CW_EVENT_MASK @@ -458,6 +458,8 @@ void QXcbWindow::create() const qreal opacity = qt_window_private(window())->opacity; if (!qFuzzyCompare(opacity, qreal(1.0))) setOpacity(opacity); + if (window()->isTopLevel()) + setWindowIcon(window()->icon()); } QXcbWindow::~QXcbWindow() diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp index 7ffd3e105f..c106bd00f8 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.cpp +++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp @@ -214,23 +214,37 @@ QXcbXSettings::QXcbXSettings(QXcbScreen *screen) QByteArray settings_atom_for_screen("_XSETTINGS_S"); settings_atom_for_screen.append(QByteArray::number(screen->screenNumber())); xcb_intern_atom_cookie_t atom_cookie = xcb_intern_atom(screen->xcb_connection(), - false, + true, settings_atom_for_screen.length(), settings_atom_for_screen.constData()); - xcb_intern_atom_reply_t *atom_reply = xcb_intern_atom_reply(screen->xcb_connection(),atom_cookie,NULL); + xcb_generic_error_t *error = 0; + xcb_intern_atom_reply_t *atom_reply = xcb_intern_atom_reply(screen->xcb_connection(),atom_cookie,&error); + if (error) { + qWarning() << Q_FUNC_INFO << "Failed to find XSETTINGS_S atom"; + return; + } xcb_atom_t selection_owner_atom = atom_reply->atom; free(atom_reply); xcb_get_selection_owner_cookie_t selection_cookie = xcb_get_selection_owner(screen->xcb_connection(), selection_owner_atom); + xcb_get_selection_owner_reply_t *selection_result = - xcb_get_selection_owner_reply(screen->xcb_connection(), selection_cookie, NULL); + xcb_get_selection_owner_reply(screen->xcb_connection(), selection_cookie, &error); + if (error) { + qWarning() << Q_FUNC_INFO << "Failed to get selection owner for XSETTINGS_S atom"; + return; + } d_ptr->x_settings_window = selection_result->owner; + if (!d_ptr->x_settings_window) { + return; + } free(selection_result); + const uint32_t event = XCB_CW_EVENT_MASK; const uint32_t event_mask[] = { XCB_EVENT_MASK_STRUCTURE_NOTIFY|XCB_EVENT_MASK_PROPERTY_CHANGE }; - xcb_change_window_attributes(screen->xcb_connection(),d_ptr->x_settings_window,XCB_CW_EVENT_MASK,event_mask); + xcb_change_window_attributes(screen->xcb_connection(),d_ptr->x_settings_window,event,event_mask); d_ptr->populateSettings(d_ptr->getSettings()); } diff --git a/src/printsupport/dialogs/qpagesetupdialog.cpp b/src/printsupport/dialogs/qpagesetupdialog.cpp index a05099fa08..6fa901fc45 100644 --- a/src/printsupport/dialogs/qpagesetupdialog.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog.cpp @@ -104,11 +104,6 @@ QT_BEGIN_NAMESPACE QPageSetupDialogPrivate::QPageSetupDialogPrivate(QPrinter *prntr) : printer(0), ownsPrinter(false) { setPrinter(prntr); - init(); -} - -void QPageSetupDialogPrivate::init() -{ } void QPageSetupDialogPrivate::setPrinter(QPrinter *newPrinter) diff --git a/src/printsupport/dialogs/qpagesetupdialog_p.h b/src/printsupport/dialogs/qpagesetupdialog_p.h index eb672cc752..ba2f0da06a 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_p.h +++ b/src/printsupport/dialogs/qpagesetupdialog_p.h @@ -73,7 +73,6 @@ class QPageSetupDialogPrivate : public QDialogPrivate public: QPageSetupDialogPrivate(QPrinter *printer); - virtual void init(); void setPrinter(QPrinter *newPrinter); QPrinter *printer; diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp index 1e0251c6d2..1add522cb8 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp @@ -574,14 +574,18 @@ void QPageSetupWidget::setRightMargin(double newValue) QPageSetupDialog::QPageSetupDialog(QPrinter *printer, QWidget *parent) : QDialog(*(new QUnixPageSetupDialogPrivate(printer)), parent) { + Q_D(QPageSetupDialog); setWindowTitle(QCoreApplication::translate("QPrintPreviewDialog", "Page Setup")); + static_cast<QUnixPageSetupDialogPrivate *>(d)->init(); } QPageSetupDialog::QPageSetupDialog(QWidget *parent) : QDialog(*(new QUnixPageSetupDialogPrivate(0)), parent) { + Q_D(QPageSetupDialog); setWindowTitle(QCoreApplication::translate("QPrintPreviewDialog", "Page Setup")); + static_cast<QUnixPageSetupDialogPrivate *>(d)->init(); } int QPageSetupDialog::exec() diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp index 273cb60d7d..a475ccbfb6 100644 --- a/src/tools/qdoc/config.cpp +++ b/src/tools/qdoc/config.cpp @@ -877,7 +877,9 @@ void Config::load(Location location, const QString& fileName) } QTextStream stream(&fin); +#ifndef QT_NO_TEXTCODEC stream.setCodec("UTF-8"); +#endif QString text = stream.readAll(); text += QLatin1String("\n\n"); text += QLatin1Char('\0'); diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index 41fe2f775c..5c25eeedc4 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -207,10 +207,10 @@ void CppCodeParser::parseSourceFile(const Location& location, const QString& fil readToken(); /* - The set of active namespaces is cleared before parsing + The set of open namespaces is cleared before parsing each source file. The word "source" here means cpp file. */ - activeNamespaces_.clear(); + qdb_->clearOpenNamespaces(); matchDocsAndStuff(); in.close(); @@ -323,21 +323,18 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, doc.startLocation().warning(tr("Invalid syntax in '\\%1'").arg(COMMAND_FN)); } else { - if (!activeNamespaces_.isEmpty()) { - foreach (const QString& usedNamespace_, activeNamespaces_) { - QStringList newPath = usedNamespace_.split("::") + parentPath; - func = qdb_->findFunctionNode(newPath, clone); - if (func) - break; - } - } - // Search the root namespace if no match was found. - if (func == 0) + func = qdb_->findNodeInOpenNamespace(parentPath, clone); + /* + Search the root namespace if no match was found. + */ + if (func == 0) { func = qdb_->findFunctionNode(parentPath, clone); + } if (func == 0) { - if (parentPath.isEmpty() && !lastPath_.isEmpty()) + if (parentPath.isEmpty() && !lastPath_.isEmpty()) { func = qdb_->findFunctionNode(lastPath_, clone); + } if (func == 0) { doc.location().warning(tr("Cannot find '%1' in '\\%2' %3") .arg(clone->name() + "(...)") @@ -426,16 +423,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, C++ namespace, search for it first in all the known C++ namespaces. */ - if (!activeNamespaces_.isEmpty()) { - foreach (const QString& usedNamespace_, activeNamespaces_) { - QStringList newPath = usedNamespace_.split("::") + path; - node = qdb_->findNodeByNameAndType(newPath, type, subtype); - if (node) { - path = newPath; - break; - } - } - } + node = qdb_->findNodeInOpenNamespace(path, type, subtype); /* If the node was not found in a C++ namespace, search @@ -458,7 +446,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, if (path.size() > 1) { path.pop_back(); QString ns = path.join("::"); - activeNamespaces_.insert(ns); + qdb_->insertOpenNamespace(ns); } } return node; @@ -1718,7 +1706,7 @@ bool CppCodeParser::matchUsingDecl() /* So far, so good. We have 'using namespace Foo;'. */ - activeNamespaces_.insert(name); + qdb_->insertOpenNamespace(name); return true; } @@ -2125,13 +2113,7 @@ bool CppCodeParser::matchDocsAndStuff() FunctionNode *func = 0; if (matchFunctionDecl(0, &parentPath, &clone, QString(), extra)) { - foreach (const QString& usedNamespace_, activeNamespaces_) { - QStringList newPath = usedNamespace_.split("::") + parentPath; - func = qdb_->findFunctionNode(newPath, clone); - if (func) { - break; - } - } + func = qdb_->findNodeInOpenNamespace(parentPath, clone); if (func == 0) func = qdb_->findFunctionNode(parentPath, clone); @@ -2256,9 +2238,8 @@ bool CppCodeParser::makeFunctionNode(const QString& signature, Tokenizer* outerTokenizer = tokenizer; int outerTok = tok; - Location loc; QByteArray latin1 = signature.toLatin1(); - Tokenizer stringTokenizer(loc, latin1); + Tokenizer stringTokenizer(location(), latin1); stringTokenizer.setParsingFnOrMacro(true); tokenizer = &stringTokenizer; readToken(); diff --git a/src/tools/qdoc/cppcodeparser.h b/src/tools/qdoc/cppcodeparser.h index eae5d1e97d..957142712b 100644 --- a/src/tools/qdoc/cppcodeparser.h +++ b/src/tools/qdoc/cppcodeparser.h @@ -166,7 +166,6 @@ protected: QStringList lastPath_; QRegExp varComment; QRegExp sep; - QSet<QString> activeNamespaces_; private: QString sequentialIteratorDefinition; diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index dd87e889bf..af8ac505f8 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -532,10 +532,12 @@ void DitaXmlGenerator::initializeGenerator(const Config &config) projectUrl = config.getString(CONFIG_URL); tagFile_ = config.getString(CONFIG_TAGFILE); +#ifndef QT_NO_TEXTCODEC outputEncoding = config.getString(CONFIG_OUTPUTENCODING); if (outputEncoding.isEmpty()) outputEncoding = QLatin1String("ISO-8859-1"); outputCodec = QTextCodec::codecForName(outputEncoding.toLocal8Bit()); +#endif naturalLanguage = config.getString(CONFIG_NATURALLANGUAGE); if (naturalLanguage.isEmpty()) @@ -3586,7 +3588,11 @@ QString DitaXmlGenerator::registerRef(const QString& ref) */ QString DitaXmlGenerator::protectEnc(const QString& string) { +#ifndef QT_NO_TEXTCODEC return protect(string, outputEncoding); +#else + return protect(string); +#endif } QString DitaXmlGenerator::protect(const QString& string, const QString& ) //outputEncoding) diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 81be63abe1..187253df50 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -273,8 +273,10 @@ void Generator::beginSubPage(const InnerNode* node, const QString& fileName) node->location().fatal(tr("Cannot open output file '%1'").arg(outFile->fileName())); QTextStream* out = new QTextStream(outFile); +#ifndef QT_NO_TEXTCODEC if (outputCodec) out->setCodec(outputCodec); +#endif outStreamStack.push(out); const_cast<InnerNode*>(node)->setOutputFileName(fileName); } diff --git a/src/tools/qdoc/generator.h b/src/tools/qdoc/generator.h index 28a9ae5ce8..2fb3117765 100644 --- a/src/tools/qdoc/generator.h +++ b/src/tools/qdoc/generator.h @@ -178,8 +178,10 @@ protected: QMap<QString, QStringList> editionGroupMap; QMap<QString, QStringList> editionModuleMap; QString naturalLanguage; +#ifndef QT_NO_TEXTCODEC QTextCodec* outputCodec; QString outputEncoding; +#endif QString tagFile_; QStack<QTextStream*> outStreamStack; diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 3d6f04decf..73788edb4a 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -179,10 +179,12 @@ void HtmlGenerator::initializeGenerator(const Config &config) projectUrl = config.getString(CONFIG_URL); tagFile_ = config.getString(CONFIG_TAGFILE); +#ifndef QT_NO_TEXTCODEC outputEncoding = config.getString(CONFIG_OUTPUTENCODING); if (outputEncoding.isEmpty()) outputEncoding = QLatin1String("UTF-8"); outputCodec = QTextCodec::codecForName(outputEncoding.toLocal8Bit()); +#endif naturalLanguage = config.getString(CONFIG_NATURALLANGUAGE); if (naturalLanguage.isEmpty()) @@ -1743,7 +1745,11 @@ void HtmlGenerator::generateHeader(const QString& title, const Node *node, CodeMarker *marker) { +#ifndef QT_NO_TEXTCODEC out() << QString("<?xml version=\"1.0\" encoding=\"%1\"?>\n").arg(outputEncoding); +#else + out() << QString("<?xml version=\"1.0\"?>\n"); +#endif out() << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; out() << QString("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"%1\" lang=\"%1\">\n").arg(naturalLanguage); out() << "<head>\n"; @@ -3185,7 +3191,11 @@ QString HtmlGenerator::registerRef(const QString& ref) QString HtmlGenerator::protectEnc(const QString &string) { +#ifndef QT_NO_TEXTCODEC return protect(string, outputEncoding); +#else + return protect(string); +#endif } QString HtmlGenerator::protect(const QString &string, const QString &outputEncoding) @@ -4172,11 +4182,12 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element) if (match) { tags += manifestMetaContent[idx].tags; foreach (const QString &attr, manifestMetaContent[idx].attributes) { - QStringList attrList = attr.split(QLatin1Char(':'), QString::SkipEmptyParts); + QLatin1Char div(':'); + QStringList attrList = attr.split(div); if (attrList.count() == 1) attrList.append(QStringLiteral("true")); - if (attrList.count() == 2) - writer.writeAttribute(attrList[0], attrList[1]); + QString attrName = attrList.takeFirst(); + writer.writeAttribute(attrName, attrList.join(div)); } } } diff --git a/src/tools/qdoc/location.h b/src/tools/qdoc/location.h index 33472810d3..0c113bcbeb 100644 --- a/src/tools/qdoc/location.h +++ b/src/tools/qdoc/location.h @@ -47,8 +47,7 @@ #define LOCATION_H #include <qstack.h> - -#include "tr.h" +#include <qcoreapplication.h> QT_BEGIN_NAMESPACE diff --git a/src/tools/qdoc/openedlist.h b/src/tools/qdoc/openedlist.h index cf7624b8e3..2aad1f6dcb 100644 --- a/src/tools/qdoc/openedlist.h +++ b/src/tools/qdoc/openedlist.h @@ -49,7 +49,6 @@ #include <qstring.h> #include "location.h" -#include "tr.h" QT_BEGIN_NAMESPACE diff --git a/src/tools/qdoc/puredocparser.cpp b/src/tools/qdoc/puredocparser.cpp index aba17d79b1..d11ef3a3c7 100644 --- a/src/tools/qdoc/puredocparser.cpp +++ b/src/tools/qdoc/puredocparser.cpp @@ -101,10 +101,10 @@ void PureDocParser::parseSourceFile(const Location& location, const QString& fil readToken(); /* - The set of active namespaces is cleared before parsing + The set of open namespaces is cleared before parsing each source file. The word "source" here means cpp file. */ - activeNamespaces_.clear(); + qdb_->clearOpenNamespaces(); processQdocComments(); in.close(); diff --git a/src/tools/qdoc/qdoc.pro b/src/tools/qdoc/qdoc.pro index 3bd11bcd5b..55e32dd4a3 100644 --- a/src/tools/qdoc/qdoc.pro +++ b/src/tools/qdoc/qdoc.pro @@ -38,7 +38,6 @@ HEADERS += atom.h \ separator.h \ text.h \ tokenizer.h \ - tr.h \ tree.h SOURCES += atom.cpp \ codechunk.cpp \ diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index 674917f6dc..7a3df4e4f2 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -1126,4 +1126,56 @@ QString QDocDatabase::refForAtom(const Atom* atom) return QString(); } +/*! + If there are open namespaces, search for the function node + having the same function name as the \a clone node in each + open namespace. The \a parentPath is a portion of the path + name provided with the function name at the point of + reference. \a parentPath is usually a class name. Return + the pointer to the function node if one is found in an + open namespace. Otherwise return 0. + + This open namespace concept is of dubious value and might + be removed. + */ +FunctionNode* QDocDatabase::findNodeInOpenNamespace(const QStringList& parentPath, + const FunctionNode* clone) +{ + FunctionNode* fn = 0; + if (!openNamespaces_.isEmpty()) { + foreach (const QString& t, openNamespaces_) { + QStringList path = t.split("::") + parentPath; + fn = findFunctionNode(path, clone); + if (fn) + break; + } + } + return fn; +} + +/*! + Find a node of the specified \a type and \a subtype that is + reached with the specified \a path. If such a node is found + in an open namespace, prefix \a path with the name of the + open namespace and "::" and return a pointer to the node. + Othewrwise return 0. + */ +Node* QDocDatabase::findNodeInOpenNamespace(QStringList& path, + Node::Type type, + Node::SubType subtype) +{ + Node* n = 0; + if (!openNamespaces_.isEmpty()) { + foreach (const QString& t, openNamespaces_) { + QStringList p = t.split("::") + path; + n = findNodeByNameAndType(p, type, subtype); + if (n) { + path = p; + break; + } + } + } + return n; +} + QT_END_NAMESPACE diff --git a/src/tools/qdoc/qdocdatabase.h b/src/tools/qdoc/qdocdatabase.h index d97fb3809a..d88160ee56 100644 --- a/src/tools/qdoc/qdocdatabase.h +++ b/src/tools/qdoc/qdocdatabase.h @@ -196,6 +196,11 @@ class QDocDatabase Generator* g, bool generateInternalNodes = false); + void clearOpenNamespaces() { openNamespaces_.clear(); } + void insertOpenNamespace(const QString& path) { openNamespaces_.insert(path); } + FunctionNode* findNodeInOpenNamespace(const QStringList& parentPath, const FunctionNode* clone); + Node* findNodeInOpenNamespace(QStringList& path, Node::Type type, Node::SubType subtype); + /* debugging functions */ void printModules() const; void printQmlModules() const; @@ -240,6 +245,7 @@ class QDocDatabase TextToNodeMap legaleseTexts_; DocNodeMultiMap docNodesByTitle_; TargetRecMultiMap targetRecMultiMap_; + QSet<QString> openNamespaces_; }; QT_END_NAMESPACE diff --git a/src/tools/qdoc/separator.cpp b/src/tools/qdoc/separator.cpp index 2403fb15c8..af10ba364c 100644 --- a/src/tools/qdoc/separator.cpp +++ b/src/tools/qdoc/separator.cpp @@ -44,7 +44,7 @@ */ #include "separator.h" -#include "tr.h" +#include <qcoreapplication.h> QT_BEGIN_NAMESPACE diff --git a/src/tools/qdoc/tokenizer.cpp b/src/tools/qdoc/tokenizer.cpp index 3968cdb828..224d451f4c 100644 --- a/src/tools/qdoc/tokenizer.cpp +++ b/src/tools/qdoc/tokenizer.cpp @@ -101,7 +101,9 @@ static QRegExp *definedX = 0; static QRegExp *defines = 0; static QRegExp *falsehoods = 0; +#ifndef QT_NO_TEXTCODEC static QTextCodec *sourceCodec = 0; +#endif /* This function is a perfect hash function for the 37 keywords of C99 @@ -496,7 +498,9 @@ void Tokenizer::initialize(const Config &config) QString sourceEncoding = config.getString(CONFIG_SOURCEENCODING); if (sourceEncoding.isEmpty()) sourceEncoding = QLatin1String("ISO-8859-1"); +#ifndef QT_NO_TEXTCODEC sourceCodec = QTextCodec::codecForName(sourceEncoding.toLocal8Bit()); +#endif comment = new QRegExp("/(?:\\*.*\\*/|/.*\n|/[^\n]*$)"); comment->setMinimal(true); @@ -770,12 +774,20 @@ bool Tokenizer::isTrue(const QString &condition) QString Tokenizer::lexeme() const { +#ifndef QT_NO_TEXTCODEC return sourceCodec->toUnicode(yyLex); +#else + return QString::fromUtf8(yyLex); +#endif } QString Tokenizer::previousLexeme() const { +#ifndef QT_NO_TEXTCODEC return sourceCodec->toUnicode(yyPrevLex); +#else + return QString::fromUtf8(yyPrevLex); +#endif } QT_END_NAMESPACE diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp index 1efab11a92..553c569ae9 100644 --- a/src/tools/qdoc/tree.cpp +++ b/src/tools/qdoc/tree.cpp @@ -367,7 +367,11 @@ const FunctionNode* Tree::findFunctionNode(const QStringList& parentPath, const Node* relative, int findFlags) const { - const Node* parent = findNode(parentPath, relative, findFlags); + const Node* parent = findNamespaceNode(parentPath); + if (parent == 0) + parent = findClassNode(parentPath, 0); + if (parent == 0) + parent = findNode(parentPath, relative, findFlags); if (parent == 0 || !parent->isInnerNode()) return 0; return ((InnerNode*)parent)->findFunctionNode(clone); @@ -658,7 +662,7 @@ Node* Tree::findNodeRecursive(const QStringList& path, Node* start, Node::Type type, Node::SubType subtype, - bool acceptCollision) + bool acceptCollision) const { if (!start || path.isEmpty()) return 0; // no place to start, or nothing to search for. @@ -736,7 +740,7 @@ EnumNode* Tree::findEnumNode(const QStringList& path, Node* start) at the root of the tree. Only a C++ class node named \a path is acceptible. If one is not found, 0 is returned. */ -ClassNode* Tree::findClassNode(const QStringList& path, Node* start) +ClassNode* Tree::findClassNode(const QStringList& path, Node* start) const { if (!start) start = const_cast<NamespaceNode*>(root()); @@ -748,7 +752,7 @@ ClassNode* Tree::findClassNode(const QStringList& path, Node* start) the root of the tree. Only a Namespace node named \a path is acceptible. If one is not found, 0 is returned. */ -NamespaceNode* Tree::findNamespaceNode(const QStringList& path) +NamespaceNode* Tree::findNamespaceNode(const QStringList& path) const { Node* start = const_cast<NamespaceNode*>(root()); return static_cast<NamespaceNode*>(findNodeRecursive(path, 0, start, Node::Namespace, Node::NoSubType)); diff --git a/src/tools/qdoc/tree.h b/src/tools/qdoc/tree.h index 67cd3a9752..e44b8d7d12 100644 --- a/src/tools/qdoc/tree.h +++ b/src/tools/qdoc/tree.h @@ -82,9 +82,9 @@ class Tree ~Tree(); EnumNode* findEnumNode(const QStringList& path, Node* start = 0); - ClassNode* findClassNode(const QStringList& path, Node* start = 0); + ClassNode* findClassNode(const QStringList& path, Node* start = 0) const; QmlClassNode* findQmlTypeNode(const QStringList& path); - NamespaceNode* findNamespaceNode(const QStringList& path); + NamespaceNode* findNamespaceNode(const QStringList& path) const; DocNode* findQmlModuleNode(const QStringList& path, Node* start = 0); Node* findNodeByNameAndType(const QStringList& path, @@ -98,7 +98,7 @@ class Tree Node* start, Node::Type type, Node::SubType subtype, - bool acceptCollision = false); + bool acceptCollision = false) const; const Node* findNode(const QStringList &path, const Node* relative = 0, diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 653a9170b2..f72abd20ab 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -1677,8 +1677,8 @@ void QTreeWidgetItemPrivate::propagateDisabled(QTreeWidgetItem *item) the item can be checked, edited, and selected. The default value for flags is - Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled. - If the item was constructed with a parent, flags will in addition contain Qt::ItemIsDropEnabled. + Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | + Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled. \sa setFlags() */ diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 0da9460794..61f3b6b8eb 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -707,7 +707,7 @@ QApplication::~QApplication() QWidgetSet *mySet = QWidgetPrivate::allWidgets; QWidgetPrivate::allWidgets = 0; for (QWidgetSet::ConstIterator it = mySet->constBegin(); it != mySet->constEnd(); ++it) { - register QWidget *w = *it; + QWidget *w = *it; if (!w->parent()) // window w->destroy(true, true); } @@ -1044,7 +1044,7 @@ void QApplication::setStyle(QStyle *style) if (QApplicationPrivate::app_style) { if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) { - register QWidget *w = *it; + QWidget *w = *it; if (!(w->windowType() == Qt::Desktop) && // except desktop w->testAttribute(Qt::WA_WState_Polished)) { // has been polished QApplicationPrivate::app_style->unpolish(w); @@ -1086,7 +1086,7 @@ void QApplication::setStyle(QStyle *style) // re-polish existing widgets if necessary if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { for (QWidgetList::ConstIterator it1 = all.constBegin(); it1 != all.constEnd(); ++it1) { - register QWidget *w = *it1; + QWidget *w = *it1; if (w->windowType() != Qt::Desktop && w->testAttribute(Qt::WA_WState_Polished)) { if (w->style() == QApplicationPrivate::app_style) QApplicationPrivate::app_style->polish(w); // repolish @@ -1098,7 +1098,7 @@ void QApplication::setStyle(QStyle *style) } for (QWidgetList::ConstIterator it2 = all.constBegin(); it2 != all.constEnd(); ++it2) { - register QWidget *w = *it2; + QWidget *w = *it2; if (w->windowType() != Qt::Desktop && !w->testAttribute(Qt::WA_SetStyle)) { QEvent e(QEvent::StyleChange); QApplication::sendEvent(w, &e); @@ -1328,7 +1328,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* QWidgetList wids = QApplication::allWidgets(); for (QWidgetList::ConstIterator it = wids.constBegin(); it != wids.constEnd(); ++it) { - register QWidget *w = *it; + QWidget *w = *it; if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class QApplication::sendEvent(w, &e); } @@ -1510,7 +1510,7 @@ void QApplication::setFont(const QFont &font, const char *className) QWidgetList wids = QApplication::allWidgets(); for (QWidgetList::ConstIterator it = wids.constBegin(); it != wids.constEnd(); ++it) { - register QWidget *w = *it; + QWidget *w = *it; if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class sendEvent(w, &e); } @@ -1580,7 +1580,7 @@ void QApplication::setWindowIcon(const QIcon &icon) QEvent e(QEvent::ApplicationWindowIconChange); QWidgetList all = QApplication::allWidgets(); for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) { - register QWidget *w = *it; + QWidget *w = *it; if (w->isWindow()) sendEvent(w, &e); } @@ -2695,12 +2695,14 @@ bool QApplicationPrivate::shouldQuit() the ones without QuitOnClose), we emit the lastWindowClosed signal */ QWidgetList list = QApplication::topLevelWidgets(); + QWindowList processedWindows; for (int i = 0; i < list.size(); ++i) { QWidget *w = list.at(i); + processedWindows.push_back(w->windowHandle()); if (w->isVisible() && !w->parentWidget() && w->testAttribute(Qt::WA_QuitOnClose)) return false; } - return QGuiApplicationPrivate::shouldQuit(); + return QGuiApplicationPrivate::shouldQuitInternal(processedWindows); } static inline void closeAllPopups() @@ -2975,7 +2977,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) && mouse->type() == QEvent::MouseMove && mouse->buttons() == 0) { // but still send them through all application event filters (normally done by notify_helper) for (int i = 0; d->extraData && i < d->extraData->eventFilters.size(); ++i) { - register QObject *obj = d->extraData->eventFilters.at(i); + QObject *obj = d->extraData->eventFilters.at(i); if (!obj) continue; if (obj->d_func()->threadData != w->d_func()->threadData) { diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index b96bd024cb..661317d21a 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -380,7 +380,7 @@ void QWhatsThisPrivate::notifyToplevels(QEvent *e) { QWidgetList toplevels = QApplication::topLevelWidgets(); for (int i = 0; i < toplevels.count(); ++i) { - register QWidget *w = toplevels.at(i); + QWidget *w = toplevels.at(i); QApplication::sendEvent(w, e); } } diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index f67a93c7b5..c6bd387a90 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -104,6 +104,8 @@ #include "qtabwidget.h" // Needed in inTabWidget() #endif // QT_KEYPAD_NAVIGATION +#include "qwindowcontainer_p.h" + // widget/widget data creation count //#define QWIDGET_EXTRA_DEBUG @@ -6250,6 +6252,17 @@ bool QWidget::isActiveWindow() const } } + // Check for an active window container + if (QWindow *ww = QGuiApplication::focusWindow()) { + while (ww) { + QWidgetWindow *qww = qobject_cast<QWidgetWindow *>(ww); + QWindowContainer *qwc = qww ? qobject_cast<QWindowContainer *>(qww->widget()) : 0; + if (qwc && qwc->topLevelWidget() == tlw) + return true; + ww = ww->parent(); + } + } + // Check if platform adaptation thinks the window is active. This is necessary for // example in case of ActiveQt servers that are embedded into another application. // Those are separate processes that are not part of the parent application Qt window/widget diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index c6edbee67d..936eb76dad 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5004,7 +5004,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_ItemView_ActivateItemOnSingleClick: ret = 0; if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) - ret = theme->themeHint(QPlatformTheme::ToolButtonStyle).toBool() ? 1 : 0; + ret = theme->themeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick).toBool() ? 1 : 0; break; case SH_TitleBar_ModifyNotification: ret = true; diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index a8fba4fb68..dad4e57d13 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -119,9 +119,12 @@ QMacStylePrivate *mPrivate; { Q_UNUSED(notification); QEvent event(QEvent::StyleChange); - foreach (QWidget *widget, QApplication::allWidgets()) { - if (QScrollBar *scrollBar = qobject_cast<QScrollBar *>(widget)) - QCoreApplication::sendEvent(scrollBar, &event); + QMutableSetIterator<QPointer<QObject> > it(QMacStylePrivate::scrollBars); + while (it.hasNext()) { + if (!it.next()) + it.remove(); + else + QCoreApplication::sendEvent(it.value(), &event); } } @end @@ -142,6 +145,13 @@ const int QMacStylePrivate::PushButtonContentPadding = 6; const qreal QMacStylePrivate::ScrollBarFadeOutDuration = 200.0; const qreal QMacStylePrivate::ScrollBarFadeOutDelay = 450.0; +QSet<QPointer<QObject> > QMacStylePrivate::scrollBars; + +static uint qHash(const QPointer<QObject> &ptr) +{ + return qHash(ptr.data()); +} + // These colors specify the titlebar gradient colors on // Leopard. Ideally we should get them from the system. static const QColor titlebarGradientActiveBegin(220, 220, 220); @@ -1620,6 +1630,19 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti } } +void QMacStylePrivate::setAutoDefaultButton(QObject *button) const +{ + if (autoDefaultButton != button) { + if (QStyleAnimation *anim = animation(autoDefaultButton)) { + anim->updateTarget(); + stopAnimation(autoDefaultButton); + } + autoDefaultButton = button; + } + if (autoDefaultButton && !animation(autoDefaultButton)) + startAnimation(new QStyleAnimation(autoDefaultButton)); +} + QMacStylePrivate::QMacStylePrivate() : mouseDown(false) { @@ -3487,15 +3510,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // takes precedence over a normal default button if (btn->features & QStyleOptionButton::AutoDefaultButton && opt->state & State_Active && opt->state & State_HasFocus) { - d->autoDefaultButton = opt->styleObject; - if (!d->animation(opt->styleObject)) - d->startAnimation(new QStyleAnimation(opt->styleObject)); + d->setAutoDefaultButton(opt->styleObject); } else if (d->autoDefaultButton == opt->styleObject) { - if (QStyleAnimation *animation = d->animation(opt->styleObject)) { - animation->updateTarget(); - d->stopAnimation(opt->styleObject); - } - d->autoDefaultButton = 0; + d->setAutoDefaultButton(0); } if (!d->autoDefaultButton) { @@ -4934,6 +4951,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex // no longer possible to move it, second the up/down buttons are removed when // there is not enough space for them. if (cc == CC_ScrollBar) { + if (opt && opt->styleObject && !QMacStylePrivate::scrollBars.contains(opt->styleObject)) + QMacStylePrivate::scrollBars.insert(QPointer<QObject>(opt->styleObject)); const int scrollBarLength = (slider->orientation == Qt::Horizontal) ? slider->rect.width() : slider->rect.height(); const QMacStyle::WidgetSizePolicy sizePolicy = widgetSizePolicy(widget, opt); @@ -6021,10 +6040,14 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, bool useAquaGuideline = true; switch (ct) { - case QStyle::CT_SpinBox: - // hack to work around horrible sizeHint() code in QAbstractSpinBox - sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); - sz.setHeight(sz.height() - 3); + + case CT_SpinBox: + if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { + // Add button + frame widths + int buttonWidth = 20; + int fw = proxy()->pixelMetric(PM_SpinBoxFrameWidth, vopt, widget); + sz += QSize(buttonWidth + 2*fw, 2*fw - 3); + } break; case QStyle::CT_TabWidget: // the size between the pane and the "contentsRect" (+4,+4) diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index c424ff0c3c..efeaa66e39 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -93,6 +93,7 @@ #include <qlibrary.h> #include <qdatetimeedit.h> #include <qmath.h> +#include <qset.h> #include <QtWidgets/qgraphicsproxywidget.h> #include <QtWidgets/qgraphicsview.h> @@ -193,10 +194,13 @@ public: HIThemeButtonDrawInfo *bdi) const; QPixmap generateBackgroundPattern() const; + void setAutoDefaultButton(QObject *button) const; + public: mutable QPointer<QObject> pressedButton; mutable QPointer<QObject> defaultButton; mutable QPointer<QObject> autoDefaultButton; + static QSet<QPointer<QObject> > scrollBars; struct ButtonState { int frame; diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 603d0e50a5..dccc9ff3ce 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -351,7 +351,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C \section1 Styles in Item Views The painting of items in views is performed by a delegate. Qt's - default delegate, QStyledItemDelegate, is also used for for calculating bounding + default delegate, QStyledItemDelegate, is also used for calculating bounding rectangles of items, and their sub-elements for the various kind of item \l{Qt::ItemDataRole}{data roles} QStyledItemDelegate supports. See the QStyledItemDelegate class diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 31cf329262..3b3c27f6cb 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -582,7 +582,7 @@ bool QWindowsXPStylePrivate::hasAlphaChannel(const QRect &rect) int firstAlpha = -1; for (int y = startY; y < h/2; ++y) { - register DWORD *buffer = (DWORD*)bufferPixels + (y * bufferW); + DWORD *buffer = (DWORD*)bufferPixels + (y * bufferW); for (int x = startX; x < w; ++x, ++buffer) { int alpha = (*buffer) >> 24; if (firstAlpha == -1) @@ -611,8 +611,8 @@ bool QWindowsXPStylePrivate::fixAlphaChannel(const QRect &rect) bool hasFixedAlphaValue = false; for (int y = startY; y < h; ++y) { - register DWORD *buffer = (DWORD*)bufferPixels + (y * bufferW); - for (register int x = startX; x < w; ++x, ++buffer) { + DWORD *buffer = (DWORD*)bufferPixels + (y * bufferW); + for (int x = startX; x < w; ++x, ++buffer) { uint pixel = *buffer; int alpha = qAlpha(pixel); if (qRed(pixel) > alpha || qGreen(pixel) > alpha || qBlue(pixel) > alpha) { @@ -643,13 +643,13 @@ bool QWindowsXPStylePrivate::swapAlphaChannel(const QRect &rect, bool allPixels) // Flip the alphas, so that 255-alpha pixels are 0, and 0-alpha are 255. for (int y = startY; y < h; ++y) { - register DWORD *buffer = (DWORD*)bufferPixels + (y * bufferW); - for (register int x = startX; x < w; ++x, ++buffer) { + DWORD *buffer = (DWORD*)bufferPixels + (y * bufferW); + for (int x = startX; x < w; ++x, ++buffer) { if (allPixels) { *buffer |= 0xFF000000; continue; } - register unsigned int alphaValue = (*buffer) & 0xFF000000; + unsigned int alphaValue = (*buffer) & 0xFF000000; if (alphaValue == 0xFF000000) { *buffer = 0; valueChange = true; diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri index b39b17fd86..3707090c4c 100644 --- a/src/widgets/styles/styles.pri +++ b/src/widgets/styles/styles.pri @@ -54,25 +54,10 @@ contains( styles, mac ) { styles/qmacstyle_mac_p.h \ styles/qmacstyle_mac_p_p.h OBJECTIVE_SOURCES += styles/qmacstyle_mac.mm - - !contains( styles, windows ) { - message( mac requires windows ) - styles += windows - DEFINES+= QT_STYLE_WINDOWS - } } else { DEFINES += QT_NO_STYLE_MAC } -contains( styles, windows ) { - HEADERS += styles/qwindowsstyle_p.h - HEADERS += styles/qwindowsstyle_p_p.h - SOURCES += styles/qwindowsstyle.cpp - DEFINES += QT_STYLE_WINDOWS -} else { - DEFINES += QT_NO_STYLE_WINDOWS -} - contains( styles, windowsvista ) { HEADERS += styles/qwindowsvistastyle_p.h HEADERS += styles/qwindowsvistastyle_p_p.h @@ -80,7 +65,6 @@ contains( styles, windowsvista ) { !contains( styles, windowsxp ) { message( windowsvista requires windowsxp ) styles += windowsxp - DEFINES += QT_STYLE_WINDOWSXP } } else { DEFINES += QT_NO_STYLE_WINDOWSVISTA @@ -93,12 +77,19 @@ contains( styles, windowsxp ) { !contains( styles, windows ) { message( windowsxp requires windows ) styles += windows - DEFINES += QT_STYLE_WINDOWS } } else { DEFINES += QT_NO_STYLE_WINDOWSXP } +contains( styles, windows ) { + HEADERS += styles/qwindowsstyle_p.h + HEADERS += styles/qwindowsstyle_p_p.h + SOURCES += styles/qwindowsstyle.cpp +} else { + DEFINES += QT_NO_STYLE_WINDOWS +} + contains( styles, gtk ) { HEADERS += styles/qgtkglobal_p.h HEADERS += styles/qgtkstyle_p.h diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp index e04656974d..5204b85a9a 100644 --- a/src/widgets/util/qsystemtrayicon_x11.cpp +++ b/src/widgets/util/qsystemtrayicon_x11.cpp @@ -153,16 +153,17 @@ private: QSystemTrayIcon *q; }; -QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn) : - q(qIn) +QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn) + : QWidget(0, Qt::Window | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint) + , q(qIn) { + setObjectName(QStringLiteral("QSystemTrayIconSys")); setToolTip(q->toolTip()); QX11SystemTrayContext *context = qX11SystemTrayContext(); Q_ASSERT(context->isValid()); setAttribute(Qt::WA_AlwaysShowToolTips, true); setAttribute(Qt::WA_TranslucentBackground, true); setAttribute(Qt::WA_QuitOnClose, false); - setWindowFlags(Qt::Window | Qt::FramelessWindowHint); const QSize size(22, 22); // Gnome, standard size setGeometry(QRect(QPoint(0, 0), size)); setMinimumSize(size); @@ -182,7 +183,6 @@ QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *qIn) : ev.xclient.format = 32; memcpy((char *)&ev.xclient.data, (const char *) l, sizeof(l)); XSendEvent(display, ev.xclient.window, False, 0, &ev); - XSync(display, False); show(); } diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 5217e57333..7cd7172ef5 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1259,6 +1259,9 @@ void QDockWidget::setFloating(bool floating) d->endDrag(true); QRect r = d->undockedGeometry; + // Keep position when undocking for the first time. + if (floating && isVisible() && !r.isValid()) + r = QRect(mapToGlobal(QPoint(0, 0)), size()); d->setWindowState(floating, false, floating ? r : QRect()); diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp index 3ba9ad9ba3..5104171fb1 100644 --- a/src/widgets/widgets/qlcdnumber.cpp +++ b/src/widgets/widgets/qlcdnumber.cpp @@ -429,7 +429,7 @@ void QLCDNumber::setDigitCount(int numDigits) bool doDisplay = d->ndigits == 0; if (numDigits == d->ndigits) // no change return; - register int i; + int i; int dif; if (numDigits > d->ndigits) { // expand dif = numDigits - d->ndigits; diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index abef6e8832..d44e9ad02f 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -132,7 +132,8 @@ void QLineEdit::initStyleOption(QStyleOptionFrame *option) const A line edit allows the user to enter and edit a single line of plain text with a useful collection of editing functions, - including undo and redo, cut and paste, and drag and drop. + including undo and redo, cut and paste, and drag and drop (see + \l setDragEnabled()). By changing the echoMode() of a line edit, it can also be used as a "write-only" field, for inputs such as passwords. @@ -1801,7 +1802,7 @@ void QLineEdit::paintEvent(QPaintEvent *) int minLB = qMax(0, -fm.minLeftBearing()); int minRB = qMax(0, -fm.minRightBearing()); - if (d->control->text().isEmpty()) { + if (d->control->text().isEmpty() && d->control->preeditAreaText().isEmpty()) { if (!d->placeholderText.isEmpty()) { QColor col = pal.text().color(); col.setAlpha(128); diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 7c72c5c456..4df89a5ede 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -2854,9 +2854,9 @@ void QMenu::mouseMoveEvent(QMouseEvent *e) d->hasHadMouse = d->hasHadMouse || rect().contains(e->pos()); QAction *action = d->actionAt(e->pos()); - if (!action) { + if (!action || action->isSeparator()) { if (d->hasHadMouse - && (!d->currentAction + && (!d->currentAction || (action && action->isSeparator()) || !(d->currentAction->menu() && d->currentAction->menu()->isVisible()))) d->setCurrentAction(0); return; diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index cca4655f58..42dca7fc66 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -1193,6 +1193,13 @@ void tst_QFile::permissions() if (qt_ntfs_permission_lookup) QEXPECT_FAIL("readonly", "QTBUG-25630", Abort); #endif +#ifdef Q_OS_UNIX + if (strcmp(QTest::currentDataTag(), "readonly") == 0) { + // in case accidentally run as root + if (::getuid() == 0) + QSKIP("Running this test as root doesn't make sense"); + } +#endif QCOMPARE((memberResult == QFile::Permissions(perms)), expected); QCOMPARE((staticResult == QFile::Permissions(perms)), expected); } diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 898aefffd3..2a79a6963e 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -1937,6 +1937,21 @@ void tst_QUrl::strictParser_data() QTest::newRow("invalid-ipvfuture-3") << "http://[v789]" << "Invalid IPvFuture address"; QTest::newRow("unbalanced-brackets") << "http://[ff02::1" << "Expected ']' to match '[' in hostname"; + // invalid IDN hostnames happen in TolerantMode too + QTest::newRow("idn-prohibited-char-space") << "http:// " << "Invalid hostname (contains invalid characters)"; + QTest::newRow("idn-prohibited-char-nbsp") << "http://\xc2\xa0" << "Invalid hostname (contains invalid characters)"; + QTest::newRow("idn-prohibited-char-control-1f") << "http://\x1f" << "Invalid hostname (contains invalid characters)"; + QTest::newRow("idn-prohibited-char-control-7f") << "http://\x7f" << "Invalid hostname (contains invalid characters)"; + QTest::newRow("idn-prohibited-char-control-80") << "http://\xc2\x80" << "Invalid hostname (contains invalid characters)"; + QTest::newRow("idn-prohibited-char-private-bmp") << "http://\xee\x80\x80" << "Invalid hostname (contains invalid characters)"; + QTest::newRow("idn-prohibited-char-private-plane15") << "http://\xf3\xb0\x80\x80" << "Invalid hostname (contains invalid characters)"; + QTest::newRow("idn-prohibited-char-private-plane16") << "http://\xf4\x80\x80\x80" << "Invalid hostname (contains invalid characters)"; + QTest::newRow("idn-prohibited-char-ffff") << "http://\xef\xbf\xbf" << "Invalid hostname (contains invalid characters)"; + QTest::newRow("idn-prohibited-char-surrogate-1") << "http://" + QString(QChar(0xD800)) << "Invalid hostname (contains invalid characters)"; + QTest::newRow("idn-prohibited-char-surrogate-2") << "http://" + QString(QChar(0xDC00)) << "Invalid hostname (contains invalid characters)"; + QTest::newRow("idn-prohibited-char-surrogate-3") << "http://" + QString(QChar(0xD800)) + "a" << "Invalid hostname (contains invalid characters)"; + // FIXME: add some tests for prohibited BiDi (RFC 3454 section 6) + // port errors happen in TolerantMode too QTest::newRow("empty-port-1") << "http://example.com:" << "Port field was empty"; QTest::newRow("empty-port-2") << "http://example.com:/" << "Port field was empty"; diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp index fa3dec620a..2014045171 100644 --- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp +++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp @@ -351,7 +351,7 @@ void tst_QUrlInternal::nameprep_testsuite_data() << QString() << 0 << 0; QTest::newRow("Non-ASCII multibyte space character U+1680") - << QString::fromUtf8("\xE1\x9A\x80") + << QString::fromUtf8("x\xE1\x9A\x80x") << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; @@ -375,13 +375,18 @@ void tst_QUrlInternal::nameprep_testsuite_data() << QString::fromUtf8("\x10\x7F") << QString() << 0 << 0; + QTest::newRow("Non-ASCII 8bit control character U+0080") + << QString::fromUtf8("x\xC2\x80x") + << QString() + << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; + QTest::newRow("Non-ASCII 8bit control character U+0085") - << QString::fromUtf8("\xC2\x85") + << QString::fromUtf8("x\xC2\x85x") << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; QTest::newRow("Non-ASCII multibyte control character U+180E") - << QString::fromUtf8("\xE1\xA0\x8E") + << QString::fromUtf8("x\xE1\xA0\x8Ex") << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; @@ -391,47 +396,47 @@ void tst_QUrlInternal::nameprep_testsuite_data() << QString() << 0 << 0; QTest::newRow("Non-ASCII control character U+1D175") - << QString::fromUtf8("\xF0\x9D\x85\xB5") + << QString::fromUtf8("x\xF0\x9D\x85\xB5x") << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; QTest::newRow("Plane 0 private use character U+F123") - << QString::fromUtf8("\xEF\x84\xA3") + << QString::fromUtf8("x\xEF\x84\xA3x") << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; QTest::newRow("Plane 15 private use character U+F1234") - << QString::fromUtf8("\xF3\xB1\x88\xB4") + << QString::fromUtf8("x\xF3\xB1\x88\xB4x") << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; QTest::newRow("Plane 16 private use character U+10F234") - << QString::fromUtf8("\xF4\x8F\x88\xB4") + << QString::fromUtf8("x\xF4\x8F\x88\xB4x") << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; QTest::newRow("Non-character code point U+8FFFE") - << QString::fromUtf8("\xF2\x8F\xBF\xBE") + << QString::fromUtf8("x\xF2\x8F\xBF\xBEx") << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; QTest::newRow("Non-character code point U+10FFFF") - << QString::fromUtf8("\xF4\x8F\xBF\xBF") + << QString::fromUtf8("x\xF4\x8F\xBF\xBFx") << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; QTest::newRow("Surrogate code U+DF42") - << QString::fromUtf8("\xED\xBD\x82") + << QString::fromUtf8("x\xED\xBD\x82x") << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; QTest::newRow("Non-plain text character U+FFFD") - << QString::fromUtf8("\xEF\xBF\xBD") + << QString::fromUtf8("x\xEF\xBF\xBDx") << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; QTest::newRow("Ideographic description character U+2FF5") - << QString::fromUtf8("\xE2\xBF\xB5") + << QString::fromUtf8("x\xE2\xBF\xB5x") << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; @@ -441,22 +446,22 @@ void tst_QUrlInternal::nameprep_testsuite_data() << QString() << 0 << 0; QTest::newRow("Left-to-right mark U+200E") - << QString::fromUtf8("\xE2\x80\x8E") - << QString::fromUtf8("\xCC\x81") + << QString::fromUtf8("x\xE2\x80\x8Ex") + << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; QTest::newRow("Deprecated U+202A") - << QString::fromUtf8("\xE2\x80\xAA") - << QString::fromUtf8("\xCC\x81") + << QString::fromUtf8("x\xE2\x80\xAA") + << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; QTest::newRow("Language tagging character U+E0001") - << QString::fromUtf8("\xF3\xA0\x80\x81") - << QString::fromUtf8("\xCC\x81") + << QString::fromUtf8("x\xF3\xA0\x80\x81x") + << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; QTest::newRow("Language tagging character U+E0042") - << QString::fromUtf8("\xF3\xA0\x81\x82") + << QString::fromUtf8("x\xF3\xA0\x81\x82x") << QString() << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; @@ -512,12 +517,6 @@ void tst_QUrlInternal::nameprep_testsuite() QFETCH(QString, out); QFETCH(QString, profile); - QEXPECT_FAIL("Left-to-right mark U+200E", - "Investigate further", Continue); - QEXPECT_FAIL("Deprecated U+202A", - "Investigate further", Continue); - QEXPECT_FAIL("Language tagging character U+E0001", - "Investigate further", Continue); qt_nameprep(&in, 0); QCOMPARE(in, out); } @@ -549,9 +548,9 @@ void tst_QUrlInternal::nameprep_highcodes_data() << QString() << 0 << 0; } { - QChar st[] = { 'D', 0xdb40, 0xdc20, 'o', 0xd834, 0xdd7a, '\'', 0x2060, 'h' }; + QChar st[] = { 'D', 'o', '\'', 0x2060, 'h' }; QChar se[] = { 'd', 'o', '\'', 'h' }; - QTest::newRow("highcodes (D, U+E0020, o, U+1D17A, ', U+2060, h)") + QTest::newRow("highcodes (D, o, ', U+2060, h)") << QString(st, sizeof(st)/sizeof(st[0])) << QString(se, sizeof(se)/sizeof(se[0])) << QString() << 0 << 0; diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index c19a42e4a6..6f5cda5307 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -252,18 +252,18 @@ void tst_QtJson::testNumbers() 0, -1, 1, - (1UL<<54), - (1UL<<55), - (1UL<<56), - -(1UL<<54), - -(1UL<<55), - -(1UL<<56), - (1UL<<54) - 1, - (1UL<<55) - 1, - (1UL<<56) - 1, - -((1UL<<54) - 1), - -((1UL<<55) - 1), - -((1UL<<56) - 1) + (1ll<<54), + (1ll<<55), + (1ll<<56), + -(1ll<<54), + -(1ll<<55), + -(1ll<<56), + (1ll<<54) - 1, + (1ll<<55) - 1, + (1ll<<56) - 1, + -((1ll<<54) - 1), + -((1ll<<55) - 1), + -((1ll<<56) - 1) }; int n = sizeof(numbers)/sizeof(qint64); @@ -289,18 +289,18 @@ void tst_QtJson::testNumbers() 0, -1, 1, - (1UL<<54), - (1UL<<55), - (1UL<<56), - -(1UL<<54), - -(1UL<<55), - -(1UL<<56), - (1UL<<54) - 1, - (1UL<<55) - 1, - (1UL<<56) - 1, - -((1UL<<54) - 1), - -((1UL<<55) - 1), - -((1UL<<56) - 1), + double(1ll<<54), + double(1ll<<55), + double(1ll<<56), + double(-(1ll<<54)), + double(-(1ll<<55)), + double(-(1ll<<56)), + double((1ll<<54) - 1), + double((1ll<<55) - 1), + double((1ll<<56) - 1), + double(-((1ll<<54) - 1)), + double(-((1ll<<55) - 1)), + double(-((1ll<<56) - 1)), 1.1, 0.1, -0.1, diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 62b894178e..4d862f4fc5 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -142,6 +142,9 @@ private slots: void toDouble_data(); void toDouble(); + void toFloat_data(); + void toFloat(); + void toPointF_data(); void toPointF(); @@ -456,6 +459,9 @@ void tst_QVariant::canConvert_data() var = QVariant::fromValue<signed char>(-1); QTest::newRow("SChar") << var << N << N << Y << N << Y << N << N << N << N << Y << N << N << Y << N << N << N << Y << N << N << N << N << N << N << N << N << N << Y << N << N << Y << Y; + var = QVariant::fromValue<QJsonValue>(QJsonValue(QStringLiteral("hello"))); + QTest::newRow("JsonValue") + << var << N << N << Y << N << N << N << N << N << N << Y << N << N << Y << N << N << N << Y << N << N << N << N << N << N << N << N << N << Y << N << N << Y << Y; #undef N #undef Y @@ -511,6 +517,7 @@ void tst_QVariant::toInt_data() bytearray[2] = '0'; bytearray[3] = '0'; QTest::newRow( "QByteArray2" ) << QVariant( bytearray ) << 4500 << true; + QTest::newRow("QJsonValue") << QVariant(QJsonValue(321)) << 321 << true; } void tst_QVariant::toInt() @@ -557,6 +564,7 @@ void tst_QVariant::toUInt_data() bytearray[2] = '2'; bytearray[3] = '1'; QTest::newRow( "QByteArray" ) << QVariant( bytearray ) << (uint)4321 << true; + QTest::newRow("QJsonValue") << QVariant(QJsonValue(321)) << (uint)321 << true; } void tst_QVariant::toUInt() @@ -742,6 +750,8 @@ void tst_QVariant::toBool_data() QTest::newRow( "ulonglong1" ) << QVariant( (qulonglong)1 ) << true; QTest::newRow( "QChar" ) << QVariant(QChar('a')) << true; QTest::newRow( "Null_QChar" ) << QVariant(QChar(0)) << false; + QTest::newRow("QJsonValue(true)") << QVariant(QJsonValue(true)) << true; + QTest::newRow("QJsonValue(false)") << QVariant(QJsonValue(false)) << false; } void tst_QVariant::toBool() @@ -805,6 +815,7 @@ void tst_QVariant::toDouble_data() bytearray[2] = '.'; bytearray[3] = '1'; QTest::newRow( "bytearray" ) << QVariant( bytearray ) << 32.1 << true; + QTest::newRow("QJsonValue") << QVariant(QJsonValue(32.1)) << 32.1 << true; } void tst_QVariant::toDouble() @@ -820,6 +831,34 @@ void tst_QVariant::toDouble() QVERIFY( ok == valueOK ); } +void tst_QVariant::toFloat_data() +{ + QTest::addColumn<QVariant>("value"); + QTest::addColumn<float>("result"); + QTest::addColumn<bool>("valueOK"); + + QByteArray bytearray(4, ' '); + bytearray[0] = '3'; + bytearray[1] = '2'; + bytearray[2] = '.'; + bytearray[3] = '1'; + QTest::newRow("QByteArray") << QVariant(bytearray) << float(32.1) << true; + QTest::newRow("QJsonValue") << QVariant(QJsonValue(32.1)) << float(32.1) << true; +} + +void tst_QVariant::toFloat() +{ + QFETCH(QVariant, value ); + QFETCH(float, result); + QFETCH(bool, valueOK); + QVERIFY(value.isValid()); + QVERIFY(value.canConvert(QMetaType::Float)); + bool ok; + float d = value.toFloat(&ok); + QCOMPARE(d, result); + QVERIFY(ok == valueOK); +} + void tst_QVariant::toLongLong_data() { QTest::addColumn<QVariant>("value"); @@ -843,6 +882,7 @@ void tst_QVariant::toLongLong_data() bytearray[2] = '0'; bytearray[3] = '0'; QTest::newRow( "QByteArray" ) << QVariant( bytearray ) << (qlonglong) 3200 << true; + QTest::newRow("QJsonValue") << QVariant(QJsonValue(321)) << (qlonglong)321 << true; } void tst_QVariant::toLongLong() @@ -887,6 +927,7 @@ void tst_QVariant::toULongLong_data() bytearray[2] = '0'; bytearray[3] = '1'; QTest::newRow( "QByteArray" ) << QVariant( bytearray ) << (qulonglong) 3201 << true; + QTest::newRow("QJsonValue") << QVariant(QJsonValue(321)) << (qulonglong)321 << true; } void tst_QVariant::toULongLong() @@ -953,6 +994,7 @@ void tst_QVariant::toString_data() QTest::newRow( "qdatetime" ) << QVariant( QDateTime( QDate( 2002, 1, 1 ), QTime( 12, 34, 56 ) ) ) << QString( "2002-01-01T12:34:56" ); QTest::newRow( "llong" ) << QVariant( (qlonglong)Q_INT64_C(123456789012) ) << QString( "123456789012" ); + QTest::newRow("QJsonValue") << QVariant(QJsonValue(QString("hello"))) << QString("hello"); } void tst_QVariant::toString() diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index c89d553112..2ec85882b8 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -909,6 +909,20 @@ void tst_QChar::normalization_manual() QVERIFY(composed.normalized(QString::NormalizationForm_KD) == decomposed); QVERIFY(composed.normalized(QString::NormalizationForm_KC) == decomposed); } + { + QString composed; + composed += QChar(0x0061); + composed += QChar(0x00f2); + QString decomposed; + decomposed += QChar(0x0061); + decomposed += QChar(0x006f); + decomposed += QChar(0x0300); + + QVERIFY(decomposed.normalized(QString::NormalizationForm_D) == decomposed); + QVERIFY(decomposed.normalized(QString::NormalizationForm_C) == composed); + QVERIFY(decomposed.normalized(QString::NormalizationForm_KD) == decomposed); + QVERIFY(decomposed.normalized(QString::NormalizationForm_KC) == composed); + } { // hangul QString composed; composed += QChar(0xc154); diff --git a/tests/auto/corelib/tools/qlocale/test/test.pro b/tests/auto/corelib/tools/qlocale/test/test.pro index 4002a5c5ea..66a968b7c3 100644 --- a/tests/auto/corelib/tools/qlocale/test/test.pro +++ b/tests/auto/corelib/tools/qlocale/test/test.pro @@ -18,3 +18,4 @@ TEST_HELPER_INSTALLS = ../syslocaleapp/syslocaleapp win32:CONFIG+= insignificant_test # QTBUG-25284 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 +blackberry:LIBS += -lpps diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 0f6015ebdc..0c4dde4b1a 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -75,6 +75,52 @@ extern "C" DWORD GetThreadLocale(void) { # include <stdlib.h> #endif +#ifdef Q_OS_BLACKBERRY +#include <unistd.h> +#include <errno.h> +#include <fcntl.h> +#include <sys/stat.h> +#include <sys/pps.h> + +static const char ppsLanguageLocalePath[] = "/pps/services/confstr/_CS_LOCALE"; +static const size_t ppsBufferSize = 256; + +static QByteArray readPpsValue(const char *ppsObject, int ppsFd) +{ + QByteArray result; + if (!ppsObject || ppsFd == -1) + return result; + + char buffer[ppsBufferSize]; + + int bytes = read(ppsFd, buffer, ppsBufferSize - 1); + if (bytes == -1) { + qFatal("Failed to read Locale pps, errno=%d", errno); + return result; + } + // ensure data is null terminated + buffer[bytes] = '\0'; + + pps_decoder_t ppsDecoder; + pps_decoder_initialize(&ppsDecoder, 0); + if (pps_decoder_parse_pps_str(&ppsDecoder, buffer) == PPS_DECODER_OK) { + pps_decoder_push(&ppsDecoder, 0); + const char *ppsBuff; + if (pps_decoder_get_string(&ppsDecoder, ppsObject, &ppsBuff) == PPS_DECODER_OK) { + result = ppsBuff; + } else { + int val; + if (pps_decoder_get_int(&ppsDecoder, ppsObject, &val) == PPS_DECODER_OK) + result = QByteArray::number(val); + } + } + + pps_decoder_cleanup(&ppsDecoder); + + return result; +} +#endif // Q_OS_BLACKBERRY + Q_DECLARE_METATYPE(QLocale::FormatType) class tst_QLocale : public QObject @@ -86,6 +132,7 @@ public: private slots: void initTestCase(); + void cleanupTestCase(); #ifdef Q_OS_WIN void windowsDefaultLocale(); #endif @@ -152,6 +199,10 @@ private slots: private: QString m_decimal, m_thousand, m_sdate, m_ldate, m_time; QString m_sysapp; + +#ifdef Q_OS_BLACKBERRY + int m_languageFd; +#endif }; tst_QLocale::tst_QLocale() @@ -173,6 +224,18 @@ void tst_QLocale::initTestCase() QVERIFY2(fi.exists() && fi.isExecutable(), qPrintable(QDir::toNativeSeparators(m_sysapp) + QStringLiteral(" does not exist or is not executable."))); + +#ifdef Q_OS_BLACKBERRY + if ((m_languageFd = open(ppsLanguageLocalePath, O_RDONLY)) == -1) + QFAIL("Failed to open language pps."); +#endif +} + +void tst_QLocale::cleanupTestCase() +{ +#ifdef Q_OS_BLACKBERRY + close(m_languageFd); +#endif } void tst_QLocale::ctor() @@ -462,6 +525,11 @@ void tst_QLocale::emptyCtor() QVERIFY2(runSysApp(m_sysapp, env, &defaultLoc, &errorMessage), qPrintable(errorMessage)); +#ifdef Q_OS_BLACKBERRY + QString locale = readPpsValue("_CS_LOCALE", m_languageFd); + QVERIFY2(runSysApp(m_sysapp, env, &locale, &errorMessage), + qPrintable(errorMessage)); +#else TEST_CTOR("C", "C") TEST_CTOR("bla", "C") TEST_CTOR("zz", "C") @@ -499,6 +567,7 @@ void tst_QLocale::emptyCtor() TEST_CTOR("en/", defaultLoc.toLatin1()) TEST_CTOR("asdfghj", defaultLoc.toLatin1()); TEST_CTOR("123456", defaultLoc.toLatin1()); +#endif // Q_OS_BLACKBERRY #undef TEST_CTOR } diff --git a/tests/auto/corelib/tools/qmessageauthenticationcode/tst_qmessageauthenticationcode.cpp b/tests/auto/corelib/tools/qmessageauthenticationcode/tst_qmessageauthenticationcode.cpp index 0e243988e2..1ac3645349 100644 --- a/tests/auto/corelib/tools/qmessageauthenticationcode/tst_qmessageauthenticationcode.cpp +++ b/tests/auto/corelib/tools/qmessageauthenticationcode/tst_qmessageauthenticationcode.cpp @@ -101,7 +101,7 @@ void tst_QMessageAuthenticationCode::result_data() << QByteArray::fromHex("750c783e6ab0b503eaa86e310a5db738"); QTest::newRow("rfc-md5-3") << QCryptographicHash::Md5 << QByteArray::fromHex("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") - << QByteArray(50, 0xdd) + << QByteArray(50, char(0xdd)) << QByteArray::fromHex("56be34521d144c88dbb8c733f0e8b3f6"); } diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp index c21f725b55..6c62d6f1b4 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.cpp +++ b/tests/auto/gui/image/qicon/tst_qicon.cpp @@ -439,6 +439,9 @@ void tst_QIcon::availableSizes() // we try to load an icon from resources QIcon icon(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-open-16.png")); QList<QSize> availableSizes = icon.availableSizes(); +#ifdef QT_NO_WIDGETS + QEXPECT_FAIL("", "See QTBUG-31993", Abort); +#endif QCOMPARE(availableSizes.size(), 1); QCOMPARE(availableSizes.at(0), QSize(16, 16)); } @@ -635,6 +638,9 @@ void tst_QIcon::task223279_inconsistentAddFile() icon2.addFile(QLatin1String("IconThatDoesntExist")); QPixmap pm2 = icon1.pixmap(32, 32); +#ifdef QT_NO_WIDGETS + QEXPECT_FAIL("", "See QTBUG-31993", Abort); +#endif QCOMPARE(pm1.isNull(), false); QCOMPARE(pm1.size(), QSize(16,16)); QCOMPARE(pm1.isNull(), pm2.isNull()); diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp index 4856f52c55..75aed3bf8b 100644 --- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp +++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp @@ -451,8 +451,8 @@ void tst_QGuiVariant::vector2D() QVariant variant; QVector2D vector = qvariant_cast<QVector2D>(variant); QVERIFY(vector.isNull()); - variant.setValue(QVector2D(0.1, 0.2)); - QCOMPARE(QVector2D(0.1, 0.2), qvariant_cast<QVector2D>(variant)); + variant.setValue(QVector2D(0.1f, 0.2f)); + QCOMPARE(QVector2D(0.1f, 0.2f), qvariant_cast<QVector2D>(variant)); void *pvector = QMetaType::create(QVariant::Vector2D, 0); QVERIFY(pvector); diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 29c72cc02e..d34ab069c3 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -176,6 +176,12 @@ void tst_QWindow::positioning() QSKIP("Multiple failures in this test on Mac OS X, see QTBUG-23059"); #endif + + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability( + QPlatformIntegration::NonFullScreenWindows)) { + QSKIP("This platform does not support non-fullscreen windows"); + } + // Some platforms enforce minimum widths for windows, which can cause extra resize // events, so set the width to suitably large value to avoid those. const QSize size = QSize(300, 40); @@ -187,7 +193,8 @@ void tst_QWindow::positioning() QCOMPARE(window.geometry().size(), size); window.setGeometry(geometry); QCOMPARE(window.geometry(), geometry); - window.show(); + // explicitly use non-fullscreen show. show() can be fullscreen on some platforms + window.showNormal(); QCoreApplication::processEvents(); QTRY_COMPARE(window.received(QEvent::Resize), 1); @@ -431,7 +438,7 @@ void tst_QWindow::testInputEvents() { InputTestWindow window; window.setGeometry(80, 80, 40, 40); - window.show(); + window.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QWindowSystemInterface::handleKeyEvent(&window, QEvent::KeyPress, Qt::Key_A, Qt::NoModifier); diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp index fb5bb18f87..ae6e450301 100644 --- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp @@ -215,8 +215,8 @@ void tst_QRawFont::correctFontData_data() << QFont::StyleNormal << QFont::Normal << QFont::HintingPreference(*hintingPreference) - << 1000.0 - << 10.0; + << qreal(1000.0) + << qreal(10.0); fileName = testFontBoldItalic; title = fileName @@ -229,8 +229,8 @@ void tst_QRawFont::correctFontData_data() << QFont::StyleItalic << QFont::Bold << QFont::HintingPreference(*hintingPreference) - << 1000.0 - << 10.0; + << qreal(1000.0) + << qreal(10.0); ++hintingPreference; } diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp index 9135c57420..17be5e4c43 100644 --- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp +++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp @@ -61,6 +61,7 @@ class tst_QDnsLookup: public QObject QString domainName(const QString &input); QString domainNameList(const QString &input); + QStringList domainNameListAlternatives(const QString &input); public slots: void initTestCase(); @@ -74,8 +75,8 @@ private slots: void tst_QDnsLookup::initTestCase() { QTest::addColumn<QString>("tld"); - QTest::newRow("normal") << ".test.macieira.org"; - QTest::newRow("idn") << ".alqualond\xc3\xab.test.macieira.org"; + QTest::newRow("normal") << ".test.qt-project.org"; + QTest::newRow("idn") << ".alqualond\xc3\xab.test.qt-project.org"; } QString tst_QDnsLookup::domainName(const QString &input) @@ -105,6 +106,14 @@ QString tst_QDnsLookup::domainNameList(const QString &input) return result; } +QStringList tst_QDnsLookup::domainNameListAlternatives(const QString &input) +{ + QStringList alternatives = input.split('|'); + for (int i = 0; i < alternatives.length(); ++i) + alternatives[i] = domainNameList(alternatives[i]); + return alternatives; +} + void tst_QDnsLookup::lookup_data() { QTest::addColumn<int>("type"); @@ -116,46 +125,57 @@ void tst_QDnsLookup::lookup_data() QTest::addColumn<QString>("ns"); QTest::addColumn<QString>("ptr"); QTest::addColumn<QString>("srv"); - QTest::addColumn<QByteArray>("txt"); - - QTest::newRow("a-empty") << int(QDnsLookup::A) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << ""<< "" << QByteArray(); - QTest::newRow("a-notfound") << int(QDnsLookup::A) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("a-single") << int(QDnsLookup::A) << "a-single" << int(QDnsLookup::NoError) << "" << "192.0.2.1" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("a-multi") << int(QDnsLookup::A) << "a-multi" << int(QDnsLookup::NoError) << "" << "192.0.2.1;192.0.2.2;192.0.2.3" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("aaaa-empty") << int(QDnsLookup::AAAA) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("aaaa-notfound") << int(QDnsLookup::AAAA) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("aaaa-single") << int(QDnsLookup::AAAA) << "aaaa-single" << int(QDnsLookup::NoError) << "" << "2001:db8::1" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("aaaa-multi") << int(QDnsLookup::AAAA) << "aaaa-multi" << int(QDnsLookup::NoError) << "" << "2001:db8::1;2001:db8::2;2001:db8::3" << "" << "" << "" << "" << QByteArray(); - - QTest::newRow("any-empty") << int(QDnsLookup::ANY) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("any-notfound") << int(QDnsLookup::ANY) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("any-a-single") << int(QDnsLookup::ANY) << "a-single" << int(QDnsLookup::NoError) << "" << "192.0.2.1" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("any-a-plus-aaaa") << int(QDnsLookup::ANY) << "a-plus-aaaa" << int(QDnsLookup::NoError) << "" << "198.51.100.1;2001:db8::1:1" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("any-multi") << int(QDnsLookup::ANY) << "multi" << int(QDnsLookup::NoError) << "" << "198.51.100.1;198.51.100.2;198.51.100.3;2001:db8::1:1;2001:db8::1:2" << "" << "" << "" << "" << QByteArray(); - - QTest::newRow("mx-empty") << int(QDnsLookup::MX) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("mx-notfound") << int(QDnsLookup::MX) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("mx-single") << int(QDnsLookup::MX) << "mx-single" << int(QDnsLookup::NoError) << "" << "" << "10 multi" << "" << "" << "" << QByteArray(); - QTest::newRow("mx-single-cname") << int(QDnsLookup::MX) << "mx-single-cname" << int(QDnsLookup::NoError) << "" << "" << "10 cname" << "" << "" << "" << QByteArray(); - QTest::newRow("mx-multi") << int(QDnsLookup::MX) << "mx-multi" << int(QDnsLookup::NoError) << "" << "" << "10 multi;20 a-single" << "" << "" << "" << QByteArray(); - - QTest::newRow("ns-empty") << int(QDnsLookup::NS) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("ns-notfound") << int(QDnsLookup::NS) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("ns-single") << int(QDnsLookup::NS) << "ns-single" << int(QDnsLookup::NoError) << "" << "" << "" << "ns3.macieira.info." << "" << "" << QByteArray(); - QTest::newRow("ns-multi") << int(QDnsLookup::NS) << "ns-multi" << int(QDnsLookup::NoError) << "" << "" << "" << "gondolin.macieira.info.;ns3.macieira.info." << "" << "" << QByteArray(); - - QTest::newRow("ptr-empty") << int(QDnsLookup::PTR) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("ptr-notfound") << int(QDnsLookup::PTR) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("ptr-single") << int(QDnsLookup::PTR) << "ptr-single" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "a-single" << "" << QByteArray(); - - QTest::newRow("srv-empty") << int(QDnsLookup::SRV) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("srv-notfound") << int(QDnsLookup::SRV) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("srv-single") << int(QDnsLookup::SRV) << "_echo._tcp.srv-single" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "5 0 7 multi" << QByteArray(); - QTest::newRow("srv-prio") << int(QDnsLookup::SRV) << "_echo._tcp.srv-prio" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "1 0 7 multi;2 0 7 a-plus-aaaa" << QByteArray(); - - QTest::newRow("txt-empty") << int(QDnsLookup::TXT) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("txt-notfound") << int(QDnsLookup::TXT) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("txt-single") << int(QDnsLookup::TXT) << "txt-single" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "" << QByteArray("Hello"); + QTest::addColumn<QString>("txt"); + + QTest::newRow("a-empty") << int(QDnsLookup::A) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << ""<< "" << ""; + QTest::newRow("a-notfound") << int(QDnsLookup::A) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("a-single") << int(QDnsLookup::A) << "a-single" << int(QDnsLookup::NoError) << "" << "192.0.2.1" << "" << "" << "" << "" << ""; + QTest::newRow("a-multi") << int(QDnsLookup::A) << "a-multi" << int(QDnsLookup::NoError) << "" << "192.0.2.1;192.0.2.2;192.0.2.3" << "" << "" << "" << "" << ""; + QTest::newRow("aaaa-empty") << int(QDnsLookup::AAAA) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("aaaa-notfound") << int(QDnsLookup::AAAA) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("aaaa-single") << int(QDnsLookup::AAAA) << "aaaa-single" << int(QDnsLookup::NoError) << "" << "2001:db8::1" << "" << "" << "" << "" << ""; + QTest::newRow("aaaa-multi") << int(QDnsLookup::AAAA) << "aaaa-multi" << int(QDnsLookup::NoError) << "" << "2001:db8::1;2001:db8::2;2001:db8::3" << "" << "" << "" << "" << ""; + + QTest::newRow("any-empty") << int(QDnsLookup::ANY) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("any-notfound") << int(QDnsLookup::ANY) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("any-a-single") << int(QDnsLookup::ANY) << "a-single" << int(QDnsLookup::NoError) << "" << "192.0.2.1" << "" << "" << "" << "" << ""; + QTest::newRow("any-a-plus-aaaa") << int(QDnsLookup::ANY) << "a-plus-aaaa" << int(QDnsLookup::NoError) << "" << "198.51.100.1;2001:db8::1:1" << "" << "" << "" << "" << ""; + QTest::newRow("any-multi") << int(QDnsLookup::ANY) << "multi" << int(QDnsLookup::NoError) << "" << "198.51.100.1;198.51.100.2;198.51.100.3;2001:db8::1:1;2001:db8::1:2" << "" << "" << "" << "" << ""; + + QTest::newRow("mx-empty") << int(QDnsLookup::MX) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("mx-notfound") << int(QDnsLookup::MX) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("mx-single") << int(QDnsLookup::MX) << "mx-single" << int(QDnsLookup::NoError) << "" << "" << "10 multi" << "" << "" << "" << ""; + QTest::newRow("mx-single-cname") << int(QDnsLookup::MX) << "mx-single-cname" << int(QDnsLookup::NoError) << "" << "" << "10 cname" << "" << "" << "" << ""; + QTest::newRow("mx-multi") << int(QDnsLookup::MX) << "mx-multi" << int(QDnsLookup::NoError) << "" << "" << "10 multi;20 a-single" << "" << "" << "" << ""; + QTest::newRow("mx-multi-sameprio") << int(QDnsLookup::MX) << "mx-multi-sameprio" << int(QDnsLookup::NoError) << "" << "" + << "10 multi;10 a-single|" + "10 a-single;10 multi" << "" << "" << "" << ""; + + QTest::newRow("ns-empty") << int(QDnsLookup::NS) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("ns-notfound") << int(QDnsLookup::NS) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("ns-single") << int(QDnsLookup::NS) << "ns-single" << int(QDnsLookup::NoError) << "" << "" << "" << "ns-foo.linpro.net." << "" << "" << ""; + QTest::newRow("ns-multi") << int(QDnsLookup::NS) << "ns-multi" << int(QDnsLookup::NoError) << "" << "" << "" << "ns-bar.linpro.net.;ns-foo.linpro.net." << "" << "" << ""; + + QTest::newRow("ptr-empty") << int(QDnsLookup::PTR) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("ptr-notfound") << int(QDnsLookup::PTR) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("ptr-single") << int(QDnsLookup::PTR) << "ptr-single" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "a-single" << "" << ""; + + QTest::newRow("srv-empty") << int(QDnsLookup::SRV) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("srv-notfound") << int(QDnsLookup::SRV) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("srv-single") << int(QDnsLookup::SRV) << "_echo._tcp.srv-single" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "5 0 7 multi" << ""; + QTest::newRow("srv-prio") << int(QDnsLookup::SRV) << "_echo._tcp.srv-prio" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "1 0 7 multi;2 0 7 a-plus-aaaa" << ""; + QTest::newRow("srv-weighted") << int(QDnsLookup::SRV) << "_echo._tcp.srv-weighted" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" + << "5 75 7 multi;5 25 7 a-plus-aaaa|" + "5 25 7 a-plus-aaaa;5 75 7 multi" << ""; + QTest::newRow("srv-multi") << int(QDnsLookup::SRV) << "_echo._tcp.srv-multi" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" + << "1 50 7 multi;2 50 7 a-single;2 50 7 aaaa-single;3 50 7 a-multi|" + "1 50 7 multi;2 50 7 aaaa-single;2 50 7 a-single;3 50 7 a-multi" << ""; + + QTest::newRow("txt-empty") << int(QDnsLookup::TXT) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("txt-notfound") << int(QDnsLookup::TXT) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << ""; + QTest::newRow("txt-single") << int(QDnsLookup::TXT) << "txt-single" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "" << "Hello"; + QTest::newRow("txt-multi-onerr") << int(QDnsLookup::TXT) << "txt-multi-onerr" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "" << "Hello World"; + QTest::newRow("txt-multi-multirr") << int(QDnsLookup::TXT) << "txt-multi-multirr" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "" << "Hello;World"; } void tst_QDnsLookup::lookup() @@ -169,15 +189,18 @@ void tst_QDnsLookup::lookup() QFETCH(QString, ns); QFETCH(QString, ptr); QFETCH(QString, srv); - QFETCH(QByteArray, txt); + QFETCH(QString, txt); // transform the inputs domain = domainName(domain); cname = domainName(cname); - mx = domainNameList(mx); ns = domainNameList(ns); ptr = domainNameList(ptr); - srv = domainNameList(srv); + + // SRV and MX have reply entries that can change order + // and we can't sort + QStringList mx_alternatives = domainNameListAlternatives(mx); + QStringList srv_alternatives = domainNameListAlternatives(srv); QDnsLookup lookup; lookup.setType(static_cast<QDnsLookup::Type>(type)); @@ -218,7 +241,8 @@ void tst_QDnsLookup::lookup() QCOMPARE(record.name(), domain); mailExchanges << QString("%1 %2").arg(QString::number(record.preference()), record.exchange()); } - QCOMPARE(mailExchanges.join(';'), mx); + QVERIFY2(mx_alternatives.contains(mailExchanges.join(';')), + qPrintable("Actual: " + mailExchanges.join(';') + "\nExpected one of:\n" + mx_alternatives.join('\n'))); // name servers QStringList nameServers; @@ -250,18 +274,23 @@ void tst_QDnsLookup::lookup() QString::number(record.port()), record.target()); } - QCOMPARE(services.join(';'), srv); + QVERIFY2(srv_alternatives.contains(services.join(';')), + qPrintable("Actual: " + services.join(';') + "\nExpected one of:\n" + srv_alternatives.join('\n'))); // text - if (!txt.isEmpty()) { - QVERIFY(!lookup.textRecords().isEmpty()); - const QDnsTextRecord firstRecord = lookup.textRecords().first(); - QCOMPARE(firstRecord.name(), domain); - QCOMPARE(firstRecord.values().size(), 1); - QCOMPARE(firstRecord.values().first(), txt); - } else { - QVERIFY(lookup.textRecords().isEmpty()); + QStringList texts; + foreach (const QDnsTextRecord &record, lookup.textRecords()) { + QCOMPARE(record.name(), domain); + QString text; + foreach (const QByteArray &ba, record.values()) { + if (!text.isEmpty()) + text += ' '; + text += QString::fromLatin1(ba); + } + texts << text; } + texts.sort(); + QCOMPARE(texts.join(';'), txt); } void tst_QDnsLookup::lookupReuse() diff --git a/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp b/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp index 84b63c7148..91b5d9292d 100644 --- a/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp +++ b/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp @@ -56,7 +56,7 @@ private slots: void tst_QDnsLookup_Appless::noApplication() { QTest::ignoreMessage(QtWarningMsg, "QDnsLookup requires a QCoreApplication"); - QDnsLookup dns(QDnsLookup::A, "a-single.test.macieira.org"); + QDnsLookup dns(QDnsLookup::A, "a-single.test.qt-project.org"); dns.lookup(); } @@ -66,7 +66,7 @@ void tst_QDnsLookup_Appless::recreateApplication() char **argv = 0; for (int i = 0; i < 10; ++i) { QCoreApplication app(argc, argv); - QDnsLookup dns(QDnsLookup::A, "a-single.test.macieira.org"); + QDnsLookup dns(QDnsLookup::A, "a-single.test.qt-project.org"); dns.lookup(); if (!dns.isFinished()) { QObject::connect(&dns, SIGNAL(finished()), diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index ee6ea546f3..e81c7f71db 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -93,7 +93,7 @@ #include "../../../network-settings.h" -#define TEST_DOMAIN ".test.macieira.org" +#define TEST_DOMAIN ".test.qt-project.org" class tst_QHostInfo : public QObject diff --git a/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp index e06285dc67..9e03884e4e 100644 --- a/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp +++ b/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp @@ -380,7 +380,7 @@ void tst_QNetworkProxyFactory::genericSystemProxy() QFETCH(int, port); // The generic system proxy is only available on the following platforms -#if (!defined Q_OS_BLACKBERRY) && (!defined Q_OS_WIN) && ((!defined Q_OS_MAC) || defined Q_OS_IOS) +#if (!defined Q_OS_BLACKBERRY) && (!defined Q_OS_WIN) && (!defined Q_OS_MACX) qputenv(envVar, url); const QList<QNetworkProxy> systemProxy = QNetworkProxyFactory::systemProxyForQuery(); QCOMPARE(systemProxy.size(), 1); @@ -389,6 +389,11 @@ void tst_QNetworkProxyFactory::genericSystemProxy() QCOMPARE(systemProxy.first().port(), static_cast<quint16>(port)); qunsetenv(envVar); #else + Q_UNUSED(envVar) + Q_UNUSED(url) + Q_UNUSED(proxyType) + Q_UNUSED(hostName) + Q_UNUSED(port) QSKIP("Generic system proxy not available on this platform."); #endif } diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp index 28ec699427..3fc89acb67 100644 --- a/tests/auto/opengl/qgl/tst_qgl.cpp +++ b/tests/auto/opengl/qgl/tst_qgl.cpp @@ -1309,14 +1309,17 @@ void tst_QGL::glWidgetReparent() { // Try it as a top-level first: GLWidget *widget = new GLWidget; + widget->setObjectName(QStringLiteral("glWidget1")); widget->setGeometry(0, 0, 200, 30); widget->show(); QWidget grandParentWidget; + grandParentWidget.setObjectName(QStringLiteral("grandParentWidget")); grandParentWidget.setPalette(Qt::blue); QVBoxLayout grandParentLayout(&grandParentWidget); QWidget parentWidget(&grandParentWidget); + parentWidget.setObjectName(QStringLiteral("parentWidget")); grandParentLayout.addWidget(&parentWidget); parentWidget.setPalette(Qt::green); parentWidget.setAutoFillBackground(true); @@ -1348,6 +1351,7 @@ void tst_QGL::glWidgetReparent() // Now do pretty much the same thing, but don't show the // widget first: widget = new GLWidget; + widget->setObjectName(QStringLiteral("glWidget2")); parentLayout.addWidget(widget); QVERIFY(QTest::qWaitForWindowExposed(&grandParentWidget)); diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index b6b534b1da..c74edab9a2 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -334,12 +334,13 @@ static inline float qrandom() { return (rand() % 100) / 100.f; } void renderAScene(int w, int h) { #ifdef QT_OPENGL_ES_2 + Q_UNUSED(w) + Q_UNUSED(h) QGLShaderProgram program; program.addShaderFromSourceCode(QGLShader::Vertex, "attribute highp vec2 pos; void main() { gl_Position = vec4(pos.xy, 1.0, 1.0); }"); program.addShaderFromSourceCode(QGLShader::Fragment, "uniform lowp vec4 color; void main() { gl_FragColor = color; }"); program.bindAttributeLocation("pos", 0); program.bind(); - int colorId = program.uniformLocation("color"); glEnableVertexAttribArray(0); diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro index 1f7582243e..1d57206a73 100644 --- a/tests/auto/other/other.pro +++ b/tests/auto/other/other.pro @@ -41,6 +41,7 @@ SUBDIRS=\ windowsmobile \ qaccessibility \ qaccessibilitylinux \ + qaccessibilitymac \ !qtHaveModule(network): SUBDIRS -= \ baselineexample \ @@ -63,7 +64,8 @@ wince*|!contains(QT_CONFIG, accessibility): SUBDIRS -= qaccessibility !mac: SUBDIRS -= \ macgui \ macnativeevents \ - macplist + macplist \ + qaccessibilitymac !embedded|wince*: SUBDIRS -= \ qdirectpainter diff --git a/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro b/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro new file mode 100644 index 0000000000..5d81567f45 --- /dev/null +++ b/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro @@ -0,0 +1,16 @@ +CONFIG += testcase +TARGET = tst_qaccessibilitymac +# LIBS += -framework Carbon +QT += widgets testlib + +HEADERS += tst_qaccessibilitymac_helpers.h +SOURCES += tst_qaccessibilitymac.cpp + +mac { + LIBS += -framework Security -framework AppKit -framework ApplicationServices + OBJECTIVE_SOURCES += tst_qaccessibilitymac_helpers.mm +} + + +requires(mac) +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp new file mode 100644 index 0000000000..25dd0d39dd --- /dev/null +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QtWidgets> +#include <QtTest/QtTest> +#include <QtCore/qcoreapplication.h> + +#include "tst_qaccessibilitymac_helpers.h" + +QT_USE_NAMESPACE + + +class AccessibleTestWindow : public QWidget +{ + Q_OBJECT +public: + AccessibleTestWindow() + { + new QHBoxLayout(this); + } + + void addWidget(QWidget* widget) + { + layout()->addWidget(widget); + widget->show(); + QTest::qWaitForWindowExposed(widget); + } + + void clearChildren() + { + qDeleteAll(children()); + new QHBoxLayout(this); + } +}; + +class tst_QAccessibilityMac : public QObject +{ +Q_OBJECT +private slots: + void init(); + void cleanup(); + + void lineEditTest(); + void hierarchyTest(); +private: + AccessibleTestWindow *m_window; +}; + + +void tst_QAccessibilityMac::init() +{ + m_window = new AccessibleTestWindow(); + m_window->setWindowTitle("Test window"); + m_window->show(); + m_window->resize(400, 400); + + QTest::qWaitForWindowExposed(m_window); +} + +void tst_QAccessibilityMac::cleanup() +{ + delete m_window; +} + + +void tst_QAccessibilityMac::lineEditTest() +{ + if (!macNativeAccessibilityEnabled()) + return; + + QLineEdit *lineEdit = new QLineEdit(m_window); + lineEdit->setText("a11y test QLineEdit"); + m_window->addWidget(lineEdit); + QVERIFY(QTest::qWaitForWindowExposed(m_window)); + QCoreApplication::processEvents(); + QVERIFY(testLineEdit()); +} + +void tst_QAccessibilityMac::hierarchyTest() +{ + if (!macNativeAccessibilityEnabled()) + return; + + QWidget *w = new QWidget(m_window); + m_window->addWidget(w); + QPushButton *b = new QPushButton(w); + w->setLayout(new QVBoxLayout()); + w->layout()->addWidget(b); + b->setText("I am a button"); + + QVERIFY(QTest::qWaitForWindowExposed(m_window)); + QCoreApplication::processEvents(); + QVERIFY(testHierarchy()); +} + +QTEST_MAIN(tst_QAccessibilityMac) +#include "tst_qaccessibilitymac.moc" diff --git a/src/tools/qdoc/tr.h b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h index 36b0c47fef..ec5beab125 100644 --- a/src/tools/qdoc/tr.h +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h @@ -3,7 +3,7 @@ ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** -** This file is part of the tools applications of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -38,45 +38,14 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include <QtCore/QString> +#include <QtCore/QPair> +#include <QtWidgets/QWidget> -/* - tr.h -*/ -#ifndef TR_H -#define TR_H +#pragma once // Yeah, it's deprecated in general, but it's standard practice for Mac OS X. -#include <qglobal.h> - -#if !defined(QT_BOOTSTRAPPED) && !defined(QT_NO_TRANSLATION) -# define TRANSLATE_QDOC -#endif - -#include <qstring.h> -#ifdef TRANSLATE_QDOC -# include <qcoreapplication.h> -#endif - -QT_BEGIN_NAMESPACE - -#ifndef TRANSLATE_QDOC - -#define Q_DECLARE_TR_FUNCTIONS(context) - -inline QString tr(const char *sourceText, const char *comment = 0) -{ - Q_UNUSED(comment); - return QString( QLatin1String(sourceText) ); -} - -struct QCoreApplication -{ - static inline QString translate(const char * /* context */ , const char *sourceText, const char * /* disambiguation */ = 0) - { return QLatin1String(sourceText); } -}; - -#endif // !TRANSLATE_QDOC - -QT_END_NAMESPACE - -#endif +bool macNativeAccessibilityEnabled(); +bool trusted(); +bool testLineEdit(); +bool testHierarchy(); diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm new file mode 100644 index 0000000000..8620b7dd2f --- /dev/null +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm @@ -0,0 +1,213 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// some versions of CALayer.h use 'slots' as an identifier +#define QT_NO_KEYWORDS + +#include "tst_qaccessibilitymac_helpers.h" +#include <QApplication> +#include <QDebug> +#include <unistd.h> + +#import <Cocoa/Cocoa.h> +#import <ApplicationServices/ApplicationServices.h> + +bool macNativeAccessibilityEnabled() +{ + bool enabled = AXAPIEnabled(); + if (!enabled) + qWarning() << "Accessibility is disabled (check System Preferences) skipping test."; + return enabled; +} + +bool trusted() +{ + return AXIsProcessTrusted(); +} + + +#define EXPECT(cond) \ + if (!(cond)) { \ + qWarning("Failure in %s, line: %d", __FILE__ , __LINE__); \ + return false; \ + } \ + + +@interface TestAXObject : NSObject +{ + AXUIElementRef reference; +} + @property (readonly) NSString *role; + @property (readonly) NSString *description; + @property (readonly) NSString *value; + @property (readonly) CGRect rect; +@end + +@implementation TestAXObject +- (id) initWithAXUIElementRef: (AXUIElementRef) ref { + if ( self = [super init] ) { + reference = ref; + AXUIElementCopyAttributeValue(ref, kAXRoleAttribute, (CFTypeRef*)&_role); + AXUIElementCopyAttributeValue(ref, kAXDescriptionAttribute, (CFTypeRef*)&_description); + AXUIElementCopyAttributeValue(ref, kAXValueAttribute, (CFTypeRef*)&_value); + AXValueRef sizeValue; + AXUIElementCopyAttributeValue(ref, kAXSizeAttribute, (CFTypeRef*)&sizeValue); + AXValueGetValue(sizeValue, kAXValueCGSizeType, &_rect.size); + AXValueRef positionValue; + AXUIElementCopyAttributeValue(ref, kAXPositionAttribute, (CFTypeRef*)&positionValue); + AXValueGetValue(positionValue, kAXValueCGPointType, &_rect.origin); + } + return self; +} + +- (AXUIElementRef) ref { return reference; } +- (void) print { + NSLog(@"Accessible Object role: '%@', description: '%@', value: '%@', rect: '%@'", self.role, self.description, self.value, NSStringFromRect(self.rect)); + NSLog(@" Children: %ld", [self.childList count]); +} + +- (NSArray*) windowList +{ + NSArray *list; + AXUIElementCopyAttributeValues( + reference, + kAXWindowsAttribute, + 0, 100, /*min, max*/ + (CFArrayRef *) &list); + return list; +} + +- (NSArray*) childList +{ + NSArray *list; + AXUIElementCopyAttributeValues( + reference, + kAXChildrenAttribute, + 0, 100, /*min, max*/ + (CFArrayRef *) &list); + return list; +} + +- (AXUIElementRef) findDirectChildByRole: (CFStringRef) role +{ + AXUIElementRef result = nil; + NSArray *childList = [self childList]; + for (id child in childList) { + CFStringRef typeString; + AXUIElementCopyAttributeValue((AXUIElementRef)child, kAXRoleAttribute, (CFTypeRef*)&typeString); + if (CFStringCompare(typeString, role, 0) == 0) { + result = (AXUIElementRef) child; + break; + } + } + return result; +} + +- (AXUIElementRef) parent +{ + AXUIElementRef p = nil; + AXUIElementCopyAttributeValue(reference, kAXParentAttribute, (CFTypeRef*)&p); + return p; +} + +@end + + +bool testLineEdit() +{ +// not sure if this is needed. on my machine the calls succeed. +// NSString *path = @"/Users/frederik/qt5/qtbase/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.app/Contents/MacOS/tst_qaccessibilitymac"; +// NSString *path = @"/Users/frederik/qt5/qtbase/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.app"; +// AXError e = AXMakeProcessTrusted((CFStringRef) path); +// NSLog(@"error: %i", e); + + pid_t pid = getpid(); + AXUIElementRef app = AXUIElementCreateApplication(pid); + EXPECT(app != nil); + TestAXObject *appObject = [[TestAXObject alloc] initWithAXUIElementRef: app]; + + NSArray *windowList = [appObject windowList]; + // one window + EXPECT([windowList count] == 1); + AXUIElementRef windowRef = (AXUIElementRef) [windowList objectAtIndex: 0]; + EXPECT(windowRef != nil); + TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef: windowRef]; + + EXPECT([window rect].size.width == 400); + // height of window includes title bar + EXPECT([window rect].size.height >= 400); + + // children of window: + AXUIElementRef lineEdit = [window findDirectChildByRole: kAXTextFieldRole]; + EXPECT(lineEdit != nil); + + TestAXObject *le = [[TestAXObject alloc] initWithAXUIElementRef: lineEdit]; + EXPECT([[le value] isEqualToString:@"a11y test QLineEdit"]); + return true; +} + +bool testHierarchy() +{ + pid_t pid = getpid(); + AXUIElementRef app = AXUIElementCreateApplication(pid); + EXPECT(app != nil); + TestAXObject *appObject = [[TestAXObject alloc] initWithAXUIElementRef: app]; + + NSArray *windowList = [appObject windowList]; + // one window + EXPECT([windowList count] == 1); + AXUIElementRef windowRef = (AXUIElementRef) [windowList objectAtIndex: 0]; + EXPECT(windowRef != nil); + TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef: windowRef]; + + // Because the plain widget is filtered out of the hierarchy, we expect the button + // to be a direct child of the window + AXUIElementRef buttonRef = [window findDirectChildByRole: kAXButtonRole]; + EXPECT(buttonRef != nil); + + TestAXObject *buttonObject = [[TestAXObject alloc] initWithAXUIElementRef: buttonRef]; + TestAXObject *parentObject = [[TestAXObject alloc] initWithAXUIElementRef: [buttonObject parent]]; + + // check that the parent is a window + EXPECT([[parentObject role] isEqualToString: (NSString *)kAXWindowRole]); + + return true; +} diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp index 0935b1bca4..4d3b5983f0 100644 --- a/tests/auto/tools/qmake/tst_qmake.cpp +++ b/tests/auto/tools/qmake/tst_qmake.cpp @@ -314,6 +314,9 @@ void tst_qmake::export_across_file_boundaries() void tst_qmake::include_dir() { +#ifdef QT_NO_WIDGETS + QSKIP("This test depends on QtWidgets"); +#else QString workDir = base_path + "/testdata/include_dir"; QVERIFY( test_compiler.qmake( workDir, "foo" )); QVERIFY( test_compiler.make( workDir )); @@ -325,6 +328,7 @@ void tst_qmake::include_dir() QVERIFY( test_compiler.make( buildDir )); QVERIFY( test_compiler.exists( buildDir, "foo", Exe, "1.0.0" )); QVERIFY( test_compiler.makeDistClean( buildDir )); +#endif } void tst_qmake::include_pwd() diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index d797c553db..65d36247f6 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -44,6 +44,7 @@ #include <qcoreapplication.h> #include <qdebug.h> +#include <qsharedpointer.h> #include <qfiledialog.h> #include <qabstractitemdelegate.h> #include <qdirmodel.h> @@ -441,33 +442,25 @@ void tst_QFiledialog::completer_data() void tst_QFiledialog::completer() { + typedef QSharedPointer<QTemporaryFile> TemporaryFilePtr; + QFETCH(QString, input); QFETCH(QString, startPath); QFETCH(int, expected); - QString tempPath = QDir::tempPath() + '/' + "QFileDialogTestDir"; - if (startPath.isEmpty()) - startPath = tempPath; + QTemporaryDir tempDir; + QVERIFY(tempDir.isValid()); - startPath = QDir::cleanPath(startPath); + const QString tempPath = tempDir.path(); + startPath = startPath.isEmpty() ? tempPath : QDir::cleanPath(startPath); // make temp dir and files - { - QDir cleanup(tempPath); - QStringList x = cleanup.entryList(); - for (int i = 0; i < x.count(); ++i) - QFile::remove(tempPath + '/' + x[i]); - cleanup.rmdir(tempPath); - } - QDir tmp(QDir::tempPath()); - if (!tmp.exists(tempPath)) - QVERIFY(tmp.mkdir("QFileDialogTestDir")); - QList<QTemporaryFile*> files; + QList<TemporaryFilePtr> files; QT_TRY { for (int i = 0; i < 10; ++i) { - QScopedPointer<QTemporaryFile> file(new QTemporaryFile(tempPath + "/rXXXXXX")); - file->open(); - files.append(file.take()); + TemporaryFilePtr file(new QTemporaryFile(tempPath + QStringLiteral("/rXXXXXX"))); + QVERIFY(file->open()); + files.append(file); } // ### flesh this out more @@ -515,7 +508,7 @@ void tst_QFiledialog::completer() QStringList expectedFiles; if (expected == -1) { - QString fullPath = startPath.isEmpty() ? tempPath : startPath; + QString fullPath = startPath; if (!fullPath.endsWith(QLatin1Char('/'))) fullPath.append(QLatin1Char('/')); fullPath.append(input); @@ -551,10 +544,8 @@ void tst_QFiledialog::completer() QTRY_COMPARE(cModel->rowCount(), expected); } QT_CATCH(...) { - qDeleteAll(files); QT_RETHROW; } - qDeleteAll(files); } void tst_QFiledialog::completer_up() @@ -888,9 +879,9 @@ void tst_QFiledialog::selectFiles() { QNonNativeFileDialog fd; fd.setViewMode(QFileDialog::List); - QString tempPath = QDir::tempPath() + '/' + "QFileDialogTestDir4SelectFiles"; - QDir dir; - QVERIFY(dir.mkpath(tempPath)); + QTemporaryDir tempDir; + QVERIFY(tempDir.isValid()); + const QString tempPath = tempDir.path(); fd.setDirectory(tempPath); QSignalSpy spyCurrentChanged(&fd, SIGNAL(currentChanged(QString))); QSignalSpy spyDirectoryEntered(&fd, SIGNAL(directoryEntered(QString))); @@ -934,15 +925,12 @@ void tst_QFiledialog::selectFiles() QCOMPARE(spyDirectoryEntered.count(), 0); QCOMPARE(spyFilesSelected.count(), 0); QCOMPARE(spyFilterSelected.count(), 0); - for (int i=0; i < 5; ++i) - QFile::remove(filesPath + QString::fromLatin1("/qfiledialog_auto_test_not_pres_%1").arg(i)); //If the selection is invalid then we fill the line edit but without the / QNonNativeFileDialog * dialog = new QNonNativeFileDialog( 0, "Save" ); dialog->setFileMode( QFileDialog::AnyFile ); dialog->setAcceptMode( QFileDialog::AcceptSave ); - QString temporary = QDir::tempPath() + QLatin1String("/blah"); - dialog->selectFile(temporary); + dialog->selectFile(tempPath + QStringLiteral("/blah")); dialog->show(); QVERIFY(QTest::qWaitForWindowExposed(dialog)); QLineEdit *lineEdit = dialog->findChild<QLineEdit*>("fileNameEdit"); diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index e36eaa5af2..0fe7c8ab75 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -1033,6 +1033,14 @@ void tst_QFileSystemModel::roleNames() QVERIFY(values.contains(roleName)); } +static inline QByteArray permissionRowName(bool readOnly, int permission) +{ + QByteArray result = readOnly ? QByteArrayLiteral("ro") : QByteArrayLiteral("rw"); + result += QByteArrayLiteral("-0"); + result += QByteArray::number(permission, 16); + return result; +} + void tst_QFileSystemModel::permissions_data() { QTest::addColumn<int>("permissions"); @@ -1043,11 +1051,10 @@ void tst_QFileSystemModel::permissions_data() QFile::ReadOwner, QFile::WriteOwner|QFile::ReadOwner, }; -#define ROW_NAME(i) qPrintable(QString().sprintf("%s-0%04x", readOnly ? "ro" : "rw", permissions[i])) - for (int readOnly = false ; readOnly <= true; ++readOnly) - for (size_t i = 0; i < sizeof permissions / sizeof *permissions; ++i) - QTest::newRow(ROW_NAME(i)) << permissions[i] << bool(readOnly); -#undef ROW_NAME + for (size_t i = 0; i < sizeof permissions / sizeof *permissions; ++i) { + QTest::newRow(permissionRowName(false, permissions[i]).constData()) << permissions[i] << false; + QTest::newRow(permissionRowName(true, permissions[i]).constData()) << permissions[i] << true; + } } void tst_QFileSystemModel::permissions() // checks QTBUG-20503 diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 5d7925aeec..268276bd4a 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -1469,7 +1469,15 @@ void tst_QListView::wordWrap() lv.setModel(&model); lv.setWordWrap(true); lv.setFixedSize(150, 150); - lv.show(); +#ifdef Q_OS_BLACKBERRY + // BB standard font size is too big, triggering + // a horizontal scrollbar even when word-wrapping + // is enabled + QFont font = lv.font(); + font.setPointSize(5); + lv.setFont(font); +#endif // Q_OS_BLACKBERRY + lv.showNormal(); QApplication::processEvents(); QTRY_COMPARE(lv.horizontalScrollBar()->isVisible(), false); @@ -2013,7 +2021,7 @@ void tst_QListView::taskQTBUG_9455_wrongScrollbarRanges() w.setMovement(QListView::Static); const int spacing = 40; w.setSpacing(spacing); - w.show(); + w.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&w)); QCOMPARE(w.verticalScrollBar()->maximum(), w.contentsSize().height() - w.viewport()->geometry().height()); } @@ -2117,7 +2125,7 @@ void tst_QListView::taskQTBUG_21115_scrollToAndHiddenItems() list << QString::number(i); model.setStringList(list); lv.setModel(&model); - lv.show(); + lv.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&lv)); // Save first item rect for reference diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index c6835f6076..c9079e222c 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -783,6 +783,31 @@ void tst_QApplication::quitOnLastWindowClosed() QVERIFY(timerSpy.count() > 15); // Should be around 20 if closing did not caused the quit } + { // QTBUG-31569: If the last widget with Qt::WA_QuitOnClose set is closed, other + // widgets that don't have the attribute set should be closed automatically. + int argc = 0; + QApplication app(argc, 0); + QVERIFY(app.quitOnLastWindowClosed()); + + QWidget w1; + w1.show(); + + QWidget w2; + w2.setAttribute(Qt::WA_QuitOnClose, false); + w2.show(); + + QVERIFY(QTest::qWaitForWindowExposed(&w2)); + + QTimer timer; + timer.setInterval(100); + timer.start(); + QSignalSpy timerSpy(&timer, SIGNAL(timeout())); + + QTimer::singleShot(100, &w1, SLOT(close())); + app.exec(); + + QVERIFY(timerSpy.count() < 10); + } } class PromptOnCloseWidget : public QWidget diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.h b/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.h index fe9e71e650..920fa5e023 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.h +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.h @@ -42,7 +42,7 @@ #include <QtCore/QPair> #include <QtWidgets/QWidget> -#pragma once // Yeah, it's deprecated in general, but it's standard practive for Mac OS X. +#pragma once // Yeah, it's deprecated in general, but it's standard practice for Mac OS X. QString nativeWindowTitle(QWidget *widget, Qt::WindowState state); bool nativeWindowModified(QWidget *widget); diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp index 440639cd49..2d9cb98e27 100644 --- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp +++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp @@ -192,6 +192,11 @@ void tst_QWindowContainer::testActivation() QVERIFY(QTest::qWaitForWindowActive(root.windowHandle())); QVERIFY(QGuiApplication::focusWindow() == root.windowHandle()); + // Verify that all states in the root widget indicate it is active + QVERIFY(root.windowHandle()->isActive()); + QVERIFY(root.isActiveWindow()); + QCOMPARE(root.palette().currentColorGroup(), QPalette::Active); + // Under KDE (ubuntu 12.10), we experience that doing two activateWindow in a row // does not work. The second gets ignored by the window manager, even though the // timestamp in the xcb connection is unique for both. @@ -201,6 +206,11 @@ void tst_QWindowContainer::testActivation() window->requestActivate(); QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(QGuiApplication::focusWindow() == window); + + // Verify that all states in the root widget still indicate it is active + QVERIFY(root.windowHandle()->isActive()); + QVERIFY(root.isActiveWindow()); + QCOMPARE(root.palette().currentColorGroup(), QPalette::Active); } diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index 2b9268f35d..4d18971cc6 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -6,10 +6,7 @@ QT += widgets testlib SOURCES += tst_qstyle.cpp wince* { - DEFINES += SRCDIR=\\\".\\\" addPixmap.files = task_25863.png addPixmap.path = . DEPLOYMENT += addPixmap -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index fc94f95f8e..94d2d22d96 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -250,9 +250,12 @@ void tst_QStyle::testProxyStyle() void tst_QStyle::drawItemPixmap() { testWidget->resize(300, 300); - testWidget->show(); + testWidget->showNormal(); - QPixmap p(QString(SRCDIR) + "/task_25863.png", "PNG"); + const QString imageFileName = QFINDTESTDATA("task_25863.png"); + QVERIFY(!imageFileName.isEmpty()); + + QPixmap p(imageFileName, "PNG"); const QPixmap actualPix = testWidget->grab(); QCOMPARE(actualPix, p); diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 36b83eefda..0bfd4baa0c 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -2044,10 +2044,11 @@ void tst_QComboBox::itemListPosition() //we test QFontComboBox because it has the specific behaviour to set a fixed size //to the list view QWidget topLevel; - topLevel.resize(200, 200); - topLevel.move(100, 100); + QHBoxLayout *layout = new QHBoxLayout(&topLevel); + QFontComboBox combo(&topLevel); + layout->addWidget(&combo); //the code to get the available screen space is copied from QComboBox code const int scrNumber = QApplication::desktop()->screenNumber(&combo); @@ -2058,11 +2059,12 @@ void tst_QComboBox::itemListPosition() QApplication::desktop()->screenGeometry(scrNumber) : QApplication::desktop()->availableGeometry(scrNumber); - combo.move(screen.width()-combo.sizeHint().width(), 0); //puts the combo to the top-right corner + topLevel.move(screen.width() - topLevel.sizeHint().width() - 10, 0); //puts the combo to the top-right corner topLevel.show(); + //wait because the window manager can move the window if there is a right panel - QTRY_VERIFY(combo.isVisible()); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); combo.showPopup(); QTRY_VERIFY(combo.view()); QTRY_VERIFY(combo.view()->isVisible()); diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index 6ab7cb4491..a4ad18c7a6 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp @@ -347,7 +347,9 @@ void tst_QDockWidget::features() void tst_QDockWidget::setFloating() { + const QRect deskRect = QApplication::desktop()->availableGeometry(); QMainWindow mw; + mw.move(deskRect.left() + deskRect.width() * 2 / 3, deskRect.top() + deskRect.height() / 3); QDockWidget dw; mw.addDockWidget(Qt::LeftDockWidgetArea, &dw); @@ -355,10 +357,16 @@ void tst_QDockWidget::setFloating() QVERIFY(QTest::qWaitForWindowExposed(&mw)); QVERIFY(!dw.isFloating()); + const QPoint dockedPosition = dw.mapToGlobal(dw.pos()); QSignalSpy spy(&dw, SIGNAL(topLevelChanged(bool))); dw.setFloating(true); + const QPoint floatingPosition = dw.pos(); + + // QTBUG-31044, show approximately at old position, give or take window frame. + QVERIFY((dockedPosition - floatingPosition).manhattanLength() < 50); + QVERIFY(dw.isFloating()); QCOMPARE(spy.count(), 1); QCOMPARE(spy.at(0).value(0).toBool(), dw.isFloating()); diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp index 6b4bc3cd35..26f49a3fed 100644 --- a/tests/auto/xml/dom/qdom/tst_qdom.cpp +++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp @@ -1705,8 +1705,8 @@ void tst_QDom::germanUmlautToByteArray() const QByteArray baseline("<a"); /* http://www.fileformat.info/info/unicode/char/00FC/index.htm */ - baseline += 0xC3; - baseline += 0xBC; + baseline += char(0xC3); + baseline += char(0xBC); baseline += "b/>\n"; QCOMPARE(data, baseline); diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index f92fad1d69..73ef0dcf23 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -171,6 +171,8 @@ Configure::Configure(int& argc, char** argv) } defaultBuildParts << QStringLiteral("libs") << QStringLiteral("tools") << QStringLiteral("examples"); + allBuildParts = defaultBuildParts; + allBuildParts << QStringLiteral("tests"); dictionary[ "QT_SOURCE_TREE" ] = sourcePath; dictionary[ "QT_BUILD_TREE" ] = buildPath; dictionary[ "QT_INSTALL_PREFIX" ] = installPath; @@ -387,6 +389,11 @@ QString Configure::firstLicensePath() void Configure::parseCmdLine() { + if (configCmdLine.size() && configCmdLine.at(0) == "-top-level") { + dictionary[ "TOPLEVEL" ] = "yes"; + configCmdLine.removeAt(0); + } + int argCount = configCmdLine.size(); int i = 0; const QStringList imageFormats = QStringList() << "gif" << "png" << "jpeg"; @@ -1001,12 +1008,22 @@ void Configure::parseCmdLine() ++i; if (i == argCount) break; - buildParts += configCmdLine.at(i); + QString part = configCmdLine.at(i); + if (!allBuildParts.contains(part)) { + cout << "Unknown part " << part << " passed to -make." << endl; + dictionary["DONE"] = "error"; + } + buildParts += part; } else if (configCmdLine.at(i) == "-nomake") { ++i; if (i == argCount) break; - nobuildParts.append(configCmdLine.at(i)); + QString part = configCmdLine.at(i); + if (!allBuildParts.contains(part)) { + cout << "Unknown part " << part << " passed to -nomake." << endl; + dictionary["DONE"] = "error"; + } + nobuildParts += part; } else if (configCmdLine.at(i) == "-skip") { @@ -1570,8 +1587,8 @@ void Configure::desc(const char *mark_option, const char *mark, const char *opti void Configure::applySpecSpecifics() { if (dictionary.contains("XQMAKESPEC")) { - //Disable building tools, docs and translations when cross compiling. - nobuildParts << "docs" << "translations" << "tools"; + //Disable building tools when cross compiling. + nobuildParts << "tools"; } if (dictionary.value("XQMAKESPEC").startsWith("wince")) { @@ -3946,15 +3963,17 @@ void Configure::generateMakefiles() QString pwd = QDir::currentPath(); { - QString dirName; + QString sourcePathMangled = sourcePath; + QString buildPathMangled = buildPath; + if (dictionary.contains("TOPLEVEL")) { + sourcePathMangled = QFileInfo(sourcePath).path(); + buildPathMangled = QFileInfo(buildPath).path(); + } bool generate = true; bool doDsp = (dictionary["VCPROJFILES"] == "yes" && dictionary["PROCESS"] == "full"); while (generate) { - QString pwd = QDir::currentPath(); - QString dirPath = buildPath + dirName; QStringList args; - args << buildPath + "/bin/qmake"; if (doDsp) { @@ -3969,11 +3988,9 @@ void Configure::generateMakefiles() } if (dictionary[ "PROCESS" ] == "full") args << "-r"; - args << (sourcePath + "/qtbase.pro"); - args << "-o"; - args << buildPath; + args << sourcePathMangled; - QDir::setCurrent(dirPath); + QDir::setCurrent(buildPathMangled); if (int exitCode = Environment::execute(args, QStringList(), QStringList())) { cout << "Qmake failed, return code " << exitCode << endl << endl; dictionary[ "DONE" ] = "error"; diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index 3014e409f9..8f95e1fb95 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -104,6 +104,7 @@ private: // Our variable dictionaries QMap<QString,QString> dictionary; + QStringList allBuildParts; QStringList defaultBuildParts; QStringList buildParts; QStringList nobuildParts; |