diff options
author | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2015-01-16 21:02:26 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2015-01-16 21:02:26 +0100 |
commit | 3f17d0349b2d9c85491a6caaaee82918959ef5ef (patch) | |
tree | 78ab938704af14d78b6cf26fbc4de73231ddab3b | |
parent | 6839aead0430a9b07b60fa3a1a7d685fe5d2d1ef (diff) | |
parent | 9d1bcd727ae50331980e52119f2256266c27b5d4 (diff) |
Merge 5.4 into 5.4.1
Change-Id: I78d848c0bb396584a205a8066d253f2bcac8da56
102 files changed, 1234 insertions, 373 deletions
@@ -3883,13 +3883,16 @@ fi if [ -z "$PKG_CONFIG" ]; then # See if PKG_CONFIG is set in the mkspec: PKG_CONFIG="`"$outpath/bin/qmake" -E -nocache -spec "$XQMAKESPEC" "CONFIG=" $DEV_NULL 2>&1 | sed -n -e 's,^PKG_CONFIG = \(.*\),\1,p'`" + [ -n "$PKG_CONFIG" ] && [ "$OPT_VERBOSE" = "yes" ] && echo "Found pkg-config from mkspec: $PKG_CONFIG" fi if [ -z "$PKG_CONFIG" ]; then PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null` + [ -n "$PKG_CONFIG" ] && [ "$OPT_VERBOSE" = "yes" ] && echo "Found pkg-config from \$PATH: $PKG_CONFIG" fi if [ "$CFG_PKGCONFIG" = "no" ]; then PKG_CONFIG= + [ "$OPT_VERBOSE" = "yes" ] && echo "pkg-config support disabled." elif [ "$CFG_PKGCONFIG" = "force" ]; then echo >&2 "" echo >&2 "You have asked to use pkg-config. Please make sure you have" @@ -3954,7 +3957,13 @@ compileTest() path=config.tests/$1 name=$2 shift 2 - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS "$@" + # allow config tests which behave differently depending on the type of + # library being built (shared/static) e.g. see config.tests/unix/icu + test_config="$QMAKE_CONFIG shared" + if [ "$CFG_SHARED" = "no" ]; then + test_config="$QMAKE_CONFIG static" + fi + "$unixtests/compile.test" "$XQMAKESPEC" "$test_config" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS "$@" } #------------------------------------------------------------------------------- @@ -4651,6 +4660,7 @@ if [ "$CFG_DBUS" = "linked" ]; then else if [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "The Qt D-Bus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found." + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -4672,6 +4682,7 @@ if [ "$CFG_GLIB" != "no" ]; then else if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "Glib support cannot be enabled due to functionality tests!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -4699,6 +4710,7 @@ if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then else if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "GTK theme support cannot be enabled due to functionality tests!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the fin al report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -4743,6 +4755,7 @@ if [ "$CFG_PULSEAUDIO" != "no" ]; then else if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo "PulseAudio support cannot be enabled due to functionality tests!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -4869,6 +4882,7 @@ elif [ "$CFG_OPENGL" = "es2" ]; then compileTest unix/opengles2 "OpenGL ES 2.0" $QMAKE_LIBS_OPENGL_ES2 $QMAKE_CFLAGS_OPENGL_ES2 if [ $? != "0" ]; then echo "The OpenGL ES 2.0 functionality test failed!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " You might need to modify the include and library search paths by editing" echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in" echo " ${XQMAKESPEC}." @@ -4942,6 +4956,7 @@ if [ "$CFG_LIBUDEV" != "no" ]; then QT_CONFIG="$QT_CONFIG libudev" elif [ "$CFG_LIBUDEV" = "yes" ]; then echo "The libudev functionality test failed!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" exit 1 else CFG_LIBUDEV=no @@ -5093,6 +5108,7 @@ if [ "$CFG_XCB" != "no" ]; then else if [ "$CFG_XCB" != "auto" ]; then echo "The test for linking against libxcb failed!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " You might need to install dependency packages for libxcb." echo " See src/plugins/platforms/xcb/README." exit 1 @@ -5109,6 +5125,7 @@ if [ "$CFG_DIRECTFB" != "no" ]; then CFG_DIRECTFB=yes elif [ "$CFG_DIRECTFB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo " DirectFB support cannot be enabled due to functionality tests!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -5165,6 +5182,7 @@ if [ "$CFG_XCB" != "no" ]; then elif [ "$CFG_XKBCOMMON" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then echo " xkbcommon support cannot be enabled because either xkbcommon or " echo " xkbcommon-x11 >= $MIN_REQ_XKBCOMMON was not found via pkg-config!" + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " Turn on verbose messaging (-v) to $0 to see the final report." echo " If you believe this message is in error you may use the continue" echo " switch (-continue) to $0 to continue." @@ -5225,6 +5243,7 @@ if [ "$CFG_EGL" != "no" ]; then fi elif [ "$CFG_EGL" = "yes" ]; then echo " The EGL functionality test failed; EGL is required by some QPA plugins to manage contexts & surfaces." + [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?" echo " You might need to modify the include and library search paths by editing" echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in ${XQMAKESPEC}." exit 1 diff --git a/doc/global/externalsites/qch-urls.qdoc b/doc/global/externalsites/qch-urls.qdoc deleted file mode 100644 index 53ab94091e..0000000000 --- a/doc/global/externalsites/qch-urls.qdoc +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \externalpage http://doc.qt.digia.com/qtcreator/creator-qml-application.html - \title external: Developing Qt Quick Applications with Creator -*/ -/*! - \externalpage http://doc.qt.digia.com/qtcreator/creator-visual-editor.html - \title external: Developing Qt Quick Applications -*/ -/*! - \externalpage http://doc.qt.digia.com/qtcreator/creator-publish-ovi.html - \title external: Publishing Applications to Ovi Store -*/ -/*! - \externalpage http://doc.qt.io/qtcreator - \title external: Qt Creator Manual -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/index.html - \title external: Qt Mobility Manual -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/qml-plugins.html - \title external: Qt Mobility QML Plugins -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-project-managing.html - \title external: Creating Qt Projects in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-building-running.html - \title external: Building and Running Applications in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-running-targets.html - \title external: Set Compiler Targets in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-build-settings.html - \title external: Build Settings in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-run-settings.html - \title external: Run Settings in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-using-qt-designer.html - \title external: Designer in Creator -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-debugging.html - \title external: Debugging Applications in Creator -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/multimedia.html - \title external: Mobility Multimedia -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/location-overview.html - \title external: Mobility Location -*/ -/*! - \externalpage http://doc.qt.digia.com/qtmobility/all-examples.html - \title external: Qt Mobility Examples -*/ -/*! - \externalpage http://doc.qt.io/qtcreator/creator-overview.html - \title external: Qt Creator Overview -*/ diff --git a/doc/global/externalsites/qtcreator.qdoc b/doc/global/externalsites/qtcreator.qdoc index c2eed07c6d..c96920a689 100644 --- a/doc/global/externalsites/qtcreator.qdoc +++ b/doc/global/externalsites/qtcreator.qdoc @@ -392,6 +392,14 @@ \title Qt Creator: Adding New Custom Wizards */ /*! + \externalpage http://doc.qt.io/qtcreator/creator-project-wizards-json.html + \title Qt Creator: Adding JSON-Based Wizards +*/ +/*! + \externalpage http://doc.qt.io/qtcreator/creator-project-wizards-xml.html + \title Qt Creator: Adding XML-Based Wizards +*/ +/*! \externalpage http://doc.qt.io/qtcreator/creator-projects-autotools.html \title Qt Creator: Setting Up an Autotools Project */ diff --git a/mkspecs/macx-ios-clang/features/default_post.prf b/mkspecs/macx-ios-clang/features/default_post.prf index aa849eb8b1..f1f23dd716 100644 --- a/mkspecs/macx-ios-clang/features/default_post.prf +++ b/mkspecs/macx-ios-clang/features/default_post.prf @@ -174,6 +174,21 @@ macx-xcode { ios_device_family.value = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY QMAKE_MAC_XCODE_SETTINGS += ios_device_family + # If QMAKE_BUNDLE_DATA contains an asset catalog that includes an + # AppIcon.appiconset, we configure Xcode to use it for app icons. + for(bundle_data, QMAKE_BUNDLE_DATA) { + for(bundle_file, $${bundle_data}.files) { + !contains(bundle_file, .*\.xcassets$): next() + !exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next() + + asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME" + asset_catalog_appicon.value = "AppIcon" + QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon + break() + } + !isEmpty(asset_catalog_appicon.name): break() + } + # Set up default 4-inch iPhone/iPod launch image so that our apps # support the full screen resolution of those devices. launch_image = Default-568h@2x.png diff --git a/mkspecs/macx-ios-clang/qmake.conf b/mkspecs/macx-ios-clang/qmake.conf index 0c083edf80..0dd761760c 100644 --- a/mkspecs/macx-ios-clang/qmake.conf +++ b/mkspecs/macx-ios-clang/qmake.conf @@ -7,7 +7,7 @@ CONFIG += app_bundle reduce_exports incremental global_init_link QMAKE_INCREMENTAL_STYLE = sublib QMAKE_MACOSX_DEPLOYMENT_TARGET = -QMAKE_IOS_DEPLOYMENT_TARGET = 5.0 +QMAKE_IOS_DEPLOYMENT_TARGET = 5.1.1 INCLUDEPATH += $$PWD/ios DEFINES += DARWIN_NO_CARBON QT_NO_PRINTER QT_NO_PRINTDIALOG diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index ebadd52f99..4a1347c954 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -42,7 +42,7 @@ CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \ -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ -DUNICODE -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY -DQT_NO_STANDARDPATHS -CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) $(EXTRA_CPPFLAGS) +CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) CXXFLAGS_BARE = $(CFLAGS_BARE) CXXFLAGS = $(CFLAGS) diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 202df7e03c..b78a742999 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -122,10 +122,10 @@ configuration options to fine tune the build process. For more information, see \l{Building Common Project Types}. - You can use the \l{external: Qt Creator Manual}{Qt Creator} new project - wizard to create the project file. You choose the project template, and Qt - Creator creates a project file with default values that enable you to build - and run the project. You can modify the project file to suit your purposes. + You can use the \l{Qt Creator: Creating Projects}{Qt Creator new project wizard} to create the project file. + You choose the project template, and Qt Creator creates a project file with + default values that enable you to build and run the project. You can modify + the project file to suit your purposes. You can also use qmake to generate project files. For a full description of qmake command line options, see \l{Running qmake}. @@ -1464,6 +1464,15 @@ executable needs to be specified as long as it is on a path contained in the \c PATH variable when the Makefile is processed. + \section1 QMAKE_CFLAGS + + Specifies the C compiler flags for building + a project. The value of this variable is typically handled by + qmake or \l{#QMAKESPEC}{qmake.conf} and rarely + needs to be modified. The flags specific to debug and release modes can be + adjusted by modifying the \c QMAKE_CFLAGS_DEBUG and + \c QMAKE_CFLAGS_RELEASE variables, respectively. + \target QMAKE_CFLAGS_DEBUG \section1 QMAKE_CFLAGS_DEBUG diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 0ff42500de..8f24c20712 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -739,13 +739,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) mkt << "DEFINES = " << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") << varGlue("DEFINES","-D"," -D","") << endl; - mkt << "INCPATH = -I" << specdir(); - if(!project->isActiveConfig("no_include_pwd")) { - QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - if(pwd.isEmpty()) - pwd = "."; - mkt << " -I" << pwd; - } + mkt << "INCPATH ="; { const ProStringList &incs = project->values("INCLUDEPATH"); for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) @@ -1497,7 +1491,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t\t\t" << writeSettings("GCC_PRECOMPILE_PREFIX_HEADER", "YES") << ";\n" << "\t\t\t\t" << writeSettings("GCC_PREFIX_HEADER", escapeFilePath(project->first("PRECOMPILED_HEADER"))) << ";\n"; } - t << "\t\t\t\t" << writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH") + ProStringList(fixForOutput(specdir())), SettingsAsList, 5) << ";\n" + t << "\t\t\t\t" << writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH"), SettingsAsList, 5) << ";\n" << "\t\t\t\t" << writeSettings("LIBRARY_SEARCH_PATHS", fixListForOutput("QMAKE_PBX_LIBPATHS"), SettingsAsList, 5) << ";\n" << "\t\t\t\t" << writeSettings("FRAMEWORK_SEARCH_PATHS", fixListForOutput("QMAKE_FRAMEWORKPATH"), !project->values("QMAKE_FRAMEWORKPATH").isEmpty() ? SettingsAsList : 0, 5) << ";\n"; diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 4c501983d8..804eab9ca7 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -444,6 +444,25 @@ MakefileGenerator::init() setSystemIncludes(v["QMAKE_DEFAULT_INCDIRS"]); + ProStringList &incs = project->values("INCLUDEPATH"); + if (!project->isActiveConfig("no_include_pwd")) { + if (Option::output_dir != qmake_getpwd()) { + // Pretend that the build dir is the source dir for #include purposes, + // consistently with the "transparent shadow builds" strategy. This is + // also consistent with #include "foo.h" falling back to #include <foo.h> + // behavior if it doesn't find the file in the source dir. + incs.prepend(Option::output_dir); + } + // This makes #include <foo.h> work if the header lives in the source dir. + // The benefit of that is questionable, as generally the user should use the + // correct include style, and extra compilers that put stuff in the source dir + // should add the dir themselves. + // More importantly, it makes #include "foo.h" work with MSVC when shadow-building, + // as this compiler looks files up relative to %CD%, not the source file's parent. + incs.prepend(qmake_getpwd()); + } + incs.append(project->specDir()); + const char * const cacheKeys[] = { "_QMAKE_STASH_", "_QMAKE_SUPER_CACHE_", 0 }; for (int i = 0; cacheKeys[i]; ++i) { if (v[cacheKeys[i]].isEmpty()) @@ -793,12 +812,6 @@ MakefileGenerator::init() ProStringList incDirs = v["DEPENDPATH"] + v["QMAKE_ABSOLUTE_SOURCE_PATH"]; if(project->isActiveConfig("depend_includepath")) incDirs += v["INCLUDEPATH"]; - if(!project->isActiveConfig("no_include_pwd")) { - QString pwd = qmake_getpwd(); - if(pwd.isEmpty()) - pwd = "."; - incDirs += pwd; - } QList<QMakeLocalFileName> deplist; for (ProStringList::Iterator it = incDirs.begin(); it != incDirs.end(); ++it) deplist.append(QMakeLocalFileName(unescapeFilePath((*it).toQString()))); @@ -850,11 +863,6 @@ MakefileGenerator::init() (*it) = Option::fixPathToLocalOS((*it).toQString()); } - if(!project->isActiveConfig("no_include_pwd")) { //get the output_dir into the pwd - if(Option::output_dir != qmake_getpwd()) - project->values("INCLUDEPATH").append("."); - } - //fix up the target deps static const char * const fixpaths[] = { "PRE_TARGETDEPS", "POST_TARGETDEPS", 0 }; for (int path = 0; fixpaths[path]; path++) { diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 8270f02feb..469f23340d 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -184,13 +184,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << varGlue("DEFINES","-D"," -D","") << endl; t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)\n"; t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n"; - t << "INCPATH = -I" << specdir(); - if(!project->isActiveConfig("no_include_pwd")) { - QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - if(pwd.isEmpty()) - pwd = "."; - t << " -I" << pwd; - } + t << "INCPATH ="; { QString isystem = var("QMAKE_CFLAGS_ISYSTEM"); const ProStringList &incs = project->values("INCLUDEPATH"); @@ -1019,8 +1013,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t-$(DEL_FILE) -r " << bundlePath << endl; } else if(project->isActiveConfig("compile_libtool")) { t << "\t-$(LIBTOOL) --mode=clean $(DEL_FILE) $(TARGET)\n"; - } else if(!project->isActiveConfig("staticlib") && project->values("QMAKE_APP_FLAG").isEmpty() && - !project->isActiveConfig("plugin")) { + } else if (project->isActiveConfig("staticlib")) { + t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n"; + } else if (project->values("QMAKE_APP_FLAG").isEmpty() && !project->isActiveConfig("plugin")) { t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n"; if (!project->isActiveConfig("unversioned_libname")) { t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " @@ -1029,7 +1024,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t-$(DEL_FILE) $(TARGETA)\n"; } } else { - t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n"; + t << "\t-$(DEL_FILE) $(TARGET) \n"; } t << varGlue("QMAKE_DISTCLEAN","\t-$(DEL_FILE) "," ","\n"); { diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 3c53421fc4..f2d6678cdf 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -306,13 +306,6 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) { t << "INCPATH = "; - if (!project->isActiveConfig("no_include_pwd")) { - QString pwd = escapeFilePath(fileFixify(qmake_getpwd())); - if (pwd.isEmpty()) - pwd = "."; - t << "-I" << pwd << " "; - } - QString isystem = var("QMAKE_CFLAGS_ISYSTEM"); const ProStringList &incs = project->values("INCLUDEPATH"); for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) { @@ -326,8 +319,7 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) t << "-I"; t << quote << inc << quote << " "; } - t << "-I" << quote << specdir() << quote - << endl; + t << endl; } void MingwMakefileGenerator::writeLibsPart(QTextStream &t) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index f271eb0679..e3031d559c 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1688,7 +1688,6 @@ void VcprojGenerator::initOld() inc = QString("\"%1\"").arg(inc); // Quote all paths if not quoted already project->values("MSVCPROJ_INCPATH").append("-I" + inc); } - project->values("MSVCPROJ_INCPATH").append("-I" + specdir()); QString dest = Option::fixPathToTargetOS(project->first("TARGET").toQString()) + project->first("TARGET_EXT"); project->values("MSVCPROJ_TARGET") = ProStringList(dest); diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 81bc16a3c6..3a2e146a33 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -537,12 +537,13 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t) const QString del_statement("-$(DEL_FILE)"); if(project->isActiveConfig("no_delete_multiple_files")) { for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) - t << "\n\t" << del_statement << " " << escapeFilePath((*it)); + t << "\n\t" << del_statement + << ' ' << escapeFilePath(Option::fixPathToTargetOS((*it).toQString())); } else { QString files, file; const int commandlineLimit = 2047; // NT limit, expanded for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { - file = " " + escapeFilePath((*it)); + file = ' ' + escapeFilePath(Option::fixPathToTargetOS((*it).toQString())); if(del_statement.length() + files.length() + qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) { t << "\n\t" << del_statement << files; @@ -605,8 +606,7 @@ void Win32MakefileGenerator::writeIncPart(QTextStream &t) if(!inc.isEmpty()) t << "-I\"" << inc << "\" "; } - t << "-I\"" << specdir() << "\"" - << endl; + t << endl; } void Win32MakefileGenerator::writeStandardParts(QTextStream &t) diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 4eb624aa87..fe089c1059 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -944,6 +944,45 @@ void QMakeEvaluator::setTemplate() } } +#if defined(Q_CC_MSVC) +static ProString msvcBinDirToQMakeArch(QString subdir) +{ + int idx = subdir.indexOf(QLatin1Char('\\')); + if (idx == -1) + return ProString("x86"); + subdir.remove(0, idx + 1); + idx = subdir.indexOf(QLatin1Char('_')); + if (idx >= 0) + subdir.remove(0, idx + 1); + subdir = subdir.toLower(); + if (subdir == QStringLiteral("amd64")) + return ProString("x86_64"); + return ProString(subdir); +} + +static ProString defaultMsvcArchitecture() +{ + return ProString("x86"); +} + +static ProString msvcArchitecture(const QString &vcInstallDir, const QString &pathVar) +{ + if (vcInstallDir.isEmpty()) + return defaultMsvcArchitecture(); + QString vcBinDir = vcInstallDir; + if (vcBinDir.endsWith(QLatin1Char('\\'))) + vcBinDir.chop(1); + foreach (const QString &dir, pathVar.split(QLatin1Char(';'))) { + if (!dir.startsWith(vcBinDir, Qt::CaseInsensitive)) + continue; + const ProString arch = msvcBinDirToQMakeArch(dir.mid(vcBinDir.length() + 1)); + if (!arch.isEmpty()) + return arch; + } + return defaultMsvcArchitecture(); +} +#endif // defined(Q_CC_MSVC) + void QMakeEvaluator::loadDefaults() { ProValueMap &vars = m_valuemapStack.top(); @@ -1004,21 +1043,9 @@ void QMakeEvaluator::loadDefaults() vars[ProKey("QMAKE_HOST.arch")] << archStr; # if defined(Q_CC_MSVC) // ### bogus condition, but nobody x-builds for msvc with a different qmake - QLatin1Char backslash('\\'); - QString paths = m_option->getEnv(QLatin1String("PATH")); - QString vcBin64 = m_option->getEnv(QLatin1String("VCINSTALLDIR")); - if (!vcBin64.endsWith(backslash)) - vcBin64.append(backslash); - vcBin64.append(QLatin1String("bin\\amd64")); - QString vcBinX86_64 = m_option->getEnv(QLatin1String("VCINSTALLDIR")); - if (!vcBinX86_64.endsWith(backslash)) - vcBinX86_64.append(backslash); - vcBinX86_64.append(QLatin1String("bin\\x86_amd64")); - if (paths.contains(vcBin64, Qt::CaseInsensitive) - || paths.contains(vcBinX86_64, Qt::CaseInsensitive)) - vars[ProKey("QMAKE_TARGET.arch")] << ProString("x86_64"); - else - vars[ProKey("QMAKE_TARGET.arch")] << ProString("x86"); + vars[ProKey("QMAKE_TARGET.arch")] = msvcArchitecture( + m_option->getEnv(QLatin1String("VCINSTALLDIR")), + m_option->getEnv(QLatin1String("PATH"))); # endif #elif defined(Q_OS_UNIX) struct utsname name; diff --git a/src/3rdparty/zlib.pri b/src/3rdparty/zlib.pri index a7073d5c3a..868d1c71bb 100644 --- a/src/3rdparty/zlib.pri +++ b/src/3rdparty/zlib.pri @@ -1,5 +1,5 @@ wince*: DEFINES += NO_ERRNO_H -INCLUDEPATH += $$PWD/zlib +INCLUDEPATH = $$PWD/zlib $$INCLUDEPATH SOURCES+= \ $$PWD/zlib/adler32.c \ $$PWD/zlib/compress.c \ diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java index 34fc31b222..516671739e 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java @@ -45,7 +45,6 @@ package org.qtproject.qt5.android; import android.app.Activity; import android.content.Context; import android.graphics.PixelFormat; -import android.util.Log; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.SurfaceHolder; @@ -87,7 +86,6 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback @Override public void surfaceCreated(SurfaceHolder holder) { - QtNative.setSurface(getId(), holder.getSurface(), getWidth(), getHeight()); } @Override diff --git a/src/corelib/doc/src/external-resources.qdoc b/src/corelib/doc/src/external-resources.qdoc index a4f1b8723a..03af1d81bf 100644 --- a/src/corelib/doc/src/external-resources.qdoc +++ b/src/corelib/doc/src/external-resources.qdoc @@ -55,3 +55,14 @@ \externalpage http://www.iana.org/assignments/character-sets/character-sets.xml \title IANA character-sets encoding file */ + +/*! + \externalpage http://doc-snapshot.qt-project.org/qt5-5.4/qtdesigner-manual.html + \title Using a Designer UI File in Your Application +*/ + +/*! + \externalpage http://doc-snapshot.qt-project.org/qt5-5.4/designer-widget-mode.html#the-property-editor + \title Qt Designer's Widget Editing Mode#The Property Editor +*/ +*/ diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 2698098be0..d592032c1f 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -116,10 +116,11 @@ QLibrarySettings::QLibrarySettings() QStringList children = settings->childGroups(); #ifdef QT_BOOTSTRAPPED haveEffectiveSourcePaths = children.contains(QLatin1String("EffectiveSourcePaths")); - haveEffectivePaths = haveEffectiveSourcePaths || children.contains(QLatin1String("EffectivePaths")); #else - haveEffectivePaths = children.contains(QLatin1String("EffectivePaths")); + // EffectiveSourcePaths is for the Qt build only, so needs no backwards compat trickery. + bool haveEffectiveSourcePaths = false; #endif + haveEffectivePaths = haveEffectiveSourcePaths || children.contains(QLatin1String("EffectivePaths")); // Backwards compat: an existing but empty file is claimed to contain the Paths section. havePaths = (!haveEffectivePaths && !children.contains(QLatin1String(platformsSection))) || children.contains(QLatin1String("Paths")); @@ -128,9 +129,7 @@ QLibrarySettings::QLibrarySettings() settings.reset(0); #else } else { -#ifdef QT_BOOTSTRAPPED haveEffectiveSourcePaths = false; -#endif haveEffectivePaths = false; havePaths = false; #endif diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm index 01d1c01f78..13b864600e 100644 --- a/src/corelib/io/qstandardpaths_mac.mm +++ b/src/corelib/io/qstandardpaths_mac.mm @@ -167,6 +167,7 @@ QString QStandardPaths::writableLocation(StandardLocation type) case TempLocation: return QDir::tempPath(); case GenericDataLocation: + case AppDataLocation: case AppLocalDataLocation: case GenericCacheLocation: case CacheLocation: diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 492031d7fe..a1a04b3ce5 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2741,9 +2741,9 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign You can check if the QMetaObject::Connection is valid by casting it to a bool. This function works in the same way as - connect(const QObject *sender, const char *signal, + \c {connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, - Qt::ConnectionType type) + Qt::ConnectionType type)} but it uses QMetaMethod to specify signal and method. \sa connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) @@ -2996,7 +2996,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal, otherwise returns \c false. This function provides the same possibilities like - disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) + \c {disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) } but uses QMetaMethod to represent the signal and the method to be disconnected. Additionally this function returnsfalse and no signals and slots disconnected @@ -4110,7 +4110,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) { This macro associates extra information to the class, which is available using QObject::metaObject(). Qt makes only limited use of this feature, in - the \l{Active Qt}, \l{Qt D-Bus} and \l{Qt QML} modules. + the \l{Active Qt}, \l{Qt D-Bus} and \l{Qt QML module}{Qt QML}. The extra information takes the form of a \a Name string and a \a Value literal string. @@ -4122,7 +4122,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) { \sa QMetaObject::classInfo() \sa QAxFactory \sa {Using Qt D-Bus Adaptors} - \sa {Extending QML - Default Property Example} + \sa {Extending QML} */ /*! diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index d8b2efbef3..a3c1cc3907 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -43,6 +43,7 @@ #include <qmath.h> #ifndef QT_NO_COMPRESS +#include <zconf.h> #include <zlib.h> #endif #include <ctype.h> diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index d52dea8d4f..082b721e82 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3296,8 +3296,8 @@ bool QDateTime::isDaylightTime() const } /*! - Sets the date part of this datetime to \a date. - If no time is set, it is set to midnight. + Sets the date part of this datetime to \a date. If no time is set yet, it + is set to midnight. If \a date is invalid, this QDateTime becomes invalid. \sa date(), setTime(), setTimeSpec() */ @@ -3309,7 +3309,14 @@ void QDateTime::setDate(const QDate &date) } /*! - Sets the time part of this datetime to \a time. + Sets the time part of this datetime to \a time. If \a time is not valid, + this function sets it to midnight. Therefore, it's possible to clear any + set time in a QDateTime by setting it to a default QTime: + + \code + QDateTime dt = QDateTime::currentDateTime(); + dt.setTime(QTime()); + \endcode \sa time(), setDate(), setTimeSpec() */ diff --git a/src/corelib/tools/qvsnprintf.cpp b/src/corelib/tools/qvsnprintf.cpp index cf595b8f31..be92e20fac 100644 --- a/src/corelib/tools/qvsnprintf.cpp +++ b/src/corelib/tools/qvsnprintf.cpp @@ -97,6 +97,7 @@ int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap) #endif /*! + \target bytearray-qsnprintf \relates QByteArray A portable snprintf() function, calls qvsnprintf. diff --git a/src/dbus/doc/src/qtdbus-index.qdoc b/src/dbus/doc/src/qtdbus-index.qdoc index 2249924ada..d534ea9140 100644 --- a/src/dbus/doc/src/qtdbus-index.qdoc +++ b/src/dbus/doc/src/qtdbus-index.qdoc @@ -212,5 +212,22 @@ \li \l{Qt D-Bus XML compiler (qdbusxml2cpp)} \li \l{Qt D-Bus C++ Classes} \li \l{Qt D-Bus Examples} + \li \l{D-Bus Viewer} \endlist */ + +/*! + \page qdbusviewer.html + \title D-Bus Viewer + \keyword qdbusviewer + + The Qt D-Bus Viewer is a tool that lets you introspect D-Bus objects and messages. You can + choose between the system bus and the session bus. Click on any service on the list + on the left side to see all the exported objects. + + You can invoke methods by double-clicking on them. If a method takes one or more IN parameters, + a property editor opens. + + Right-click on a signal to connect to it. All emitted signals including their parameters + are output in the message view on the lower side of the window. +*/ diff --git a/src/dbus/qdbus_symbols.cpp b/src/dbus/qdbus_symbols.cpp index e475a23f48..67643098d9 100644 --- a/src/dbus/qdbus_symbols.cpp +++ b/src/dbus/qdbus_symbols.cpp @@ -86,9 +86,9 @@ bool qdbus_loadLibDBus() static int majorversions[] = { 3, 2, -1 }; const QString baseNames[] = { #ifdef Q_OS_WIN - QStringLiteral("dbus-1"), + QLatin1String("dbus-1"), #endif - QStringLiteral("libdbus-1") + QLatin1String("libdbus-1") }; lib->unload(); diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h index 0785fea4b4..4bec3af490 100644 --- a/src/dbus/qdbus_symbols_p.h +++ b/src/dbus/qdbus_symbols_p.h @@ -323,6 +323,8 @@ DEFINEFUNC(void , dbus_pending_call_unref, (DBusPendingCall /* dbus-server.h */ DEFINEFUNC(dbus_bool_t , dbus_server_allocate_data_slot, (dbus_int32_t *slot_p), (slot_p), return) +DEFINEFUNC(void , dbus_server_free_data_slot, (dbus_int32_t *slot_p), + (slot_p), return) DEFINEFUNC(void , dbus_server_disconnect, (DBusServer *server), (server), ) DEFINEFUNC(char* , dbus_server_get_address, (DBusServer *server), diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index dd92602dce..698fb1b46c 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -66,6 +66,9 @@ QT_BEGIN_NAMESPACE +// used with dbus_server_allocate_data_slot +static dbus_int32_t server_slot = -1; + static QBasicAtomicInt isDebugging = Q_BASIC_ATOMIC_INITIALIZER(-1); #define qDBusDebug if (::isDebugging == 0); else qDebug @@ -1084,8 +1087,10 @@ void QDBusConnectionPrivate::closeConnection() mode = InvalidMode; // prevent reentrancy baseService.clear(); - if (server) + if (server) { q_dbus_server_disconnect(server); + q_dbus_server_free_data_slot(&server_slot); + } if (oldMode == ClientMode || oldMode == PeerMode) { if (connection) { @@ -1651,8 +1656,6 @@ void QDBusConnectionPrivate::handleSignal(const QDBusMessage& msg) handleSignal(key, msg); // third try } -static dbus_int32_t server_slot = -1; - void QDBusConnectionPrivate::setServer(DBusServer *s, const QDBusErrorInternal &error) { mode = ServerMode; diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp index b2c76a8750..3fec7c9111 100644 --- a/src/dbus/qdbusserver.cpp +++ b/src/dbus/qdbusserver.cpp @@ -110,6 +110,7 @@ QDBusServer::~QDBusServer() } d->serverConnectionNames.clear(); } + d->deleteLater(); } /*! diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 0c3ea37b29..f5e6f7cca6 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -1075,9 +1075,9 @@ void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem) } } -bool QPaintEngineEx::requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &t) const +bool QPaintEngineEx::requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &) const { - return t.type() >= QTransform::TxProject; + return false; } bool QPaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h index 5475503f22..5fc8bbaf09 100644 --- a/src/gui/painting/qpathclipper_p.h +++ b/src/gui/painting/qpathclipper_p.h @@ -414,22 +414,6 @@ inline void QPathSegments::addIntersection(int index, const Intersection &inters } } -inline void QWingedEdge::TraversalStatus::flipDirection() -{ - direction = QWingedEdge::flip(direction); -} - -inline void QWingedEdge::TraversalStatus::flipTraversal() -{ - traversal = QWingedEdge::flip(traversal); -} - -inline void QWingedEdge::TraversalStatus::flip() -{ - flipDirection(); - flipTraversal(); -} - inline int QWingedEdge::edgeCount() const { return m_edges.size(); @@ -471,11 +455,27 @@ inline QPathEdge::Traversal QWingedEdge::flip(QPathEdge::Traversal traversal) return traversal == QPathEdge::RightTraversal ? QPathEdge::LeftTraversal : QPathEdge::RightTraversal; } +inline void QWingedEdge::TraversalStatus::flipTraversal() +{ + traversal = QWingedEdge::flip(traversal); +} + inline QPathEdge::Direction QWingedEdge::flip(QPathEdge::Direction direction) { return direction == QPathEdge::Forward ? QPathEdge::Backward : QPathEdge::Forward; } +inline void QWingedEdge::TraversalStatus::flipDirection() +{ + direction = QWingedEdge::flip(direction); +} + +inline void QWingedEdge::TraversalStatus::flip() +{ + flipDirection(); + flipTraversal(); +} + QT_END_NAMESPACE #endif // QPATHCLIPPER_P_H diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 9610482145..e010dd62ae 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -647,7 +647,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const e.g. for italicized fonts, and that the width of the returned rectangle might be different than what the width() method returns. - If you want to know the advance width of the string (to layout + If you want to know the advance width of the string (to lay out a set of strings next to each other), use width() instead. Newline characters are processed as normal characters, \e not as @@ -817,7 +817,7 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA e.g. for italicized fonts, and that the width of the returned rectangle might be different than what the width() method returns. - If you want to know the advance width of the string (to layout + If you want to know the advance width of the string (to lay out a set of strings next to each other), use width() instead. Newline characters are processed as normal characters, \e not as @@ -1432,7 +1432,7 @@ qreal QFontMetricsF::width(QChar ch) const e.g. for italicized fonts, and that the width of the returned rectangle might be different than what the width() method returns. - If you want to know the advance width of the string (to layout + If you want to know the advance width of the string (to lay out a set of strings next to each other), use width() instead. Newline characters are processed as normal characters, \e not as @@ -1606,7 +1606,7 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta e.g. for italicized fonts, and that the width of the returned rectangle might be different than what the width() method returns. - If you want to know the advance width of the string (to layout + If you want to know the advance width of the string (to lay out a set of strings next to each other), use width() instead. Newline characters are processed as normal characters, \e not as diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index 10fdf2f97d..b68f6adfff 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -778,18 +778,34 @@ bool QHostAddress::operator==(const QHostAddress &other) const bool QHostAddress::operator ==(SpecialAddress other) const { QT_ENSURE_PARSED(this); - QHostAddress otherAddress(other); - QT_ENSURE_PARSED(&otherAddress); + switch (other) { + case Null: + return d->protocol == QAbstractSocket::UnknownNetworkLayerProtocol; - if (d->protocol == QAbstractSocket::IPv4Protocol) - return otherAddress.d->protocol == QAbstractSocket::IPv4Protocol && d->a == otherAddress.d->a; - if (d->protocol == QAbstractSocket::IPv6Protocol) { - return otherAddress.d->protocol == QAbstractSocket::IPv6Protocol - && memcmp(&d->a6, &otherAddress.d->a6, sizeof(Q_IPV6ADDR)) == 0; + case Broadcast: + return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_BROADCAST; + + case LocalHost: + return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_LOOPBACK; + + case Any: + return d->protocol == QAbstractSocket::AnyIPProtocol; + + case AnyIPv4: + return d->protocol == QAbstractSocket::IPv4Protocol && d->a == INADDR_ANY; + + case LocalHostIPv6: + case AnyIPv6: + if (d->protocol == QAbstractSocket::IPv6Protocol) { + Q_IPV6ADDR ip6 = { { 0 } }; + ip6[15] = quint8(other == LocalHostIPv6); // 1 for localhost, 0 for any + return memcmp(&d->a6, &ip6, sizeof ip6) == 0; + } + return false; } - if (d->protocol == QAbstractSocket::AnyIPProtocol) - return other == QHostAddress::Any; - return int(other) == int(Null); + + Q_UNREACHABLE(); + return false; } /*! diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index ad170e187c..eed1b70025 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -567,9 +567,6 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &address, quint16 return false; } - localPort = port; - localAddress = address; - #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativeBind(%s, %i) == true", address.toString().toLatin1().constData(), port); diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index f5943d657f..184add15c3 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -852,9 +852,6 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &a, quint16 port) return false; } - localPort = port; - localAddress = address; - #if defined (QNATIVESOCKETENGINE_DEBUG) qDebug("QNativeSocketEnginePrivate::nativeBind(%s, %i) == true", address.toString().toLatin1().constData(), port); diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 5dec1d0915..27ff33be86 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -521,6 +521,11 @@ QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintin break; } + if (QGuiApplication::platformNativeInterface()->nativeResourceForScreen("nofonthinting", + QGuiApplication::primaryScreen())) { + return QFontEngine::HintNone; + } + if (useXftConf) { void *hintStyleResource = QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle", diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index d1e78dfe5d..1c157c79c3 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -376,8 +376,6 @@ namespace QtAndroid const auto &it = m_surfaces.find(surfaceId); if (it != m_surfaces.end()) m_surfaces.remove(surfaceId); - if (m_surfaces.isEmpty()) - m_surfaceId = 1; QJNIEnvironmentPrivate env; if (!env) diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp index 5781f0d7c6..4c38178343 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp @@ -50,8 +50,10 @@ QAndroidPlatformOpenGLContext::QAndroidPlatformOpenGLContext(const QSurfaceForma void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface) { - if (surface->surface()->surfaceClass() == QSurface::Window) - static_cast<QAndroidPlatformOpenGLWindow *>(surface)->checkNativeSurface(eglConfig()); + if (surface->surface()->surfaceClass() == QSurface::Window && + static_cast<QAndroidPlatformOpenGLWindow *>(surface)->checkNativeSurface(eglConfig())) { + QEGLPlatformContext::makeCurrent(surface); + } QEGLPlatformContext::swapBuffers(surface); } diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp index 8dc8e84f0a..de7f1f6990 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp @@ -138,19 +138,19 @@ EGLSurface QAndroidPlatformOpenGLWindow::eglSurface(EGLConfig config) return m_eglSurface; } -void QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config) +bool QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config) { QMutexLocker lock(&m_surfaceMutex); if (m_nativeSurfaceId == -1 || !m_androidSurfaceObject.isValid()) - return; + return false; // makeCurrent is NOT needed. createEgl(config); - // we've create another surface, the window should be repainted QRect availableGeometry = screen()->availableGeometry(); if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0) QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size()))); + return true; // makeCurrent is needed! } void QAndroidPlatformOpenGLWindow::applicationStateChanged(Qt::ApplicationState state) @@ -209,15 +209,19 @@ void QAndroidPlatformOpenGLWindow::surfaceChanged(JNIEnv *jniEnv, jobject surfac Q_UNUSED(jniEnv); Q_UNUSED(w); Q_UNUSED(h); + lockSurface(); m_androidSurfaceObject = surface; - m_surfaceWaitCondition.wakeOne(); + if (surface) // wait until we have a valid surface to draw into + m_surfaceWaitCondition.wakeOne(); unlockSurface(); - // repaint the window - QRect availableGeometry = screen()->availableGeometry(); - if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0) - QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size()))); + if (surface) { + // repaint the window, when we have a valid surface + QRect availableGeometry = screen()->availableGeometry(); + if (geometry().width() > 0 && geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0) + QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), geometry().size()))); + } } QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.h b/src/plugins/platforms/android/qandroidplatformopenglwindow.h index 71787edee1..6d6548fc6a 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.h +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.h @@ -54,7 +54,7 @@ public: EGLSurface eglSurface(EGLConfig config); QSurfaceFormat format() const; - void checkNativeSurface(EGLConfig config); + bool checkNativeSurface(EGLConfig config); void applicationStateChanged(Qt::ApplicationState); @@ -66,7 +66,7 @@ protected: void clearEgl(); private: - EGLDisplay m_eglDisplay; + EGLDisplay m_eglDisplay = EGL_NO_DISPLAY; EGLSurface m_eglSurface = EGL_NO_SURFACE; EGLNativeWindowType m_nativeWindow = nullptr; diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp index b70f936be1..092ade2e4a 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.cpp +++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp @@ -391,7 +391,7 @@ Qt::ScreenOrientation QAndroidPlatformScreen::nativeOrientation() const void QAndroidPlatformScreen::surfaceChanged(JNIEnv *env, jobject surface, int w, int h) { lockSurface(); - if (surface && w && h) { + if (surface && w > 0 && h > 0) { releaseSurface(); m_nativeSurface = ANativeWindow_fromSurface(env, surface); QMetaObject::invokeMethod(this, "setDirty", Qt::QueuedConnection, Q_ARG(QRect, QRect(0, 0, w, h))); diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 8d8df13dc3..fa71ab4086 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -48,7 +48,7 @@ class QCocoaBackingStore; class QCocoaGLContext; QT_END_NAMESPACE -Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper); +Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); @interface QT_MANGLE_NAMESPACE(QNSView) : NSView <NSTextInputClient> { QImage m_backingStore; @@ -72,7 +72,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QNSViewMouseMoveHelper); bool m_shouldSetGLContextinDrawRect; #endif NSString *m_inputSource; - QNSViewMouseMoveHelper *m_mouseMoveHelper; + QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) *m_mouseMoveHelper; bool m_resendKeyEvent; } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 699340795d..771b464805 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -83,7 +83,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; - (CGFloat)deviceDeltaZ; @end -@interface QNSViewMouseMoveHelper : NSObject +@interface QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) : NSObject { QNSView *view; } @@ -97,7 +97,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; @end -@implementation QNSViewMouseMoveHelper +@implementation QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) - (id)initWithView:(QNSView *)theView { @@ -158,7 +158,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; currentCustomDragTypes = 0; m_sendUpAsRightButton = false; m_inputSource = 0; - m_mouseMoveHelper = [[QNSViewMouseMoveHelper alloc] initWithView:self]; + m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self]; m_resendKeyEvent = false; if (!touchDevice) { diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 4af2a4965f..712bf0098b 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -46,6 +46,7 @@ #include <qpa/qwindowsysteminterface.h> #include "qiosapplicationdelegate.h" #include "qiosviewcontroller.h" +#include "quiview.h" #include <sys/sysctl.h> @@ -244,6 +245,22 @@ void QIOSScreen::updateProperties() m_geometry = fromCGRect([rootView convertRect:m_uiScreen.bounds fromView:m_uiWindow]).toRect(); m_availableGeometry = fromCGRect([rootView convertRect:m_uiScreen.applicationFrame fromView:m_uiWindow]).toRect(); + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0 && ![m_uiWindow.rootViewController shouldAutorotate]) { + // Setting the statusbar orientation (content orientation) on iOS8+ will result in the UIScreen + // updating its geometry and available geometry, which in the case of content orientation is not + // what we want. We want to reflect the screen geometry based on the locked orientation, and + // adjust the available geometry based on the repositioned status bar for the current status + // bar orientation. + + Qt::ScreenOrientation lockedOrientation = toQtScreenOrientation(UIDeviceOrientation(rootView.qtViewController.lockedOrientation)); + Qt::ScreenOrientation contenOrientation = toQtScreenOrientation(UIDeviceOrientation([UIApplication sharedApplication].statusBarOrientation)); + + QTransform transform = screen()->transformBetween(lockedOrientation, contenOrientation, m_geometry).inverted(); + + m_geometry = transform.mapRect(m_geometry); + m_availableGeometry = transform.mapRect(m_availableGeometry); + } + if (m_geometry != previousGeometry || m_availableGeometry != previousAvailableGeometry) { const qreal millimetersPerInch = 25.4; m_physicalSize = QSizeF(m_geometry.size()) / m_unscaledDpi * millimetersPerInch; diff --git a/src/plugins/platforms/ios/qiostextresponder.h b/src/plugins/platforms/ios/qiostextresponder.h index 118ab8958a..21b61bf8da 100644 --- a/src/plugins/platforms/ios/qiostextresponder.h +++ b/src/plugins/platforms/ios/qiostextresponder.h @@ -51,6 +51,7 @@ class QIOSInputContext; QIOSInputContext *m_inputContext; QString m_markedText; BOOL m_inSendEventToFocusObject; + BOOL m_inSelectionChange; } - (id)initWithInputContext:(QIOSInputContext *)context; diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index bebc7577f8..15fade0838 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -171,6 +171,7 @@ return self; m_inSendEventToFocusObject = NO; + m_inSelectionChange = NO; m_inputContext = inputContext; QVariantMap platformData = [self imValue:Qt::ImPlatformData].toMap(); @@ -302,6 +303,7 @@ return; if (updatedProperties & (Qt::ImCursorPosition | Qt::ImAnchorPosition)) { + QScopedValueRollback<BOOL> rollback(m_inSelectionChange, true); [self.inputDelegate selectionWillChange:self]; [self.inputDelegate selectionDidChange:self]; } @@ -349,6 +351,15 @@ - (void)setSelectedTextRange:(UITextRange *)range { + if (m_inSelectionChange) { + // After [UITextInputDelegate selectionWillChange], UIKit will cancel + // any ongoing auto correction (if enabled) and ask us to set an empty selection. + // This is contradictory to our current attempt to set a selection, so we ignore + // the callback. UIKit will be re-notified of the new selection after + // [UITextInputDelegate selectionDidChange]. + return; + } + QUITextRange *r = static_cast<QUITextRange *>(range); QList<QInputMethodEvent::Attribute> attrs; attrs << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, r.range.location, r.range.length, 0); diff --git a/src/plugins/platforms/ios/qiosviewcontroller.h b/src/plugins/platforms/ios/qiosviewcontroller.h index 586edd589d..df7ce0ff4a 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.h +++ b/src/plugins/platforms/ios/qiosviewcontroller.h @@ -35,15 +35,17 @@ class QIOSScreen; -@interface QIOSViewController : UIViewController { - QIOSScreen *m_screen; -} +@interface QIOSViewController : UIViewController -@property (nonatomic, assign) BOOL changingOrientation; +- (id)initWithQIOSScreen:(QIOSScreen *)screen; +- (void)updateProperties; + +@property (nonatomic, assign) UIInterfaceOrientation lockedOrientation; + +// UIViewController +@property (nonatomic, assign) BOOL shouldAutorotate; @property (nonatomic, assign) BOOL prefersStatusBarHidden; @property (nonatomic, assign) UIStatusBarAnimation preferredStatusBarUpdateAnimation; -- (id)initWithQIOSScreen:(QIOSScreen *)screen; -- (void)updateProperties; @end diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index f678f7e807..01bc84ae68 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -41,6 +41,8 @@ #import "qiosviewcontroller.h" +#include <QtCore/qscopedvaluerollback.h> + #include <QtGui/QGuiApplication> #include <QtGui/QWindow> #include <QtGui/QScreen> @@ -119,6 +121,13 @@ // ------------------------------------------------------------------------- +@interface QIOSViewController () { + QIOSScreen *m_screen; + BOOL m_updatingProperties; +} +@property (nonatomic, assign) BOOL changingOrientation; +@end + @implementation QIOSViewController - (id)initWithQIOSScreen:(QIOSScreen *)screen @@ -147,6 +156,7 @@ #endif self.changingOrientation = NO; + self.shouldAutorotate = [super shouldAutorotate]; // Status bar may be initially hidden at startup through Info.plist self.prefersStatusBarHidden = infoPlistValue(@"UIStatusBarHidden", false); @@ -173,6 +183,10 @@ [center addObserver:self selector:@selector(willChangeStatusBarFrame:) name:UIApplicationWillChangeStatusBarFrameNotification object:[UIApplication sharedApplication]]; + + [center addObserver:self selector:@selector(didChangeStatusBarOrientation:) + name:UIApplicationDidChangeStatusBarOrientationNotification + object:[UIApplication sharedApplication]]; } - (void)viewDidUnload @@ -183,19 +197,16 @@ // ------------------------------------------------------------------------- --(BOOL)shouldAutorotate -{ - // Until a proper orientation and rotation API is in place, we always auto rotate. - // If auto rotation is not wanted, you would need to switch it off manually from Info.plist. - return YES; -} - #if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_6_0) -(NSUInteger)supportedInterfaceOrientations { - // We need to tell iOS that we support all orientations in order to set - // status bar orientation when application content orientation changes. - return UIInterfaceOrientationMaskAll; + // As documented by Apple in the iOS 6.0 release notes, setStatusBarOrientation:animated: + // only works if the supportedInterfaceOrientations of the view controller is 0, making + // us responsible for ensuring that the status bar orientation is consistent. We enter + // this mode when auto-rotation is disabled due to an explicit content orientation being + // set on the focus window. Note that this is counter to what the documentation for + // supportedInterfaceOrientations says, which states that the method should not return 0. + return [self shouldAutorotate] ? UIInterfaceOrientationMaskAll : 0; } #endif @@ -203,7 +214,7 @@ -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { Q_UNUSED(interfaceOrientation); - return YES; + return [self shouldAutorotate]; } #endif @@ -250,6 +261,22 @@ }]; } +- (void)didChangeStatusBarOrientation:(NSNotification *)notification +{ + Q_UNUSED(notification); + + if (self.view.window.screen != [UIScreen mainScreen]) + return; + + // If the statusbar changes orientation due to auto-rotation we don't care, + // there will be re-layout anyways. Only if the statusbar changes due to + // reportContentOrientation, we need to update the window layout. + if (self.changingOrientation) + return; + + [self.view setNeedsLayout]; +} + - (void)viewWillLayoutSubviews { if (!QCoreApplication::instance()) @@ -265,6 +292,15 @@ if (!isQtApplication()) return; + // Prevent recursion caused by updating the status bar appearance (position + // or visibility), which in turn may cause a layout of our subviews, and + // a reset of window-states, which themselves affect the view controller + // properties such as the statusbar visibilty. + if (m_updatingProperties) + return; + + QScopedValueRollback<BOOL> updateRollback(m_updatingProperties, YES); + QWindow *focusWindow = QGuiApplication::focusWindow(); // If we don't have a focus window we leave the statusbar @@ -281,6 +317,8 @@ // All decisions are based on the the top level window focusWindow = qt_window_private(focusWindow)->topLevelWindow(); + UIApplication *uiApplication = [UIApplication sharedApplication]; + bool currentStatusBarVisibility = self.prefersStatusBarHidden; self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen; @@ -291,13 +329,60 @@ } else #endif { - [[UIApplication sharedApplication] - setStatusBarHidden:self.prefersStatusBarHidden + [uiApplication setStatusBarHidden:self.prefersStatusBarHidden withAnimation:self.preferredStatusBarUpdateAnimation]; } [self.view setNeedsLayout]; } + + + // -------------- Content orientation --------------- + + static BOOL kAnimateContentOrientationChanges = YES; + + Qt::ScreenOrientation contentOrientation = focusWindow->contentOrientation(); + if (contentOrientation != Qt::PrimaryOrientation) { + // An explicit content orientation has been reported for the focus window, + // so we keep the status bar in sync with content orientation. This will ensure + // that the task bar (and associated gestures) are also rotated accordingly. + + if (self.shouldAutorotate) { + // We are moving from Qt::PrimaryOrientation to an explicit orientation, + // so we need to store the current statusbar orientation, as we need it + // later when mapping screen coordinates for QScreen and for returning + // to Qt::PrimaryOrientation. + self.lockedOrientation = uiApplication.statusBarOrientation; + + // Calling setStatusBarOrientation only has an effect when auto-rotation is + // disabled, which makes sense when there's an explicit content orientation. + self.shouldAutorotate = NO; + } + + [uiApplication setStatusBarOrientation: + UIInterfaceOrientation(fromQtScreenOrientation(contentOrientation)) + animated:kAnimateContentOrientationChanges]; + + } else { + // The content orientation is set to Qt::PrimaryOrientation, meaning + // that auto-rotation should be enabled. But we may be coming out of + // a state of locked orientation, which needs some cleanup before we + // can enable auto-rotation again. + if (!self.shouldAutorotate) { + // First we need to restore the statusbar to what it was at the + // time of locking the orientation, otherwise iOS will be very + // confused when it starts doing auto-rotation again. + [uiApplication setStatusBarOrientation: + UIInterfaceOrientation(self.lockedOrientation) + animated:kAnimateContentOrientationChanges]; + + // Then we can re-enable auto-rotation + self.shouldAutorotate = YES; + + // And finally let iOS rotate the root view to match the device orientation + [UIViewController attemptRotationToDeviceOrientation]; + } + } } #if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0) diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 480062e4de..6c4614408d 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -75,6 +75,15 @@ QIOSWindow::QIOSWindow(QWindow *window) setWindowState(window->windowState()); setOpacity(window->opacity()); + + Qt::ScreenOrientation initialOrientation = window->contentOrientation(); + if (initialOrientation != Qt::PrimaryOrientation) { + // Start up in portrait, then apply possible content orientation, + // as per Apple's documentation. + dispatch_async(dispatch_get_main_queue(), ^{ + handleContentOrientationChange(initialOrientation); + }); + } } QIOSWindow::~QIOSWindow() @@ -322,10 +331,12 @@ void QIOSWindow::updateWindowLevel() void QIOSWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { - // Keep the status bar in sync with content orientation. This will ensure - // that the task bar (and associated gestures) are aligned correctly: - UIInterfaceOrientation uiOrientation = UIInterfaceOrientation(fromQtScreenOrientation(orientation)); - [[UIApplication sharedApplication] setStatusBarOrientation:uiOrientation animated:NO]; + // Update the QWindow representation straight away, so that + // we can update the statusbar orientation based on the new + // content orientation. + qt_window_private(window())->contentOrientation = orientation; + + [m_view.qtViewController updateProperties]; } void QIOSWindow::applicationStateChanged(Qt::ApplicationState) diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp index fce60c3169..d3eb049269 100644 --- a/src/plugins/platforms/windows/qwindowsdrag.cpp +++ b/src/plugins/platforms/windows/qwindowsdrag.cpp @@ -626,7 +626,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState, const QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(m_window, windowsDrag->dropData(), m_lastPoint / QWindowsScaling::factor(), - translateToQDragDropActions(*pdwEffect)); + translateToQDragDropActions(m_chosenEffect)); if (response.isAccepted()) { const Qt::DropAction action = response.acceptedAction(); diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 3058b29f2d..31dedd40a2 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -78,7 +78,8 @@ static int resourceType(const QByteArray &key) QByteArrayLiteral("startupid"), QByteArrayLiteral("traywindow"), QByteArrayLiteral("gettimestamp"), QByteArrayLiteral("x11screen"), QByteArrayLiteral("rootwindow"), - QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingEnabled") + QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingEnabled"), + QByteArrayLiteral("nofonthinting") }; const QByteArray *end = names + sizeof(names) / sizeof(names[0]); const QByteArray *result = std::find(names, end, key); @@ -283,6 +284,9 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resource, Q case GetTimestamp: result = getTimestamp(xcbScreen); break; + case NoFontHinting: + result = xcbScreen->noFontHinting() ? this : 0; //qboolptr... + break; default: break; } diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index b667f1a372..330dd008c4 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -67,7 +67,8 @@ public: X11Screen, RootWindow, ScreenSubpixelType, - ScreenAntialiasingEnabled + ScreenAntialiasingEnabled, + NoFontHinting }; QXcbNativeInterface(); diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 8bdedba8ac..7136455754 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -53,7 +53,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, , m_screen(scr) , m_crtc(output ? output->crtc : 0) , m_outputName(outputName) - , m_sizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize()) + , m_outputSizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize()) , m_virtualSize(scr->width_in_pixels, scr->height_in_pixels) , m_virtualSizeMillimeters(scr->width_in_millimeters, scr->height_in_millimeters) , m_orientation(Qt::PrimaryOrientation) @@ -62,6 +62,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, , m_forcedDpi(-1) , m_devicePixelRatio(1) , m_hintStyle(QFontEngine::HintStyle(-1)) + , m_noFontHinting(false) , m_subpixelType(QFontEngine::SubpixelAntialiasingType(-1)) , m_antialiasingEnabled(-1) , m_xSettings(0) @@ -71,18 +72,27 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, updateGeometry(output ? output->timestamp : 0); updateRefreshRate(); + const int dpr = int(devicePixelRatio()); // On VNC, it can be that physical size is unknown while // virtual size is known (probably back-calculated from DPI and resolution) if (m_sizeMillimeters.isEmpty()) m_sizeMillimeters = m_virtualSizeMillimeters; - if (m_geometry.isEmpty()) + if (m_geometry.isEmpty()) { m_geometry = QRect(QPoint(), m_virtualSize/dpr); + m_nativeGeometry = QRect(QPoint(), m_virtualSize); + } if (m_availableGeometry.isEmpty()) m_availableGeometry = m_geometry; readXResources(); + // disable font hinting when we do UI scaling + static bool dpr_scaling_enabled = (qgetenv("QT_DEVICE_PIXEL_RATIO").toInt() > 1 + || qgetenv("QT_DEVICE_PIXEL_RATIO").toLower() == "auto"); + if (dpr_scaling_enabled) + m_noFontHinting = true; + #ifdef Q_XCB_DEBUG qDebug(); qDebug("Screen output %s of xcb screen %d:", m_outputName.toUtf8().constData(), m_number); @@ -93,6 +103,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, qDebug(" virtual height.: %lf", m_virtualSizeMillimeters.height()); qDebug(" virtual geom...: %d x %d", m_virtualSize.width(), m_virtualSize.height()); qDebug(" avail virt geom: %d x %d +%d +%d", m_availableGeometry.width(), m_availableGeometry.height(), m_availableGeometry.x(), m_availableGeometry.y()); + qDebug(" orientation....: %d", m_orientation); qDebug(" pixel ratio....: %d", m_devicePixelRatio); qDebug(" depth..........: %d", screen()->root_depth); qDebug(" white pixel....: %x", screen()->white_pixel); @@ -313,8 +324,14 @@ QDpi QXcbScreen::logicalDpi() const if (m_forcedDpi > 0) return QDpi(m_forcedDpi/dpr, m_forcedDpi/dpr); - return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width() / dpr, - Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height() / dpr); + static const bool auto_dpr = qgetenv("QT_DEVICE_PIXEL_RATIO").toLower() == "auto"; + if (auto_dpr) { + return QDpi(Q_MM_PER_INCH * m_geometry.width() / m_sizeMillimeters.width(), + Q_MM_PER_INCH * m_geometry.height() / m_sizeMillimeters.height()); + } else { + return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width() / dpr, + Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height() / dpr); + } } @@ -413,6 +430,24 @@ void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp) if (crtc) { xGeometry = QRect(crtc->x, crtc->y, crtc->width, crtc->height); xAvailableGeometry = xGeometry; + switch (crtc->rotation) { + case XCB_RANDR_ROTATION_ROTATE_0: // xrandr --rotate normal + m_orientation = Qt::LandscapeOrientation; + m_sizeMillimeters = m_outputSizeMillimeters; + break; + case XCB_RANDR_ROTATION_ROTATE_90: // xrandr --rotate left + m_orientation = Qt::PortraitOrientation; + m_sizeMillimeters = m_outputSizeMillimeters.transposed(); + break; + case XCB_RANDR_ROTATION_ROTATE_180: // xrandr --rotate inverted + m_orientation = Qt::InvertedLandscapeOrientation; + m_sizeMillimeters = m_outputSizeMillimeters; + break; + case XCB_RANDR_ROTATION_ROTATE_270: // xrandr --rotate right + m_orientation = Qt::InvertedPortraitOrientation; + m_sizeMillimeters = m_outputSizeMillimeters.transposed(); + break; + } free(crtc); } } @@ -441,6 +476,7 @@ void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp) m_devicePixelRatio = qRound(dpi/96); const int dpr = int(devicePixelRatio()); // we may override m_devicePixelRatio m_geometry = QRect(xGeometry.topLeft()/dpr, xGeometry.size()/dpr); + m_nativeGeometry = QRect(xGeometry.topLeft(), xGeometry.size()); m_availableGeometry = QRect(xAvailableGeometry.topLeft()/dpr, xAvailableGeometry.size()/dpr); QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index ca0aee2cc4..e9ab2edaa0 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -62,6 +62,7 @@ public: QWindow *topLevelAt(const QPoint &point) const; QRect geometry() const { return m_geometry; } + QRect nativeGeometry() const { return m_nativeGeometry; } QRect availableGeometry() const {return m_availableGeometry;} int depth() const { return m_screen->root_depth; } QImage::Format format() const; @@ -97,6 +98,7 @@ public: void readXResources(); QFontEngine::HintStyle hintStyle() const { return m_hintStyle; } + bool noFontHinting() const { return m_noFontHinting; } QFontEngine::SubpixelAntialiasingType subpixelType() const { return m_subpixelType; } int antialiasingEnabled() const { return m_antialiasingEnabled; } @@ -111,8 +113,10 @@ private: xcb_screen_t *m_screen; xcb_randr_crtc_t m_crtc; QString m_outputName; + QSizeF m_outputSizeMillimeters; QSizeF m_sizeMillimeters; QRect m_geometry; + QRect m_nativeGeometry; QRect m_availableGeometry; QSize m_virtualSize; QSizeF m_virtualSizeMillimeters; @@ -129,6 +133,7 @@ private: int m_forcedDpi; int m_devicePixelRatio; QFontEngine::HintStyle m_hintStyle; + bool m_noFontHinting; QFontEngine::SubpixelAntialiasingType m_subpixelType; int m_antialiasingEnabled; QXcbXSettings *m_xSettings; diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index e1ccc3f086..4fd71f1635 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -151,7 +151,7 @@ static inline QRect mapToNative(const QRect &qtRect, int dpr) return QRect(qtRect.x() * dpr, qtRect.y() * dpr, qtRect.width() * dpr, qtRect.height() * dpr); } -// When converting native rects to Qt rects: round top/left towards the origin and +// When mapping expose events to Qt rects: round top/left towards the origin and // bottom/right away from the origin, making sure that we cover the whole widget static inline QPoint dpr_floor(const QPoint &p, int dpr) @@ -164,11 +164,15 @@ static inline QPoint dpr_ceil(const QPoint &p, int dpr) return QPoint((p.x() + dpr - 1) / dpr, (p.y() + dpr - 1) / dpr); } -static inline QRect mapFromNative(const QRect &xRect, int dpr) +static inline QRect mapExposeFromNative(const QRect &xRect, int dpr) { return QRect(dpr_floor(xRect.topLeft(), dpr), dpr_ceil(xRect.bottomRight(), dpr)); } +static inline QRect mapGeometryFromNative(const QRect &xRect, int dpr) +{ + return QRect(xRect.topLeft() / dpr, xRect.bottomRight() / dpr); +} // Returns \c true if we should set WM_TRANSIENT_FOR on \a w static inline bool isTransient(const QWindow *w) @@ -1718,7 +1722,7 @@ public: return false; if (expose->count == 0) m_pending = false; - *m_region |= mapFromNative(QRect(expose->x, expose->y, expose->width, expose->height), m_dpr); + *m_region |= mapExposeFromNative(QRect(expose->x, expose->y, expose->width, expose->height), m_dpr); return true; } @@ -1746,7 +1750,7 @@ void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event) { const int dpr = int(devicePixelRatio()); QRect x_rect(event->x, event->y, event->width, event->height); - QRect rect = mapFromNative(x_rect, dpr); + QRect rect = mapExposeFromNative(x_rect, dpr); if (m_exposeRegion.isEmpty()) m_exposeRegion = rect; @@ -1831,6 +1835,23 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even } } +// Temporary workaround for bug in QPlatformScreen::screenForNativeGeometry +// we need the native geometries to detect our screen, but that's not +// available in cross-platform code. Will be fixed properly when highDPI +// support is refactored to expose the native coordinate system. + +QPlatformScreen *QXcbWindow::screenForNativeGeometry(const QRect &newGeometry) const +{ + QXcbScreen *currentScreen = static_cast<QXcbScreen*>(screen()); + if (!parent() && !currentScreen->nativeGeometry().intersects(newGeometry)) { + Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) { + if (static_cast<QXcbScreen*>(screen)->nativeGeometry().intersects(newGeometry)) + return screen; + } + } + return currentScreen; +} + void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event) { bool fromSendEvent = (event->response_type & 0x80); @@ -1847,15 +1868,23 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * } } - QRect rect = mapFromNative(QRect(pos, QSize(event->width, event->height)), int(devicePixelRatio())); + const int dpr = devicePixelRatio(); + const QRect nativeRect = QRect(pos, QSize(event->width, event->height)); + const QRect rect = mapGeometryFromNative(nativeRect, dpr); QPlatformWindow::setGeometry(rect); QWindowSystemInterface::handleGeometryChange(window(), rect); - QPlatformScreen *newScreen = screenForGeometry(rect); + QPlatformScreen *newScreen = screenForNativeGeometry(nativeRect); if (newScreen != m_screen) { m_screen = static_cast<QXcbScreen*>(newScreen); QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen()); + int newDpr = devicePixelRatio(); + if (newDpr != dpr) { + QRect newRect = mapGeometryFromNative(nativeRect, newDpr); + QPlatformWindow::setGeometry(newRect); + QWindowSystemInterface::handleGeometryChange(window(), newRect); + } } m_configureNotifyPending = false; diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 12d20d004d..254421e57d 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -154,6 +154,8 @@ public: qreal devicePixelRatio() const; + QPlatformScreen *screenForNativeGeometry(const QRect &newGeometry) const; + public Q_SLOTS: void updateSyncRequestCounter(); diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp index 13d42832db..a1dadb0e54 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.cpp +++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp @@ -36,7 +36,9 @@ #include <QtCore/QByteArray> #include <QtCore/QtEndian> +#ifdef XCB_USE_XLIB #include <X11/extensions/XIproto.h> +#endif //XCB_USE_XLIB QT_BEGIN_NAMESPACE /* Implementation of http://standards.freedesktop.org/xsettings-spec/xsettings-0.5.html */ @@ -138,6 +140,7 @@ public: return value + 4 - remainder; } +#ifdef XCB_USE_XLIB void populateSettings(const QByteArray &xSettings) { if (xSettings.length() < 12) @@ -212,6 +215,7 @@ public: } } +#endif //XCB_USE_XLIB QXcbScreen *screen; xcb_window_t x_settings_window; @@ -258,8 +262,10 @@ QXcbXSettings::QXcbXSettings(QXcbScreen *screen) const uint32_t event_mask[] = { XCB_EVENT_MASK_STRUCTURE_NOTIFY|XCB_EVENT_MASK_PROPERTY_CHANGE }; xcb_change_window_attributes(screen->xcb_connection(),d_ptr->x_settings_window,event,event_mask); +#ifdef XCB_USE_XLIB d_ptr->populateSettings(d_ptr->getSettings()); d_ptr->initialized = true; +#endif //XCB_USE_XLIB } QXcbXSettings::~QXcbXSettings() @@ -279,7 +285,9 @@ void QXcbXSettings::handlePropertyNotifyEvent(const xcb_property_notify_event_t Q_D(QXcbXSettings); if (event->window != d->x_settings_window) return; +#ifdef XCB_USE_XLIB d->populateSettings(d->getSettings()); +#endif //XCB_USE_XLIB } void QXcbXSettings::registerCallbackForProperty(const QByteArray &property, QXcbXSettings::PropertyChangeFunc func, void *handle) diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index 4e0a3e0795..69f74ef775 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -931,6 +931,8 @@ void QWin32PrintEnginePrivate::initHDC() default: break; } + + updateMetrics(); } void QWin32PrintEnginePrivate::release() diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index 98e262a7e2..2808587d96 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -1060,6 +1060,7 @@ bool QSqlQuery::exec() */ bool QSqlQuery::execBatch(BatchExecutionMode mode) { + d->sqlResult->resetBindCount(); return d->sqlResult->execBatch(mode == ValuesAsColumns); } diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 882bb999fb..b133c49b5e 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1579,12 +1579,17 @@ void QColorDialogPrivate::_q_pickScreenColor() q->grabMouse(); #endif -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 // excludes WinCE and WinRT // On Windows mouse tracking doesn't work over other processes's windows updateTimer->start(30); + + // HACK: Because mouse grabbing doesn't work across processes, we have to have a dummy, + // invisible window to catch the mouse click, otherwise we will click whatever we clicked + // and loose focus. + dummyTransparentWindow.show(); #endif q->grabKeyboard(); - /* With setMouseTracking(true) the desired color can be more precisedly picked up, + /* With setMouseTracking(true) the desired color can be more precisely picked up, * and continuously pushing the mouse button is not necessary. */ q->setMouseTracking(true); @@ -1606,8 +1611,9 @@ void QColorDialogPrivate::releaseColorPicking() cp->setCrossVisible(true); q->removeEventFilter(colorPickingEventFilter); q->releaseMouse(); -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 updateTimer->stop(); + dummyTransparentWindow.setVisible(false); #endif q->releaseKeyboard(); q->setMouseTracking(false); @@ -1635,6 +1641,10 @@ void QColorDialogPrivate::init(const QColor &initial) #ifdef Q_WS_MAC delegate = 0; #endif +#ifdef Q_OS_WIN32 + dummyTransparentWindow.resize(1, 1); + dummyTransparentWindow.setFlags(Qt::Tool | Qt::FramelessWindowHint); +#endif q->setCurrentColor(initial); } @@ -1791,7 +1801,7 @@ void QColorDialogPrivate::initWidgets() cancel = buttons->addButton(QDialogButtonBox::Cancel); QObject::connect(cancel, SIGNAL(clicked()), q, SLOT(reject())); -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 updateTimer = new QTimer(q); QObject::connect(updateTimer, SIGNAL(timeout()), q, SLOT(_q_updateColorPicking())); #endif @@ -2219,8 +2229,12 @@ void QColorDialogPrivate::_q_updateColorPicking() return; lastGlobalPos = newGlobalPos; - if (!q->rect().contains(q->mapFromGlobal(newGlobalPos))) // Inside the dialog mouse tracking works, handleColorPickingMouseMove will be called + if (!q->rect().contains(q->mapFromGlobal(newGlobalPos))) { // Inside the dialog mouse tracking works, handleColorPickingMouseMove will be called updateColorPicking(newGlobalPos); +#ifdef Q_OS_WIN32 + dummyTransparentWindow.setPosition(newGlobalPos); +#endif + } #endif // ! QT_NO_CURSOR } diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h index 2b501522f5..9182b510f1 100644 --- a/src/widgets/dialogs/qcolordialog_p.h +++ b/src/widgets/dialogs/qcolordialog_p.h @@ -49,6 +49,7 @@ #include "private/qdialog_p.h" #include "qcolordialog.h" #include "qsharedpointer.h" +#include "qwindow.h" #ifndef QT_NO_COLORDIALOG @@ -77,7 +78,7 @@ public: }; QColorDialogPrivate() : options(new QColorDialogOptions) -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 , updateTimer(0) #endif {} @@ -143,8 +144,9 @@ public: QPointer<QObject> receiverToDisconnectOnClose; QByteArray memberToDisconnectOnClose; -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 QTimer *updateTimer; + QWindow dummyTransparentWindow; #endif #ifdef Q_WS_MAC diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp index 01ca398a14..371949e768 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -108,10 +108,10 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance { Q_Q(QProgressDialog); label = new QLabel(labelText, q); - int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, 0, q); - label->setAlignment(Qt::Alignment(align)); bar = new QProgressBar(q); bar->setRange(min, max); + int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, 0, q); + label->setAlignment(Qt::Alignment(align)); autoClose = true; autoReset = true; forceHide = false; diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index c362530264..c99e15b9b8 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -12392,10 +12392,9 @@ static void releaseMouseGrabOfWidget(QWidget *widget) \note Only visible widgets can grab mouse input. If isVisible() returns \c false for a widget, that widget cannot call grabMouse(). - \note \b{(Mac OS X developers)} For \e Cocoa, calling - grabMouse() on a widget only works when the mouse is inside the - frame of that widget. For \e Carbon, it works outside the widget's - frame as well, like for Windows and X11. + \note On Windows, grabMouse() only works when the mouse is inside a window + owned by the process. + On OS X, grabMouse() only works when the mouse is inside the frame of that widget. \sa releaseMouse(), grabKeyboard(), releaseKeyboard() */ @@ -12416,7 +12415,7 @@ void QWidget::grabMouse() \warning Grabbing the mouse might lock the terminal. - \note \b{(Mac OS X developers)} See the note in QWidget::grabMouse(). + \note See the note in QWidget::grabMouse(). \sa releaseMouse(), grabKeyboard(), releaseKeyboard(), setCursor() */ diff --git a/tests/auto/corelib/io/qdatastream/qdatastream.pro b/tests/auto/corelib/io/qdatastream/qdatastream.pro index 25c29b83ee..9ab2b0948d 100644 --- a/tests/auto/corelib/io/qdatastream/qdatastream.pro +++ b/tests/auto/corelib/io/qdatastream/qdatastream.pro @@ -5,3 +5,8 @@ SOURCES = tst_qdatastream.cpp TESTDATA += datastream.q42 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/corelib/io/qdatastream/testdata.qrc b/tests/auto/corelib/io/qdatastream/testdata.qrc new file mode 100644 index 0000000000..fb63cb3438 --- /dev/null +++ b/tests/auto/corelib/io/qdatastream/testdata.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>datastream.q42</file> + </qresource> +</RCC> diff --git a/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc b/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc new file mode 100644 index 0000000000..f30290c262 --- /dev/null +++ b/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/android_testdata"> + <file>tst_qtemporaryfile.cpp</file> + <file>resources/test.txt</file> + </qresource> +</RCC> diff --git a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro index 8a91340e5f..c16a729ad0 100644 --- a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro +++ b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro @@ -5,4 +5,8 @@ QT = core testlib SOURCES = tst_qtemporaryfile.cpp TESTDATA += tst_qtemporaryfile.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -RESOURCES += qtemporaryfile.qrc
\ No newline at end of file +RESOURCES += qtemporaryfile.qrc + +android:!android-no-sdk { + RESOURCES += android_testdata.qrc +} diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index a08a0ae777..29a3c4e18a 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -92,6 +92,24 @@ void tst_QTemporaryFile::initTestCase() // For QTBUG_4796 QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX")); QCoreApplication::setApplicationName("tst_qtemporaryfile"); + +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QString sourceDir(":/android_testdata/"); + QDirIterator it(sourceDir, QDirIterator::Subdirectories); + while (it.hasNext()) { + it.next(); + + QFileInfo sourceFileInfo = it.fileInfo(); + if (!sourceFileInfo.isDir()) { + QFileInfo destinationFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1Char('/') + sourceFileInfo.filePath().mid(sourceDir.length())); + + if (!destinationFileInfo.exists()) { + QVERIFY(QDir().mkpath(destinationFileInfo.path())); + QVERIFY(QFile::copy(sourceFileInfo.filePath(), destinationFileInfo.filePath())); + } + } + } +#endif } void tst_QTemporaryFile::cleanupTestCase() @@ -253,20 +271,21 @@ void tst_QTemporaryFile::autoRemove() QVERIFY(!QFile::exists(fileName)); } +struct ChdirOnReturn +{ + ChdirOnReturn(const QString& d) : dir(d) {} + ~ChdirOnReturn() { + QDir::setCurrent(dir); + } + QString dir; +}; + void tst_QTemporaryFile::nonWritableCurrentDir() { #ifdef Q_OS_UNIX if (::geteuid() == 0) QSKIP("not valid running this test as root"); - struct ChdirOnReturn - { - ChdirOnReturn(const QString& d) : dir(d) {} - ~ChdirOnReturn() { - QDir::setCurrent(dir); - } - QString dir; - }; ChdirOnReturn cor(QDir::currentPath()); #if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) @@ -443,6 +462,12 @@ void tst_QTemporaryFile::rename() void tst_QTemporaryFile::renameFdLeak() { #ifdef Q_OS_UNIX + +# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + ChdirOnReturn cor(QDir::currentPath()); + QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); +# endif + const QByteArray sourceFile = QFile::encodeName(QFINDTESTDATA(__FILE__)); QVERIFY(!sourceFile.isEmpty()); // Test this on Unix only @@ -646,7 +671,11 @@ void tst_QTemporaryFile::createNativeFile_data() QTest::addColumn<bool>("valid"); QTest::addColumn<QByteArray>("content"); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + const QString nativeFilePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/resources/test.txt"); +#else const QString nativeFilePath = QFINDTESTDATA("resources/test.txt"); +#endif QTest::newRow("nativeFile") << nativeFilePath << (qint64)-1 << false << QByteArray(); QTest::newRow("nativeFileWithPos") << nativeFilePath << (qint64)5 << false << QByteArray(); diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro index 498d8f9c40..29b9854ebb 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro +++ b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro @@ -5,3 +5,8 @@ SOURCES = tst_qtextboundaryfinder.cpp TESTDATA += data DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc b/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc new file mode 100644 index 0000000000..0cc4ccaa57 --- /dev/null +++ b/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc @@ -0,0 +1,8 @@ +<RCC> + <qresource prefix="/"> + <file>data/GraphemeBreakTest.txt</file> + <file>data/LineBreakTest.txt</file> + <file>data/SentenceBreakTest.txt</file> + <file>data/WordBreakTest.txt</file> + </qresource> +</RCC> diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp index df6fb9e9bc..70794a52f5 100644 --- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp +++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp @@ -294,6 +294,7 @@ void tst_QDBusConnection::connectToPeer() "", "newconn"); QVERIFY(!con.isConnected()); QVERIFY(con.lastError().isValid()); + QDBusConnection::disconnectFromPeer("newconn"); } QDBusServer server; @@ -303,6 +304,7 @@ void tst_QDBusConnection::connectToPeer() "unix:abstract=/tmp/dbus-XXXXXXXXXX,guid=00000000000000000000000000000000", "newconn2"); QVERIFY(!con.isConnected()); QVERIFY(con.lastError().isValid()); + QDBusConnection::disconnectFromPeer("newconn2"); } { diff --git a/tests/auto/dbus/qdbusmarshall/common.h b/tests/auto/dbus/qdbusmarshall/common.h index 76fe0e4bfb..323b54a137 100644 --- a/tests/auto/dbus/qdbusmarshall/common.h +++ b/tests/auto/dbus/qdbusmarshall/common.h @@ -30,7 +30,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <math.h> // isnan +#include <qmath.h> // qIsNan #include <qvariant.h> #ifdef Q_OS_UNIX @@ -320,7 +320,7 @@ bool compare(const QVariant &v1, const QVariant &v2); bool compare(double d1, double d2) { - if (isnan(d1) && isnan(d2)) + if (qIsNaN(d1) && qIsNaN(d2)) return true; return d1 == d2; } diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro index 117e34653d..42280d3bd4 100644 --- a/tests/auto/gui/image/qimage/qimage.pro +++ b/tests/auto/gui/image/qimage/qimage.pro @@ -6,4 +6,6 @@ SOURCES += tst_qimage.cpp QT += core-private gui-private testlib contains(QT_CONFIG, c++11): CONFIG += c++11 +android:!android-no-sdk:RESOURCES+=qimage.qrc + TESTDATA += images/* diff --git a/tests/auto/gui/image/qimage/qimage.qrc b/tests/auto/gui/image/qimage/qimage.qrc new file mode 100644 index 0000000000..e5de27faf8 --- /dev/null +++ b/tests/auto/gui/image/qimage/qimage.qrc @@ -0,0 +1,22 @@ +<RCC> + <qresource prefix="/"> + <file>images/image.bmp</file> + <file>images/image.gif</file> + <file>images/image.ico</file> + <file>images/image.jpg</file> + <file>images/image.pbm</file> + <file>images/image.pgm</file> + <file>images/image.png</file> + <file>images/image.ppm</file> + <file>images/image.xbm</file> + <file>images/image.xpm</file> + <file>images/jpeg_exif_orientation_value_1.jpg</file> + <file>images/jpeg_exif_orientation_value_2.jpg</file> + <file>images/jpeg_exif_orientation_value_3.jpg</file> + <file>images/jpeg_exif_orientation_value_4.jpg</file> + <file>images/jpeg_exif_orientation_value_5.jpg</file> + <file>images/jpeg_exif_orientation_value_6.jpg</file> + <file>images/jpeg_exif_orientation_value_7.jpg</file> + <file>images/jpeg_exif_orientation_value_8.jpg</file> + </qresource> +</RCC> diff --git a/tests/auto/gui/image/qimagereader/android_testdata.qrc b/tests/auto/gui/image/qimagereader/android_testdata.qrc new file mode 100644 index 0000000000..bba32781fa --- /dev/null +++ b/tests/auto/gui/image/qimagereader/android_testdata.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>images/trans.gif</file> + <file>images/kollada-noext</file> + </qresource> +</RCC> diff --git a/tests/auto/gui/image/qimagereader/qimagereader.pro b/tests/auto/gui/image/qimagereader/qimagereader.pro index 7686643b3a..76fb4d8bfc 100644 --- a/tests/auto/gui/image/qimagereader/qimagereader.pro +++ b/tests/auto/gui/image/qimagereader/qimagereader.pro @@ -5,6 +5,10 @@ MOC_DIR=tmp QT += core-private gui-private network testlib RESOURCES += qimagereader.qrc +android: !android-no-sdk { + RESOURCES += android_testdata.qrc +} + win32-msvc:QMAKE_CXXFLAGS -= -Zm200 win32-msvc:QMAKE_CXXFLAGS += -Zm800 win32-msvc.net:QMAKE_CXXFLAGS -= -Zm300 diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.pro b/tests/auto/gui/image/qimagewriter/qimagewriter.pro index f77ff0659b..ce6707ec92 100644 --- a/tests/auto/gui/image/qimagewriter/qimagewriter.pro +++ b/tests/auto/gui/image/qimagewriter/qimagewriter.pro @@ -5,5 +5,5 @@ SOURCES += tst_qimagewriter.cpp MOC_DIR=tmp win32-msvc:QMAKE_CXXFLAGS -= -Zm200 win32-msvc:QMAKE_CXXFLAGS += -Zm800 - +android:!android-no-sdk:RESOURCES+= qimagewriter.qrc TESTDATA += images/* diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.qrc b/tests/auto/gui/image/qimagewriter/qimagewriter.qrc new file mode 100644 index 0000000000..29b036e303 --- /dev/null +++ b/tests/auto/gui/image/qimagewriter/qimagewriter.qrc @@ -0,0 +1,16 @@ +<RCC> + <qresource prefix="/"> + <file>images/beavis.jpg</file> + <file>images/colorful.bmp</file> + <file>images/earth.gif</file> + <file>images/font.bmp</file> + <file>images/gnus.xbm</file> + <file>images/kollada.png</file> + <file>images/marble.xpm</file> + <file>images/ship63.pbm</file> + <file>images/teapot.ppm</file> + <file>images/trolltech.gif</file> + <file>images/YCbCr_cmyk.jpg</file> + <file>images/YCbCr_rgb.jpg</file> + </qresource> +</RCC> diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index 7e826310a1..f1045a8cf7 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -90,6 +90,7 @@ private slots: void saveToTemporaryFile(); private: QString prefix; + QString writePrefix; }; // helper to skip an autotest when the given image format is not supported @@ -114,6 +115,11 @@ void tst_QImageWriter::initTestCase() prefix = QFINDTESTDATA("images/"); if (prefix.isEmpty()) QFAIL("Can't find images directory!"); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + writePrefix = QDir::homePath(); +#else + writePrefix = prefix; +#endif } // Testing get/set functions @@ -212,7 +218,7 @@ void tst_QImageWriter::writeImage() QVERIFY2(!image.isNull(), qPrintable(reader.errorString())); } { - QImageWriter writer(prefix + "gen-" + fileName, format); + QImageWriter writer(writePrefix + "gen-" + fileName, format); QVERIFY(writer.write(image)); } @@ -224,11 +230,11 @@ void tst_QImageWriter::writeImage() #endif if (!skip) { // Shouldn't be able to write to read-only file - QFile sourceFile(prefix + "gen-" + fileName); + QFile sourceFile(writePrefix + "gen-" + fileName); QFile::Permissions permissions = sourceFile.permissions(); QVERIFY(sourceFile.setPermissions(QFile::ReadOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther)); - QImageWriter writer(prefix + "gen-" + fileName, format); + QImageWriter writer(writePrefix + "gen-" + fileName, format); QVERIFY(!writer.write(image)); QVERIFY(sourceFile.setPermissions(permissions)); @@ -237,7 +243,7 @@ void tst_QImageWriter::writeImage() QImage image2; { - QImageReader reader(prefix + "gen-" + fileName); + QImageReader reader(writePrefix + "gen-" + fileName); image2 = reader.read(); QVERIFY(!image2.isNull()); } @@ -456,7 +462,7 @@ void tst_QImageWriter::supportsOption() << QImageIOHandler::Animation << QImageIOHandler::BackgroundColor; - QImageWriter writer(prefix + fileName); + QImageWriter writer(writePrefix + fileName); for (int i = 0; i < options.size(); ++i) { QVERIFY(writer.supportsOption(QImageIOHandler::ImageOption(options.at(i)))); allOptions.remove(QImageIOHandler::ImageOption(options.at(i))); @@ -472,13 +478,13 @@ void tst_QImageWriter::saveWithNoFormat_data() QTest::addColumn<QByteArray>("format"); QTest::addColumn<QImageWriter::ImageWriterError>("error"); - QTest::newRow("garble") << prefix + QString("gen-out.garble") << QByteArray("jpeg") << QImageWriter::UnsupportedFormatError; - QTest::newRow("bmp") << prefix + QString("gen-out.bmp") << QByteArray("bmp") << QImageWriter::ImageWriterError(0); - QTest::newRow("xbm") << prefix + QString("gen-out.xbm") << QByteArray("xbm") << QImageWriter::ImageWriterError(0); - QTest::newRow("xpm") << prefix + QString("gen-out.xpm") << QByteArray("xpm") << QImageWriter::ImageWriterError(0); - QTest::newRow("png") << prefix + QString("gen-out.png") << QByteArray("png") << QImageWriter::ImageWriterError(0); - QTest::newRow("ppm") << prefix + QString("gen-out.ppm") << QByteArray("ppm") << QImageWriter::ImageWriterError(0); - QTest::newRow("pbm") << prefix + QString("gen-out.pbm") << QByteArray("pbm") << QImageWriter::ImageWriterError(0); + QTest::newRow("garble") << writePrefix + QString("gen-out.garble") << QByteArray("jpeg") << QImageWriter::UnsupportedFormatError; + QTest::newRow("bmp") << writePrefix + QString("gen-out.bmp") << QByteArray("bmp") << QImageWriter::ImageWriterError(0); + QTest::newRow("xbm") << writePrefix + QString("gen-out.xbm") << QByteArray("xbm") << QImageWriter::ImageWriterError(0); + QTest::newRow("xpm") << writePrefix + QString("gen-out.xpm") << QByteArray("xpm") << QImageWriter::ImageWriterError(0); + QTest::newRow("png") << writePrefix + QString("gen-out.png") << QByteArray("png") << QImageWriter::ImageWriterError(0); + QTest::newRow("ppm") << writePrefix + QString("gen-out.ppm") << QByteArray("ppm") << QImageWriter::ImageWriterError(0); + QTest::newRow("pbm") << writePrefix + QString("gen-out.pbm") << QByteArray("pbm") << QImageWriter::ImageWriterError(0); } void tst_QImageWriter::saveWithNoFormat() diff --git a/tests/auto/gui/image/qpixmap/qpixmap.qrc b/tests/auto/gui/image/qpixmap/qpixmap.qrc index 99fde61a29..3965622dba 100644 --- a/tests/auto/gui/image/qpixmap/qpixmap.qrc +++ b/tests/auto/gui/image/qpixmap/qpixmap.qrc @@ -1,5 +1,27 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> +<RCC> + <qresource> + <file>loadFromData/designer_argb32.png</file> + <file>loadFromData/designer_indexed8_no_alpha_animated.gif</file> + <file>loadFromData/designer_indexed8_no_alpha.gif</file> + <file>loadFromData/designer_indexed8_no_alpha.png</file> + <file>loadFromData/designer_indexed8_with_alpha_animated.gif</file> + <file>loadFromData/designer_indexed8_with_alpha.gif</file> + <file>loadFromData/designer_indexed8_with_alpha.png</file> + <file>loadFromData/designer_rgb32.jpg</file> + <file>loadFromData/designer_rgb32.png</file> + <file>convertFromImage/task31722_1/img1.png</file> + <file>convertFromImage/task31722_1/img2.png</file> + <file>convertFromToHICON/icon_8bpp_16x16.png</file> + <file>convertFromToHICON/icon_8bpp_32x32.png</file> + <file>convertFromToHICON/icon_8bpp_48x48.png</file> + <file>convertFromToHICON/icon_8bpp.ico</file> + <file>convertFromToHICON/icon_32bpp_16x16.png</file> + <file>convertFromToHICON/icon_32bpp_32x32.png</file> + <file>convertFromToHICON/icon_32bpp_48x48.png</file> + <file>convertFromToHICON/icon_32bpp_256x256.png</file> + <file>convertFromToHICON/icon_32bpp.ico</file> + <file>convertFromImage/task31722_0/img1.png</file> + <file>convertFromImage/task31722_0/img2.png</file> <file>images/designer.png</file> <file>images/dx_0_dy_0_50_50_100_100.png</file> <file>images/dx_0_dy_0_null.png</file> @@ -25,5 +47,5 @@ <file>images/dx_-128_dy_-128_x_y_w_h.png</file> <file>images/dx_128_dy_128_x_y_w_h.png</file> <file>images/dx_1_dy_0_null.png</file> -</qresource> + </qresource> </RCC> diff --git a/tests/auto/gui/painting/qpainter/qpainter.pro b/tests/auto/gui/painting/qpainter/qpainter.pro index 752f9be1f4..7e9d438e1b 100644 --- a/tests/auto/gui/painting/qpainter/qpainter.pro +++ b/tests/auto/gui/painting/qpainter/qpainter.pro @@ -10,3 +10,8 @@ SOURCES += tst_qpainter.cpp TESTDATA += drawEllipse/* drawLine_rop_bitmap/* drawPixmap_rop/* drawPixmap_rop_bitmap/* \ task217400.png DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/gui/painting/qpainter/testdata.qrc b/tests/auto/gui/painting/qpainter/testdata.qrc new file mode 100644 index 0000000000..a7b8c222e5 --- /dev/null +++ b/tests/auto/gui/painting/qpainter/testdata.qrc @@ -0,0 +1,186 @@ +<RCC> + <qresource prefix="/"> + <file>task217400.png</file> + <file>drawEllipse/10x10SizeAt0x0.png</file> + <file>drawEllipse/10x10SizeAt100x100.png</file> + <file>drawEllipse/10x10SizeAt200x200.png</file> + <file>drawEllipse/13x100SizeAt0x0.png</file> + <file>drawEllipse/13x100SizeAt100x100.png</file> + <file>drawEllipse/13x100SizeAt200x200.png</file> + <file>drawEllipse/200x200SizeAt0x0.png</file> + <file>drawEllipse/200x200SizeAt100x100.png</file> + <file>drawEllipse/200x200SizeAt200x200.png</file> + <file>drawLine_rop_bitmap/dst.xbm</file> + <file>drawLine_rop_bitmap/res/res_AndNotROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_AndROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_ClearROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_CopyROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_NandROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_NopROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_NorROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_NotAndROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_NotCopyROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_NotOrROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_NotROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_NotXorROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_OrNotROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_OrROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_SetROP.xbm</file> + <file>drawLine_rop_bitmap/res/res_XorROP.xbm</file> + <file>drawPixmap_rop/dst1.png</file> + <file>drawPixmap_rop/dst2.png</file> + <file>drawPixmap_rop/dst3.png</file> + <file>drawPixmap_rop/src1.xbm</file> + <file>drawPixmap_rop/src2-mask.xbm</file> + <file>drawPixmap_rop/src2.xbm</file> + <file>drawPixmap_rop/src3.xbm</file> + <file>drawPixmap_rop/res/res_AndNotROP0.png</file> + <file>drawPixmap_rop/res/res_AndNotROP1.png</file> + <file>drawPixmap_rop/res/res_AndNotROP2.png</file> + <file>drawPixmap_rop/res/res_AndNotROP3.png</file> + <file>drawPixmap_rop/res/res_AndNotROP4.png</file> + <file>drawPixmap_rop/res/res_AndNotROP5.png</file> + <file>drawPixmap_rop/res/res_AndNotROP6.png</file> + <file>drawPixmap_rop/res/res_AndNotROP7.png</file> + <file>drawPixmap_rop/res/res_AndROP0.png</file> + <file>drawPixmap_rop/res/res_AndROP1.png</file> + <file>drawPixmap_rop/res/res_AndROP2.png</file> + <file>drawPixmap_rop/res/res_AndROP3.png</file> + <file>drawPixmap_rop/res/res_AndROP4.png</file> + <file>drawPixmap_rop/res/res_AndROP5.png</file> + <file>drawPixmap_rop/res/res_AndROP6.png</file> + <file>drawPixmap_rop/res/res_AndROP7.png</file> + <file>drawPixmap_rop/res/res_ClearROP0.png</file> + <file>drawPixmap_rop/res/res_ClearROP1.png</file> + <file>drawPixmap_rop/res/res_ClearROP2.png</file> + <file>drawPixmap_rop/res/res_ClearROP3.png</file> + <file>drawPixmap_rop/res/res_ClearROP4.png</file> + <file>drawPixmap_rop/res/res_ClearROP5.png</file> + <file>drawPixmap_rop/res/res_ClearROP6.png</file> + <file>drawPixmap_rop/res/res_ClearROP7.png</file> + <file>drawPixmap_rop/res/res_CopyROP0.png</file> + <file>drawPixmap_rop/res/res_CopyROP1.png</file> + <file>drawPixmap_rop/res/res_CopyROP2.png</file> + <file>drawPixmap_rop/res/res_CopyROP3.png</file> + <file>drawPixmap_rop/res/res_CopyROP4.png</file> + <file>drawPixmap_rop/res/res_CopyROP5.png</file> + <file>drawPixmap_rop/res/res_CopyROP6.png</file> + <file>drawPixmap_rop/res/res_CopyROP7.png</file> + <file>drawPixmap_rop/res/res_NandROP0.png</file> + <file>drawPixmap_rop/res/res_NandROP1.png</file> + <file>drawPixmap_rop/res/res_NandROP2.png</file> + <file>drawPixmap_rop/res/res_NandROP3.png</file> + <file>drawPixmap_rop/res/res_NandROP4.png</file> + <file>drawPixmap_rop/res/res_NandROP5.png</file> + <file>drawPixmap_rop/res/res_NandROP6.png</file> + <file>drawPixmap_rop/res/res_NandROP7.png</file> + <file>drawPixmap_rop/res/res_NopROP0.png</file> + <file>drawPixmap_rop/res/res_NopROP1.png</file> + <file>drawPixmap_rop/res/res_NopROP2.png</file> + <file>drawPixmap_rop/res/res_NopROP3.png</file> + <file>drawPixmap_rop/res/res_NopROP4.png</file> + <file>drawPixmap_rop/res/res_NopROP5.png</file> + <file>drawPixmap_rop/res/res_NopROP6.png</file> + <file>drawPixmap_rop/res/res_NopROP7.png</file> + <file>drawPixmap_rop/res/res_NorROP0.png</file> + <file>drawPixmap_rop/res/res_NorROP1.png</file> + <file>drawPixmap_rop/res/res_NorROP2.png</file> + <file>drawPixmap_rop/res/res_NorROP3.png</file> + <file>drawPixmap_rop/res/res_NorROP4.png</file> + <file>drawPixmap_rop/res/res_NorROP5.png</file> + <file>drawPixmap_rop/res/res_NorROP6.png</file> + <file>drawPixmap_rop/res/res_NorROP7.png</file> + <file>drawPixmap_rop/res/res_NotAndROP0.png</file> + <file>drawPixmap_rop/res/res_NotAndROP1.png</file> + <file>drawPixmap_rop/res/res_NotAndROP2.png</file> + <file>drawPixmap_rop/res/res_NotAndROP3.png</file> + <file>drawPixmap_rop/res/res_NotAndROP4.png</file> + <file>drawPixmap_rop/res/res_NotAndROP5.png</file> + <file>drawPixmap_rop/res/res_NotAndROP6.png</file> + <file>drawPixmap_rop/res/res_NotAndROP7.png</file> + <file>drawPixmap_rop/res/res_NotCopyROP0.png</file> + <file>drawPixmap_rop/res/res_NotCopyROP1.png</file> + <file>drawPixmap_rop/res/res_NotCopyROP2.png</file> + <file>drawPixmap_rop/res/res_NotCopyROP3.png</file> + <file>drawPixmap_rop/res/res_NotCopyROP4.png</file> + <file>drawPixmap_rop/res/res_NotCopyROP5.png</file> + <file>drawPixmap_rop/res/res_NotCopyROP6.png</file> + <file>drawPixmap_rop/res/res_NotCopyROP7.png</file> + <file>drawPixmap_rop/res/res_NotOrROP0.png</file> + <file>drawPixmap_rop/res/res_NotOrROP1.png</file> + <file>drawPixmap_rop/res/res_NotOrROP2.png</file> + <file>drawPixmap_rop/res/res_NotOrROP3.png</file> + <file>drawPixmap_rop/res/res_NotOrROP4.png</file> + <file>drawPixmap_rop/res/res_NotOrROP5.png</file> + <file>drawPixmap_rop/res/res_NotOrROP6.png</file> + <file>drawPixmap_rop/res/res_NotOrROP7.png</file> + <file>drawPixmap_rop/res/res_NotROP0.png</file> + <file>drawPixmap_rop/res/res_NotROP1.png</file> + <file>drawPixmap_rop/res/res_NotROP2.png</file> + <file>drawPixmap_rop/res/res_NotROP3.png</file> + <file>drawPixmap_rop/res/res_NotROP4.png</file> + <file>drawPixmap_rop/res/res_NotROP5.png</file> + <file>drawPixmap_rop/res/res_NotROP6.png</file> + <file>drawPixmap_rop/res/res_NotROP7.png</file> + <file>drawPixmap_rop/res/res_NotXorROP0.png</file> + <file>drawPixmap_rop/res/res_NotXorROP1.png</file> + <file>drawPixmap_rop/res/res_NotXorROP2.png</file> + <file>drawPixmap_rop/res/res_NotXorROP3.png</file> + <file>drawPixmap_rop/res/res_NotXorROP4.png</file> + <file>drawPixmap_rop/res/res_NotXorROP5.png</file> + <file>drawPixmap_rop/res/res_NotXorROP6.png</file> + <file>drawPixmap_rop/res/res_NotXorROP7.png</file> + <file>drawPixmap_rop/res/res_OrNotROP0.png</file> + <file>drawPixmap_rop/res/res_OrNotROP1.png</file> + <file>drawPixmap_rop/res/res_OrNotROP2.png</file> + <file>drawPixmap_rop/res/res_OrNotROP3.png</file> + <file>drawPixmap_rop/res/res_OrNotROP4.png</file> + <file>drawPixmap_rop/res/res_OrNotROP5.png</file> + <file>drawPixmap_rop/res/res_OrNotROP6.png</file> + <file>drawPixmap_rop/res/res_OrNotROP7.png</file> + <file>drawPixmap_rop/res/res_OrROP0.png</file> + <file>drawPixmap_rop/res/res_OrROP1.png</file> + <file>drawPixmap_rop/res/res_OrROP2.png</file> + <file>drawPixmap_rop/res/res_OrROP3.png</file> + <file>drawPixmap_rop/res/res_OrROP4.png</file> + <file>drawPixmap_rop/res/res_OrROP5.png</file> + <file>drawPixmap_rop/res/res_OrROP6.png</file> + <file>drawPixmap_rop/res/res_OrROP7.png</file> + <file>drawPixmap_rop/res/res_SetROP0.png</file> + <file>drawPixmap_rop/res/res_SetROP1.png</file> + <file>drawPixmap_rop/res/res_SetROP2.png</file> + <file>drawPixmap_rop/res/res_SetROP3.png</file> + <file>drawPixmap_rop/res/res_SetROP4.png</file> + <file>drawPixmap_rop/res/res_SetROP5.png</file> + <file>drawPixmap_rop/res/res_SetROP6.png</file> + <file>drawPixmap_rop/res/res_SetROP7.png</file> + <file>drawPixmap_rop/res/res_XorROP0.png</file> + <file>drawPixmap_rop/res/res_XorROP1.png</file> + <file>drawPixmap_rop/res/res_XorROP2.png</file> + <file>drawPixmap_rop/res/res_XorROP3.png</file> + <file>drawPixmap_rop/res/res_XorROP4.png</file> + <file>drawPixmap_rop/res/res_XorROP5.png</file> + <file>drawPixmap_rop/res/res_XorROP6.png</file> + <file>drawPixmap_rop/res/res_XorROP7.png</file> + <file>drawPixmap_rop_bitmap/dst.xbm</file> + <file>drawPixmap_rop_bitmap/src1-mask.xbm</file> + <file>drawPixmap_rop_bitmap/src1.xbm</file> + <file>drawPixmap_rop_bitmap/src2.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_AndNotROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_AndROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_ClearROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_CopyROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_NandROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_NopROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_NorROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_NotAndROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_NotCopyROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_NotOrROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_NotROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_NotXorROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_OrNotROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_OrROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_SetROP.xbm</file> + <file>drawPixmap_rop_bitmap/res/res_XorROP.xbm</file> + </qresource> +</RCC> diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 41ceebb646..8a0705630d 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -730,6 +730,7 @@ void tst_QPainter::initFrom() pal.setColor(QPalette::Foreground, QColor(255, 0, 0)); pal.setBrush(QPalette::Background, QColor(0, 255, 0)); widget->setPalette(pal); + widget->show(); QFont font = widget->font(); font.setPointSize(26); diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp index bd4da12ea3..969c8f9ce7 100644 --- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp @@ -307,24 +307,22 @@ void tst_QRawFont::advances() bool supportsSubPixelPositions = font_d->fontEngine->supportsSubPixelPositions(); QVector<QPointF> advances = font.advancesForGlyphIndexes(glyphIndices); - // On Windows and QNX, freetype engine returns advance of 9 for some of the glyphs - // when full hinting is used (default on Windows). - bool mayFail = false; -#if defined (Q_OS_WIN) - mayFail = font_d->fontEngine->type() == QFontEngine::Freetype - && (hintingPreference == QFont::PreferFullHinting - || hintingPreference == QFont::PreferDefaultHinting); -#elif defined(Q_OS_QNX) - mayFail = font_d->fontEngine->type() == QFontEngine::Freetype - && hintingPreference == QFont::PreferFullHinting; -#endif + bool mayDiffer = font_d->fontEngine->type() == QFontEngine::Freetype + && (hintingPreference == QFont::PreferFullHinting + || hintingPreference == QFont::PreferDefaultHinting); for (int i = 0; i < glyphIndices.size(); ++i) { - if (mayFail && (i == 0 || i == 5)) { - QEXPECT_FAIL("", "FreeType engine reports unexpected advance " - "for some glyphs (9 instead of 8)", Continue); + if ((i == 0 || i == 5) && mayDiffer) { + QVERIFY2(qRound(advances.at(i).x()) == 8 + || qRound(advances.at(i).x()) == 9, + qPrintable(QStringLiteral("%1 != %2 && %1 != %3") + .arg(qRound(advances.at(i).x())) + .arg(8) + .arg(9))); + } else { + QCOMPARE(qRound(advances.at(i).x()), 8); } - QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0)); + if (supportsSubPixelPositions) QVERIFY(advances.at(i).x() > 8.0); @@ -342,11 +340,17 @@ void tst_QRawFont::advances() QVERIFY(font.advancesForGlyphIndexes(glyphIndices.constData(), advances.data(), numGlyphs)); for (int i = 0; i < glyphIndices.size(); ++i) { - if (mayFail && (i == 0 || i == 5)) { - QEXPECT_FAIL("", "FreeType engine reports unexpected advance " - "for some glyphs (9 instead of 8)", Continue); + if ((i == 0 || i == 5) && mayDiffer) { + QVERIFY2(qRound(advances.at(i).x()) == 8 + || qRound(advances.at(i).x()) == 9, + qPrintable(QStringLiteral("%1 != %2 && %1 != %3") + .arg(qRound(advances.at(i).x())) + .arg(8) + .arg(9))); + } else { + QCOMPARE(qRound(advances.at(i).x()), 8); } - QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0)); + if (supportsSubPixelPositions) QVERIFY(advances.at(i).x() > 8.0); diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index 4b2970cd17..4fa8575153 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -1280,6 +1280,13 @@ void tst_QTextLayout::smallTextLengthWrapAtWordBoundaryOrAnywhere() void tst_QTextLayout::testDefaultTabs() { QTextLayout layout("Foo\tBar\ta slightly longer text\tend.", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); layout.beginLayout(); QTextLine line = layout.createLine(); @@ -1322,6 +1329,13 @@ void tst_QTextLayout::testDefaultTabs() void tst_QTextLayout::testTabs() { QTextLayout layout("Foo\tBar.", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); QTextOption option = layout.textOption(); option.setTabStop(150); @@ -1339,6 +1353,13 @@ void tst_QTextLayout::testTabs() void tst_QTextLayout::testMultilineTab() { QTextLayout layout("Lorem ipsum dolor sit\tBar.", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); // test if this works on the second line. layout.beginLayout(); @@ -1348,12 +1369,20 @@ void tst_QTextLayout::testMultilineTab() line.setLineWidth(220.); layout.endLayout(); + QCOMPARE(line.cursorToX(22), 80.); } void tst_QTextLayout::testMultiTab() { QTextLayout layout("Foo\t\t\tBar.", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); layout.beginLayout(); QTextLine line = layout.createLine(); @@ -1367,6 +1396,13 @@ void tst_QTextLayout::testTabsInAlignedParag() { QTextLayout layout("Foo\tsome more words", testFont); layout.setCacheEnabled(true); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + QTextOption option = layout.textOption(); // right option.setAlignment(Qt::AlignRight); @@ -1426,6 +1462,12 @@ void tst_QTextLayout::testRightTab() */ layout.setCacheEnabled(true); + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + QTextOption option = layout.textOption(); QList<QTextOption::Tab> tabs; QTextOption::Tab tab; @@ -1463,6 +1505,13 @@ void tst_QTextLayout::testRightTab() void tst_QTextLayout::testCenteredTab() { QTextLayout layout("Foo\tBar", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); // test if centering the tab works. We expect the center of 'Bar.' to be at the tab point. QTextOption option = layout.textOption(); @@ -1484,6 +1533,13 @@ void tst_QTextLayout::testCenteredTab() void tst_QTextLayout::testDelimiterTab() { QTextLayout layout("Foo\tBar. Barrabas", testFont); + + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + layout.setCacheEnabled(true); // try the different delimiter characters to see if the alignment works there. QTextOption option = layout.textOption(); @@ -1537,6 +1593,12 @@ void tst_QTextLayout::tabsForRtl() */ layout.setCacheEnabled(true); + QFont font = layout.font(); + QFontPrivate *fd = QFontPrivate::get(font); + qreal dpiScale = qreal(fd->dpi) / qreal(qt_defaultDpiY()); + if (!qFuzzyCompare(dpiScale, 1.0)) + QSKIP("Test logic does not work when tabs are scaled by dpi"); + QTextOption option = layout.textOption(); QList<QTextOption::Tab> tabs; QTextOption::Tab tab; diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp index cc8dd2105f..e7f30f8940 100644 --- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp +++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp @@ -200,6 +200,12 @@ void tst_QDnsLookup::lookup() lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); + +#if defined(Q_OS_ANDROID) + if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) + QEXPECT_FAIL("", "Not yet supported on Android", Abort); +#endif + QVERIFY2(int(lookup.error()) == error, qPrintable(lookup.errorString())); if (error == QDnsLookup::NoError) QVERIFY(lookup.errorString().isEmpty()); @@ -295,6 +301,12 @@ void tst_QDnsLookup::lookupReuse() lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); + +#if defined(Q_OS_ANDROID) + if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) + QEXPECT_FAIL("", "Not yet supported on Android", Abort); +#endif + QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("a-single")); @@ -333,6 +345,12 @@ void tst_QDnsLookup::lookupAbortRetry() lookup.lookup(); QVERIFY(waitForDone(&lookup)); QVERIFY(lookup.isFinished()); + +#if defined(Q_OS_ANDROID) + if (lookup.errorString() == QStringLiteral("Not yet supported on Android")) + QEXPECT_FAIL("", "Not yet supported on Android", Abort); +#endif + QCOMPARE(int(lookup.error()), int(QDnsLookup::NoError)); QVERIFY(!lookup.hostAddressRecords().isEmpty()); QCOMPARE(lookup.hostAddressRecords().first().name(), domainName("aaaa-single")); diff --git a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp index 8321f4fee1..a44afcbe8f 100644 --- a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp +++ b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp @@ -45,6 +45,10 @@ private slots: void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop() { +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Not supported on Android"); +#endif + // based on testcase provided in QTBUG-39488 QByteArray msg = "Hello World"; diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index a862ce2094..ecf3a9b050 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -147,6 +147,8 @@ private slots: void invalidQuery(); void batchExec_data() { generic_data(); } void batchExec(); + void QTBUG_43874_data() { generic_data(); } + void QTBUG_43874(); void oraArrayBind_data() { generic_data(); } void oraArrayBind(); void lastInsertId_data() { generic_data(); } @@ -338,6 +340,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) << qTableName("blobstest", __FILE__, db) << qTableName("oraRowId", __FILE__, db) << qTableName("qtest_batch", __FILE__, db) + << qTableName("bug43874", __FILE__, db) << qTableName("bug6421", __FILE__, db).toUpper() << qTableName("bug5765", __FILE__, db) << qTableName("bug6852", __FILE__, db) @@ -2185,6 +2188,33 @@ void tst_QSqlQuery::batchExec() QVERIFY( q.value( 3 ).isNull() ); } +void tst_QSqlQuery::QTBUG_43874() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlQuery q(db); + const QString tableName = qTableName("bug43874", __FILE__, db); + + QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id INT)")); + QVERIFY_SQL(q, prepare("INSERT INTO " + tableName + " (id) VALUES (?)")); + + for (int i = 0; i < 2; ++i) { + QVariantList ids; + ids << i; + q.addBindValue(ids); + QVERIFY_SQL(q, execBatch()); + } + QVERIFY_SQL(q, exec("SELECT id FROM " + tableName + " ORDER BY id")); + + QVERIFY(q.next()); + QCOMPARE(q.value(0).toInt(), 0); + + QVERIFY(q.next()); + QCOMPARE(q.value(0).toInt(), 1); +} + void tst_QSqlQuery::oraArrayBind() { QFETCH( QString, dbName ); diff --git a/tests/auto/test.pl b/tests/auto/test.pl index 7c3708472c..48166e1c30 100755 --- a/tests/auto/test.pl +++ b/tests/auto/test.pl @@ -138,35 +138,22 @@ sub handleDir { my ($dir) = @_; my $currentDir = getcwd(); - chdir($dir) || die("Could not chdir to $dir"); - my @components; - my $command; - @components = split(/\//, $dir); - my $component = $components[$#components]; - - $command = "tst_".$component; - - if ( -e $command.$EXE_SUFFIX ) - { - executeTestCurrentDir($command); - } else { - opendir(DIR, $dir); - my @files = readdir(DIR); - closedir DIR; - my $file; - foreach $file (@files) - { - #skip hidden files - next if (substr($file,0,1) eq "."); - - if ( -d $dir."/".$file) - { - handleDir($dir."/".$file) - } - + opendir(DIR, $dir); + my @files = readdir(DIR); + closedir DIR; + my $file; + foreach $file (@files) { + #skip hidden files + next if (substr($file,0,1) eq "."); + + if ( -d $dir."/".$file) { + handleDir($dir."/".$file) + } elsif ( $file =~ /^tst_/ and -x $dir."/".$file ) { + chdir($dir) || die("Could not chdir to $dir"); + executeTestCurrentDir($file); + chdir($currentDir); } } - chdir($currentDir); } sub executeTestCurrentDir { diff --git a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp index 3ed8e1e88e..273be1d9c3 100644 --- a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp +++ b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp @@ -113,6 +113,12 @@ void tst_QSidebar::addUrls() QAbstractItemModel *model = qsidebar.model(); QDir testDir = QDir::home(); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + // temp and home is the same directory on Android + testDir.mkdir(QStringLiteral("test")); + QVERIFY(testDir.cd(QStringLiteral("test"))); +#endif + // default QCOMPARE(model->rowCount(), 0); diff --git a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro index 680286d1e4..79848ac22c 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro +++ b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro @@ -13,9 +13,13 @@ wince* { DEPLOYMENT += addit tests sourceFile } -wince*: { +android|wince*: { DEFINES += SRCDIR=\\\"./\\\" } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" } +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc b/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc new file mode 100644 index 0000000000..e0ef4203fe --- /dev/null +++ b/tests/auto/widgets/itemviews/qdirmodel/testdata.qrc @@ -0,0 +1,11 @@ +<RCC> + <qresource prefix="/android_testdata"> + <file>dirtest/test1/dummy</file> + <file>dirtest/test1/test</file> + <file>test/file01.tst</file> + <file>test/file02.tst</file> + <file>test/file03.tst</file> + <file>test/file04.tst</file> + <file>tst_qdirmodel.cpp</file> + </qresource> +</RCC> diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp index 4fee5fb1e5..56a8d1f1f4 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp @@ -42,6 +42,7 @@ class tst_QDirModel : public QObject { Q_OBJECT public slots: + void initTestCase(); void cleanupTestCase(); void init(); private slots: @@ -113,6 +114,29 @@ void tst_QDirModel::getSetCheck() QCOMPARE(true, obj1.lazyChildCount()); } +void tst_QDirModel::initTestCase() +{ +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QString dataPath = SRCDIR; + QString resourceSourcePath = QStringLiteral(":/android_testdata"); + QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories); + while (it.hasNext()) { + it.next(); + + QFileInfo fileInfo = it.fileInfo(); + if (!fileInfo.isDir()) { + QString destination = dataPath + QLatin1Char('/') + fileInfo.filePath().mid(resourceSourcePath.length()); + QFileInfo destinationFileInfo(destination); + if (!destinationFileInfo.exists()) { + QDir().mkpath(destinationFileInfo.path()); + if (!QFile::copy(fileInfo.filePath(), destination)) + qWarning("Failed to copy %s", qPrintable(fileInfo.filePath())); + } + } + } +#endif +} + void tst_QDirModel::cleanupTestCase() { QDir current; @@ -556,10 +580,12 @@ void tst_QDirModel::filePath() model.setResolveSymlinks(false); QModelIndex index = model.index(SRCDIR "test.lnk"); QVERIFY(index.isValid()); -#ifndef Q_OS_WINCE +#if !defined(Q_OS_WINCE) && !defined(Q_OS_ANDROID) QString path = SRCDIR; #else - QString path = QFileInfo(SRCDIR).absoluteFilePath() + "/"; + QString path = QFileInfo(SRCDIR).absoluteFilePath(); + if (!path.endsWith("/")) + path += "/"; #endif QCOMPARE(model.filePath(index), path + QString( "test.lnk")); model.setResolveSymlinks(true); @@ -592,6 +618,10 @@ void tst_QDirModel::task196768_sorting() view.setSortingEnabled(true); index2 = model.index(path); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QEXPECT_FAIL("", "QTBUG-43818", Continue); +#endif + QCOMPARE(index.data(), index2.data()); } diff --git a/tests/auto/widgets/kernel/qlayout/qlayout.pro b/tests/auto/widgets/kernel/qlayout/qlayout.pro index 4a5db512c8..8bdbde9282 100644 --- a/tests/auto/widgets/kernel/qlayout/qlayout.pro +++ b/tests/auto/widgets/kernel/qlayout/qlayout.pro @@ -11,3 +11,8 @@ wince* { } else { TESTDATA += baseline/* } + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/widgets/kernel/qlayout/testdata.qrc b/tests/auto/widgets/kernel/qlayout/testdata.qrc new file mode 100644 index 0000000000..24e8e56263 --- /dev/null +++ b/tests/auto/widgets/kernel/qlayout/testdata.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>baseline/smartmaxsize</file> + </qresource> +</RCC> diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index c889643524..0bdc71e55b 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp @@ -345,6 +345,10 @@ void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated() void tst_QLayout::testRetainSizeWhenHidden() { +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Test does not work on platforms which default to showMaximized()"); +#endif + QWidget widget; QBoxLayout layout(QBoxLayout::TopToBottom, &widget); diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index 4d18971cc6..b4546aa760 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -10,3 +10,8 @@ wince* { addPixmap.path = . DEPLOYMENT += addPixmap } + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/widgets/styles/qstyle/testdata.qrc b/tests/auto/widgets/styles/qstyle/testdata.qrc new file mode 100644 index 0000000000..c16b9be775 --- /dev/null +++ b/tests/auto/widgets/styles/qstyle/testdata.qrc @@ -0,0 +1,20 @@ +<RCC> + <qresource prefix="/"> + <file>images/mac/button.png</file> + <file>images/mac/combobox.png</file> + <file>images/mac/lineedit.png</file> + <file>images/mac/mdi.png</file> + <file>images/mac/menu.png</file> + <file>images/mac/radiobutton.png</file> + <file>images/mac/slider.png</file> + <file>images/mac/spinbox.png</file> + <file>images/vista/button.png</file> + <file>images/vista/combobox.png</file> + <file>images/vista/lineedit.png</file> + <file>images/vista/menu.png</file> + <file>images/vista/radiobutton.png</file> + <file>images/vista/slider.png</file> + <file>images/vista/spinbox.png</file> + <file>task_25863.png</file> + </qresource> +</RCC> diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro index e5a6f5d7d2..8ee8d017ab 100644 --- a/tests/benchmarks/benchmarks.pro +++ b/tests/benchmarks/benchmarks.pro @@ -1,12 +1,12 @@ TEMPLATE = subdirs SUBDIRS = \ corelib \ - gui \ sql \ # removed-by-refactor qtHaveModule(opengl): SUBDIRS += opengl qtHaveModule(dbus): SUBDIRS += dbus qtHaveModule(network): SUBDIRS += network +qtHaveModule(gui): SUBDIRS += gui check-trusted.CONFIG += recursive QMAKE_EXTRA_TARGETS += check-trusted diff --git a/tests/manual/diaglib/eventfilter.cpp b/tests/manual/diaglib/eventfilter.cpp index 23a6d44fef..0a815fd883 100644 --- a/tests/manual/diaglib/eventfilter.cpp +++ b/tests/manual/diaglib/eventfilter.cpp @@ -36,6 +36,28 @@ #include <QtCore/QDebug> #include <QtCore/QTextStream> +#if QT_VERSION >= 0x050000 +# if defined(QT_WIDGETS_LIB) +# define HAVE_APPLICATION +# endif +# if defined(QT_GUI_LIB) +# define HAVE_GUI_APPLICATION +# endif +#else // Qt 5 +# if defined(QT_GUI_LIB) +# define HAVE_APPLICATION +# endif +#endif + +#ifdef HAVE_APPLICATION +# include <QApplication> +# include <QWidget> +#endif +#ifdef HAVE_GUI_APPLICATION +# include <QtGui/QGuiApplication> +# include <QtGui/QWindow> +#endif + namespace QtDiag { EventFilter::EventFilter(EventCategories eventCategories, QObject *p) @@ -131,16 +153,60 @@ static inline bool matchesType(const QObject *o, EventFilter::ObjectTypes types) return types & EventFilter::OtherType; } +static void formatObject(const QObject *o, QDebug debug) +{ + if (o) { + debug << o->metaObject()->className(); + const QString on = o->objectName(); + if (!on.isEmpty()) + debug << '/' << on; + } else { + debug << "null"; + } +} + +static void formatApplicationState(QDebug debug) +{ +#if defined(HAVE_APPLICATION) + if (const QWidget *mw = QApplication::activeModalWidget()) { + debug << "\n QApplication::activeModalWidget = "; + formatObject(mw, debug); + } + if (const QWidget *pw = QApplication::activePopupWidget()) { + debug << "\n QApplication::activePopupWidget = "; + formatObject(pw, debug); + } + debug << "\n QApplication::activeWindow = "; + formatObject(QApplication::activeWindow(), debug); +#endif // HAVE_APPLICATION +#if defined(HAVE_GUI_APPLICATION) + if (const QWindow *mw = QGuiApplication::modalWindow()) { + debug << "\n QGuiApplication::modalWindow = "; + formatObject(mw, debug); + } + debug << "\n QGuiApplication::focusWindow = "; + formatObject(QGuiApplication::focusWindow(), debug); +#endif // HAVE_GUI_APPLICATION +} + bool EventFilter::eventFilter(QObject *o, QEvent *e) { static int n = 0; if (matchesType(o, m_objectTypes) && m_eventTypes.contains(e->type())) { QDebug debug = qDebug().nospace(); - const QString on = o->objectName(); - debug << '#' << n++ << ' ' << o->metaObject()->className(); - if (!on.isEmpty()) - debug << '/' << on; + debug << '#' << n++ << ' '; + formatObject(o, debug); debug << ' ' << e; + switch (e->type()) { +#if QT_VERSION >= 0x050000 + case QEvent::FocusAboutToChange: +#endif + case QEvent::FocusIn: + formatApplicationState(debug); + break; + default: + break; + } } return false; } diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp index 487e95266b..dc1e0e08c0 100644 --- a/tests/manual/qscreen/main.cpp +++ b/tests/manual/qscreen/main.cpp @@ -80,8 +80,11 @@ void screenAdded(QScreen* screen) // But this works as long as the screens are all virtual siblings w->show(); QRect geom = w->geometry(); + geom.setSize(w->sizeHint()); + if (geom.height() > screen->geometry().height()) + geom.setHeight(screen->geometry().height() * 9 / 10); geom.moveCenter(screen->geometry().center()); - w->move(geom.topLeft()); + w->setGeometry(geom); props->insert(screen, w); diff --git a/tests/manual/qscreen/propertyfield.cpp b/tests/manual/qscreen/propertyfield.cpp index e6392465f2..f1e5e22ec9 100644 --- a/tests/manual/qscreen/propertyfield.cpp +++ b/tests/manual/qscreen/propertyfield.cpp @@ -34,8 +34,9 @@ #include "propertyfield.h" #include <QDebug> -PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent) : - QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop) +PropertyField::PropertyField(QObject* subject, const QMetaProperty& prop, QWidget *parent) + : QLineEdit(parent), m_subject(subject), m_lastChangeTime(QTime::currentTime()), m_prop(prop) + , m_defaultBrush(palette().brush(QPalette::Active, QPalette::Text)) { setReadOnly(true); if (prop.hasNotifySignal()) { @@ -99,7 +100,7 @@ void PropertyField::propertyChanged() setText(text); m_lastText = text; m_lastTextShowing = text; - modPalette.setBrush(QPalette::Text, Qt::black); + modPalette.setBrush(QPalette::Text, m_defaultBrush); } setPalette(modPalette); } diff --git a/tests/manual/qscreen/propertyfield.h b/tests/manual/qscreen/propertyfield.h index 2738a215a6..f76ac7fc6b 100644 --- a/tests/manual/qscreen/propertyfield.h +++ b/tests/manual/qscreen/propertyfield.h @@ -63,6 +63,7 @@ private: QString m_lastTextShowing; QTime m_lastChangeTime; const QMetaProperty m_prop; + QBrush m_defaultBrush; }; #endif // PROPERTYFIELD_H |