diff options
162 files changed, 1204 insertions, 814 deletions
diff --git a/config.tests/unix/padstring b/config.tests/unix/padstring deleted file mode 100755 index 283475d071..0000000000 --- a/config.tests/unix/padstring +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -LEN="$1" -STR="$2" -PAD='\0' -STRLEN=`echo $STR | wc -c` -RES="$STR" - -EXTRALEN=`expr $LEN - $STRLEN` -while [ "$EXTRALEN" -gt 32 ]; do - RES="$RES$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD" - EXTRALEN=`expr $EXTRALEN - 32` -done -while [ "$EXTRALEN" -gt 0 ]; do - RES="$RES$PAD" - EXTRALEN=`expr $EXTRALEN - 1` -done -cat <<EOF -$RES -EOF - - @@ -820,7 +820,10 @@ QT_INSTALL_TRANSLATIONS= QT_INSTALL_SETTINGS= QT_INSTALL_EXAMPLES= QT_INSTALL_TESTS= +CFG_SYSROOT= QT_HOST_PREFIX= +QT_HOST_BINS= +QT_HOST_DATA= #flags for SQL drivers QT_CFLAGS_PSQL= @@ -973,7 +976,7 @@ while [ "$#" -gt 0 ]; do shift VAL=$1 ;; - -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-sdk|-arch|-host-arch|-mysql_config|-sysroot) + -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` shift VAL="$1" @@ -1156,6 +1159,12 @@ while [ "$#" -gt 0 ]; do hostprefix) QT_HOST_PREFIX="$VAL" ;; + hostdatadir) + QT_HOST_DATA="$VAL" + ;; + hostbindir) + QT_HOST_BINS="$VAL" + ;; force-pkg-config) QT_FORCE_PKGCONFIG=yes ;; @@ -3077,6 +3086,40 @@ if [ -z "$QT_INSTALL_TESTS" ]; then #default fi QT_INSTALL_TESTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TESTS"` +#------- host paths -------- + +if [ -z "$QT_HOST_PREFIX" ]; then + QT_HOST_PREFIX=$QT_INSTALL_PREFIX + haveHpx=false +else + QT_HOST_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_PREFIX"` + haveHpx=true +fi + +if [ -z "$QT_HOST_BINS" ]; then #default + if $haveHpx; then + if [ "$CFG_PREFIX_INSTALL" = "no" ]; then + if [ "$BUILD_ON_MAC" = "yes" ]; then + QT_HOST_BINS="/Developer/Applications/Qt" + fi + fi + [ -z "$QT_HOST_BINS" ] && QT_HOST_BINS="$QT_HOST_PREFIX/bin" #fallback + else + QT_HOST_BINS="$QT_INSTALL_BINS" + fi +fi +QT_HOST_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_BINS"` + +if [ -z "$QT_HOST_DATA" ]; then #default + if $haveHpx; then + QT_HOST_DATA="$QT_HOST_PREFIX" + else + QT_HOST_DATA="$QT_INSTALL_DATA" + fi +else + QT_HOST_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_DATA"` +fi + #------------------------------------------------------------------------------- # help - interactive parts of the script _after_ this section please #------------------------------------------------------------------------------- @@ -3194,6 +3237,7 @@ cat <<EOF -hostprefix [dir] .. Tools and libraries needed when developing applications are installed in [dir]. If [dir] is not given, the current build directory will be used. + (default PREFIX) EOF fi cat <<EOF @@ -3230,6 +3274,17 @@ cat <<EOF (default PREFIX/examples) -testsdir <dir> ....... Tests will be installed to <dir> (default PREFIX/tests) +EOF +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then +cat <<EOF + + -hostbindir <dir> .. Host executables will be installed to <dir> + (default HOSTPREFIX/bin) + -hostdatadir <dir> . Data used by qmake will be installed to <dir> + (default HOSTPREFIX) +EOF +fi +cat <<EOF Configure options: @@ -3925,105 +3980,44 @@ esac #------------------------------------------------------------------------------- [ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global" -LICENSE_USER_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_lcnsuser=$Licensee"` -LICENSE_PRODUCTS_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_lcnsprod=$Edition"` -PREFIX_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_prfxpath=$QT_INSTALL_PREFIX"` -DOCUMENTATION_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_docspath=$QT_INSTALL_DOCS"` -HEADERS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_hdrspath=$QT_INSTALL_HEADERS"` -LIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_INSTALL_LIBS"` -BINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_INSTALL_BINS"` -PLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_INSTALL_PLUGINS"` -IMPORTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_impspath=$QT_INSTALL_IMPORTS"` -DATA_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_datapath=$QT_INSTALL_DATA"` -TRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_INSTALL_TRANSLATIONS"` -SETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS"` -EXAMPLES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_xmplpath=$QT_INSTALL_EXAMPLES"` -TESTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_tstspath=$QT_INSTALL_TESTS"` - -TODAY=`date +%Y-%m-%d` cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF /* License Info */ -static const char qt_configure_licensee_str [256 + 12] = "$LICENSE_USER_STR"; -static const char qt_configure_licensed_products_str [256 + 12] = "$LICENSE_PRODUCTS_STR"; +static const char qt_configure_licensee_str [256 + 12] = "qt_lcnsuser=$Licensee"; +static const char qt_configure_licensed_products_str [256 + 12] = "qt_lcnsprod=$Edition"; /* Installation date */ -static const char qt_configure_installation [12+11] = "qt_instdate=$TODAY"; -EOF +static const char qt_configure_installation [12+11] = "qt_instdate=`date +%Y-%m-%d`"; - -if [ ! -z "$QT_HOST_PREFIX" ]; then - HOSTPREFIX_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_prfxpath=$QT_HOST_PREFIX"` - HOSTDOCUMENTATION_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_docspath=$QT_HOST_PREFIX/doc"` - HOSTHEADERS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_hdrspath=$QT_HOST_PREFIX/include"` - HOSTLIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_HOST_PREFIX/lib"` - HOSTBINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_HOST_PREFIX/bin"` - HOSTPLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_HOST_PREFIX/plugins"` - HOSTIMPORTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_impspath=$QT_HOST_PREFIX/IMPORTS"` - HOSTDATA_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_datapath=$QT_HOST_PREFIX"` - HOSTTRANSLATIONS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_trnspath=$QT_HOST_PREFIX/translations"` - HOSTSETTINGS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_stngpath=$QT_INSTALL_SETTINGS"` - HOSTEXAMPLES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_xmplpath=$QT_INSTALL_EXAMPLES"` - HOSTTESTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_tstspath=$QT_INSTALL_TESTS"` - - cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF - -#if defined(QT_BOOTSTRAPPED) || defined(QT_BUILD_QMAKE) /* Installation Info */ -static const char qt_configure_prefix_path_str [256 + 12] = "$HOSTPREFIX_PATH_STR"; -static const char qt_configure_documentation_path_str[256 + 12] = "$HOSTDOCUMENTATION_PATH_STR"; -static const char qt_configure_headers_path_str [256 + 12] = "$HOSTHEADERS_PATH_STR"; -static const char qt_configure_libraries_path_str [256 + 12] = "$HOSTLIBRARIES_PATH_STR"; -static const char qt_configure_binaries_path_str [256 + 12] = "$HOSTBINARIES_PATH_STR"; -static const char qt_configure_plugins_path_str [256 + 12] = "$HOSTPLUGINS_PATH_STR"; -static const char qt_configure_imports_path_str [256 + 12] = "$HOSTIMPORTS_PATH_STR"; -static const char qt_configure_data_path_str [256 + 12] = "$HOSTDATA_PATH_STR"; -static const char qt_configure_translations_path_str [256 + 12] = "$HOSTTRANSLATIONS_PATH_STR"; -static const char qt_configure_settings_path_str [256 + 12] = "$HOSTSETTINGS_PATH_STR"; -static const char qt_configure_examples_path_str [256 + 12] = "$HOSTEXAMPLES_PATH_STR"; -static const char qt_configure_tests_path_str [256 + 12] = "$HOSTTESTS_PATH_STR"; -#else // QT_BOOTSTRAPPED +static const char qt_configure_prefix_path_strs[][256 + 12] = { + "qt_prfxpath=$QT_INSTALL_PREFIX", + "qt_docspath=$QT_INSTALL_DOCS", + "qt_hdrspath=$QT_INSTALL_HEADERS", + "qt_libspath=$QT_INSTALL_LIBS", + "qt_binspath=$QT_INSTALL_BINS", + "qt_plugpath=$QT_INSTALL_PLUGINS", + "qt_impspath=$QT_INSTALL_IMPORTS", + "qt_datapath=$QT_INSTALL_DATA", + "qt_trnspath=$QT_INSTALL_TRANSLATIONS", + "qt_xmplpath=$QT_INSTALL_EXAMPLES", + "qt_tstspath=$QT_INSTALL_TESTS", +#ifdef QT_BUILD_QMAKE + "qt_ssrtpath=$CFG_SYSROOT", + "qt_hpfxpath=$QT_HOST_PREFIX", + "qt_hbinpath=$QT_HOST_BINS", + "qt_hdatpath=$QT_HOST_DATA", +#endif +}; +static const char qt_configure_settings_path_str[256 + 12] = "qt_stngpath=$QT_INSTALL_SETTINGS"; EOF -fi cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF -/* Installation Info */ -static const char qt_configure_prefix_path_str [256 + 12] = "$PREFIX_PATH_STR"; -static const char qt_configure_documentation_path_str[256 + 12] = "$DOCUMENTATION_PATH_STR"; -static const char qt_configure_headers_path_str [256 + 12] = "$HEADERS_PATH_STR"; -static const char qt_configure_libraries_path_str [256 + 12] = "$LIBRARIES_PATH_STR"; -static const char qt_configure_binaries_path_str [256 + 12] = "$BINARIES_PATH_STR"; -static const char qt_configure_plugins_path_str [256 + 12] = "$PLUGINS_PATH_STR"; -static const char qt_configure_imports_path_str [256 + 12] = "$IMPORTS_PATH_STR"; -static const char qt_configure_data_path_str [256 + 12] = "$DATA_PATH_STR"; -static const char qt_configure_translations_path_str [256 + 12] = "$TRANSLATIONS_PATH_STR"; -static const char qt_configure_settings_path_str [256 + 12] = "$SETTINGS_PATH_STR"; -static const char qt_configure_examples_path_str [256 + 12] = "$EXAMPLES_PATH_STR"; -static const char qt_configure_tests_path_str [256 + 12] = "$TESTS_PATH_STR"; -EOF -if [ ! -z "$QT_HOST_PREFIX" ]; then - cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF -#endif // QT_BOOTSTRAPPED - -EOF -fi - -cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF /* strlen( "qt_lcnsxxxx" ) == 12 */ #define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12; #define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12; -#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12; -#define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12; -#define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12; -#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12; -#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12; -#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12; -#define QT_CONFIGURE_IMPORTS_PATH qt_configure_imports_path_str + 12; -#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12; -#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12; + #define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12; -#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12; -#define QT_CONFIGURE_TESTS_PATH qt_configure_tests_path_str + 12; EOF # avoid unecessary rebuilds by copying only if qconfig.cpp has changed @@ -4037,9 +4031,9 @@ fi # ----------------------------------------------------------------------------- if [ "$LicenseType" = "Evaluation" ]; then - EVALKEY=`"$relpath/config.tests/unix/padstring" 524 "qt_qevalkey=$LicenseKeyExt"` + EVALKEY=qt_qevalkey=$LicenseKeyExt elif echo "$D_FLAGS" | grep QT_EVAL >/dev/null 2>&1; then - EVALKEY=`"$relpath/config.tests/unix/padstring" 524 "qt_qevalkey="` + EVALKEY=qt_qevalkey= fi if [ -n "$EVALKEY" ]; then @@ -6619,10 +6613,9 @@ EOF if [ -n "$CFG_SYSROOT" ]; then echo "# sysroot" >>"$QTCONFIG.tmp" echo `basename "$XQMAKESPEC"` \{ >>"$QTCONFIG.tmp" - echo " QT_SYSROOT += \$\$quote($CFG_SYSROOT)" >>"$QTCONFIG.tmp" - echo " QMAKE_CFLAGS += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp" - echo " QMAKE_CXXFLAGS += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp" - echo " QMAKE_LFLAGS += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp" + echo " QMAKE_CFLAGS += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp" + echo " QMAKE_CXXFLAGS += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp" + echo " QMAKE_LFLAGS += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp" echo "}" >> "$QTCONFIG.tmp" echo >> "$QTCONFIG.tmp" fi diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0 index 9ab96fb8d8..47994aa774 100644 --- a/dist/changes-5.0.0 +++ b/dist/changes-5.0.0 @@ -45,6 +45,8 @@ information about a particular change. in Qt4, so these methods return a bool now. If your code used the undocumented QBool, simply replace it with bool. +- qIsDetached<> has been removed without replacement. + - QMetaType: * QMetaType::construct() has been renamed to QMetaType::create(). * QMetaType::unregisterType() has been removed. @@ -201,6 +203,10 @@ information about a particular change. - qmake * Projects which explicitly set an empty TARGET are considered broken now. * The makespec and .qmake.cache do not see build pass specific variables any more. + * Configure's -sysroot and -hostprefix are now handled slightly differently. + The QT_INSTALL_... properties are now automatically prefixed with the sysroot; + the raw values are available as QT_RAW_INSTALL_... and the sysroot as QT_SYSROOT. + The new QT_HOST_... properties can be used to refer to the Qt host tools. * Several functions and built-in variables were modified to return normalized paths. - QTextCodecPlugin has been removed since it is no longer used. All text codecs diff --git a/examples/animation/moveblocks/main.cpp b/examples/animation/moveblocks/main.cpp index 8e7c04e9f0..d807bb63d9 100644 --- a/examples/animation/moveblocks/main.cpp +++ b/examples/animation/moveblocks/main.cpp @@ -50,7 +50,7 @@ public: { } - StateSwitchEvent(int rand) + explicit StateSwitchEvent(int rand) : QEvent(Type(StateSwitchType)), m_rand(rand) { diff --git a/mkspecs/aix-g++-64/qmake.conf b/mkspecs/aix-g++-64/qmake.conf index b0179d5603..5a73aeb8c1 100644 --- a/mkspecs/aix-g++-64/qmake.conf +++ b/mkspecs/aix-g++-64/qmake.conf @@ -67,9 +67,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthreads -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar -X64 cq QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = ranlib -X64 diff --git a/mkspecs/aix-g++/qmake.conf b/mkspecs/aix-g++/qmake.conf index 2e2e991f54..9ddb1619ab 100644 --- a/mkspecs/aix-g++/qmake.conf +++ b/mkspecs/aix-g++/qmake.conf @@ -67,9 +67,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthreads -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/aix-xlc-64/qmake.conf b/mkspecs/aix-xlc-64/qmake.conf index 486b8c6f0f..db5ddc33cd 100644 --- a/mkspecs/aix-xlc-64/qmake.conf +++ b/mkspecs/aix-xlc-64/qmake.conf @@ -66,9 +66,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthreads -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar -X64 cq QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = ranlib -X64 diff --git a/mkspecs/aix-xlc/qmake.conf b/mkspecs/aix-xlc/qmake.conf index 8655db6d82..ff83a45702 100644 --- a/mkspecs/aix-xlc/qmake.conf +++ b/mkspecs/aix-xlc/qmake.conf @@ -67,9 +67,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthreads -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = ranlib diff --git a/mkspecs/common/linux.conf b/mkspecs/common/linux.conf index f8f007bada..a809a6b6f9 100644 --- a/mkspecs/common/linux.conf +++ b/mkspecs/common/linux.conf @@ -46,9 +46,6 @@ QMAKE_CFLAGS_XCB = QMAKE_LIBS_XCB = QMAKE_DEFINES_XCB = -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf index b22b852013..6ba55325e8 100644 --- a/mkspecs/common/mac.conf +++ b/mkspecs/common/mac.conf @@ -21,9 +21,6 @@ QMAKE_LIBS_OPENGL = -framework OpenGL -framework AGL QMAKE_LIBS_OPENGL_QT = $$QMAKE_LIBS_OPENGL QMAKE_LIBS_THREAD = -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cq QMAKE_RANLIB = ranlib -s diff --git a/mkspecs/cygwin-g++/qmake.conf b/mkspecs/cygwin-g++/qmake.conf index c46384fc8b..ece21e226f 100644 --- a/mkspecs/cygwin-g++/qmake.conf +++ b/mkspecs/cygwin-g++/qmake.conf @@ -72,9 +72,6 @@ QMAKE_PREFIX_SHLIB = lib QMAKE_PREFIX_STATICLIB = lib QMAKE_EXTENSION_STATICLIB = a -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/darwin-g++/qmake.conf b/mkspecs/darwin-g++/qmake.conf index 84dc764e6b..c059f0cb6f 100644 --- a/mkspecs/darwin-g++/qmake.conf +++ b/mkspecs/darwin-g++/qmake.conf @@ -78,9 +78,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = ranlib -s diff --git a/mkspecs/features/default_pre.prf b/mkspecs/features/default_pre.prf index 59a7e4cb14..5d8684bf00 100644 --- a/mkspecs/features/default_pre.prf +++ b/mkspecs/features/default_pre.prf @@ -26,10 +26,10 @@ CONFIG = lex yacc warn_on debug uic resources $$CONFIG # can we tell syncqt to do a -developer-build win32 { CMP_QDIR = $$upper($$QTDIR) - CMP_INSTALL_PREFIX = $$upper($$[QT_INSTALL_PREFIX]) + CMP_INSTALL_PREFIX = $$upper($$[QT_HOST_PREFIX]) } else { CMP_QDIR = $$QTDIR - CMP_INSTALL_PREFIX = $$[QT_INSTALL_PREFIX] + CMP_INSTALL_PREFIX = $$[QT_HOST_PREFIX] } contains(CMP_QDIR, $$CMP_INSTALL_PREFIX):QTFWD = -qtdir $$QTDIR -module-fwd $$QTDIR/mkspecs/modules -developer-build unset(CMP_QDIR) diff --git a/mkspecs/features/module.prf b/mkspecs/features/module.prf index 85639f0345..d95c7a418d 100644 --- a/mkspecs/features/module.prf +++ b/mkspecs/features/module.prf @@ -1,5 +1,5 @@ !isEmpty(MODULE_PRI) { - pritarget.path = $$[QT_INSTALL_DATA]/mkspecs/modules + pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules pritarget.files = $$MODULE_PRI INSTALLS += pritarget } else { diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 6081342929..5328e6ccff 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -1,5 +1,32 @@ CONFIG *= moc thread +# Temporary fixes to avoid QDeclarative -> QQml breakage: + +# Projects depending on declarative will now get the full set of +# -DOldSymbol=NewSymbol definitions added to their configuration +# so that the old symbol names still compile. All code previously +# in the declarative library is now in the qml library. +contains(QT, qmldevtools):!contains(QT, declarative) { + QT += declarative +} +contains(QT, qmldevtools-private):!contains(QT, declarative-private) { + QT += declarative-private +} + +contains(QT, quick):!contains(QT, declarative) { + QT += declarative +} +contains(QT, quick-private):!contains(QT, declarative-private) { + QT += declarative-private +} + +contains(QT, declarative):!contains(QT, qml) { + QT += qml +} +contains(QT, declarative-private):!contains(QT, qml-private) { + QT += qml-private +} + #handle defines win32 { qt_static:DEFINES += QT_NODLL diff --git a/mkspecs/features/qt_config.prf b/mkspecs/features/qt_config.prf index 8441728815..8d0dcce92c 100644 --- a/mkspecs/features/qt_config.prf +++ b/mkspecs/features/qt_config.prf @@ -8,7 +8,7 @@ exists($$_QMAKE_CACHE_) { isEmpty(QMAKE_QT_CONFIG)|!exists($$QMAKE_QT_CONFIG) { !isEmpty(QT_BUILD_TREE):QMAKE_QT_CONFIG = $$QT_BUILD_TREE else:exists($$_QMAKE_CACHE_):QMAKE_QT_CONFIG = $$fromfile($$_QMAKE_CACHE_, QT_BUILD_TREE) - isEmpty(QMAKE_QT_CONFIG):QMAKE_QT_CONFIG = $$[QT_INSTALL_DATA] + isEmpty(QMAKE_QT_CONFIG):QMAKE_QT_CONFIG = $$[QT_HOST_DATA] QMAKE_QT_CONFIG = $$QMAKE_QT_CONFIG/mkspecs/qconfig.pri } !exists($$QMAKE_QT_CONFIG)|!include($$QMAKE_QT_CONFIG, "", true) { diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 65eec35bfc..31b28156e8 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -132,7 +132,7 @@ defineTest(qtAddModule) { isEmpty(LINKAGE) { # Make sure we can link to uninstalled libraries - !isEqual(MODULE_LIBS, $$[QT_INSTALL_LIBS]) { + !isEqual(MODULE_LIBS, $$[QT_INSTALL_LIBS]) { ### XXX QMAKE_LIBDIR *= $$MODULE_LIBS unix:!mac:QMAKE_LFLAGS *= "-Wl,-rpath-link,$$MODULE_LIBS" } @@ -164,7 +164,7 @@ defineTest(qtAddModule) { # variable, default defineTest(qtPrepareTool) { - MODBASE = $$[QT_INSTALL_BINS] + MODBASE = $$[QT_HOST_BINS] !isEmpty(QT_BUILD_TREE):MODBASE = $$QT_BUILD_TREE/bin count(ARGS, 2, greaterThan) { isEmpty(QT.$${3}.bins):warning("No QT.$${3}.bins, module path ignored for qtPrepareTool($$1, $$2, $$3)") diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index aee95295e8..b71ef61252 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -8,7 +8,7 @@ isEmpty(QMAKE_QT_MODULE)|!exists($$QMAKE_QT_MODULE) { !exists($$QMAKE_QT_MODULE):exists($$QMAKE_CACHE_DIR/mkspecs/qmodule.pri):QMAKE_QT_MODULE = $$QMAKE_CACHE_DIR/mkspecs/qmodule.pri !exists($$QMAKE_QT_MODULE):exists($$QMAKE_CACHE_DIR/qtbase/mkspecs/qmodule.pri):QMAKE_QT_MODULE = $$QMAKE_CACHE_DIR/qtbase/mkspecs/qmodule.pri !exists($$QMAKE_QT_MODULE):if(!isEmpty(QT_BUILD_TREE) & exists($$QT_BUILD_TREE/mkspecs/qmodule.pri)):QMAKE_QT_MODULE = $$QT_BUILD_TREE/mkspecs/qmodule.pri - !exists($$QMAKE_QT_MODULE):exists($$[QT_INSTALL_DATA]/mkspecs/qmodule.pri):QMAKE_QT_MODULE = $$[QT_INSTALL_DATA]/mkspecs/qmodule.pri + !exists($$QMAKE_QT_MODULE):exists($$[QT_HOST_DATA]/mkspecs/qmodule.pri):QMAKE_QT_MODULE = $$[QT_HOST_DATA]/mkspecs/qmodule.pri } !contains(QMAKE_INTERNAL_INCLUDED_FILES, .*qmodule\\.pri) { diff --git a/mkspecs/features/qt_module_config.prf b/mkspecs/features/qt_module_config.prf index e106c3f1e7..98cdab121f 100644 --- a/mkspecs/features/qt_module_config.prf +++ b/mkspecs/features/qt_module_config.prf @@ -118,24 +118,24 @@ load(qt_installs) unix|win32-g++* { CONFIG += create_pc - QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS] - QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET - QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS] + QMAKE_PKGCONFIG_LIBDIR = $$[QT_RAW_INSTALL_LIBS] + QMAKE_PKGCONFIG_INCDIR = $$[QT_RAW_INSTALL_HEADERS]/$$TARGET + QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_RAW_INSTALL_HEADERS] QMAKE_PKGCONFIG_DESTDIR = pkgconfig include_replace.match = $$QMAKE_INCDIR_QT - include_replace.replace = $$[QT_INSTALL_HEADERS] + include_replace.replace = $$[QT_RAW_INSTALL_HEADERS] lib_replace.match = $$QMAKE_LIBDIR_QT - lib_replace.replace = $$[QT_INSTALL_LIBS] + lib_replace.replace = $$[QT_RAW_INSTALL_LIBS] prefix_replace.match = $$QT_BUILD_TREE - prefix_replace.replace = $$[QT_INSTALL_PREFIX] + prefix_replace.replace = $$[QT_RAW_INSTALL_PREFIX] QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace prefix_replace } unix { CONFIG += create_libtool explicitlib - QMAKE_LIBTOOL_LIBDIR = $$[QT_INSTALL_LIBS] - QMAKE_PRL_LIBDIR = $$[QT_INSTALL_LIBS] + QMAKE_PRL_LIBDIR = $$[QT_RAW_INSTALL_LIBS] ### XXX QMAKE_PRL_INSTALL_REPLACE += include_replace lib_replace + QMAKE_LIBTOOL_LIBDIR = $$[QT_RAW_INSTALL_LIBS] QMAKE_LIBTOOL_INSTALL_REPLACE += include_replace lib_replace } diff --git a/mkspecs/freebsd-g++/qmake.conf b/mkspecs/freebsd-g++/qmake.conf index 9d7c4431d8..f1db098c19 100644 --- a/mkspecs/freebsd-g++/qmake.conf +++ b/mkspecs/freebsd-g++/qmake.conf @@ -32,9 +32,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/freebsd-g++34/qmake.conf b/mkspecs/freebsd-g++34/qmake.conf index 0f52993451..ee597de6c5 100644 --- a/mkspecs/freebsd-g++34/qmake.conf +++ b/mkspecs/freebsd-g++34/qmake.conf @@ -67,9 +67,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/freebsd-g++40/qmake.conf b/mkspecs/freebsd-g++40/qmake.conf index bf4271126a..331c267b9e 100644 --- a/mkspecs/freebsd-g++40/qmake.conf +++ b/mkspecs/freebsd-g++40/qmake.conf @@ -67,9 +67,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/freebsd-icc/qmake.conf b/mkspecs/freebsd-icc/qmake.conf index acc8f14b3a..fc7251bcbf 100644 --- a/mkspecs/freebsd-icc/qmake.conf +++ b/mkspecs/freebsd-icc/qmake.conf @@ -90,9 +90,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/hpux-acc-64/qmake.conf b/mkspecs/hpux-acc-64/qmake.conf index b9aaf5ab24..de0fff1d91 100644 --- a/mkspecs/hpux-acc-64/qmake.conf +++ b/mkspecs/hpux-acc-64/qmake.conf @@ -111,9 +111,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL -lXt QMAKE_LIBS_THREAD = -lpthread QMAKE_LIBS_YACC = -ly -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/hpux-acc-o64/qmake.conf b/mkspecs/hpux-acc-o64/qmake.conf index 389e813dba..5773566b9e 100644 --- a/mkspecs/hpux-acc-o64/qmake.conf +++ b/mkspecs/hpux-acc-o64/qmake.conf @@ -109,9 +109,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread QMAKE_LIBS_YACC = -ly -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/hpux-acc/qmake.conf b/mkspecs/hpux-acc/qmake.conf index d1b6e5ce56..6bc226c7e2 100644 --- a/mkspecs/hpux-acc/qmake.conf +++ b/mkspecs/hpux-acc/qmake.conf @@ -90,9 +90,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL -lXt QMAKE_LIBS_THREAD = -lpthread QMAKE_LIBS_YACC = -ly -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/hpux-g++-64/qmake.conf b/mkspecs/hpux-g++-64/qmake.conf index f796496c56..1f478ccca4 100644 --- a/mkspecs/hpux-g++-64/qmake.conf +++ b/mkspecs/hpux-g++-64/qmake.conf @@ -73,9 +73,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread QMAKE_LIBS_YACC = -ly -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/hpux-g++/qmake.conf b/mkspecs/hpux-g++/qmake.conf index e9891e79f1..6685fe1a5e 100644 --- a/mkspecs/hpux-g++/qmake.conf +++ b/mkspecs/hpux-g++/qmake.conf @@ -73,9 +73,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread QMAKE_LIBS_YACC = -ly -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/hpuxi-acc-32/qmake.conf b/mkspecs/hpuxi-acc-32/qmake.conf index d7e4a0ad34..53d05b7450 100644 --- a/mkspecs/hpuxi-acc-32/qmake.conf +++ b/mkspecs/hpuxi-acc-32/qmake.conf @@ -65,9 +65,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL -lXt QMAKE_LIBS_THREAD = -lpthread QMAKE_LIBS_YACC = -ly -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/hpuxi-acc-64/qmake.conf b/mkspecs/hpuxi-acc-64/qmake.conf index 3ed9b55073..d5d51a9dea 100644 --- a/mkspecs/hpuxi-acc-64/qmake.conf +++ b/mkspecs/hpuxi-acc-64/qmake.conf @@ -108,9 +108,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL -lXt QMAKE_LIBS_THREAD = -lpthread QMAKE_LIBS_YACC = -ly -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/hpuxi-g++-64/qmake.conf b/mkspecs/hpuxi-g++-64/qmake.conf index a8f445ca00..9d4daae5c3 100644 --- a/mkspecs/hpuxi-g++-64/qmake.conf +++ b/mkspecs/hpuxi-g++-64/qmake.conf @@ -76,9 +76,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread QMAKE_LIBS_YACC = -ly -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/hurd-g++/qmake.conf b/mkspecs/hurd-g++/qmake.conf index 09a72fa0d7..e7416cd9f6 100644 --- a/mkspecs/hurd-g++/qmake.conf +++ b/mkspecs/hurd-g++/qmake.conf @@ -42,9 +42,6 @@ QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 QMAKE_LIBS_OPENVG = -lOpenVG QMAKE_LIBS_THREAD = -lpthread -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/irix-cc-64/qmake.conf b/mkspecs/irix-cc-64/qmake.conf index ec94824be6..ac5f3b5847 100644 --- a/mkspecs/irix-cc-64/qmake.conf +++ b/mkspecs/irix-cc-64/qmake.conf @@ -98,9 +98,6 @@ QMAKE_LIBS_OPENGL = -lGL -lm QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = CC -ar -o QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/irix-cc/qmake.conf b/mkspecs/irix-cc/qmake.conf index 777da9b5db..eaec795f2a 100644 --- a/mkspecs/irix-cc/qmake.conf +++ b/mkspecs/irix-cc/qmake.conf @@ -98,9 +98,6 @@ QMAKE_LIBS_OPENGL = -lGL -lm QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = CC -ar -o QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/irix-g++-64/qmake.conf b/mkspecs/irix-g++-64/qmake.conf index aa853dedfe..2dcd690c5a 100644 --- a/mkspecs/irix-g++-64/qmake.conf +++ b/mkspecs/irix-g++-64/qmake.conf @@ -71,9 +71,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/irix-g++/qmake.conf b/mkspecs/irix-g++/qmake.conf index 77d47a9ce9..c532a35f6f 100644 --- a/mkspecs/irix-g++/qmake.conf +++ b/mkspecs/irix-g++/qmake.conf @@ -71,9 +71,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/linux-cxx/qmake.conf b/mkspecs/linux-cxx/qmake.conf index 79aa834a90..0bd1193730 100644 --- a/mkspecs/linux-cxx/qmake.conf +++ b/mkspecs/linux-cxx/qmake.conf @@ -63,9 +63,6 @@ QMAKE_LIBS_NIS = -lnsl QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_RANLIB = diff --git a/mkspecs/linux-ecc-64/qmake.conf b/mkspecs/linux-ecc-64/qmake.conf index 50f841f1d4..a4b9e03f2c 100644 --- a/mkspecs/linux-ecc-64/qmake.conf +++ b/mkspecs/linux-ecc-64/qmake.conf @@ -67,9 +67,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf index 4ff63cda71..49a3306538 100644 --- a/mkspecs/linux-icc/qmake.conf +++ b/mkspecs/linux-icc/qmake.conf @@ -74,9 +74,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = xiar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/linux-kcc/qmake.conf b/mkspecs/linux-kcc/qmake.conf index 23fd6298ac..ab1847f42d 100644 --- a/mkspecs/linux-kcc/qmake.conf +++ b/mkspecs/linux-kcc/qmake.conf @@ -76,9 +76,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/linux-pgcc/qmake.conf b/mkspecs/linux-pgcc/qmake.conf index ed88215609..80b4cc28ba 100644 --- a/mkspecs/linux-pgcc/qmake.conf +++ b/mkspecs/linux-pgcc/qmake.conf @@ -67,9 +67,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/lynxos-g++/qmake.conf b/mkspecs/lynxos-g++/qmake.conf index 6b6f4057bf..500dc498ee 100644 --- a/mkspecs/lynxos-g++/qmake.conf +++ b/mkspecs/lynxos-g++/qmake.conf @@ -70,9 +70,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/macx-xlc/qmake.conf b/mkspecs/macx-xlc/qmake.conf index f84524bbdf..77c300a4ae 100644 --- a/mkspecs/macx-xlc/qmake.conf +++ b/mkspecs/macx-xlc/qmake.conf @@ -77,9 +77,6 @@ QMAKE_LIBS_OPENGL = -framework OpenGL -framework AGL QMAKE_LIBS_OPENGL_QT = $$QMAKE_LIBS_OPENGL #QMAKE_LIBS_THREAD = -lpthreads -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = ranlib -s diff --git a/mkspecs/netbsd-g++/qmake.conf b/mkspecs/netbsd-g++/qmake.conf index ab4b7c374c..17609f2fb7 100644 --- a/mkspecs/netbsd-g++/qmake.conf +++ b/mkspecs/netbsd-g++/qmake.conf @@ -68,9 +68,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = ranlib diff --git a/mkspecs/openbsd-g++/qmake.conf b/mkspecs/openbsd-g++/qmake.conf index 56d94160e3..1539c46960 100644 --- a/mkspecs/openbsd-g++/qmake.conf +++ b/mkspecs/openbsd-g++/qmake.conf @@ -69,9 +69,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar q QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = ranlib diff --git a/mkspecs/sco-cc/qmake.conf b/mkspecs/sco-cc/qmake.conf index 179b774e03..4cb71db520 100644 --- a/mkspecs/sco-cc/qmake.conf +++ b/mkspecs/sco-cc/qmake.conf @@ -63,9 +63,6 @@ QMAKE_LIBS_X11SM = -lSM -lICE QMAKE_LIBS_OPENGL = -lGL -lXt QMAKE_LIBS_OPENGL_QT = -lGL -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/sco-g++/qmake.conf b/mkspecs/sco-g++/qmake.conf index 9b321a486a..b4839eb571 100644 --- a/mkspecs/sco-g++/qmake.conf +++ b/mkspecs/sco-g++/qmake.conf @@ -64,9 +64,6 @@ QMAKE_LIBS_X11 = -lXext -lX11 -lsocket -lm QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/solaris-cc-64/qmake.conf b/mkspecs/solaris-cc-64/qmake.conf index 80709af5f4..b28c4505c9 100644 --- a/mkspecs/solaris-cc-64/qmake.conf +++ b/mkspecs/solaris-cc-64/qmake.conf @@ -88,9 +88,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread -lrt QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = CC -xar -o QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/solaris-cc/qmake.conf b/mkspecs/solaris-cc/qmake.conf index 0672841acc..e29d37bc87 100644 --- a/mkspecs/solaris-cc/qmake.conf +++ b/mkspecs/solaris-cc/qmake.conf @@ -71,9 +71,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread -lrt QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = CC -xar -o QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/solaris-g++-64/qmake.conf b/mkspecs/solaris-g++-64/qmake.conf index 7bc7b9fd60..c08212765d 100644 --- a/mkspecs/solaris-g++-64/qmake.conf +++ b/mkspecs/solaris-g++-64/qmake.conf @@ -92,9 +92,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread -lrt QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/solaris-g++/qmake.conf b/mkspecs/solaris-g++/qmake.conf index be21cdd1da..5c9909210f 100644 --- a/mkspecs/solaris-g++/qmake.conf +++ b/mkspecs/solaris-g++/qmake.conf @@ -75,9 +75,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread -lrt QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/tru64-cxx/qmake.conf b/mkspecs/tru64-cxx/qmake.conf index afabf3e220..a8db2a3c3a 100644 --- a/mkspecs/tru64-cxx/qmake.conf +++ b/mkspecs/tru64-cxx/qmake.conf @@ -64,9 +64,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lrt -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/tru64-g++/qmake.conf b/mkspecs/tru64-g++/qmake.conf index 6acd5cdb22..e1236cf5f8 100644 --- a/mkspecs/tru64-g++/qmake.conf +++ b/mkspecs/tru64-g++/qmake.conf @@ -66,9 +66,6 @@ QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lpthread -lexc -lrt -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/unixware-cc/qmake.conf b/mkspecs/unixware-cc/qmake.conf index 74478d66e2..4e55970aa7 100644 --- a/mkspecs/unixware-cc/qmake.conf +++ b/mkspecs/unixware-cc/qmake.conf @@ -69,9 +69,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/unixware-g++/qmake.conf b/mkspecs/unixware-g++/qmake.conf index a158d9522a..753c3a86a7 100644 --- a/mkspecs/unixware-g++/qmake.conf +++ b/mkspecs/unixware-g++/qmake.conf @@ -68,9 +68,6 @@ QMAKE_LIBS_OPENGL = -lGL -lXt QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = -lthread -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cq QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/unsupported/integrity-ghs/qmake.conf b/mkspecs/unsupported/integrity-ghs/qmake.conf index 54253edc8f..7f2ac2fb04 100644 --- a/mkspecs/unsupported/integrity-ghs/qmake.conf +++ b/mkspecs/unsupported/integrity-ghs/qmake.conf @@ -50,9 +50,6 @@ QMAKE_LIBS_X11 = QMAKE_LIBS_X11SM = QMAKE_LIBS_THREAD = -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_RANLIB = diff --git a/mkspecs/unsupported/linux-host-g++/qmake.conf b/mkspecs/unsupported/linux-host-g++/qmake.conf index 1ad529ebae..2e0b7dba44 100644 --- a/mkspecs/unsupported/linux-host-g++/qmake.conf +++ b/mkspecs/unsupported/linux-host-g++/qmake.conf @@ -108,9 +108,6 @@ QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 QMAKE_LIBS_OPENVG = -lOpenVG QMAKE_LIBS_THREAD = -lpthread -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = host-ar cqs QMAKE_OBJCOPY = host-objcopy QMAKE_RANLIB = diff --git a/mkspecs/unsupported/qnx-g++/qmake.conf b/mkspecs/unsupported/qnx-g++/qmake.conf index 83c4a26e06..bc96c21e9f 100644 --- a/mkspecs/unsupported/qnx-g++/qmake.conf +++ b/mkspecs/unsupported/qnx-g++/qmake.conf @@ -37,9 +37,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = QMAKE_LIBS_NETWORK = -lsocket -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_RANLIB = diff --git a/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf b/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf index a3b571b144..10f2627d66 100644 --- a/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf +++ b/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf @@ -84,9 +84,6 @@ QMAKE_LIBS_THREAD = QMAKE_LIBS_NETWORK = # -lnetwrap # only needed if kernel is missing gethostbyname and friends -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf b/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf index 8bdf1c5011..c3c974e3e7 100644 --- a/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf +++ b/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf @@ -83,9 +83,6 @@ QMAKE_LIBS_OPENGL_QT = -lGL QMAKE_LIBS_THREAD = QMAKE_LIBS_NETWORK = # -lnet # only needed if kernel is missing gethostbyname and friends -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = ar cqs QMAKE_OBJCOPY = objcopy QMAKE_RANLIB = diff --git a/qmake/generators/integrity/gbuild.cpp b/qmake/generators/integrity/gbuild.cpp index c72c120f39..895df24193 100644 --- a/qmake/generators/integrity/gbuild.cpp +++ b/qmake/generators/integrity/gbuild.cpp @@ -213,7 +213,7 @@ GBuildMakefileGenerator::write() dllbase += DLLOFFSET; } - warn_msg(WarnParser, Option::output.fileName().toAscii()); + warn_msg(WarnParser, Option::output.fileName().toAscii().constData()); QTextStream t(&Option::output); QString primaryTarget(project->values("QMAKE_CXX").at(0)); @@ -425,7 +425,7 @@ GBuildMakefileGenerator::openOutput(QFile &file, const QString &build) const outputName += QDir::separator(); outputName += fileInfo(project->projectFile()).baseName(); outputName += projectSuffix(); - warn_msg(WarnParser, outputName.toAscii()); + warn_msg(WarnParser, outputName.toAscii().constData()); file.setFileName(outputName); } debug_msg(1, "file is %s", file.fileName().toLatin1().constData()); diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 5d6dee1bb9..70efff0bcd 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -1378,7 +1378,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } tmp = project->values("QMAKE_PBX_VARS"); for(int i = 0; i < tmp.count(); i++) { - QString var = tmp[i], val = qgetenv(var.toLatin1()); + QString var = tmp[i], val = QString::fromAscii(qgetenv(var.toLatin1().constData())); if(val.isEmpty() && var == "TB") val = "/usr/bin/"; t << "\t\t\t\t" << writeSettings(var, escapeFilePath(val)) << ";" << "\n"; diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 8544dce2fc..63367f116a 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -3174,7 +3174,7 @@ MakefileGenerator::pkgConfigPrefix() const { if(!project->isEmpty("QMAKE_PKGCONFIG_PREFIX")) return project->first("QMAKE_PKGCONFIG_PREFIX"); - return QLibraryInfo::location(QLibraryInfo::PrefixPath); + return QLibraryInfo::rawLocation(QLibraryInfo::PrefixPath); } QString diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index d28d48b4d0..642dd97e68 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -185,9 +185,9 @@ SourceFile *SourceFiles::lookupFile(const char *file) void SourceFiles::addFile(SourceFile *p, const char *k, bool own_file) { - QByteArray ba = p->file.local().toLatin1(); + const QByteArray ba = p->file.local().toLatin1(); if(!k) - k = ba; + k = ba.constData(); int h = hash(k) % num_nodes; SourceFileNode *pn = new SourceFileNode; pn->own_file = own_file; diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 81f541f94e..e0f55a64c9 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -1615,7 +1615,7 @@ bool VCLinkerTool::parseOption(const char* option) { // Split up in subsystem, and version number QStringList both = QString(option+11).split(","); - switch (elfHash(both[0].toLatin1())) { + switch (elfHash(both[0].toLatin1().constData())) { case 0x8438445: // CONSOLE SubSystem = subSystemConsole; break; diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 8b1cf519ff..37d923f9c1 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -477,7 +477,7 @@ protected: public: void parseOptions(QStringList& options) { for (QStringList::ConstIterator it=options.begin(); (it!=options.end()); it++) - parseOption((*it).toLatin1()); + parseOption((*it).toLatin1().constData()); } static QStringList fixCommandLine(const QString &input); }; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 109b50fd94..434d4b4559 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1575,11 +1575,11 @@ QString VcprojGenerator::findTemplate(QString file) QString ret; if(!exists((ret = file)) && !exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && - !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc.net/" + file))) && - !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2002/" + file))) && - !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2003/" + file))) && - !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2005/" + file))) && - !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2008/" + file)))) + !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::HostDataPath) + "/win32-msvc.net/" + file))) && + !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::HostDataPath) + "/win32-msvc2002/" + file))) && + !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::HostDataPath) + "/win32-msvc2003/" + file))) && + !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::HostDataPath) + "/win32-msvc2005/" + file))) && + !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::HostDataPath) + "/win32-msvc2008/" + file)))) return ""; debug_msg(1, "Generator: MSVC.NET: Found template \'%s\'", ret.toLatin1().constData()); return ret; diff --git a/qmake/option.cpp b/qmake/option.cpp index cf72351f1f..4e0d5b198e 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -594,7 +594,7 @@ QStringList Option::mkspecPaths() ret << Option::mkfile::project_build_root + concat; if (!Option::mkfile::project_root.isEmpty()) ret << Option::mkfile::project_root + concat; - ret << QLibraryInfo::location(QLibraryInfo::DataPath) + concat; + ret << QLibraryInfo::location(QLibraryInfo::HostDataPath) + concat; return ret; } diff --git a/qmake/option.h b/qmake/option.h index 2d0d1114a9..23384877fd 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -46,6 +46,7 @@ #include <qstring.h> #include <qstringlist.h> #include <qfile.h> +#include <qlibraryinfo.h> QT_BEGIN_NAMESPACE @@ -219,28 +220,6 @@ private: inline QString fixEnvVariables(const QString &x) { return Option::fixString(x, Option::FixEnvVars); } inline QStringList splitPathList(const QString &paths) { return paths.split(Option::dirlist_sep); } -// this is a stripped down version of the one found in QtCore -class QLibraryInfo -{ -public: - enum LibraryLocation - { - PrefixPath, - DocumentationPath, - HeadersPath, - LibrariesPath, - BinariesPath, - PluginsPath, - DataPath, - TranslationsPath, - SettingsPath, - ExamplesPath, - ImportsPath, - TestsPath - }; - static QString location(LibraryLocation); -}; - QT_END_NAMESPACE #endif // OPTION_H diff --git a/qmake/project.cpp b/qmake/project.cpp index 34e443f5c5..f6e26254c5 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -591,7 +591,7 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0) } for(QStringList::Iterator concat_it = concat.begin(); concat_it != concat.end(); ++concat_it) - feature_roots << (QLibraryInfo::location(QLibraryInfo::DataPath) + + feature_roots << (QLibraryInfo::location(QLibraryInfo::HostDataPath) + mkspecs_concat + (*concat_it)); return feature_roots; } @@ -1435,7 +1435,7 @@ QMakeProject::resolveSpec(QString *spec, const QString &qmakespec) if (*spec == "default") { #ifdef Q_OS_UNIX char buffer[1024]; - int l = readlink(qmakespec.toLatin1(), buffer, 1023); + int l = readlink(qmakespec.toLatin1().constData(), buffer, 1023); if (l != -1) { buffer[l] = '\0'; *spec = QString::fromLatin1(buffer); @@ -1988,7 +1988,7 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list, if(args.count() > 1) singleLine = (args[1].toLower() == "true"); QString output; - FILE *proc = QT_POPEN(args[0].toLatin1(), "r"); + FILE *proc = QT_POPEN(args[0].toLatin1().constData(), "r"); while(proc && !feof(proc)) { int read_in = int(fread(buff, 1, 255, proc)); if(!read_in) @@ -3061,19 +3061,19 @@ QStringList &QMakeProject::values(const QString &_var, QHash<QString, QStringLis place[var] = QStringList(Option::fixPathToTargetOS( !Option::qmake_abslocation.isEmpty() ? Option::qmake_abslocation - : QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmake", + : QLibraryInfo::location(QLibraryInfo::HostBinariesPath) + "/qmake", false)); } #if defined(Q_OS_WIN32) && defined(Q_CC_MSVC) else if(var.startsWith(QLatin1String("QMAKE_TARGET."))) { QString ret, type = var.mid(13); if(type == "arch") { - QString paths = qgetenv("PATH"); - QString vcBin64 = qgetenv("VCINSTALLDIR"); + QString paths = QString::fromLocal8Bit(qgetenv("PATH")); + QString vcBin64 = QString::fromLocal8Bit(qgetenv("VCINSTALLDIR")); if (!vcBin64.endsWith('\\')) vcBin64.append('\\'); vcBin64.append("bin\\amd64"); - QString vcBinX86_64 = qgetenv("VCINSTALLDIR"); + QString vcBinX86_64 = QString::fromLocal8Bit(qgetenv("VCINSTALLDIR")); if (!vcBinX86_64.endsWith('\\')) vcBinX86_64.append('\\'); vcBinX86_64.append("bin\\x86_amd64"); diff --git a/qmake/property.cpp b/qmake/property.cpp index 064c8f6082..8ed9462c60 100644 --- a/qmake/property.cpp +++ b/qmake/property.cpp @@ -49,8 +49,48 @@ QT_BEGIN_NAMESPACE +static const struct { + const char *name; + QLibraryInfo::LibraryLocation loc; + bool raw; +} propList[] = { + { "QT_SYSROOT", QLibraryInfo::SysrootPath, true }, + { "QT_INSTALL_PREFIX", QLibraryInfo::PrefixPath, false }, + { "QT_INSTALL_DATA", QLibraryInfo::DataPath, false }, + { "QT_INSTALL_DOCS", QLibraryInfo::DocumentationPath, false }, + { "QT_INSTALL_HEADERS", QLibraryInfo::HeadersPath, false }, + { "QT_INSTALL_LIBS", QLibraryInfo::LibrariesPath, false }, + { "QT_INSTALL_BINS", QLibraryInfo::BinariesPath, false }, + { "QT_INSTALL_TESTS", QLibraryInfo::TestsPath, false }, + { "QT_INSTALL_PLUGINS", QLibraryInfo::PluginsPath, false }, + { "QT_INSTALL_IMPORTS", QLibraryInfo::ImportsPath, false }, + { "QT_INSTALL_TRANSLATIONS", QLibraryInfo::TranslationsPath, false }, + { "QT_INSTALL_CONFIGURATION", QLibraryInfo::SettingsPath, false }, + { "QT_INSTALL_EXAMPLES", QLibraryInfo::ExamplesPath, false }, + { "QT_INSTALL_DEMOS", QLibraryInfo::ExamplesPath, false }, // Just backwards compat + { "QT_RAW_INSTALL_PREFIX", QLibraryInfo::PrefixPath, true }, + { "QT_RAW_INSTALL_DATA", QLibraryInfo::DataPath, true }, + { "QT_RAW_INSTALL_DOCS", QLibraryInfo::DocumentationPath, true }, + { "QT_RAW_INSTALL_HEADERS", QLibraryInfo::HeadersPath, true }, + { "QT_RAW_INSTALL_LIBS", QLibraryInfo::LibrariesPath, true }, + { "QT_RAW_INSTALL_BINS", QLibraryInfo::BinariesPath, true }, + { "QT_RAW_INSTALL_TESTS", QLibraryInfo::TestsPath, true }, + { "QT_RAW_INSTALL_PLUGINS", QLibraryInfo::PluginsPath, true }, + { "QT_RAW_INSTALL_IMPORTS", QLibraryInfo::ImportsPath, true }, + { "QT_RAW_INSTALL_TRANSLATIONS", QLibraryInfo::TranslationsPath, true }, + { "QT_RAW_INSTALL_CONFIGURATION", QLibraryInfo::SettingsPath, true }, + { "QT_RAW_INSTALL_EXAMPLES", QLibraryInfo::ExamplesPath, true }, + { "QT_HOST_PREFIX", QLibraryInfo::HostPrefixPath, true }, + { "QT_HOST_DATA", QLibraryInfo::HostDataPath, true }, + { "QT_HOST_BINS", QLibraryInfo::HostBinariesPath, true }, +}; + QMakeProperty::QMakeProperty() : settings(0) { + for (int i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) + m_values[QString::fromLatin1(propList[i].name)] = propList[i].raw + ? QLibraryInfo::rawLocation(propList[i].loc) + : QLibraryInfo::location(propList[i].loc); } QMakeProperty::~QMakeProperty() @@ -78,32 +118,9 @@ QMakeProperty::keyBase(bool version) const QString QMakeProperty::value(QString v, bool just_check) { - if(v == "QT_INSTALL_PREFIX") - return QLibraryInfo::location(QLibraryInfo::PrefixPath); - else if(v == "QT_INSTALL_DATA") - return QLibraryInfo::location(QLibraryInfo::DataPath); - else if(v == "QT_INSTALL_DOCS") - return QLibraryInfo::location(QLibraryInfo::DocumentationPath); - else if(v == "QT_INSTALL_HEADERS") - return QLibraryInfo::location(QLibraryInfo::HeadersPath); - else if(v == "QT_INSTALL_LIBS") - return QLibraryInfo::location(QLibraryInfo::LibrariesPath); - else if(v == "QT_INSTALL_BINS") - return QLibraryInfo::location(QLibraryInfo::BinariesPath); - else if(v == "QT_INSTALL_TESTS") - return QLibraryInfo::location(QLibraryInfo::TestsPath); - else if(v == "QT_INSTALL_PLUGINS") - return QLibraryInfo::location(QLibraryInfo::PluginsPath); - else if(v == "QT_INSTALL_IMPORTS") - return QLibraryInfo::location(QLibraryInfo::ImportsPath); - else if(v == "QT_INSTALL_TRANSLATIONS") - return QLibraryInfo::location(QLibraryInfo::TranslationsPath); - else if(v == "QT_INSTALL_CONFIGURATION") - return QLibraryInfo::location(QLibraryInfo::SettingsPath); - else if(v == "QT_INSTALL_EXAMPLES") - return QLibraryInfo::location(QLibraryInfo::ExamplesPath); - else if(v == "QT_INSTALL_DEMOS") - return QLibraryInfo::location(QLibraryInfo::ExamplesPath); + QString val = m_values.value(v); + if (!val.isNull()) + return val; else if(v == "QMAKE_MKSPECS") return Option::mkspecPaths().join(Option::dirlist_sep); else if(v == "QMAKE_VERSION") @@ -192,19 +209,8 @@ QMakeProperty::exec() } } QStringList specialProps; - specialProps.append("QT_INSTALL_PREFIX"); - specialProps.append("QT_INSTALL_DATA"); - specialProps.append("QT_INSTALL_DOCS"); - specialProps.append("QT_INSTALL_HEADERS"); - specialProps.append("QT_INSTALL_LIBS"); - specialProps.append("QT_INSTALL_BINS"); - specialProps.append("QT_INSTALL_TESTS"); - specialProps.append("QT_INSTALL_PLUGINS"); - specialProps.append("QT_INSTALL_IMPORTS"); - specialProps.append("QT_INSTALL_TRANSLATIONS"); - specialProps.append("QT_INSTALL_CONFIGURATION"); - specialProps.append("QT_INSTALL_EXAMPLES"); - specialProps.append("QT_INSTALL_DEMOS"); + for (int i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) + specialProps.append(QString::fromLatin1(propList[i].name)); specialProps.append("QMAKE_MKSPECS"); specialProps.append("QMAKE_VERSION"); #ifdef QT_VERSION_STR diff --git a/qmake/property.h b/qmake/property.h index d67d0ad09d..6195e482fb 100644 --- a/qmake/property.h +++ b/qmake/property.h @@ -44,6 +44,7 @@ #include <qglobal.h> #include <qstring.h> +#include <qhash.h> QT_BEGIN_NAMESPACE @@ -55,6 +56,9 @@ class QMakeProperty void initSettings(); QString keyBase(bool =true) const; QString value(QString, bool just_check); + + QHash<QString, QString> m_values; + public: QMakeProperty(); ~QMakeProperty(); diff --git a/qtbase.pro b/qtbase.pro index 5fc9cb3888..01a5aa33dc 100644 --- a/qtbase.pro +++ b/qtbase.pro @@ -98,7 +98,7 @@ CONFIG -= qt ### installations #### #qmake -qmake.path=$$[QT_INSTALL_BINS] +qmake.path = $$[QT_HOST_BINS] win32 { qmake.files=$$QT_BUILD_TREE/bin/qmake.exe } else { @@ -107,18 +107,18 @@ win32 { INSTALLS += qmake #syncqt -syncqt.path=$$[QT_INSTALL_BINS] +syncqt.path = $$[QT_HOST_BINS] syncqt.files=$$QT_BUILD_TREE/bin/syncqt win32:syncqt.files=$$QT_BUILD_TREE/bin/syncqt.bat INSTALLS += syncqt #qtmodule-configtests -configtests.path=$$[QT_INSTALL_BINS] +configtests.path = $$[QT_HOST_BINS] configtests.files=$$QT_BUILD_TREE/bin/qtmodule-configtests INSTALLS += configtests #mkspecs -mkspecs.path=$$[QT_INSTALL_DATA]/mkspecs +mkspecs.path = $$[QT_HOST_DATA]/mkspecs mkspecs.files=$$QT_BUILD_TREE/mkspecs/qconfig.pri $$QT_BUILD_TREE/mkspecs/qmodule.pri $$files($$QT_SOURCE_TREE/mkspecs/*) mkspecs.files -= $$QT_SOURCE_TREE/mkspecs/modules unix { diff --git a/src/concurrent/qfutureinterface_p.h b/src/concurrent/qfutureinterface_p.h index 3a73f846ac..b985e31ab6 100644 --- a/src/concurrent/qfutureinterface_p.h +++ b/src/concurrent/qfutureinterface_p.h @@ -80,7 +80,7 @@ public: QFutureCallOutEvent() : QEvent(QEvent::FutureCallOut), callOutType(CallOutType(0)), index1(-1), index2(-1) { } - QFutureCallOutEvent(CallOutType callOutType, int index1 = -1) + explicit QFutureCallOutEvent(CallOutType callOutType, int index1 = -1) : QEvent(QEvent::FutureCallOut), callOutType(callOutType), index1(index1), index2(-1) { } QFutureCallOutEvent(CallOutType callOutType, int index1, int index2) diff --git a/src/corelib/arch/qatomic_gcc.h b/src/corelib/arch/qatomic_gcc.h index 225a7809eb..9edb74fa73 100644 --- a/src/corelib/arch/qatomic_gcc.h +++ b/src/corelib/arch/qatomic_gcc.h @@ -84,7 +84,7 @@ template <typename T> struct QAtomicOps: QGenericAtomicOps<QAtomicOps<T> > typedef T Type; #ifndef __ia64__ - static T loadAcquire(T &_q_value) + static T loadAcquire(const T &_q_value) { T tmp = _q_value; __sync_synchronize(); diff --git a/src/corelib/arch/qatomic_ia64.h b/src/corelib/arch/qatomic_ia64.h index d82ad12223..5108751f2a 100644 --- a/src/corelib/arch/qatomic_ia64.h +++ b/src/corelib/arch/qatomic_ia64.h @@ -143,9 +143,9 @@ template <int size> struct QBasicAtomicOps: QGenericAtomicOps<QBasicAtomicOps<si static void orderedMemoryFence(); template <typename T> static inline - T loadAcquire(T &_q_value) + T loadAcquire(const T &_q_value) { - return *static_cast<volatile T *>(&_q_value); + return *static_cast<const volatile T *>(&_q_value); } template <typename T> static inline diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 4cfdfe5966..f6f0cd8699 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -111,7 +111,7 @@ static bool qisalnum(register char c) static bool nameMatch(const QByteArray &name, const QByteArray &test) { // if they're the same, return a perfect score - if (qstricmp(name, test) == 0) + if (qstricmp(name.constData(), test.constData()) == 0) return true; const char *n = name.constData(); @@ -510,7 +510,7 @@ static QTextCodec * ru_RU_hack(const char * i) { koi8r, latin5, i); } #if !defined(QT_NO_SETLOCALE) - setlocale(LC_CTYPE, origlocale); + setlocale(LC_CTYPE, origlocale.constData()); #endif return ru_RU_codec; @@ -648,7 +648,7 @@ static void setupLocaleMapper() else if (try_locale_list(pt_154locales, lang)) localeMapper = QTextCodec::codecForName("PT 154"); else if (try_locale_list(probably_koi8_rlocales, lang)) - localeMapper = ru_RU_hack(lang); + localeMapper = ru_RU_hack(lang.constData()); } } diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 5fbc8cdd19..99328d52ac 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -578,16 +578,6 @@ class QDataStream; # else # define Q_SVG_EXPORT Q_DECL_IMPORT # endif -# if defined(QT_BUILD_QTQUICK1_LIB) -# define Q_QTQUICK1_EXPORT Q_DECL_EXPORT -# else -# define Q_QTQUICK1_EXPORT Q_DECL_IMPORT -# endif -# if defined(QT_BUILD_DECLARATIVE_LIB) -# define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT -# else -# define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT -# endif # if defined(QT_BUILD_OPENGL_LIB) # define Q_OPENGL_EXPORT Q_DECL_EXPORT # else @@ -648,8 +638,6 @@ class QDataStream; # define Q_SQL_EXPORT Q_DECL_IMPORT # define Q_NETWORK_EXPORT Q_DECL_IMPORT # define Q_SVG_EXPORT Q_DECL_IMPORT -# define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT -# define Q_QTQUICK1_EXPORT Q_DECL_IMPORT # define Q_CANVAS_EXPORT Q_DECL_IMPORT # define Q_OPENGL_EXPORT Q_DECL_IMPORT # define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT @@ -682,8 +670,6 @@ class QDataStream; # define Q_SQL_EXPORT Q_DECL_EXPORT # define Q_NETWORK_EXPORT Q_DECL_EXPORT # define Q_SVG_EXPORT Q_DECL_EXPORT -# define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT -# define Q_QTQUICK1_EXPORT Q_DECL_EXPORT # define Q_OPENGL_EXPORT Q_DECL_EXPORT # define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT # define Q_OPENVG_EXPORT Q_DECL_EXPORT @@ -702,8 +688,6 @@ class QDataStream; # define Q_SQL_EXPORT # define Q_NETWORK_EXPORT # define Q_SVG_EXPORT -# define Q_DECLARATIVE_EXPORT -# define Q_QTQUICK1_EXPORT # define Q_OPENGL_EXPORT # define Q_MULTIMEDIA_EXPORT # define Q_OPENVG_EXPORT diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index c871675334..4caacece2d 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -46,11 +46,7 @@ #include "qlibraryinfo.h" #include "qscopedpointer.h" -#if defined(QT_BUILD_QMAKE) || defined(QT_BOOTSTRAPPED) -# define BOOTSTRAPPING -#endif - -#ifdef BOOTSTRAPPING +#ifdef QT_BUILD_QMAKE QT_BEGIN_NAMESPACE extern QString qmake_libraryInfoFile(); QT_END_NAMESPACE @@ -97,7 +93,7 @@ public: QLibrarySettings::QLibrarySettings() : settings(QLibraryInfoPrivate::findConfiguration()) { -#ifndef BOOTSTRAPPING +#ifndef QT_BUILD_QMAKE qAddPostRoutine(QLibraryInfoPrivate::cleanup); #endif } @@ -105,7 +101,7 @@ QLibrarySettings::QLibrarySettings() QSettings *QLibraryInfoPrivate::findConfiguration() { QString qtconfig = QLatin1String(":/qt/etc/qt.conf"); -#ifdef BOOTSTRAPPING +#ifdef QT_BUILD_QMAKE if(!QFile::exists(qtconfig)) qtconfig = qmake_libraryInfoFile(); #else @@ -152,6 +148,8 @@ QSettings *QLibraryInfoPrivate::findConfiguration() \sa QSysInfo, {Using qt.conf} */ +#ifndef QT_BUILD_QMAKE + /*! \internal You cannot create a QLibraryInfo, instead only the static functions are available to query @@ -214,135 +212,82 @@ QLibraryInfo::isDebugBuild() return false; } +#endif // QT_BUILD_QMAKE + +static const struct { + char key[14], value[13]; +} qtConfEntries[] = { + { "Prefix", "" }, + { "Documentation", "doc" }, + { "Headers", "include" }, + { "Libraries", "lib" }, + { "Binaries", "bin" }, + { "Plugins", "plugins" }, + { "Imports", "imports" }, + { "Data", "" }, + { "Translations", "translations" }, + { "Examples", "" }, + { "Tests", "tests" }, +#ifdef QT_BUILD_QMAKE + { "Sysroot", "" }, + { "HostPrefix", "" }, + { "HostBinaries", "bin" }, + { "HostData", "" }, +#endif +}; + /*! Returns the location specified by \a loc. */ - QString QLibraryInfo::location(LibraryLocation loc) { +#ifdef QT_BUILD_QMAKE + QString ret = rawLocation(loc); + + // Automatically prepend the sysroot to target paths + if (loc < SysrootPath || loc > LastHostPath) { + QString sysroot = rawLocation(SysrootPath); + if (!sysroot.isEmpty() && ret.length() > 2 && ret.at(1) == QLatin1Char(':') + && (ret.at(2) == QLatin1Char('/') || ret.at(2) == QLatin1Char('\\'))) + ret.replace(0, 2, sysroot); // Strip out the drive on Windows targets + else + ret.prepend(sysroot); + } + + return ret; +} + +QString +QLibraryInfo::rawLocation(LibraryLocation loc) +{ +#else +# define rawLocation location +#endif QString ret; if(!QLibraryInfoPrivate::configuration()) { const char *path = 0; - switch (loc) { -#ifdef QT_CONFIGURE_PREFIX_PATH - case PrefixPath: - path = QT_CONFIGURE_PREFIX_PATH; - break; -#endif -#ifdef QT_CONFIGURE_DOCUMENTATION_PATH - case DocumentationPath: - path = QT_CONFIGURE_DOCUMENTATION_PATH; - break; -#endif -#ifdef QT_CONFIGURE_HEADERS_PATH - case HeadersPath: - path = QT_CONFIGURE_HEADERS_PATH; - break; -#endif -#ifdef QT_CONFIGURE_LIBRARIES_PATH - case LibrariesPath: - path = QT_CONFIGURE_LIBRARIES_PATH; - break; -#endif -#ifdef QT_CONFIGURE_BINARIES_PATH - case BinariesPath: - path = QT_CONFIGURE_BINARIES_PATH; - break; -#endif -#ifdef QT_CONFIGURE_PLUGINS_PATH - case PluginsPath: - path = QT_CONFIGURE_PLUGINS_PATH; - break; -#endif -#ifdef QT_CONFIGURE_IMPORTS_PATH - case ImportsPath: - path = QT_CONFIGURE_IMPORTS_PATH; - break; -#endif -#ifdef QT_CONFIGURE_DATA_PATH - case DataPath: - path = QT_CONFIGURE_DATA_PATH; - break; -#endif -#ifdef QT_CONFIGURE_TRANSLATIONS_PATH - case TranslationsPath: - path = QT_CONFIGURE_TRANSLATIONS_PATH; - break; -#endif -#ifdef QT_CONFIGURE_SETTINGS_PATH - case SettingsPath: + if (loc >= 0 && loc < sizeof(qt_configure_prefix_path_strs)/sizeof(qt_configure_prefix_path_strs[0])) + path = qt_configure_prefix_path_strs[loc] + 12; +#ifndef Q_OS_WIN // On Windows we use the registry + else if (loc == SettingsPath) path = QT_CONFIGURE_SETTINGS_PATH; - break; #endif -#ifdef QT_CONFIGURE_EXAMPLES_PATH - case ExamplesPath: - path = QT_CONFIGURE_EXAMPLES_PATH; - break; -#endif -#ifdef QT_CONFIGURE_TESTS_PATH - case TestsPath: - path = QT_CONFIGURE_TESTS_PATH; - break; -#endif - default: - break; - } if (path) ret = QString::fromLocal8Bit(path); } else { QString key; QString defaultValue; - switch(loc) { - case PrefixPath: - key = QLatin1String("Prefix"); - break; - case DocumentationPath: - key = QLatin1String("Documentation"); - defaultValue = QLatin1String("doc"); - break; - case HeadersPath: - key = QLatin1String("Headers"); - defaultValue = QLatin1String("include"); - break; - case LibrariesPath: - key = QLatin1String("Libraries"); - defaultValue = QLatin1String("lib"); - break; - case BinariesPath: - key = QLatin1String("Binaries"); - defaultValue = QLatin1String("bin"); - break; - case PluginsPath: - key = QLatin1String("Plugins"); - defaultValue = QLatin1String("plugins"); - break; - case ImportsPath: - key = QLatin1String("Imports"); - defaultValue = QLatin1String("imports"); - break; - case DataPath: - key = QLatin1String("Data"); - break; - case TranslationsPath: - key = QLatin1String("Translations"); - defaultValue = QLatin1String("translations"); - break; - case SettingsPath: - key = QLatin1String("Settings"); - break; - case ExamplesPath: - key = QLatin1String("Examples"); - break; - case TestsPath: - key = QLatin1String("Tests"); - defaultValue = QLatin1String("tests"); - break; - default: - break; + if (loc >= 0 && loc < sizeof(qtConfEntries)/sizeof(qtConfEntries[0])) { + key = QLatin1String(qtConfEntries[loc].key); + defaultValue = QLatin1String(qtConfEntries[loc].value); } +#ifndef Q_OS_WIN // On Windows we use the registry + else if (loc == SettingsPath) + key = QLatin1String("Settings"); +#endif if(!key.isNull()) { QSettings *config = QLibraryInfoPrivate::configuration(); @@ -366,11 +311,19 @@ QLibraryInfo::location(LibraryLocation loc) if (QDir::isRelativePath(ret)) { QString baseDir; - if (loc == PrefixPath) { - // we make the prefix path absolute to the executable's directory -#ifdef BOOTSTRAPPING +#ifdef QT_BUILD_QMAKE + if (loc == HostPrefixPath || loc == PrefixPath) { + // We make the prefix path absolute to the executable's directory. + // loc == PrefixPath while a sysroot is set would make no sense here. baseDir = QFileInfo(qmake_libraryInfoFile()).absolutePath(); + } else if (loc == SysrootPath) { + // The sysroot is bare + return ret; + } else if (loc > SysrootPath && loc <= LastHostPath) { + // We make any other host path absolute to the host prefix directory. + baseDir = rawLocation(HostPrefixPath); #else + if (loc == PrefixPath) { if (QCoreApplication::instance()) { #ifdef Q_OS_MAC CFBundleRef bundleRef = CFBundleGetMainBundle(); @@ -382,6 +335,7 @@ QLibraryInfo::location(LibraryLocation loc) } } #endif + // We make the prefix path absolute to the executable's directory. baseDir = QCoreApplication::applicationDirPath(); } else { baseDir = QDir::currentPath(); @@ -389,7 +343,7 @@ QLibraryInfo::location(LibraryLocation loc) #endif } else { // we make any other path absolute to the prefix directory - baseDir = location(PrefixPath); + baseDir = rawLocation(PrefixPath); } ret = QDir::cleanPath(baseDir + QLatin1Char('/') + ret); } @@ -413,9 +367,9 @@ QLibraryInfo::location(LibraryLocation loc) \value ImportsPath The location of installed QML extensions to import. \value DataPath The location of general Qt data. \value TranslationsPath The location of translation information for Qt strings. - \value SettingsPath The location for Qt settings. \value ExamplesPath The location for examples upon install. \value TestsPath The location of installed Qt testcases. + \value SettingsPath The location for Qt settings. Not applicable on Windows. \sa location() */ @@ -443,9 +397,9 @@ void qt_core_boilerplate() "Library path: %s\n" "Include path: %s\n", qt_configure_installation + 12, - qt_configure_prefix_path_str + 12, - qt_configure_libraries_path_str + 12, - qt_configure_headers_path_str + 12); + qt_configure_prefix_path_strs[QT_PREPEND_NAMESPACE(QLibraryInfo)::PrefixPath] + 12, + qt_configure_prefix_path_strs[QT_PREPEND_NAMESPACE(QLibraryInfo)::LibrariesPath] + 12, + qt_configure_prefix_path_strs[QT_PREPEND_NAMESPACE(QLibraryInfo)::HeadersPath] + 12); QT_PREPEND_NAMESPACE(qDumpCPUFeatures)(); diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 66f3d40792..d180e63198 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -66,20 +66,32 @@ public: enum LibraryLocation { - PrefixPath, + PrefixPath = 0, DocumentationPath, HeadersPath, LibrariesPath, BinariesPath, PluginsPath, + ImportsPath, DataPath, TranslationsPath, - SettingsPath, ExamplesPath, - ImportsPath, - TestsPath + TestsPath, + // Insert new values above this line +#ifdef QT_BUILD_QMAKE + // These are not subject to binary compatibility constraints + SysrootPath, + HostPrefixPath, + HostBinariesPath, + HostDataPath, + LastHostPath = HostDataPath, +#endif + SettingsPath = 100 }; static QString location(LibraryLocation); // ### Qt 5: consider renaming it to path() +#ifdef QT_BUILD_QMAKE + static QString rawLocation(LibraryLocation); +#endif private: QLibraryInfo(); diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index 6297b35b9c..1c08bbe1cf 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -49,15 +49,12 @@ QT_BEGIN_NAMESPACE /* QTypeInfo - type trait functionality - qIsDetached - data sharing functionality */ /* The catch-all template. */ -template <typename T> inline bool qIsDetached(T &) { return true; } - template <typename T> class QTypeInfo { @@ -161,6 +158,10 @@ public: \ template<> \ Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS) +/* Specialize QTypeInfo for QFlags<T> */ +template<typename T> class QFlags; +template<typename T> +Q_DECLARE_TYPEINFO_BODY(QFlags<T>, Q_PRIMITIVE_TYPE); /* Specialize a shared type with: @@ -184,7 +185,6 @@ QT_BEGIN_NAMESPACE #endif #define Q_DECLARE_SHARED(TYPE) \ -template <> inline bool qIsDetached<TYPE>(TYPE &t) { return t.isDetached(); } \ template <> inline void qSwap<TYPE>(TYPE &value1, TYPE &value2) \ { qSwap(value1.data_ptr(), value2.data_ptr()); } \ Q_DECLARE_SHARED_STL(TYPE) diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 5e466e480d..e8ff6107ce 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -476,12 +476,12 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea slash = dirName.length(); } if (slash) { - QByteArray chunk = QFile::encodeName(dirName.left(slash)); + const QByteArray chunk = QFile::encodeName(dirName.left(slash)); QT_STATBUF st; - if (QT_STAT(chunk, &st) != -1) { + if (QT_STAT(chunk.constData(), &st) != -1) { if ((st.st_mode & S_IFMT) != S_IFDIR) return false; - } else if (QT_MKDIR(chunk, 0777) != 0) { + } else if (QT_MKDIR(chunk.constData(), 0777) != 0) { return false; } } @@ -492,7 +492,7 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea if (dirName.endsWith(QLatin1Char('/'))) dirName.chop(1); #endif - return (QT_MKDIR(QFile::encodeName(dirName), 0777) == 0); + return (QT_MKDIR(QFile::encodeName(dirName).constData(), 0777) == 0); } //static @@ -501,12 +501,12 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo if (removeEmptyParents) { QString dirName = QDir::cleanPath(entry.filePath()); for (int oldslash = 0, slash=dirName.length(); slash > 0; oldslash = slash) { - QByteArray chunk = QFile::encodeName(dirName.left(slash)); + const QByteArray chunk = QFile::encodeName(dirName.left(slash)); QT_STATBUF st; - if (QT_STAT(chunk, &st) != -1) { + if (QT_STAT(chunk.constData(), &st) != -1) { if ((st.st_mode & S_IFMT) != S_IFDIR) return false; - if (::rmdir(chunk) != 0) + if (::rmdir(chunk.constData()) != 0) return oldslash != 0; } else { return false; @@ -515,7 +515,7 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo } return true; } - return rmdir(QFile::encodeName(entry.filePath())) == 0; + return rmdir(QFile::encodeName(entry.filePath()).constData()) == 0; } //static @@ -623,7 +623,7 @@ QString QFileSystemEngine::tempPath() bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &path) { int r; - r = QT_CHDIR(path.nativeFilePath()); + r = QT_CHDIR(path.nativeFilePath().constData()); return r >= 0; } diff --git a/src/corelib/io/qfilesystemwatcher_polling_p.h b/src/corelib/io/qfilesystemwatcher_polling_p.h index 14f6345412..e50082c6d3 100644 --- a/src/corelib/io/qfilesystemwatcher_polling_p.h +++ b/src/corelib/io/qfilesystemwatcher_polling_p.h @@ -58,6 +58,7 @@ #include <QtCore/qdatetime.h> #include <QtCore/qdir.h> #include <QtCore/qtimer.h> +#include <QtCore/qhash.h> #include "qfilesystemwatcher_p.h" diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index e4d90e000a..1ec0390235 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -1752,10 +1752,10 @@ bool QConfFileSettingsPrivate::readIniFile(const QByteArray &data, iniSection = iniSection.trimmed(); - if (qstricmp(iniSection, "general") == 0) { + if (qstricmp(iniSection.constData(), "general") == 0) { currentSection.clear(); } else { - if (qstricmp(iniSection, "%general") == 0) { + if (qstricmp(iniSection.constData(), "%general") == 0) { currentSection = QLatin1String(iniSection.constData() + 1); } else { currentSection.clear(); @@ -1912,7 +1912,7 @@ bool QConfFileSettingsPrivate::writeIniFile(QIODevice &device, const ParsedSetti if (realSection.isEmpty()) { realSection = "[General]"; - } else if (qstricmp(realSection, "general") == 0) { + } else if (qstricmp(realSection.constData(), "general") == 0) { realSection = "[%General]"; } else { realSection.prepend('['); diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index 62c846738e..5499751751 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -42,6 +42,7 @@ #include "qstandardpaths.h" #include <qdir.h> #include <qfile.h> +#include <qhash.h> #include <qtextstream.h> #include <qcoreapplication.h> #include <private/qfilesystemengine_p.h> diff --git a/src/corelib/json/qjsonarray.cpp b/src/corelib/json/qjsonarray.cpp index cdf9192b27..433a68105d 100644 --- a/src/corelib/json/qjsonarray.cpp +++ b/src/corelib/json/qjsonarray.cpp @@ -44,6 +44,7 @@ #include <qjsonarray.h> #include <qjsonvalue.h> #include <qstringlist.h> +#include <qvariant.h> #include <qdebug.h> #include "qjsonwriter_p.h" diff --git a/src/corelib/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp index 8a7fa760ae..c2204bf696 100644 --- a/src/corelib/json/qjsondocument.cpp +++ b/src/corelib/json/qjsondocument.cpp @@ -44,6 +44,7 @@ #include <qjsonvalue.h> #include <qjsonarray.h> #include <qstringlist.h> +#include <qvariant.h> #include <qdebug.h> #include "qjsonwriter_p.h" #include "qjsonparser_p.h" diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp index a854f73c7e..cfe71e8959 100644 --- a/src/corelib/json/qjsonobject.cpp +++ b/src/corelib/json/qjsonobject.cpp @@ -44,6 +44,7 @@ #include <qjsonarray.h> #include <qstringlist.h> #include <qdebug.h> +#include <qvariant.h> #include "qjson_p.h" #include "qjsonwriter_p.h" diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index 1f36f9c9c8..cac89f2b13 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -288,7 +288,7 @@ public: MaxUser = 65535 // last user event id }; - QEvent(Type type); + explicit QEvent(Type type); virtual ~QEvent(); inline Type type() const { return static_cast<Type>(t); } inline bool spontaneous() const { return spont; } @@ -330,7 +330,7 @@ private: class Q_CORE_EXPORT QTimerEvent : public QEvent { public: - QTimerEvent( int timerId ); + explicit QTimerEvent( int timerId ); ~QTimerEvent(); int timerId() const { return id; } protected: @@ -355,7 +355,7 @@ protected: class Q_CORE_EXPORT QDynamicPropertyChangeEvent : public QEvent { public: - QDynamicPropertyChangeEvent(const QByteArray &name); + explicit QDynamicPropertyChangeEvent(const QByteArray &name); ~QDynamicPropertyChangeEvent(); inline QByteArray propertyName() const { return n; } diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index c404967e6a..565f1ef4b3 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -55,6 +55,7 @@ #include "QtCore/qabstracteventdispatcher.h" #include "QtCore/qt_windows.h" +#include "QtCore/qhash.h" #include "qabstracteventdispatcher_p.h" @@ -130,7 +131,7 @@ struct WinTimerInfo { // internal timer info class QZeroTimerEvent : public QTimerEvent { public: - inline QZeroTimerEvent(int timerId) + explicit inline QZeroTimerEvent(int timerId) : QTimerEvent(timerId) { t = QEvent::ZeroTimerEvent; } }; diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index beb7294abd..f969875455 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -565,6 +565,7 @@ template <class T> class QSet; template <class T> class QSharedPointer; template <class T1, class T2> class QMap; template <class T1, class T2> class QHash; +template <class T1, class T2> struct QPair; typedef QList<QVariant> QVariantList; typedef QMap<QString, QVariant> QVariantMap; typedef QHash<QString, QVariant> QVariantHash; @@ -586,6 +587,23 @@ struct QMetaTypeId< SINGLE_ARG_TEMPLATE<T> > \ } \ }; +#define Q_DECLARE_METATYPE_TEMPLATE_2ARG(DOUBLE_ARG_TEMPLATE) \ +template<typename T, typename U> \ +struct QMetaTypeId< DOUBLE_ARG_TEMPLATE<T, U> > \ +{ \ + enum { \ + Defined = QMetaTypeId2<T>::Defined && QMetaTypeId2<U>::Defined \ + }; \ + static int qt_metatype_id() \ + { \ + static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \ + if (!metatype_id.load()) \ + metatype_id.storeRelease(qRegisterMetaType< DOUBLE_ARG_TEMPLATE<T, U> >( QByteArray(QByteArray(#DOUBLE_ARG_TEMPLATE "<") + QMetaType::typeName(qMetaTypeId<T>()) + ", " + QMetaType::typeName(qMetaTypeId<U>()) + ">").constData(), \ + reinterpret_cast< DOUBLE_ARG_TEMPLATE<T, U> *>(quintptr(-1)))); \ + return metatype_id.loadAcquire(); \ + } \ +}; + Q_DECLARE_METATYPE_TEMPLATE_1ARG(QList) Q_DECLARE_METATYPE_TEMPLATE_1ARG(QVector) Q_DECLARE_METATYPE_TEMPLATE_1ARG(QQueue) @@ -594,6 +612,10 @@ Q_DECLARE_METATYPE_TEMPLATE_1ARG(QSet) Q_DECLARE_METATYPE_TEMPLATE_1ARG(QSharedPointer) Q_DECLARE_METATYPE_TEMPLATE_1ARG(QLinkedList) +Q_DECLARE_METATYPE_TEMPLATE_2ARG(QHash) +Q_DECLARE_METATYPE_TEMPLATE_2ARG(QMap) +Q_DECLARE_METATYPE_TEMPLATE_2ARG(QPair) + inline QMetaType::QMetaType(const ExtensionFlag extensionFlags, const QMetaTypeInterface *info, Creator creator, Deleter deleter, diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 530ddb3f13..19440e9368 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -69,6 +69,16 @@ QT_BEGIN_NAMESPACE +struct QObjectPrivate::ExtraData +{ + ExtraData() {} +#ifndef QT_NO_USERDATA + QVector<QObjectUserData *> userData; +#endif + QList<QByteArray> propertyNames; + QList<QVariant> propertyValues; +}; + static int DIRECT_CONNECTION_ONLY = 0; static int *queuedConnectionTypes(const QList<QByteArray> &typeNames) diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index 710aa630d9..c8edadce9d 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -60,7 +60,6 @@ #include "QtCore/qlist.h" #include "QtCore/qvector.h" #include "QtCore/qreadwritelock.h" -#include "QtCore/qvariant.h" QT_BEGIN_NAMESPACE @@ -98,16 +97,8 @@ class Q_CORE_EXPORT QObjectPrivate : public QObjectData { Q_DECLARE_PUBLIC(QObject) + struct ExtraData; public: - struct ExtraData - { - ExtraData() {} -#ifndef QT_NO_USERDATA - QVector<QObjectUserData *> userData; -#endif - QList<QByteArray> propertyNames; - QList<QVariant> propertyValues; - }; typedef void (*StaticMetaCallFunction)(QObject *, QMetaObject::Call, int, void **); struct Connection diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 15daf223b9..4b3829b53e 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -210,16 +210,16 @@ Q_CORE_EXPORT const char *qFlagLocation(const char *method); #ifndef QT_NO_DEBUG # define QLOCATION "\0" __FILE__ ":" QTOSTRING(__LINE__) # ifndef QT_NO_KEYWORDS -# define METHOD(a) qFlagLocation("0"#a QLOCATION) +# define METHOD(a) qFlagLocation("0" QTOSTRING(a) QLOCATION) # endif -# define SLOT(a) qFlagLocation("1"#a QLOCATION) -# define SIGNAL(a) qFlagLocation("2"#a QLOCATION) +# define SLOT(a) qFlagLocation("1" QTOSTRING(a) QLOCATION) +# define SIGNAL(a) qFlagLocation("2" QTOSTRING(a) QLOCATION) #else # ifndef QT_NO_KEYWORDS -# define METHOD(a) "0"#a +# define METHOD(a) "0" QTOSTRING(a) # endif -# define SLOT(a) "1"#a -# define SIGNAL(a) "2"#a +# define SLOT(a) "1" QTOSTRING(a) +# define SIGNAL(a) "2" QTOSTRING(a) #endif #define QMETHOD_CODE 0 // member type codes diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 4f3e4f8b4e..029a261faf 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1696,7 +1696,7 @@ void QVariant::load(QDataStream &s) if (typeId == QVariant::UserType) { QByteArray name; s >> name; - typeId = QMetaType::type(name); + typeId = QMetaType::type(name.constData()); if (!typeId) { s.setStatus(QDataStream::ReadCorruptData); return; diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index 96338c62dc..01a69dbd8b 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -136,7 +136,7 @@ public: // Atomic API, implemented in qatomic_XXX.h - T loadAcquire() { return Ops::loadAcquire(_q_value); } + T loadAcquire() const { return Ops::loadAcquire(_q_value); } void storeRelease(T newValue) { Ops::storeRelease(_q_value, newValue); } static bool isReferenceCountingNative() { return Ops::isReferenceCountingNative(); } @@ -206,7 +206,7 @@ public: void store(Type newValue) { _q_value = newValue; } // Atomic API, implemented in qatomic_XXX.h - Type loadAcquire() { return Ops::loadAcquire(_q_value); } + Type loadAcquire() const { return Ops::loadAcquire(_q_value); } void storeRelease(Type newValue) { Ops::storeRelease(_q_value, newValue); } static bool isTestAndSetNative() { return Ops::isTestAndSetNative(); } diff --git a/src/corelib/thread/qgenericatomic.h b/src/corelib/thread/qgenericatomic.h index f4d5e2f8d9..34c040c39b 100644 --- a/src/corelib/thread/qgenericatomic.h +++ b/src/corelib/thread/qgenericatomic.h @@ -85,7 +85,7 @@ template <typename BaseClass> struct QGenericAtomicOps static void orderedMemoryFence() { } template <typename T> static inline always_inline - T load(T &_q_value) + T load(const T &_q_value) { return _q_value; } @@ -97,9 +97,9 @@ template <typename BaseClass> struct QGenericAtomicOps } template <typename T> static inline always_inline - T loadAcquire(T &_q_value) + T loadAcquire(const T &_q_value) { - T tmp = *static_cast<volatile T *>(&_q_value); + T tmp = *static_cast<const volatile T *>(&_q_value); BaseClass::acquireMemoryFence(); return tmp; } diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 445fe5cd81..b6719c9536 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -343,7 +343,7 @@ int qstrcmp(const QByteArray &str1, const QByteArray &str2) { int l1 = str1.length(); int l2 = str2.length(); - int ret = memcmp(str1, str2, qMin(l1, l2)); + int ret = memcmp(str1.constData(), str2.constData(), qMin(l1, l2)); if (ret != 0) return ret; @@ -995,6 +995,8 @@ QByteArray &QByteArray::operator=(const char *str) /*! \fn QByteArray::operator const char *() const \fn QByteArray::operator const void *() const + \obsolete Use constData() instead. + Returns a pointer to the data stored in the byte array. The pointer can be used to access the bytes that compose the array. The data is '\\0'-terminated. The pointer remains valid as long @@ -2751,7 +2753,7 @@ QDataStream &operator<<(QDataStream &out, const QByteArray &ba) out << (quint32)0xffffffff; return out; } - return out.writeBytes(ba, ba.size()); + return out.writeBytes(ba.constData(), ba.size()); } /*! \relates QByteArray diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index 8202097da5..09c43988fd 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -207,8 +207,10 @@ public: void squeeze(); #ifndef QT_NO_CAST_FROM_BYTEARRAY - operator const char *() const; - operator const void *() const; +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED operator const char *() const { return constData(); } + QT_DEPRECATED operator const void *() const { return constData(); } +#endif #endif char *data(); const char *data() const; @@ -415,12 +417,6 @@ inline char QByteArray::operator[](uint i) const inline bool QByteArray::isEmpty() const { return d->size == 0; } -#ifndef QT_NO_CAST_FROM_BYTEARRAY -inline QByteArray::operator const char *() const -{ return d->data(); } -inline QByteArray::operator const void *() const -{ return d->data(); } -#endif inline char *QByteArray::data() { detach(); return d->data(); } inline const char *QByteArray::data() const diff --git a/src/corelib/tools/qcryptographichash.h b/src/corelib/tools/qcryptographichash.h index 2bfc03373a..6ebe389faf 100644 --- a/src/corelib/tools/qcryptographichash.h +++ b/src/corelib/tools/qcryptographichash.h @@ -65,7 +65,7 @@ public: Sha512 }; - QCryptographicHash(Algorithm method); + explicit QCryptographicHash(Algorithm method); ~QCryptographicHash(); void reset(); diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index c029f627b2..2ecd934100 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -42,7 +42,6 @@ #ifndef QLOCALE_H #define QLOCALE_H -#include <QtCore/qvariant.h> #include <QtCore/qstring.h> #include <QtCore/qobjectdefs.h> diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index c6902ca206..ad7c9706c4 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -55,7 +55,7 @@ #include "QtCore/qstring.h" #include "QtCore/qvarlengtharray.h" -#include "QtCore/qmetatype.h" +#include "QtCore/qvariant.h" #include "qlocale.h" diff --git a/src/corelib/tools/qlocale_unix.cpp b/src/corelib/tools/qlocale_unix.cpp index 6ace96f771..f2876912b4 100644 --- a/src/corelib/tools/qlocale_unix.cpp +++ b/src/corelib/tools/qlocale_unix.cpp @@ -98,7 +98,7 @@ QLocale QSystemLocale::fallbackLocale() const lang = qgetenv("LC_NUMERIC"); if (lang.isEmpty()) lang = qgetenv("LANG"); - return QLocale(QLatin1String(lang)); + return QLocale(QString::fromLatin1(lang)); } QVariant QSystemLocale::query(QueryType type, QVariant in) const diff --git a/src/corelib/tools/qpair.h b/src/corelib/tools/qpair.h index 5df33a4e9d..4dc28f2d26 100644 --- a/src/corelib/tools/qpair.h +++ b/src/corelib/tools/qpair.h @@ -63,6 +63,22 @@ struct QPair T2 second; }; +// mark QPair<T1,T2> as complex/movable/primitive depending on the +// typeinfos of the constituents: +template<class T1, class T2> +class QTypeInfo< QPair<T1, T2> > +{ +public: + enum { + isComplex = QTypeInfo<T1>::isComplex || QTypeInfo<T2>::isComplex, + isStatic = QTypeInfo<T1>::isStatic || QTypeInfo<T2>::isStatic, + isLarge = sizeof(QPair<T1, T2>) > sizeof(void*), + isPointer = false, + isDummy = false, + sizeOf = sizeof(QPair<T1, T2>) + }; +}; + template <class T1, class T2> Q_INLINE_TEMPLATE bool operator==(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2) { return p1.first == p2.first && p1.second == p2.second; } diff --git a/src/corelib/tools/qscopedvaluerollback.h b/src/corelib/tools/qscopedvaluerollback.h index 23d2d9eda0..d53cabd315 100644 --- a/src/corelib/tools/qscopedvaluerollback.h +++ b/src/corelib/tools/qscopedvaluerollback.h @@ -51,7 +51,7 @@ template <typename T> class QScopedValueRollback { public: - QScopedValueRollback(T &var) : + explicit QScopedValueRollback(T &var) : varRef(var) { oldValue = varRef; diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 45ccfb8aea..083abcbaad 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -2132,7 +2132,8 @@ QString &QString::replace(QChar c, const QLatin1String &after, Qt::CaseSensitivi /*! - Returns true if string \a other is equal to this string; otherwise + \relates QString + Returns true if string \a s1 is equal to string \a s2; otherwise returns false. The comparison is based exclusively on the numeric Unicode values of @@ -2140,12 +2141,12 @@ QString &QString::replace(QChar c, const QLatin1String &after, Qt::CaseSensitivi expect. Consider sorting user-interface strings with localeAwareCompare(). */ -bool QString::operator==(const QString &other) const +bool operator==(const QString &s1, const QString &s2) { - if (d->size != other.d->size) + if (s1.d->size != s2.d->size) return false; - return qMemEquals(d->data(), other.d->data(), d->size); + return qMemEquals(s1.d->data(), s2.d->data(), s1.d->size); } /*! @@ -2200,17 +2201,18 @@ bool QString::operator==(const QLatin1String &other) const */ /*! - Returns true if this string is lexically less than string \a - other; otherwise returns false. + \relates QString + Returns true if string \a s1 is lexically less than string + \a s2; otherwise returns false. The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-interface strings using the QString::localeAwareCompare() function. */ -bool QString::operator<(const QString &other) const +bool operator<(const QString &s1, const QString &s2) { - return ucstrcmp(constData(), length(), other.constData(), other.length()) < 0; + return ucstrcmp(s1.constData(), s1.length(), s2.constData(), s2.length()) < 0; } /*! @@ -2261,10 +2263,11 @@ bool QString::operator<(const QLatin1String &other) const go through QObject::tr(), for example. */ -/*! \fn bool QString::operator<=(const QString &other) const +/*! \fn bool operator<=(const QString &s1, const QString &s2) + \relates QString - Returns true if this string is lexically less than or equal to - string \a other; otherwise returns false. + Returns true if string \a s1 is lexically less than or equal to + string \a s2; otherwise returns false. The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would @@ -2304,10 +2307,11 @@ bool QString::operator<(const QLatin1String &other) const go through QObject::tr(), for example. */ -/*! \fn bool QString::operator>(const QString &other) const +/*! \fn bool operator>(const QString &s1, const QString &s2) + \relates QString - Returns true if this string is lexically greater than string \a - other; otherwise returns false. + Returns true if string \a s1 is lexically greater than string \a + s2; otherwise returns false. The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would @@ -2363,10 +2367,11 @@ bool QString::operator>(const QLatin1String &other) const for example. */ -/*! \fn bool QString::operator>=(const QString &other) const +/*! \fn bool operator>=(const QString &s1, const QString &s2) + \relates QString - Returns true if this string is lexically greater than or equal to - string \a other; otherwise returns false. + Returns true if string \a s1 is lexically greater than or equal to + string \a s2; otherwise returns false. The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would @@ -2406,9 +2411,10 @@ bool QString::operator>(const QLatin1String &other) const for example. */ -/*! \fn bool QString::operator!=(const QString &other) const +/*! \fn bool operator!=(const QString &s1, const QString &s2) + \relates QString - Returns true if this string is not equal to string \a other; + Returns true if string \a s1 is not equal to string \a s2; otherwise returns false. The comparison is based exclusively on the numeric Unicode values @@ -4727,7 +4733,7 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1, } // else fall through # endif // declared in <string.h> - int delta = strcoll(toLocal8Bit_helper(data1, length1), toLocal8Bit_helper(data2, length2)); + int delta = strcoll(toLocal8Bit_helper(data1, length1).constData(), toLocal8Bit_helper(data2, length2).constData()); if (delta == 0) delta = ucstrcmp(data1, length1, data2, length2); return delta; diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index b1ade85a30..6fc86fc04b 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -417,6 +417,10 @@ public: { return fromLocal8Bit_helper(str, (str && size == -1) ? int(strlen(str)) : size); } + static inline QString fromAscii(const QByteArray &str) { return fromAscii(str.data(), str.size()); } + static inline QString fromLatin1(const QByteArray &str) { return fromLatin1(str.data(), str.size()); } + static inline QString fromUtf8(const QByteArray &str) { return fromUtf8(str.data(), str.size()); } + static inline QString fromLocal8Bit(const QByteArray &str) { return fromLocal8Bit(str.data(), str.size()); } static QString fromUtf16(const ushort *, int size = -1); static QString fromUcs4(const uint *, int size = -1); static QString fromRawData(const QChar *, int size); @@ -482,12 +486,12 @@ public: static QString number(qulonglong, int base=10); static QString number(double, char f='g', int prec=6); - bool operator==(const QString &s) const; - bool operator<(const QString &s) const; - inline bool operator>(const QString &s) const { return s < *this; } - inline bool operator!=(const QString &s) const { return !operator==(s); } - inline bool operator<=(const QString &s) const { return !operator>(s); } - inline bool operator>=(const QString &s) const { return !operator<(s); } + friend Q_CORE_EXPORT bool operator==(const QString &s1, const QString &s2); + friend Q_CORE_EXPORT bool operator<(const QString &s1, const QString &s2); + friend inline bool operator>(const QString &s1, const QString &s2) { return s2 < s1; } + friend inline bool operator!=(const QString &s1, const QString &s2) { return !(s1 == s2); } + friend inline bool operator<=(const QString &s1, const QString &s2) { return !(s1 > s2); } + friend inline bool operator>=(const QString &s1, const QString &s2) { return !(s1 < s2); } bool operator==(const QLatin1String &s) const; bool operator<(const QLatin1String &s) const; diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 4c963185ad..e34425be7e 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -45,12 +45,6 @@ #include <QtCore/qstring.h> #include <QtCore/qbytearray.h> -#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) -# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 0) -# include <QtCore/qmap.h> -# endif -#endif - #include <string.h> QT_BEGIN_HEADER @@ -173,6 +167,16 @@ template <> struct QConcatenable<QChar> : private QAbstractConcatenable { *out++ = c; } }; +template <> struct QConcatenable<QChar::SpecialCharacter> : private QAbstractConcatenable +{ + typedef QChar::SpecialCharacter type; + typedef QString ConvertTo; + enum { ExactSize = true }; + static int size(const QChar::SpecialCharacter) { return 1; } + static inline void appendTo(const QChar::SpecialCharacter c, QChar *&out) + { *out++ = c; } +}; + template <> struct QConcatenable<QCharRef> : private QAbstractConcatenable { typedef QCharRef type; diff --git a/src/corelib/tools/qstringmatcher.h b/src/corelib/tools/qstringmatcher.h index a9b2a7c371..3f614f732c 100644 --- a/src/corelib/tools/qstringmatcher.h +++ b/src/corelib/tools/qstringmatcher.h @@ -55,7 +55,7 @@ class Q_CORE_EXPORT QStringMatcher { public: QStringMatcher(); - QStringMatcher(const QString &pattern, + explicit QStringMatcher(const QString &pattern, Qt::CaseSensitivity cs = Qt::CaseSensitive); QStringMatcher(const QChar *uc, int len, Qt::CaseSensitivity cs = Qt::CaseSensitive); diff --git a/src/corelib/xml/qxmlstream.h b/src/corelib/xml/qxmlstream.h index 3a9ddfd990..90382c7fe5 100644 --- a/src/corelib/xml/qxmlstream.h +++ b/src/corelib/xml/qxmlstream.h @@ -248,10 +248,10 @@ public: QXmlStreamReader(); - QXmlStreamReader(QIODevice *device); - QXmlStreamReader(const QByteArray &data); - QXmlStreamReader(const QString &data); - QXmlStreamReader(const char * data); + explicit QXmlStreamReader(QIODevice *device); + explicit QXmlStreamReader(const QByteArray &data); + explicit QXmlStreamReader(const QString &data); + explicit QXmlStreamReader(const char * data); ~QXmlStreamReader(); void setDevice(QIODevice *device); @@ -361,9 +361,9 @@ class Q_CORE_EXPORT QXmlStreamWriter QDOC_PROPERTY(int autoFormattingIndent READ autoFormattingIndent WRITE setAutoFormattingIndent) public: QXmlStreamWriter(); - QXmlStreamWriter(QIODevice *device); - QXmlStreamWriter(QByteArray *array); - QXmlStreamWriter(QString *string); + explicit QXmlStreamWriter(QIODevice *device); + explicit QXmlStreamWriter(QByteArray *array); + explicit QXmlStreamWriter(QString *string); ~QXmlStreamWriter(); void setDevice(QIODevice *device); diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 6ce08d93cc..3e53b04728 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -5132,7 +5132,8 @@ bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth #undef IWX_LSB #undef IWX_PIX -/*! \obsolete +/*! \fn int QImage::serialNumber() const + \obsolete Returns a number that identifies the contents of this QImage object. Distinct QImage objects can only have the same serial number if they refer to the same contents (but they don't @@ -5147,14 +5148,6 @@ bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth \sa operator==() */ -int QImage::serialNumber() const -{ - if (!d) - return 0; - else - return d->ser_no; -} - /*! Returns a number that identifies the contents of this QImage object. Distinct QImage objects can only have the same key if they diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 5a3ae8f886..e9192f1031 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -253,7 +253,9 @@ public: inline static QImage fromData(const QByteArray &data, const char *format = 0) { return fromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), format); } - int serialNumber() const; +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; } +#endif qint64 cacheKey() const; QPaintEngine *paintEngine() const; diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 504f583baf..65b9d62dfa 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -885,7 +885,8 @@ void QPixmap::fill(const QColor &color) data->fill(color); } -/*! \obsolete +/*! \fn int QPixmap::serialNumber() const + \obsolete Returns a number that identifies the contents of this QPixmap object. Distinct QPixmap objects can only have the same serial number if they refer to the same contents (but they don't have @@ -898,12 +899,6 @@ void QPixmap::fill(const QColor &color) it as a cache key. For caching pixmaps, we recommend using the QPixmapCache class whenever possible. */ -int QPixmap::serialNumber() const -{ - if (isNull()) - return 0; - return data->serialNumber(); -} /*! Returns a number that identifies this QPixmap. Distinct QPixmap diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 27bfe15688..3d78a43917 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -146,7 +146,7 @@ public: void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = 0); #if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED int serialNumber() const; + QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; } #endif qint64 cacheKey() const; diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 8125b1360d..7c7c4652e3 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -115,7 +115,7 @@ void QRasterPlatformPixmap::resize(int width, int height) image.setColor(1, QColor(Qt::color1).rgba()); } - setSerialNumber(image.serialNumber()); + setSerialNumber(image.cacheKey() >> 32); } bool QRasterPlatformPixmap::fromData(const uchar *buffer, uint len, const char *format, @@ -349,7 +349,7 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC } is_null = (w <= 0 || h <= 0); - setSerialNumber(image.serialNumber()); + setSerialNumber(image.cacheKey() >> 32); } QImage* QRasterPlatformPixmap::buffer() diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h index 6ca109b03f..426a6d9954 100644 --- a/src/gui/image/qpixmapcache_p.h +++ b/src/gui/image/qpixmapcache_p.h @@ -96,8 +96,6 @@ public: QPixmapCache::Key key; }; -inline bool qIsDetached(QPixmapCacheEntry &t) { return t.isDetached(); } - QT_END_NAMESPACE #endif // QPIXMAPCACHE_P_H diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index ca93095a94..d70f6be201 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -71,7 +71,7 @@ class QScreen; class Q_GUI_EXPORT QInputEvent : public QEvent { public: - QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier); + explicit QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier); ~QInputEvent(); inline Qt::KeyboardModifiers modifiers() const { return modState; } inline void setModifiers(Qt::KeyboardModifiers amodifiers) { modState = amodifiers; } @@ -276,7 +276,7 @@ protected: class Q_GUI_EXPORT QFocusEvent : public QEvent { public: - QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason); + explicit QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason); ~QFocusEvent(); inline bool gotFocus() const { return type() == FocusIn; } @@ -292,8 +292,8 @@ private: class Q_GUI_EXPORT QPaintEvent : public QEvent { public: - QPaintEvent(const QRegion& paintRegion); - QPaintEvent(const QRect &paintRect); + explicit QPaintEvent(const QRegion& paintRegion); + explicit QPaintEvent(const QRect &paintRect); ~QPaintEvent(); inline const QRect &rect() const { return m_rect; } @@ -311,7 +311,7 @@ protected: class Q_GUI_EXPORT QUpdateLaterEvent : public QEvent { public: - QUpdateLaterEvent(const QRegion& paintRegion); + explicit QUpdateLaterEvent(const QRegion& paintRegion); ~QUpdateLaterEvent(); inline const QRegion ®ion() const { return m_region; } @@ -337,7 +337,7 @@ protected: class Q_GUI_EXPORT QExposeEvent : public QEvent { public: - QExposeEvent(const QRegion &rgn); + explicit QExposeEvent(const QRegion &rgn); ~QExposeEvent(); inline const QRegion ®ion() const { return rgn; } @@ -464,11 +464,12 @@ private: int replace_length; QString tentativeCommit; }; +Q_DECLARE_TYPEINFO(QInputMethodEvent::Attribute, Q_MOVABLE_TYPE); class Q_GUI_EXPORT QInputMethodQueryEvent : public QEvent { public: - QInputMethodQueryEvent(Qt::InputMethodQueries queries); + explicit QInputMethodQueryEvent(Qt::InputMethodQueries queries); ~QInputMethodQueryEvent(); Qt::InputMethodQueries queries() const { return m_queries; } @@ -586,7 +587,7 @@ private: class Q_GUI_EXPORT QStatusTipEvent : public QEvent { public: - QStatusTipEvent(const QString &tip); + explicit QStatusTipEvent(const QString &tip); ~QStatusTipEvent(); inline QString tip() const { return s; } @@ -599,7 +600,7 @@ private: class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent { public: - QWhatsThisClickedEvent(const QString &href); + explicit QWhatsThisClickedEvent(const QString &href); ~QWhatsThisClickedEvent(); inline QString href() const { return s; } @@ -624,8 +625,8 @@ public: class Q_GUI_EXPORT QFileOpenEvent : public QEvent { public: - QFileOpenEvent(const QString &file); - QFileOpenEvent(const QUrl &url); + explicit QFileOpenEvent(const QString &file); + explicit QFileOpenEvent(const QUrl &url); ~QFileOpenEvent(); inline QString file() const { return f; } @@ -639,7 +640,7 @@ private: class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent { public: - QToolBarChangeEvent(bool t); + explicit QToolBarChangeEvent(bool t); ~QToolBarChangeEvent(); inline bool toggle() const { return tog; } @@ -669,7 +670,7 @@ protected: class Q_GUI_EXPORT QClipboardEvent : public QEvent { public: - QClipboardEvent(QEventPrivate *data); + explicit QClipboardEvent(QEventPrivate *data); ~QClipboardEvent(); QEventPrivate *data() { return d; } @@ -679,7 +680,7 @@ public: class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent { public: - QWindowStateChangeEvent(Qt::WindowStates aOldState); + explicit QWindowStateChangeEvent(Qt::WindowStates aOldState); QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride); ~QWindowStateChangeEvent(); @@ -711,7 +712,7 @@ public: }; Q_DECLARE_FLAGS(InfoFlags, InfoFlag) - TouchPoint(int id = -1); + explicit TouchPoint(int id = -1); TouchPoint(const QTouchEvent::TouchPoint &other); ~TouchPoint(); @@ -783,11 +784,11 @@ public: }; #endif - QTouchEvent(QEvent::Type eventType, - QTouchDevice *device = 0, - Qt::KeyboardModifiers modifiers = Qt::NoModifier, - Qt::TouchPointStates touchPointStates = 0, - const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>()); + explicit QTouchEvent(QEvent::Type eventType, + QTouchDevice *device = 0, + Qt::KeyboardModifiers modifiers = Qt::NoModifier, + Qt::TouchPointStates touchPointStates = 0, + const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>()); ~QTouchEvent(); inline QWindow *window() const { return _window; } @@ -825,7 +826,7 @@ class QScrollPrepareEventPrivate; class Q_GUI_EXPORT QScrollPrepareEvent : public QEvent { public: - QScrollPrepareEvent(const QPointF &startPos); + explicit QScrollPrepareEvent(const QPointF &startPos); ~QScrollPrepareEvent(); QPointF startPos() const; diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index 3e2c35f088..d5c4d6c762 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -49,9 +49,7 @@ #include <private/qobject_p.h> #include <qmutex.h> -#ifndef QT_NO_DEBUG #include <QtCore/QHash> -#endif QT_BEGIN_HEADER diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index 8ee62ce8d9..9a2eb12e3f 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -844,7 +844,8 @@ bool QPalette::isEqual(QPalette::ColorGroup group1, QPalette::ColorGroup group2) return true; } -/*! \obsolete +/*! \fn int QPalette::serialNumber() const + \obsolete Returns a number that identifies the contents of this QPalette object. Distinct QPalette objects can only have the same serial @@ -860,10 +861,6 @@ bool QPalette::isEqual(QPalette::ColorGroup group1, QPalette::ColorGroup group2) \sa operator==() */ -int QPalette::serialNumber() const -{ - return d->ser_no; -} /*! Returns a number that identifies the contents of this QPalette diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h index cc710fa67a..ca619a89b4 100644 --- a/src/gui/kernel/qpalette.h +++ b/src/gui/kernel/qpalette.h @@ -139,7 +139,9 @@ public: inline bool operator!=(const QPalette &p) const { return !(operator==(p)); } bool isCopyOf(const QPalette &p) const; - int serialNumber() const; +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; } +#endif qint64 cacheKey() const; QPalette resolve(const QPalette &) const; diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index a084a3dd8c..4bceb28ef7 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1148,25 +1148,6 @@ QByteArray QFontEngine::convertToPostscriptFontFamilyName(const QByteArray &fami return f; } -class QRgbGreyPalette: public QVector<QRgb> -{ -public: - QRgbGreyPalette() - { - resize(256); - QRgb *it = data(); - for (int i = 0; i < size(); ++i, ++it) - *it = 0xff000000 | i | (i<<8) | (i<<16); - } -}; - -Q_GLOBAL_STATIC(QVector<QRgb>, qt_grayPalette) - -const QVector<QRgb> &QFontEngine::grayPalette() -{ - return *qt_grayPalette(); -} - QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round) { if (glyphs.numGlyphs >= 1) { diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index fed135ea87..44464ee788 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -279,7 +279,6 @@ public: int m_subPixelPositionCount; // Number of positions within a single pixel for this cache protected: - static const QVector<QRgb> &grayPalette(); QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false); private: diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h index 7ddc8975e4..e48460ffd0 100644 --- a/src/gui/text/qfontmetrics.h +++ b/src/gui/text/qfontmetrics.h @@ -61,7 +61,7 @@ class QRect; class Q_GUI_EXPORT QFontMetrics { public: - QFontMetrics(const QFont &); + explicit QFontMetrics(const QFont &); QFontMetrics(const QFont &, QPaintDevice *pd); QFontMetrics(const QFontMetrics &); ~QFontMetrics(); @@ -127,7 +127,7 @@ private: class Q_GUI_EXPORT QFontMetricsF { public: - QFontMetricsF(const QFont &); + explicit QFontMetricsF(const QFont &); QFontMetricsF(const QFont &, QPaintDevice *pd); QFontMetricsF(const QFontMetrics &); QFontMetricsF(const QFontMetricsF &); diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index 0dd0d99d2a..02fd921fac 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -2325,7 +2325,7 @@ void QTextCursor::insertImage(const QImage &image, const QString &name) } QString imageName = name; if (name.isEmpty()) - imageName = QString::number(image.serialNumber()); + imageName = QString::number(image.cacheKey()); d->priv->document()->addResource(QTextDocument::ImageResource, QUrl(imageName), image); QTextImageFormat format; format.setName(imageName); diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index e4f4020461..c64420b000 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -264,38 +264,20 @@ namespace QTest template <typename T1, typename T2> bool qCompare(T1 const &, T2 const &, const char *, const char *, const char *, int); -#if defined(QT_COORD_TYPE) && (defined(Q_PROCESSOR_ARM) || defined(QT_NO_FPU) || defined(Q_OS_WINCE)) template <> - inline bool qCompare<qreal, float>(qreal const &t1, float const &t2, const char *actual, + inline bool qCompare<double, float>(double const &t1, float const &t2, const char *actual, const char *expected, const char *file, int line) { - return qCompare<qreal>(t1, qreal(t2), actual, expected, file, line); + return qCompare<qreal>(qreal(t1), qreal(t2), actual, expected, file, line); } template <> - inline bool qCompare<float, qreal>(float const &t1, qreal const &t2, const char *actual, + inline bool qCompare<float, double>(float const &t1, double const &t2, const char *actual, const char *expected, const char *file, int line) { - return qCompare<qreal>(qreal(t1), t2, actual, expected, file, line); + return qCompare<qreal>(qreal(t1), qreal(t2), actual, expected, file, line); } -#elif defined(QT_COORD_TYPE) || defined(Q_PROCESSOR_ARM) || defined(QT_NO_FPU) || defined(Q_OS_WINCE) - template <> - inline bool qCompare<qreal, double>(qreal const &t1, double const &t2, const char *actual, - const char *expected, const char *file, int line) - { - return qCompare<float>(float(t1), float(t2), actual, expected, file, line); - } - - template <> - inline bool qCompare<double, qreal>(double const &t1, qreal const &t2, const char *actual, - const char *expected, const char *file, int line) - { - return qCompare<float>(float(t1), float(t2), actual, expected, file, line); - } - -#endif - template <typename T> inline bool qCompare(const T *t1, const T *t2, const char *actual, const char *expected, const char *file, int line) diff --git a/src/testlib/qtestdata.h b/src/testlib/qtestdata.h index 22dae76167..8849b15ddb 100644 --- a/src/testlib/qtestdata.h +++ b/src/testlib/qtestdata.h @@ -89,6 +89,14 @@ inline QTestData &operator<<(QTestData &data, const char * value) return data; } +#ifdef QT_USE_QSTRINGBUILDER +template<typename A, typename B> +inline QTestData &operator<<(QTestData &data, const QStringBuilder<A, B> &value) +{ + return data << typename QConcatenable<QStringBuilder<A, B> >::ConvertTo(value); +} +#endif + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 772df1feec..6f67a7dddf 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -159,7 +159,7 @@ int runMoc(int _argc, char **_argv) bool autoInclude = true; bool defaultInclude = true; Preprocessor pp; - Moc moc; + Moc moc(pp); pp.macros["Q_MOC_RUN"]; pp.macros["__cplusplus"]; QByteArray filename; diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 7b358c1ae8..4189c29de1 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -304,7 +304,9 @@ void Moc::parseFunctionArguments(FunctionDef *def) arg.rightType += lexem(); } arg.normalizedType = normalizeType(QByteArray(arg.type.name + ' ' + arg.rightType)); + arg.normalizedType = getTypeSubstitution(arg.normalizedType); arg.typeNameForCast = normalizeType(QByteArray(noRef(arg.type.name) + "(*)" + arg.rightType)); + arg.typeNameForCast = getTypeSubstitution(arg.typeNameForCast); if (test(EQ)) arg.isDefault = true; def->arguments += arg; @@ -414,6 +416,7 @@ bool Moc::parseFunction(FunctionDef *def, bool inMacro) } def->normalizedType = normalizeType(def->type.name); + def->normalizedType = getTypeSubstitution(def->normalizedType); if (!test(RPAREN)) { parseFunctionArguments(def); @@ -512,6 +515,7 @@ bool Moc::parseMaybeFunction(const ClassDef *cdef, FunctionDef *def) } def->normalizedType = normalizeType(def->type.name); + def->normalizedType = getTypeSubstitution(def->normalizedType); if (!test(RPAREN)) { parseFunctionArguments(def); @@ -968,6 +972,7 @@ void Moc::createPropertyDef(PropertyDef &propDef) QVariant. */ type = normalizeType(type); + type = getTypeSubstitution(type); if (type == "QMap") type = "QMap<QString,QVariant>"; else if (type == "QValueList") @@ -1081,7 +1086,6 @@ void Moc::parseProperty(ClassDef *def) createPropertyDef(propDef); next(RPAREN); - if(!propDef.notify.isEmpty()) def->notifyableProperties++; if (propDef.revision > 0) @@ -1244,7 +1248,8 @@ void Moc::parseInterfaces(ClassDef *def) } // resolve from classnames to interface ids for (int i = 0; i < iface.count(); ++i) { - const QByteArray iid = interface2IdMap.value(iface.at(i).className); + QByteArray className = getTypeSubstitution(iface.at(i).className); + QByteArray iid = interface2IdMap.value(className); if (iid.isEmpty()) error("Undefined interface"); @@ -1502,6 +1507,107 @@ void Moc::checkProperties(ClassDef *cdef) } } +QByteArray Moc::getSubstitution(const QByteArray &token) const +{ + Macros::ConstIterator it = preprocessor.macros.find(token); + if (it != preprocessor.macros.end() && it->symbols.count() == 1) { + // We can only handle substitutions that result in a single symbol + return it->symbols.at(0).lexem(); + } + + return QByteArray(); +} + +QByteArray Moc::getTokenSubstitution(const QByteArray &token) const +{ + QByteArray result = token; + + QSet<QByteArray> used; + + // Process substitution chain until no replacement exists + QByteArray substitution = getSubstitution(result); + while (!substitution.isEmpty()) { + used.insert(result); + result = substitution; + + if (used.contains(result)) { + break; + } + + substitution = getSubstitution(result); + } + + return result; +} + +QByteArray Moc::getWordSubstitution(const QByteArray &word) const +{ + QByteArray result; + + // A word can contain multiple components separated by '*' + int startIndex = 0; + do { + int index = word.indexOf('*', startIndex); + if (index == -1) { + result.append(getTokenSubstitution(word.mid(startIndex))); + } else { + result.append(getTokenSubstitution(word.mid(startIndex, (index - startIndex)))); + result.append('*'); + } + + startIndex = index + 1; + } while (startIndex != 0); + + return result; +} + +QByteArray Moc::getNameSubstitution(const QByteArray &name) const +{ + QByteArray result; + + // Parse multiple tokens in this name independently + int startIndex = 0; + do { + int index = name.indexOf(' ', startIndex); + if (index == -1) { + result.append(getWordSubstitution(name.mid(startIndex))); + } else { + result.append(getWordSubstitution(name.mid(startIndex, (index - startIndex)))); + result.append(' '); + } + + startIndex = index + 1; + } while (startIndex != 0); + + return result; +} + +QByteArray Moc::getTypeSubstitution(const QByteArray &typeName) const +{ + int index = typeName.indexOf('<'); + if (index != -1) { + QByteArray templateName = typeName.left(index); + + int lastIndex = typeName.lastIndexOf('>'); + if (lastIndex > index) { + QByteArray result = getNameSubstitution(templateName); + + // Parse the interior type independently + QByteArray parameter = typeName.mid(index + 1, (lastIndex - index - 1)); + QByteArray interior = getTypeSubstitution(parameter); + if (interior.endsWith('>')) { + interior.append(' '); + } + result.append('<').append(interior).append(typeName.mid(lastIndex)); + return result; + } else { + // Something is broken; return the input unmodified + return typeName; + } + } + + return getNameSubstitution(typeName); +} QT_END_NAMESPACE diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index aedb97b234..9e9225da0a 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -43,6 +43,7 @@ #define MOC_H #include "parser.h" +#include "preprocessor.h" #include <QStringList> #include <QMap> #include <QPair> @@ -197,12 +198,14 @@ struct NamespaceDef { class Moc : public Parser { public: - Moc() - : noInclude(false), generatedCode(false), mustIncludeQMetaTypeH(false), mustIncludeQPluginH(false) + Moc(Preprocessor &p) + : preprocessor(p), noInclude(false), generatedCode(false), + mustIncludeQMetaTypeH(false), mustIncludeQPluginH(false) {} QByteArray filename; + Preprocessor &preprocessor; bool noInclude; bool generatedCode; bool mustIncludeQMetaTypeH; @@ -260,6 +263,12 @@ public: void checkSuperClasses(ClassDef *def); void checkProperties(ClassDef* cdef); + + QByteArray getSubstitution(const QByteArray &token) const; + QByteArray getTokenSubstitution(const QByteArray &token) const; + QByteArray getWordSubstitution(const QByteArray &word) const; + QByteArray getNameSubstitution(const QByteArray &name) const; + QByteArray getTypeSubstitution(const QByteArray &typeName) const; }; inline QByteArray noRef(const QByteArray &type) diff --git a/src/tools/moc/moc.pro b/src/tools/moc/moc.pro index 3ee507855c..5c96c96a4c 100644 --- a/src/tools/moc/moc.pro +++ b/src/tools/moc/moc.pro @@ -13,6 +13,6 @@ HEADERS += qdatetime_p.h SOURCES += main.cpp include(../bootstrap/bootstrap.pri) -target.path=$$[QT_INSTALL_BINS] +target.path = $$[QT_HOST_BINS] INSTALLS += target load(qt_targets) diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index b31c47e7ad..dfe23983b7 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -681,7 +681,7 @@ bool RCCResourceLibrary::output(QIODevice &outDevice, QIODevice &errorDevice) m_errorDevice->write("Could not write footer\n"); return false; } - outDevice.write(m_out, m_out.size()); + outDevice.write(m_out.constData(), m_out.size()); return true; } diff --git a/src/tools/rcc/rcc.pro b/src/tools/rcc/rcc.pro index 6c78642406..e87ef605b9 100644 --- a/src/tools/rcc/rcc.pro +++ b/src/tools/rcc/rcc.pro @@ -11,6 +11,6 @@ HEADERS += ../../corelib/kernel/qcorecmdlineargs_p.h SOURCES += main.cpp include(../bootstrap/bootstrap.pri) -target.path=$$[QT_INSTALL_BINS] +target.path = $$[QT_HOST_BINS] INSTALLS += target load(qt_targets) diff --git a/src/tools/uic/cpp/cppwriteicondata.cpp b/src/tools/uic/cpp/cppwriteicondata.cpp index 39ce52f4b3..082961cfe6 100644 --- a/src/tools/uic/cpp/cppwriteicondata.cpp +++ b/src/tools/uic/cpp/cppwriteicondata.cpp @@ -176,8 +176,8 @@ void WriteIconData::writeImage(QTextStream &output, const QString &indent, void WriteIconData::writeImage(QIODevice &output, DomImage *image) { - QByteArray array = transformImageData(image->elementData()->text()); - output.write(array, array.size()); + const QByteArray array = transformImageData(image->elementData()->text()); + output.write(array.constData(), array.size()); } } // namespace CPP diff --git a/src/tools/uic/uic.pro b/src/tools/uic/uic.pro index 7a95db861f..0acc6e77c8 100644 --- a/src/tools/uic/uic.pro +++ b/src/tools/uic/uic.pro @@ -22,6 +22,6 @@ linux-g++-maemo { include(../bootstrap/bootstrap.pri) -target.path=$$[QT_INSTALL_BINS] +target.path = $$[QT_HOST_BINS] INSTALLS += target load(qt_targets) diff --git a/src/widgets/graphicsview/qgraphicssceneevent.h b/src/widgets/graphicsview/qgraphicssceneevent.h index be93c47476..95de435846 100644 --- a/src/widgets/graphicsview/qgraphicssceneevent.h +++ b/src/widgets/graphicsview/qgraphicssceneevent.h @@ -66,7 +66,7 @@ class QGraphicsSceneEventPrivate; class Q_WIDGETS_EXPORT QGraphicsSceneEvent : public QEvent { public: - QGraphicsSceneEvent(Type type); + explicit QGraphicsSceneEvent(Type type); ~QGraphicsSceneEvent(); QWidget *widget() const; @@ -84,7 +84,7 @@ class QGraphicsSceneMouseEventPrivate; class Q_WIDGETS_EXPORT QGraphicsSceneMouseEvent : public QGraphicsSceneEvent { public: - QGraphicsSceneMouseEvent(Type type = None); + explicit QGraphicsSceneMouseEvent(Type type = None); ~QGraphicsSceneMouseEvent(); QPointF pos() const; @@ -132,7 +132,7 @@ class QGraphicsSceneWheelEventPrivate; class Q_WIDGETS_EXPORT QGraphicsSceneWheelEvent : public QGraphicsSceneEvent { public: - QGraphicsSceneWheelEvent(Type type = None); + explicit QGraphicsSceneWheelEvent(Type type = None); ~QGraphicsSceneWheelEvent(); QPointF pos() const; @@ -167,7 +167,7 @@ class Q_WIDGETS_EXPORT QGraphicsSceneContextMenuEvent : public QGraphicsSceneEve public: enum Reason { Mouse, Keyboard, Other }; - QGraphicsSceneContextMenuEvent(Type type = None); + explicit QGraphicsSceneContextMenuEvent(Type type = None); ~QGraphicsSceneContextMenuEvent(); QPointF pos() const; @@ -194,7 +194,7 @@ class QGraphicsSceneHoverEventPrivate; class Q_WIDGETS_EXPORT QGraphicsSceneHoverEvent : public QGraphicsSceneEvent { public: - QGraphicsSceneHoverEvent(Type type = None); + explicit QGraphicsSceneHoverEvent(Type type = None); ~QGraphicsSceneHoverEvent(); QPointF pos() const; @@ -227,7 +227,7 @@ class QGraphicsSceneHelpEventPrivate; class Q_WIDGETS_EXPORT QGraphicsSceneHelpEvent : public QGraphicsSceneEvent { public: - QGraphicsSceneHelpEvent(Type type = None); + explicit QGraphicsSceneHelpEvent(Type type = None); ~QGraphicsSceneHelpEvent(); QPointF scenePos() const; @@ -245,7 +245,7 @@ class QGraphicsSceneDragDropEventPrivate; class Q_WIDGETS_EXPORT QGraphicsSceneDragDropEvent : public QGraphicsSceneEvent { public: - QGraphicsSceneDragDropEvent(Type type = None); + explicit QGraphicsSceneDragDropEvent(Type type = None); ~QGraphicsSceneDragDropEvent(); QPointF pos() const; diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h index 8c412680b8..5e121def41 100644 --- a/src/widgets/kernel/qgesture.h +++ b/src/widgets/kernel/qgesture.h @@ -270,7 +270,7 @@ class QGestureEventPrivate; class Q_WIDGETS_EXPORT QGestureEvent : public QEvent { public: - QGestureEvent(const QList<QGesture *> &gestures); + explicit QGestureEvent(const QList<QGesture *> &gestures); ~QGestureEvent(); QList<QGesture *> gestures() const; diff --git a/src/widgets/kernel/qicon.cpp b/src/widgets/kernel/qicon.cpp index 4f244b1027..369e26c21e 100644 --- a/src/widgets/kernel/qicon.cpp +++ b/src/widgets/kernel/qicon.cpp @@ -616,7 +616,8 @@ QIcon::operator QVariant() const return QVariant(QVariant::Icon, this); } -/*! \obsolete +/*! \fn int QIcon::serialNumber() const + \obsolete Returns a number that identifies the contents of this QIcon object. Distinct QIcon objects can have @@ -633,11 +634,6 @@ QIcon::operator QVariant() const \sa QPixmap::serialNumber() */ -int QIcon::serialNumber() const -{ - return d ? d->serialNum : 0; -} - /*! Returns a number that identifies the contents of this QIcon object. Distinct QIcon objects can have the same key if diff --git a/src/widgets/kernel/qicon.h b/src/widgets/kernel/qicon.h index 7bef500946..c6e07ba3e2 100644 --- a/src/widgets/kernel/qicon.h +++ b/src/widgets/kernel/qicon.h @@ -94,7 +94,9 @@ public: bool isDetached() const; void detach(); - int serialNumber() const; +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; } +#endif qint64 cacheKey() const; void addPixmap(const QPixmap &pixmap, Mode mode = Normal, State state = Off); diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 95fde4e4f6..766ca51ec3 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -5684,24 +5684,24 @@ static QByteArray encodeEntity(const QByteArray& str) QByteArray tmp(str); int len = tmp.size(); int i = 0; - const char* d = tmp.data(); + const char* d = tmp.constData(); while (i < len) { if (d[i] == '%'){ tmp.replace(i, 1, "<"); - d = tmp; + d = tmp.constData(); len += 4; i += 5; } else if (d[i] == '"') { tmp.replace(i, 1, """); - d = tmp; + d = tmp.constData(); len += 4; i += 5; } else if (d[i] == '&' && i + 1 < len && d[i+1] == '#') { // Dont encode < or " or &custom;. // Only encode character references tmp.replace(i, 1, "&"); - d = tmp; + d = tmp.constData(); len += 4; i += 5; } else { diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index 2488d27807..c2205edb40 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -1612,7 +1612,7 @@ QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning) d->encMapper = codec->makeDecoder(); } - QString input = d->encMapper->toUnicode(data, data.size()); + QString input = d->encMapper->toUnicode(data.constData(), data.size()); if (d->lookingForEncodingDecl) { d->encodingDeclChars += input; @@ -1633,9 +1633,9 @@ QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning) input.clear(); // prime the decoder with the data so far - d->encMapper->toUnicode(d->encodingDeclBytes, d->encodingDeclBytes.size()); + d->encMapper->toUnicode(d->encodingDeclBytes.constData(), d->encodingDeclBytes.size()); // now feed it the new data - input = d->encMapper->toUnicode(data, data.size()); + input = d->encMapper->toUnicode(data.constData(), data.size()); } } } diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp index d466d7b8d8..2794c174ba 100644 --- a/tests/auto/corelib/global/qflags/tst_qflags.cpp +++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp @@ -123,6 +123,15 @@ void tst_QFlags::constExpr() #endif } +// (statically) check QTypeInfo for QFlags instantiations: +enum MyEnum { Zero, One, Two, Four=4 }; +Q_DECLARE_FLAGS( MyFlags, MyEnum ); +Q_DECLARE_OPERATORS_FOR_FLAGS( MyFlags ); + +Q_STATIC_ASSERT( !QTypeInfo<MyFlags>::isComplex ); +Q_STATIC_ASSERT( !QTypeInfo<MyFlags>::isStatic ); +Q_STATIC_ASSERT( !QTypeInfo<MyFlags>::isLarge ); +Q_STATIC_ASSERT( !QTypeInfo<MyFlags>::isPointer ); QTEST_MAIN(tst_QFlags) #include "tst_qflags.moc" diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index e2144134d9..61484c1736 100644 --- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -132,7 +132,7 @@ public: class StartStopEvent: public QEvent { public: - StartStopEvent(int type, QEventLoop *loop = 0) + explicit StartStopEvent(int type, QEventLoop *loop = 0) : QEvent(Type(type)), el(loop) { } diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 72913d10f2..f8403f11a1 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -682,6 +682,36 @@ public: }; Q_DECLARE_METATYPE(CustomMultiInheritanceObject*); +class C { char _[4]; }; +class M { char _[4]; }; +class P { char _[4]; }; + +QT_BEGIN_NAMESPACE +Q_DECLARE_TYPEINFO(M, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(P, Q_PRIMITIVE_TYPE); +QT_END_NAMESPACE + +// avoid the comma: +typedef QPair<C,C> QPairCC; +typedef QPair<C,M> QPairCM; +typedef QPair<C,P> QPairCP; +typedef QPair<M,C> QPairMC; +typedef QPair<M,M> QPairMM; +typedef QPair<M,P> QPairMP; +typedef QPair<P,C> QPairPC; +typedef QPair<P,M> QPairPM; +typedef QPair<P,P> QPairPP; + +Q_DECLARE_METATYPE(QPairCC) +Q_DECLARE_METATYPE(QPairCM) +Q_DECLARE_METATYPE(QPairCP) +Q_DECLARE_METATYPE(QPairMC) +Q_DECLARE_METATYPE(QPairMM) +Q_DECLARE_METATYPE(QPairMP) +Q_DECLARE_METATYPE(QPairPC) +Q_DECLARE_METATYPE(QPairPM) +Q_DECLARE_METATYPE(QPairPP) + void tst_QMetaType::flags_data() { QTest::addColumn<int>("type"); @@ -700,6 +730,15 @@ QT_FOR_EACH_STATIC_CORE_POINTER(ADD_METATYPE_TEST_ROW) QTest::newRow("CustomMovable") << ::qMetaTypeId<CustomMovable>() << true << true << false; QTest::newRow("CustomObject*") << ::qMetaTypeId<CustomObject*>() << true << false << true; QTest::newRow("CustomMultiInheritanceObject*") << ::qMetaTypeId<CustomMultiInheritanceObject*>() << true << false << true; + QTest::newRow("QPair<C,C>") << ::qMetaTypeId<QPair<C,C> >() << false << true << false; + QTest::newRow("QPair<C,M>") << ::qMetaTypeId<QPair<C,M> >() << false << true << false; + QTest::newRow("QPair<C,P>") << ::qMetaTypeId<QPair<C,P> >() << false << true << false; + QTest::newRow("QPair<M,C>") << ::qMetaTypeId<QPair<M,C> >() << false << true << false; + QTest::newRow("QPair<M,M>") << ::qMetaTypeId<QPair<M,M> >() << true << true << false; + QTest::newRow("QPair<M,P>") << ::qMetaTypeId<QPair<M,P> >() << true << true << false; + QTest::newRow("QPair<P,C>") << ::qMetaTypeId<QPair<P,C> >() << false << true << false; + QTest::newRow("QPair<P,M>") << ::qMetaTypeId<QPair<P,M> >() << true << true << false; + QTest::newRow("QPair<P,P>") << ::qMetaTypeId<QPair<P,P> >() << true << false << false; } void tst_QMetaType::flags() @@ -1014,6 +1053,61 @@ void tst_QMetaType::registerStreamBuiltin() Q_DECLARE_METATYPE(QSharedPointer<QObject>) +typedef QHash<int, uint> IntUIntHash; +Q_DECLARE_METATYPE(IntUIntHash) +typedef QMap<int, uint> IntUIntMap; +Q_DECLARE_METATYPE(IntUIntMap) +typedef QPair<int, uint> IntUIntPair; +Q_DECLARE_METATYPE(IntUIntPair) + +struct CustomComparable +{ + CustomComparable(int i_ = 0) :i(i_) { } + bool operator==(const CustomComparable &other) const + { + return i == other.i; + } + int i; +}; + +struct UnregisteredType {}; + +typedef QHash<int, CustomComparable> IntComparableHash; +Q_DECLARE_METATYPE(IntComparableHash) +typedef QMap<int, CustomComparable> IntComparableMap; +Q_DECLARE_METATYPE(IntComparableMap) +typedef QPair<int, CustomComparable> IntComparablePair; +Q_DECLARE_METATYPE(IntComparablePair) + +typedef QHash<int, int> IntIntHash; +typedef int NaturalNumber; +class AutoMetaTypeObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(IntIntHash someHash READ someHash CONSTANT) + Q_PROPERTY(NaturalNumber someInt READ someInt CONSTANT) +public: + AutoMetaTypeObject(QObject *parent = 0) + : QObject(parent), m_int(42) + { + m_hash.insert(4, 2); + } + + QHash<int,int> someHash() const + { + return m_hash; + } + + int someInt() const + { + return m_int; + } + +private: + QHash<int,int> m_hash; + int m_int; +}; + void tst_QMetaType::automaticTemplateRegistration() { { @@ -1055,6 +1149,84 @@ void tst_QMetaType::automaticTemplateRegistration() vectorList << sharedPointerList; QVERIFY(QVariant::fromValue(vectorList).value<QVector<QList<QSharedPointer<QObject> > > >().first().first() == testObject); } + { + IntIntHash intIntHash; + intIntHash.insert(4, 2); + QCOMPARE(QVariant::fromValue(intIntHash).value<IntIntHash>().value(4), 2); + + AutoMetaTypeObject amto; + + qRegisterMetaType<QHash<int, int> >("IntIntHash"); + QVariant hashVariant = amto.property("someHash"); + QCOMPARE(hashVariant.value<IntIntHash>().value(4), 2); + + qRegisterMetaType<int>("NaturalNumber"); + QVariant intVariant = amto.property("someInt"); + QCOMPARE(intVariant.value<NaturalNumber>(), 42); + } + { + IntUIntHash intUIntHash; + intUIntHash.insert(4, 2); + QCOMPARE(QVariant::fromValue(intUIntHash).value<IntUIntHash>().value(4), (uint)2); + } + { + IntComparableHash intComparableHash; + CustomComparable m; + intComparableHash.insert(4, m); + QCOMPARE(QVariant::fromValue(intComparableHash).value<IntComparableHash>().value(4), m); + } + { + QVariantHash variantHash; + variantHash.insert(QStringLiteral("4"), 2); + QCOMPARE(QVariant::fromValue(variantHash).value<QVariantHash>().value(QStringLiteral("4")), QVariant(2)); + } + { + typedef QMap<int, int> IntIntMap; + IntIntMap intIntMap; + intIntMap.insert(4, 2); + QCOMPARE(QVariant::fromValue(intIntMap).value<IntIntMap>().value(4), 2); + } + { + IntUIntMap intUIntMap; + intUIntMap.insert(4, 2); + QCOMPARE(QVariant::fromValue(intUIntMap).value<IntUIntMap>().value(4), (uint)2); + } + { + IntComparableMap intComparableMap; + CustomComparable m; + intComparableMap.insert(4, m); + QCOMPARE(QVariant::fromValue(intComparableMap).value<IntComparableMap>().value(4), m); + } + { + QVariantMap variantMap; + variantMap.insert(QStringLiteral("4"), 2); + QCOMPARE(QVariant::fromValue(variantMap).value<QVariantMap>().value(QStringLiteral("4")), QVariant(2)); + } + { + typedef QPair<int, int> IntIntPair; + IntIntPair intIntPair = qMakePair(4, 2); + QCOMPARE(QVariant::fromValue(intIntPair).value<IntIntPair>().first, 4); + QCOMPARE(QVariant::fromValue(intIntPair).value<IntIntPair>().second, 2); + } + { + IntUIntPair intUIntPair = qMakePair<int, uint>(4, 2); + QCOMPARE(QVariant::fromValue(intUIntPair).value<IntUIntPair>().first, 4); + QCOMPARE(QVariant::fromValue(intUIntPair).value<IntUIntPair>().second, (uint)2); + } + { + CustomComparable m; + IntComparablePair intComparablePair = qMakePair(4, m); + QCOMPARE(QVariant::fromValue(intComparablePair).value<IntComparablePair>().first, 4); + QCOMPARE(QVariant::fromValue(intComparablePair).value<IntComparablePair>().second, m); + } + { + typedef QHash<int, UnregisteredType> IntUnregisteredTypeHash; + QVERIFY(qRegisterMetaType<IntUnregisteredTypeHash>("IntUnregisteredTypeHash") > 0); + } + { + typedef QList<UnregisteredType> UnregisteredTypeList; + QVERIFY(qRegisterMetaType<UnregisteredTypeList>("UnregisteredTypeList") > 0); + } } // Compile-time test, it should be possible to register function pointer types diff --git a/tests/auto/corelib/tools/qpair/qpair.pro b/tests/auto/corelib/tools/qpair/qpair.pro new file mode 100644 index 0000000000..9c7752327e --- /dev/null +++ b/tests/auto/corelib/tools/qpair/qpair.pro @@ -0,0 +1,4 @@ +CONFIG += testcase parallel_test +TARGET = tst_qpair +QT = core testlib +SOURCES = tst_qpair.cpp diff --git a/tests/auto/corelib/tools/qpair/tst_qpair.cpp b/tests/auto/corelib/tools/qpair/tst_qpair.cpp new file mode 100644 index 0000000000..5de1e8f8bb --- /dev/null +++ b/tests/auto/corelib/tools/qpair/tst_qpair.cpp @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> + +#include <QPair> + +class tst_QPair : public QObject +{ + Q_OBJECT +private Q_SLOTS: + void dummy() {} +}; + +class C { char _[4]; }; +class M { char _[4]; }; +class P { char _[4]; }; + +QT_BEGIN_NAMESPACE +Q_DECLARE_TYPEINFO(M, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(P, Q_PRIMITIVE_TYPE); +QT_END_NAMESPACE + +// avoid the comma: +typedef QPair<C,C> QPairCC; +typedef QPair<C,M> QPairCM; +typedef QPair<C,P> QPairCP; +typedef QPair<M,C> QPairMC; +typedef QPair<M,M> QPairMM; +typedef QPair<M,P> QPairMP; +typedef QPair<P,C> QPairPC; +typedef QPair<P,M> QPairPM; +typedef QPair<P,P> QPairPP; + +Q_STATIC_ASSERT( QTypeInfo<QPairCC>::isComplex); +Q_STATIC_ASSERT( QTypeInfo<QPairCC>::isStatic ); + +Q_STATIC_ASSERT( QTypeInfo<QPairCM>::isComplex); +Q_STATIC_ASSERT( QTypeInfo<QPairCM>::isStatic ); + +Q_STATIC_ASSERT( QTypeInfo<QPairCP>::isComplex); +Q_STATIC_ASSERT( QTypeInfo<QPairCP>::isStatic ); + +Q_STATIC_ASSERT( QTypeInfo<QPairMC>::isComplex); +Q_STATIC_ASSERT( QTypeInfo<QPairMC>::isStatic ); + +Q_STATIC_ASSERT( QTypeInfo<QPairMM>::isComplex); +Q_STATIC_ASSERT(!QTypeInfo<QPairMM>::isStatic ); + +Q_STATIC_ASSERT( QTypeInfo<QPairMP>::isComplex); +Q_STATIC_ASSERT(!QTypeInfo<QPairMP>::isStatic ); + +Q_STATIC_ASSERT( QTypeInfo<QPairPC>::isComplex); +Q_STATIC_ASSERT( QTypeInfo<QPairPC>::isStatic ); + +Q_STATIC_ASSERT( QTypeInfo<QPairPM>::isComplex); +Q_STATIC_ASSERT(!QTypeInfo<QPairPM>::isStatic ); + +Q_STATIC_ASSERT(!QTypeInfo<QPairPP>::isComplex); +Q_STATIC_ASSERT(!QTypeInfo<QPairPP>::isStatic ); + +Q_STATIC_ASSERT(!QTypeInfo<QPairPP>::isDummy ); +Q_STATIC_ASSERT(!QTypeInfo<QPairPP>::isPointer); + + +QTEST_APPLESS_MAIN(tst_QPair) +#include "tst_qpair.moc" diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp index afc16078b8..556b9ac16a 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp @@ -73,6 +73,7 @@ void runScenario() QString string(l1string); QStringRef stringref(&string, 2, 10); QLatin1Char achar('c'); + QChar::SpecialCharacter special(QChar::Nbsp); QString r2(QLatin1String(LITERAL LITERAL)); QString r3 = QString::fromUtf8(UTF8_LITERAL UTF8_LITERAL); QString r; @@ -97,6 +98,8 @@ void runScenario() QCOMPARE(r, QString(string P achar)); r = achar + string; QCOMPARE(r, QString(achar P string)); + r = special + string; + QCOMPARE(r, QString(special P string)); #ifdef Q_COMPILER_UNICODE_STRINGS r = QStringLiteral(UNICODE_LITERAL); diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro index 930799e3b3..89bb3bc416 100644 --- a/tests/auto/corelib/tools/tools.pro +++ b/tests/auto/corelib/tools/tools.pro @@ -20,6 +20,7 @@ SUBDIRS=\ qlocale \ qmap \ qmargins \ + qpair \ qpoint \ qqueue \ qrect \ diff --git a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index 50ae22c530..7ca4fc981b 100644 --- a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -2938,7 +2938,7 @@ void tst_QTextDocumentFragment::backgroundImage() doc.setHtml("<p style=\"background-image: url(testPixmap)\">Hello</p>"); QBrush bg = doc.begin().blockFormat().background(); QVERIFY(bg.style() == Qt::TexturePattern); - QVERIFY(bg.texture().serialNumber() == doc.testPixmap.serialNumber()); + QCOMPARE(bg.texture().cacheKey(), doc.testPixmap.cacheKey()); } void tst_QTextDocumentFragment::dontMergePreAndNonPre() diff --git a/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp b/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp index 9c1b8c32f6..7cb5dfd5cd 100644 --- a/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp +++ b/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp @@ -93,7 +93,7 @@ void tst_QAuthenticator::basicAuth() QVERIFY(priv->phase == QAuthenticatorPrivate::Start); QList<QPair<QByteArray, QByteArray> > headers; - headers << qMakePair(QByteArray("WWW-Authenticate"), "Basic " + data.toUtf8()); + headers << qMakePair<QByteArray, QByteArray>(QByteArray("WWW-Authenticate"), "Basic " + data.toUtf8()); priv->parseHttpResponse(headers, /*isProxy = */ false); QCOMPARE(auth.realm(), realm); @@ -104,7 +104,7 @@ void tst_QAuthenticator::basicAuth() QVERIFY(priv->phase == QAuthenticatorPrivate::Start); - QCOMPARE(priv->calculateResponse("GET", "/").constData(), ("Basic " + expectedReply).constData()); + QCOMPARE(priv->calculateResponse("GET", "/").constData(), QByteArray("Basic " + expectedReply).constData()); } void tst_QAuthenticator::ntlmAuth_data() @@ -138,7 +138,7 @@ void tst_QAuthenticator::ntlmAuth() // NTLM phase 2: challenge headers.clear(); - headers << qMakePair(QByteArray("WWW-Authenticate"), "NTLM " + data.toUtf8()); + headers << qMakePair<QByteArray, QByteArray>(QByteArray("WWW-Authenticate"), "NTLM " + data.toUtf8()); priv->parseHttpResponse(headers, /*isProxy = */ false); QEXPECT_FAIL("with-realm", "NTLM authentication code doesn't extract the realm", Continue); diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index 8b65c312bc..5395c7c28b 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -2242,7 +2242,7 @@ void tst_QTcpSocket::suddenRemoteDisconnect() QString::fromLatin1("Could not start %1: %2").arg(processExe, serverProcess.errorString()))); while (!serverProcess.canReadLine()) QVERIFY(serverProcess.waitForReadyRead(10000)); - QCOMPARE(serverProcess.readLine().data(), (server.toLatin1() + "\n").data()); + QCOMPARE(serverProcess.readLine().data(), QByteArray(server.toLatin1() + "\n").data()); // Start client QProcess clientProcess; @@ -2252,7 +2252,7 @@ void tst_QTcpSocket::suddenRemoteDisconnect() QString::fromLatin1("Could not start %1: %2").arg(processExe, clientProcess.errorString()))); while (!clientProcess.canReadLine()) QVERIFY(clientProcess.waitForReadyRead(10000)); - QCOMPARE(clientProcess.readLine().data(), (client.toLatin1() + "\n").data()); + QCOMPARE(clientProcess.readLine().data(), QByteArray(client.toLatin1() + "\n").data()); // Let them play for a while qDebug("Running stress test for 5 seconds"); diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp index 01e26b6608..81881fc700 100644 --- a/tests/auto/other/gestures/tst_gestures.cpp +++ b/tests/auto/other/gestures/tst_gestures.cpp @@ -87,7 +87,7 @@ class CustomEvent : public QEvent public: static int EventType; - CustomEvent(int serial_ = 0) + explicit CustomEvent(int serial_ = 0) : QEvent(QEvent::Type(CustomEvent::EventType)), serial(serial_), hasHotSpot(false) { diff --git a/tests/auto/testlib/selftests/alive/qtestalive.cpp b/tests/auto/testlib/selftests/alive/qtestalive.cpp index c2e597ac18..d962b7801f 100644 --- a/tests/auto/testlib/selftests/alive/qtestalive.cpp +++ b/tests/auto/testlib/selftests/alive/qtestalive.cpp @@ -50,7 +50,7 @@ public: enum { AliveEventType = QEvent::User + 422 }; - inline QTestAliveEvent(int aSequenceId) + explicit inline QTestAliveEvent(int aSequenceId) : QEvent(QEvent::Type(AliveEventType)), seqId(aSequenceId) {} inline int sequenceId() const { return seqId; } diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 27db6cc59c..49095048bf 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -535,6 +535,7 @@ private slots: void cxx11Enums_data(); void cxx11Enums(); void returnRefs(); + void redefinedNames(); signals: void sigWithUnsignedArg(unsigned foo); @@ -1762,6 +1763,157 @@ void tst_Moc::returnRefs() // they used to cause miscompilation of the moc generated file. } +struct ActualInterfaceName +{ + virtual ~ActualInterfaceName() {} + virtual void foo() = 0; +}; + +QT_BEGIN_NAMESPACE +Q_DECLARE_INTERFACE(ActualInterfaceName, "foo.bar.ActualInterfaceName") +QT_END_NAMESPACE + +#define DefinedInterfaceName ActualInterfaceName +#define RedefinedInterfaceName DefinedInterfaceName + +struct ActualName {}; +#define DefinedName ActualName +#define RedefinedName DefinedName + +template<typename T> +struct ActualTemplateName {}; + +#define DefinedTemplateName ActualTemplateName +#define RedefinedTemplateName DefinedTemplateName + +#define ActualName ActualName + +class RedefinitionTest : public QObject, public RedefinedInterfaceName +{ + Q_OBJECT + Q_INTERFACES(RedefinedInterfaceName) + + Q_PROPERTY(ActualName p1 READ getP1) + + Q_PROPERTY(DefinedName p2 READ getP2) + Q_PROPERTY(RedefinedName p3 READ getP3) + + Q_PROPERTY(DefinedName * p4 READ getP4) + Q_PROPERTY(RedefinedName * p5 READ getP5) + + Q_PROPERTY(DefinedName ** p6 READ getP6) + Q_PROPERTY(RedefinedName ** p7 READ getP7) + + Q_PROPERTY(DefinedName const ** p8 READ getP8) + Q_PROPERTY(RedefinedName const ** p9 READ getP9) + + Q_PROPERTY(DefinedName const * const * p10 READ getP10) + Q_PROPERTY(RedefinedName const * const * p11 READ getP11) + + Q_PROPERTY(DefinedTemplateName<DefinedName> p16 READ getP16) + Q_PROPERTY(RedefinedTemplateName<RedefinedName> p17 READ getP17) + + Q_PROPERTY(DefinedTemplateName<DefinedName **> p18 READ getP18) + Q_PROPERTY(RedefinedTemplateName<RedefinedName **> p19 READ getP19) + + Q_PROPERTY(DefinedTemplateName<DefinedName const * const> p20 READ getP20) + Q_PROPERTY(RedefinedTemplateName<RedefinedName const * const> p21 READ getP21) + +signals: + void signal1(ActualName); + void signal2(DefinedName); + void signal3(RedefinedName); + +public slots: + void slot1(ActualName x) { v = x; } + void slot2(DefinedName x) { v = x; } + void slot3(RedefinedName x) { v = x; } + +public: + void foo() {} + + ActualName v; + + ActualName *vp; + ActualName const *vcp; + + ActualTemplateName<ActualName> tv; + ActualTemplateName<ActualName **> tvpp; + ActualTemplateName<ActualName const * const> tvcpc; + + ActualName getP0() { return v; } + ActualName getP1() { return v; } + + DefinedName getP2() { return v; } + RedefinedName getP3() { return v; } + + DefinedName * getP4() { return &v; } + RedefinedName * getP5() { return &v; } + + DefinedName ** getP6() { return &vp; } + RedefinedName ** getP7() { return &vp; } + + DefinedName const ** getP8() { return &vcp; } + RedefinedName const ** getP9() { return &vcp; } + + DefinedName const * const * getP10() const { return &vcp; } + RedefinedName const * const * getP11() const { return &vcp; } + + DefinedTemplateName<DefinedName> getP16() { return tv; } + RedefinedTemplateName<RedefinedName> getP17() { return tv; } + + DefinedTemplateName<DefinedName **> getP18() { return tvpp; } + RedefinedTemplateName<RedefinedName **> getP19() { return tvpp; } + + DefinedTemplateName<DefinedName const * const> getP20() { return tvcpc; } + RedefinedTemplateName<RedefinedName const * const> getP21() { return tvcpc; } +}; + +void tst_Moc::redefinedNames() +{ + RedefinitionTest tst; + const QMetaObject *mobj = tst.metaObject(); + QVERIFY(mobj->indexOfProperty("p1") != -1); + + // Use the true slot name rather than the declared name + QVERIFY(QObject::connect(&tst, SIGNAL(signal1(ActualName)), + &tst, SLOT(slot1(ActualName)))); + + QVERIFY(QObject::connect(&tst, SIGNAL(signal2(ActualName)), + &tst, SLOT(slot2(ActualName)))); + + QVERIFY(QObject::connect(&tst, SIGNAL(signal3(ActualName)), + &tst, SLOT(slot3(ActualName)))); + + // Use the declared slot name rather than the true name + QVERIFY(QObject::connect(&tst, SIGNAL(signal1(ActualName)), + &tst, SLOT(slot2(DefinedName)))); + + QVERIFY(QObject::connect(&tst, SIGNAL(signal1(ActualName)), + &tst, SLOT(slot3(RedefinedName)))); + + // Use the declared signal name rather than the true name + QVERIFY(QObject::connect(&tst, SIGNAL(signal2(DefinedName)), + &tst, SLOT(slot1(ActualName)))); + + QVERIFY(QObject::connect(&tst, SIGNAL(signal3(RedefinedName)), + &tst, SLOT(slot1(ActualName)))); + + // Use both declared names + QVERIFY(QObject::connect(&tst, SIGNAL(signal2(DefinedName)), + &tst, SLOT(slot2(DefinedName)))); + + QVERIFY(QObject::connect(&tst, SIGNAL(signal2(DefinedName)), + &tst, SLOT(slot3(RedefinedName)))); + + QVERIFY(QObject::connect(&tst, SIGNAL(signal3(RedefinedName)), + &tst, SLOT(slot2(DefinedName)))); + + QVERIFY(QObject::connect(&tst, SIGNAL(signal3(RedefinedName)), + &tst, SLOT(slot3(RedefinedName)))); +} + + QTEST_APPLESS_MAIN(tst_Moc) #include "tst_moc.moc" diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 0fe93995a1..f9eb8b6159 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -1335,7 +1335,7 @@ void tst_QComboBox::textpixmapdata() for (int i = 0; i<text.count(); ++i) { QIcon icon = testWidget->itemIcon(i); - QVERIFY(icon.serialNumber() == icons.at(i).serialNumber()); + QCOMPARE(icon.cacheKey(), icons.at(i).cacheKey()); QPixmap original = icons.at(i).pixmap(1024); QPixmap pixmap = icon.pixmap(1024); QVERIFY(pixmap.toImage() == original.toImage()); diff --git a/tests/benchmarks/corelib/tools/containers-associative/main.cpp b/tests/benchmarks/corelib/tools/containers-associative/main.cpp index 7f2e7b68ca..ab1c406708 100644 --- a/tests/benchmarks/corelib/tools/containers-associative/main.cpp +++ b/tests/benchmarks/corelib/tools/containers-associative/main.cpp @@ -72,8 +72,8 @@ void tst_associative_containers::insert_data() const QByteArray sizeString = QByteArray::number(size); - QTest::newRow(("hash--" + sizeString).constData()) << true << size; - QTest::newRow(("map--" + sizeString).constData()) << false << size; + QTest::newRow(QByteArray("hash--" + sizeString).constData()) << true << size; + QTest::newRow(QByteArray("map--" + sizeString).constData()) << false << size; } } @@ -104,8 +104,8 @@ void tst_associative_containers::lookup_data() const QByteArray sizeString = QByteArray::number(size); - QTest::newRow(("hash--" + sizeString).constData()) << true << size; - QTest::newRow(("map--" + sizeString).constData()) << false << size; + QTest::newRow(QByteArray("hash--" + sizeString).constData()) << true << size; + QTest::newRow(QByteArray("map--" + sizeString).constData()) << false << size; } } diff --git a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp index e42a40b110..43eadb6633 100644 --- a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp +++ b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp @@ -176,8 +176,8 @@ void tst_vector_vs_std::insert_int_data() for (int size = 10; size < 20000; size += 100) { const QByteArray sizeString = QByteArray::number(size); - QTest::newRow(("std::vector-int--" + sizeString).constData()) << true << size; - QTest::newRow(("QVector-int--" + sizeString).constData()) << false << size; + QTest::newRow(QByteArray("std::vector-int--" + sizeString).constData()) << true << size; + QTest::newRow(QByteArray("QVector-int--" + sizeString).constData()) << false << size; } } @@ -199,8 +199,8 @@ void tst_vector_vs_std::insert_Large_data() for (int size = 10; size < LARGE_MAX_SIZE; size += 100) { const QByteArray sizeString = QByteArray::number(size); - QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size; - QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size; + QTest::newRow(QByteArray("std::vector-Large--" + sizeString).constData()) << true << size; + QTest::newRow(QByteArray("QVector-Large--" + sizeString).constData()) << false << size; } } @@ -222,8 +222,8 @@ void tst_vector_vs_std::lookup_int_data() for (int size = 10; size < 20000; size += 100) { const QByteArray sizeString = QByteArray::number(size); - QTest::newRow(("std::vector-int--" + sizeString).constData()) << true << size; - QTest::newRow(("QVector-int--" + sizeString).constData()) << false << size; + QTest::newRow(QByteArray("std::vector-int--" + sizeString).constData()) << true << size; + QTest::newRow(QByteArray("QVector-int--" + sizeString).constData()) << false << size; } } @@ -245,8 +245,8 @@ void tst_vector_vs_std::lookup_Large_data() for (int size = 10; size < LARGE_MAX_SIZE; size += 100) { const QByteArray sizeString = QByteArray::number(size); - QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size; - QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size; + QTest::newRow(QByteArray("std::vector-Large--" + sizeString).constData()) << true << size; + QTest::newRow(QByteArray("QVector-Large--" + sizeString).constData()) << false << size; } } diff --git a/tests/benchmarks/dbus/qdbustype/main.cpp b/tests/benchmarks/dbus/qdbustype/main.cpp index 0e0ce358bb..b0f6988425 100644 --- a/tests/benchmarks/dbus/qdbustype/main.cpp +++ b/tests/benchmarks/dbus/qdbustype/main.cpp @@ -56,7 +56,7 @@ private Q_SLOTS: static inline void benchmarkAddRow(const char *name, const char *data) { - QTest::newRow(QByteArray("native-") + name) << data << true; + QTest::newRow(QByteArray(QByteArray("native-") + name)) << data << true; QTest::newRow(name) << data << false; } diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp index 1ebdf2e0bb..3ce3d5c2c1 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp @@ -41,7 +41,7 @@ #include "themeevent.h" -ThemeEvent::ThemeEvent( QString newTheme, Type type) : QEvent(type), +ThemeEvent::ThemeEvent( const QString &newTheme, Type type) : QEvent(type), m_theme(newTheme) { diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h index c98f90da55..3603b5966f 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h @@ -50,7 +50,7 @@ static QEvent::Type ThemeEventType = (QEvent::Type) 1010; class ThemeEvent : public QEvent { public: - ThemeEvent(QString newTheme, QEvent::Type type = ThemeEventType ); + explicit ThemeEvent(const QString &newTheme, QEvent::Type type = ThemeEventType ); ~ThemeEvent(); public: diff --git a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp index fcddf5ed90..45acd41749 100644 --- a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp +++ b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp @@ -153,9 +153,9 @@ void tst_qstylesheetstyle::grid_data() QTest::addColumn<int>("N"); for (int n = 5; n <= 25; n += 5) { const QByteArray nString = QByteArray::number(n*n); - QTest::newRow(("simple--" + nString).constData()) << false << false << n; - QTest::newRow(("events--" + nString).constData()) << true << false << n; - QTest::newRow(("show--" + nString).constData()) << true << true << n; + QTest::newRow(QByteArray("simple--" + nString).constData()) << false << false << n; + QTest::newRow(QByteArray("events--" + nString).constData()) << true << false << n; + QTest::newRow(QByteArray("show--" + nString).constData()) << true << true << n; } } diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp index fe9efa55b7..16f9625eba 100644 --- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -530,7 +530,7 @@ void tst_qnetworkreply::downloadPerformance() // unlike the above function, this one tries to send as fast as possible // and measures how fast it was. TimedSender sender(5000); - QNetworkRequest request("debugpipe://127.0.0.1:" + QString::number(sender.serverPort()) + "/?bare=1"); + QNetworkRequest request(QUrl(QStringLiteral("debugpipe://127.0.0.1:") + QString::number(sender.serverPort()) + QStringLiteral("/?bare=1"))); QNetworkReplyPtr reply = manager.get(request); DataReader reader(reply, false); @@ -552,7 +552,7 @@ void tst_qnetworkreply::uploadPerformance() DataGenerator generator; - QNetworkRequest request("debugpipe://127.0.0.1:" + QString::number(reader.serverPort()) + "/?bare=1"); + QNetworkRequest request(QUrl(QStringLiteral("debugpipe://127.0.0.1:") + QString::number(reader.serverPort()) + QStringLiteral("/?bare=1"))); QNetworkReplyPtr reply = manager.put(request, &generator); generator.start(); connect(&reader, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index b630d289a5..a586821bdc 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1063,11 +1063,33 @@ void Configure::parseCmdLine() dictionary[ "QT_INSTALL_TESTS" ] = configCmdLine.at(i); } + else if (configCmdLine.at(i) == "-sysroot") { + ++i; + if (i == argCount) + break; + dictionary[ "CFG_SYSROOT" ] = configCmdLine.at(i); + } + else if (configCmdLine.at(i) == "-hostprefix") { ++i; + if (i == argCount || configCmdLine.at(i).startsWith('-')) + dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_BUILD_TREE" ]; + else + dictionary[ "QT_HOST_PREFIX" ] = configCmdLine.at(i); + } + + else if (configCmdLine.at(i) == "-hostbindir") { + ++i; if (i == argCount) break; - dictionary[ "QT_HOST_PREFIX" ] = configCmdLine.at(i); + dictionary[ "QT_HOST_BINS" ] = configCmdLine.at(i); + } + + else if (configCmdLine.at(i) == "-hostdatadir") { + ++i; + if (i == argCount) + break; + dictionary[ "QT_HOST_DATA" ] = configCmdLine.at(i); } else if (configCmdLine.at(i) == "-make") { @@ -2377,6 +2399,16 @@ void Configure::generateOutputVars() if (!dictionary[ "QT_INSTALL_TESTS" ].size()) dictionary[ "QT_INSTALL_TESTS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/tests"); + bool haveHpx = false; + if (dictionary[ "QT_HOST_PREFIX" ].isEmpty()) + dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ]; + else + haveHpx = true; + if (dictionary[ "QT_HOST_BINS" ].isEmpty()) + dictionary[ "QT_HOST_BINS" ] = haveHpx ? fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin") : dictionary[ "QT_INSTALL_BINS" ]; + if (dictionary[ "QT_HOST_DATA" ].isEmpty()) + dictionary[ "QT_HOST_DATA" ] = haveHpx ? dictionary[ "QT_HOST_PREFIX" ] : dictionary[ "QT_INSTALL_DATA" ]; + if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux")) dictionary[ "QMAKE_RPATHDIR" ] = dictionary[ "QT_INSTALL_LIBS" ]; @@ -2595,6 +2627,17 @@ void Configure::generateCachefile() << "QT_MINOR_VERSION = " << dictionary["VERSION_MINOR"] << endl << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl; + if (!dictionary["CFG_SYSROOT"].isEmpty()) { + QString targetSpec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ]; + configStream << endl + << "# sysroot" << endl + << targetSpec << " {" << endl + << " QMAKE_CFLAGS += --sysroot=$$[QT_SYSROOT]" << endl + << " QMAKE_CXXFLAGS += --sysroot=$$[QT_SYSROOT]" << endl + << " QMAKE_LFLAGS += --sysroot=$$[QT_SYSROOT]" << endl + << "}" << endl; + } + configStream.flush(); configFile.close(); } @@ -2853,51 +2896,31 @@ void Configure::generateConfigfiles() << endl << "/* Build date */" << endl << "static const char qt_configure_installation [11 + 12] = \"qt_instdate=" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl - << endl; - if (!dictionary[ "QT_HOST_PREFIX" ].isNull()) - tmpStream << "#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)" << endl; - tmpStream << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << escapeSeparators(dictionary["QT_INSTALL_PREFIX"]) << "\";" << endl - << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << escapeSeparators(dictionary["QT_INSTALL_DOCS"]) << "\";" << endl - << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << escapeSeparators(dictionary["QT_INSTALL_HEADERS"]) << "\";" << endl - << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << escapeSeparators(dictionary["QT_INSTALL_LIBS"]) << "\";" << endl - << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << escapeSeparators(dictionary["QT_INSTALL_BINS"]) << "\";" << endl - << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << escapeSeparators(dictionary["QT_INSTALL_PLUGINS"]) << "\";" << endl - << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << escapeSeparators(dictionary["QT_INSTALL_IMPORTS"]) << "\";" << endl - << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << escapeSeparators(dictionary["QT_INSTALL_DATA"]) << "\";" << endl - << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << escapeSeparators(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\";" << endl - << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << escapeSeparators(dictionary["QT_INSTALL_EXAMPLES"]) << "\";" << endl - << "static const char qt_configure_tests_path_str [512 + 12] = \"qt_tstspath=" << escapeSeparators(dictionary["QT_INSTALL_TESTS"]) << "\";" << endl + << endl + << "static const char qt_configure_prefix_path_strs[][12 + 512] = {" << endl + << " \"qt_prfxpath=" << escapeSeparators(dictionary["QT_INSTALL_PREFIX"]) << "\"," << endl + << " \"qt_docspath=" << escapeSeparators(dictionary["QT_INSTALL_DOCS"]) << "\"," << endl + << " \"qt_hdrspath=" << escapeSeparators(dictionary["QT_INSTALL_HEADERS"]) << "\"," << endl + << " \"qt_libspath=" << escapeSeparators(dictionary["QT_INSTALL_LIBS"]) << "\"," << endl + << " \"qt_binspath=" << escapeSeparators(dictionary["QT_INSTALL_BINS"]) << "\"," << endl + << " \"qt_plugpath=" << escapeSeparators(dictionary["QT_INSTALL_PLUGINS"]) << "\"," << endl + << " \"qt_impspath=" << escapeSeparators(dictionary["QT_INSTALL_IMPORTS"]) << "\"," << endl + << " \"qt_datapath=" << escapeSeparators(dictionary["QT_INSTALL_DATA"]) << "\"," << endl + << " \"qt_trnspath=" << escapeSeparators(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\"," << endl + << " \"qt_xmplpath=" << escapeSeparators(dictionary["QT_INSTALL_EXAMPLES"]) << "\"," << endl + << " \"qt_tstspath=" << escapeSeparators(dictionary["QT_INSTALL_TESTS"]) << "\"," << endl + << "#ifdef QT_BUILD_QMAKE" << endl + << " \"qt_ssrtpath=" << escapeSeparators(dictionary["CFG_SYSROOT"]) << "\"," << endl + << " \"qt_hpfxpath=" << escapeSeparators(dictionary["QT_HOST_PREFIX"]) << "\"," << endl + << " \"qt_hbinpath=" << escapeSeparators(dictionary["QT_HOST_BINS"]) << "\"," << endl + << " \"qt_hdatpath=" << escapeSeparators(dictionary["QT_HOST_DATA"]) << "\"," << endl + << "#endif" << endl + << "};" << endl //<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << escapeSeparators(dictionary["QT_INSTALL_SETTINGS"]) << "\";" << endl - ; - if (!dictionary[ "QT_HOST_PREFIX" ].isNull()) { - tmpStream << "#else" << endl - << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << escapeSeparators(dictionary[ "QT_HOST_PREFIX" ]) << "\";" << endl - << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/doc", true) <<"\";" << endl - << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/include", true) <<"\";" << endl - << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib", true) <<"\";" << endl - << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin", true) <<"\";" << endl - << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins", true) <<"\";" << endl - << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/imports", true) <<"\";" << endl - << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ], true) <<"\";" << endl - << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations", true) <<"\";" << endl - << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example", true) <<"\";" << endl - << "static const char qt_configure_tests_path_str [512 + 12] = \"qt_tstspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/tests", true) <<"\";" << endl - << "#endif //QT_BOOTSTRAPPED" << endl; - } - tmpStream << "/* strlen( \"qt_lcnsxxxx\") == 12 */" << endl + << endl + << "/* strlen( \"qt_lcnsxxxx\") == 12 */" << endl << "#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;" << endl << "#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;" << endl - << "#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12;" << endl - << "#define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;" << endl - << "#define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;" << endl - << "#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;" << endl - << "#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;" << endl - << "#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;" << endl - << "#define QT_CONFIGURE_IMPORTS_PATH qt_configure_imports_path_str + 12;" << endl - << "#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;" << endl - << "#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;" << endl - << "#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;" << endl - << "#define QT_CONFIGURE_TESTS_PATH qt_configure_tests_path_str + 12;" << endl //<< "#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;" << endl << endl; |