diff options
author | Liang Qi <[email protected]> | 2016-03-10 16:39:05 +0100 |
---|---|---|
committer | Liang Qi <[email protected]> | 2016-03-11 20:08:50 +0100 |
commit | 50d0f57b77b8088875d7185c5906b5f57985d5fb (patch) | |
tree | 16d21bb5f558461511258f493159658ccecc696a | |
parent | 713282dfe41fbad1c1c940cec54227cd7c267831 (diff) | |
parent | 45dc347a95fd674cefcf5d1ac63b01557fcb2fef (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
This change partially reverts 1bfc7f68 about QT_HAS_BUILTIN define
and undef in src/corelib/tools/qsimd_p.h.
This change is also squashed with "Fall back to c++11 standard
compiler flag for host builds" which is done by Peter Seiderer.
Conflicts:
mkspecs/features/default_post.prf
src/3rdparty/sqlite/0001-Fixing-the-SQLite3-build-for-WEC2013-again.patch
src/3rdparty/sqlite/sqlite3.c
src/corelib/tools/qsimd_p.h
src/gui/kernel/qevent.cpp
src/gui/kernel/qwindowsysteminterface.cpp
src/gui/kernel/qwindowsysteminterface_p.h
src/plugins/bearer/blackberry/blackberry.pro
src/plugins/platforms/cocoa/qcocoasystemsettings.mm
src/plugins/platformthemes/gtk2/gtk2.pro
src/plugins/styles/bb10style/bb10style.pro
src/sql/drivers/sqlite2/qsql_sqlite2.cpp
tools/configure/configureapp.cpp
Task-number: QTBUG-51644
Done-with: Peter Seiderer <[email protected]>
Change-Id: I6100d6ace31b2e8d41a95f0b5d5ebf8f1fd88b44
179 files changed, 1443 insertions, 934 deletions
diff --git a/config.tests/unix/alsa/alsatest.cpp b/config.tests/unix/alsa/alsatest.cpp index f93eda4a376..1b2b141b793 100644 --- a/config.tests/unix/alsa/alsatest.cpp +++ b/config.tests/unix/alsa/alsatest.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ #include <alsa/asoundlib.h> -#if(!(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 10)) +#if SND_LIB_VERSION < 0x1000a // 1.0.10 #error "Alsa version found too old, require >= 1.0.10" #endif diff --git a/doc/global/manifest-meta.qdocconf b/doc/global/manifest-meta.qdocconf index c45470838aa..f535f5e2903 100644 --- a/doc/global/manifest-meta.qdocconf +++ b/doc/global/manifest-meta.qdocconf @@ -55,9 +55,7 @@ manifestmeta.highlighted.names = "QtQuick/Qt Quick Demo - Same Game" \ "QtMultimedia/QML Video Shader Effects Example" \ "QtCanvas3D/Planets Example" \ "QtCanvas3D/Interactive Mobile Phone Example" \ - "QtLocation/Map Viewer (QML)" \ - "QtWebEngine/WebEngine Quick Nano Browser" \ - "QtWebEngine/Markdown Editor Example" + "QtLocation/Map Viewer (QML)" manifestmeta.highlighted.attributes = isHighlighted:true diff --git a/mkspecs/common/wince/qplatformdefs.h b/mkspecs/common/wince/qplatformdefs.h index 1c7db53df09..92f5013231e 100644 --- a/mkspecs/common/wince/qplatformdefs.h +++ b/mkspecs/common/wince/qplatformdefs.h @@ -58,7 +58,6 @@ #include <tchar.h> #include <stdio.h> #include <stdlib.h> -#include <windows.h> #ifdef QT_LARGEFILE_SUPPORT #define QT_STATBUF struct _stati64 // non-ANSI defs diff --git a/mkspecs/features/benchmark.prf b/mkspecs/features/benchmark.prf new file mode 100644 index 00000000000..bfae9227001 --- /dev/null +++ b/mkspecs/features/benchmark.prf @@ -0,0 +1 @@ +load(testcase) diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index cd8d8859aa9..e7e9a5bd87f 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -96,9 +96,16 @@ breakpad { } c++11|c++14|c++1z { - c++1z: cxxstd = CXX1Z - else: c++14: cxxstd = CXX14 - else: cxxstd = CXX11 + # Disable special compiler flags for host builds + !host_build|!cross_compile { + c++1z: cxxstd = CXX1Z + else: c++14: cxxstd = CXX14 + else: cxxstd = CXX11 + } else { + # Fall back to c++11, because since 5.7 c++11 is required everywhere, + # including host builds + cxxstd = CXX11 + } # Check if we should disable the GNU extensions or not !strict_c++:!isEmpty(QMAKE_CXXFLAGS_GNU$$cxxstd): cxxstd = GNU$$cxxstd diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf index 07300842a05..c1c668aec81 100644 --- a/mkspecs/features/qt_common.prf +++ b/mkspecs/features/qt_common.prf @@ -84,9 +84,9 @@ warnings_are_errors:warning_clean { QMAKE_CXXFLAGS_WARN_ON += -Werror -ww177,1224,1478,1881 $$WERROR } } else:gcc:!clang:!intel_icc { - # GCC 4.6-4.9, 5.x + # GCC 4.6-4.9, 5.x, ... ver = $${QT_GCC_MAJOR_VERSION}.$${QT_GCC_MINOR_VERSION} - contains(ver, "(4\\.[6789]|5\\..)") { + contains(ver, "(4\\.[6789]|[5-9]\\..)") { QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=cpp -Wno-error=deprecated-declarations $$WERROR # GCC prints this bogus warning, after it has inlined a lot of code diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf index 8b717c98f4b..9c453505430 100644 --- a/mkspecs/features/qt_module_pris.prf +++ b/mkspecs/features/qt_module_pris.prf @@ -42,8 +42,11 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri module_libs = "\$\$QT_MODULE_HOST_LIB_BASE" else: \ module_libs = "\$\$QT_MODULE_LIB_BASE" - !isEmpty(QT_PRIVATE): \ - module_rundep = "QT.$${MODULE_ID}.run_depends = $$replace(QT_PRIVATE, -private$, _private)" + # In addition to the library's private deps, the private module's deps + # are logically runtime deps of the public module. + runtime_deps = $$QT_PRIVATE $$QT_FOR_PRIVATE + !isEmpty(runtime_deps): \ + module_rundep = "QT.$${MODULE_ID}.run_depends = $$replace(runtime_deps, -private$, _private)" else: \ module_rundep = module_build_type = v2 diff --git a/mkspecs/features/testcase.prf b/mkspecs/features/testcase.prf index e6eace190e5..08ed00715d0 100644 --- a/mkspecs/features/testcase.prf +++ b/mkspecs/features/testcase.prf @@ -6,13 +6,16 @@ have_target { # qt_build_config tells us to re-enable exceptions here. testcase_exceptions: CONFIG += exceptions -check.files = -check.path = . +benchmark: type = benchmark +else: type = check + +$${type}.files = +$${type}.path = . # Add environment for non-installed builds. Do this first, so the # 'make' variable expansions don't end up in a batch file/script. QT_TOOL_NAME = target -qtAddTargetEnv(check.commands, QT) +qtAddTargetEnv($${type}.commands, QT) # If the test ends up in a different directory, we should cd to that directory. TESTRUN_CWD = $$DESTDIR @@ -27,44 +30,44 @@ debug_and_release:debug_and_release_target { } # Allow for a custom test runner script -check.commands += $(TESTRUNNER) +$${type}.commands += $(TESTRUNNER) unix { isEmpty(TEST_TARGET_DIR): TEST_TARGET_DIR = . app_bundle: \ - check.commands += $${TEST_TARGET_DIR}/$(QMAKE_TARGET).app/Contents/MacOS/$(QMAKE_TARGET) + $${type}.commands += $${TEST_TARGET_DIR}/$(QMAKE_TARGET).app/Contents/MacOS/$(QMAKE_TARGET) else: \ - check.commands += $${TEST_TARGET_DIR}/$(QMAKE_TARGET) + $${type}.commands += $${TEST_TARGET_DIR}/$(QMAKE_TARGET) } else { # Windows !isEmpty(TEST_TARGET_DIR): TEST_TARGET_DIR = $${TEST_TARGET_DIR}$${QMAKE_DIR_SEP} - check.commands += $${TEST_TARGET_DIR}$(TARGET) + $${type}.commands += $${TEST_TARGET_DIR}$(TARGET) } # Allow for custom arguments to tests -check.commands += $(TESTARGS) +$${type}.commands += $(TESTARGS) !isEmpty(TESTRUN_CWD):!contains(TESTRUN_CWD, ^\\./?): \ - check.commands = cd $$shell_path($$TESTRUN_CWD) && $$check.commands + $${type}.commands = cd $$shell_path($$TESTRUN_CWD) && $$eval($${type}.commands) # If the test is marked as insignificant, discard the exit code -insignificant_test:check.commands = -$${check.commands} +insignificant_test: $${type}.commands = -$$eval($${type}.commands) -QMAKE_EXTRA_TARGETS *= check +QMAKE_EXTRA_TARGETS *= $${type} isEmpty(BUILDS)|build_pass { - check.depends = first + $${type}.depends = first } else { # For exclusive builds, only run the test once. - check.CONFIG = recursive - check.target = check_all - check.recurse_target = check - check.commands = - - check_first.depends = $$eval($$first(BUILDS).target)-check - check_first.target = check - QMAKE_EXTRA_TARGETS += check_first + $${type}.CONFIG = recursive + $${type}.target = $${type}_all + $${type}.recurse_target = $${type} + $${type}.commands = + + $${type}_first.depends = $$eval($$first(BUILDS).target)-$${type} + $${type}_first.target = $${type} + QMAKE_EXTRA_TARGETS += $${type}_first } !no_testcase_installs:!contains(INSTALLS, target) { diff --git a/mkspecs/features/testcase_targets.prf b/mkspecs/features/testcase_targets.prf index e9b107735a0..16ec6a9f0d4 100644 --- a/mkspecs/features/testcase_targets.prf +++ b/mkspecs/features/testcase_targets.prf @@ -7,3 +7,13 @@ check.depends = first # `make check' implies build QMAKE_EXTRA_TARGETS += check } + +# ... and the same for benchmarks, too. +!contains(QMAKE_EXTRA_TARGETS, benchmark) { + contains(TEMPLATE, subdirs): \ + prepareRecursiveTarget(benchmark) + else: \ + benchmark.depends = first # `make benchmark' implies build + QMAKE_EXTRA_TARGETS += benchmark +} + diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index f062605dd4f..80a62a1cc28 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -564,7 +564,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t) dst = escapeFilePath(filePrefixRoot(root, targetdir + src.section('/', -1))); if(!ret.isEmpty()) ret += "\n\t"; - ret += "-$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + dst; + ret += "-$(INSTALL_FILE) " + escapeFilePath(Option::fixPathToTargetOS(src, false)) + ' ' + dst; if(!uninst.isEmpty()) uninst.append("\n\t"); uninst.append("-$(DEL_FILE) " + dst); diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp index 01d9c26e01a..2a481031470 100644 --- a/qmake/library/qmakeparser.cpp +++ b/qmake/library/qmakeparser.cpp @@ -275,7 +275,8 @@ void QMakeParser::putHashStr(ushort *&pTokPtr, const ushort *buf, uint len) *tokPtr++ = (ushort)hash; *tokPtr++ = (ushort)(hash >> 16); *tokPtr++ = (ushort)len; - memcpy(tokPtr, buf, len * 2); + if (len) // buf may be nullptr; don't pass that to memcpy (-> undefined behavior) + memcpy(tokPtr, buf, len * 2); pTokPtr = tokPtr + len; } diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro index edfc0e7954d..163842e8fc3 100644 --- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro +++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro @@ -7,8 +7,12 @@ CONFIG += \ load(qt_helper_lib) +# built-in shapers list configuration: +SHAPERS += opentype # HB's main shaper; enabling it should be enough most of the time +mac: SHAPERS += coretext # native shaper on OSX/iOS; could be used alone to handle both OT and AAT fonts + DEFINES += HAVE_CONFIG_H -DEFINES += HAVE_OT HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED +DEFINES += HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED # platform/compiler specific definitions DEFINES += HAVE_ATEXIT @@ -78,57 +82,59 @@ HEADERS += \ $$PWD/src/hb-unicode.h \ $$PWD/src/hb-version.h -# Open Type -SOURCES += \ - $$PWD/src/hb-ot-font.cc \ - $$PWD/src/hb-ot-layout.cc \ - $$PWD/src/hb-ot-map.cc \ - $$PWD/src/hb-ot-shape.cc \ - $$PWD/src/hb-ot-shape-complex-arabic.cc \ - $$PWD/src/hb-ot-shape-complex-default.cc \ - $$PWD/src/hb-ot-shape-complex-hangul.cc \ - $$PWD/src/hb-ot-shape-complex-hebrew.cc \ - $$PWD/src/hb-ot-shape-complex-indic.cc \ - $$PWD/src/hb-ot-shape-complex-indic-table.cc \ - $$PWD/src/hb-ot-shape-complex-myanmar.cc \ - $$PWD/src/hb-ot-shape-complex-thai.cc \ - $$PWD/src/hb-ot-shape-complex-tibetan.cc \ - $$PWD/src/hb-ot-shape-complex-use.cc \ - $$PWD/src/hb-ot-shape-complex-use-table.cc \ - $$PWD/src/hb-ot-shape-fallback.cc \ - $$PWD/src/hb-ot-shape-normalize.cc +contains(SHAPERS, opentype) { + DEFINES += HAVE_OT -HEADERS += \ - $$PWD/src/hb-ot-layout-common-private.hh \ - $$PWD/src/hb-ot-layout-gdef-table.hh \ - $$PWD/src/hb-ot-layout-gpos-table.hh \ - $$PWD/src/hb-ot-layout-gsubgpos-private.hh \ - $$PWD/src/hb-ot-layout-gsub-table.hh \ - $$PWD/src/hb-ot-layout-jstf-table.hh \ - $$PWD/src/hb-ot-layout-private.hh \ - $$PWD/src/hb-ot-map-private.hh \ - $$PWD/src/hb-ot-shape-complex-arabic-fallback.hh \ - $$PWD/src/hb-ot-shape-complex-arabic-private.hh \ - $$PWD/src/hb-ot-shape-complex-arabic-table.hh \ - $$PWD/src/hb-ot-shape-complex-indic-machine.hh \ - $$PWD/src/hb-ot-shape-complex-indic-private.hh \ - $$PWD/src/hb-ot-shape-complex-myanmar-machine.hh \ - $$PWD/src/hb-ot-shape-complex-private.hh \ - $$PWD/src/hb-ot-shape-complex-use-machine.hh \ - $$PWD/src/hb-ot-shape-complex-use-private.hh \ - $$PWD/src/hb-ot-shape-fallback-private.hh \ - $$PWD/src/hb-ot-shape-normalize-private.hh \ - $$PWD/src/hb-ot-shape-private.hh + SOURCES += \ + $$PWD/src/hb-ot-font.cc \ + $$PWD/src/hb-ot-layout.cc \ + $$PWD/src/hb-ot-map.cc \ + $$PWD/src/hb-ot-shape.cc \ + $$PWD/src/hb-ot-shape-complex-arabic.cc \ + $$PWD/src/hb-ot-shape-complex-default.cc \ + $$PWD/src/hb-ot-shape-complex-hangul.cc \ + $$PWD/src/hb-ot-shape-complex-hebrew.cc \ + $$PWD/src/hb-ot-shape-complex-indic.cc \ + $$PWD/src/hb-ot-shape-complex-indic-table.cc \ + $$PWD/src/hb-ot-shape-complex-myanmar.cc \ + $$PWD/src/hb-ot-shape-complex-thai.cc \ + $$PWD/src/hb-ot-shape-complex-tibetan.cc \ + $$PWD/src/hb-ot-shape-complex-use.cc \ + $$PWD/src/hb-ot-shape-complex-use-table.cc \ + $$PWD/src/hb-ot-shape-fallback.cc \ + $$PWD/src/hb-ot-shape-normalize.cc -HEADERS += \ - $$PWD/src/hb-ot.h \ - $$PWD/src/hb-ot-font.h \ - $$PWD/src/hb-ot-layout.h \ - $$PWD/src/hb-ot-shape.h \ - $$PWD/src/hb-ot-tag.h - -mac { - # Apple Advanced Typography + HEADERS += \ + $$PWD/src/hb-ot-layout-common-private.hh \ + $$PWD/src/hb-ot-layout-gdef-table.hh \ + $$PWD/src/hb-ot-layout-gpos-table.hh \ + $$PWD/src/hb-ot-layout-gsubgpos-private.hh \ + $$PWD/src/hb-ot-layout-gsub-table.hh \ + $$PWD/src/hb-ot-layout-jstf-table.hh \ + $$PWD/src/hb-ot-layout-private.hh \ + $$PWD/src/hb-ot-map-private.hh \ + $$PWD/src/hb-ot-shape-complex-arabic-fallback.hh \ + $$PWD/src/hb-ot-shape-complex-arabic-private.hh \ + $$PWD/src/hb-ot-shape-complex-arabic-table.hh \ + $$PWD/src/hb-ot-shape-complex-indic-machine.hh \ + $$PWD/src/hb-ot-shape-complex-indic-private.hh \ + $$PWD/src/hb-ot-shape-complex-myanmar-machine.hh \ + $$PWD/src/hb-ot-shape-complex-private.hh \ + $$PWD/src/hb-ot-shape-complex-use-machine.hh \ + $$PWD/src/hb-ot-shape-complex-use-private.hh \ + $$PWD/src/hb-ot-shape-fallback-private.hh \ + $$PWD/src/hb-ot-shape-normalize-private.hh \ + $$PWD/src/hb-ot-shape-private.hh + + HEADERS += \ + $$PWD/src/hb-ot.h \ + $$PWD/src/hb-ot-font.h \ + $$PWD/src/hb-ot-layout.h \ + $$PWD/src/hb-ot-shape.h \ + $$PWD/src/hb-ot-tag.h +} + +contains(SHAPERS, coretext) { DEFINES += HAVE_CORETEXT SOURCES += \ diff --git a/src/concurrent/concurrent.pro b/src/concurrent/concurrent.pro index 2b8fef2d6aa..2a519314f35 100644 --- a/src/concurrent/concurrent.pro +++ b/src/concurrent/concurrent.pro @@ -7,8 +7,6 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000 QMAKE_DOCS = $$PWD/doc/qtconcurrent.qdocconf -load(qt_module) - PRECOMPILED_HEADER = ../corelib/global/qt_pch.h SOURCES += \ @@ -41,3 +39,5 @@ HEADERS += \ contains(QT_CONFIG, clock-gettime) { linux-*|hpux-*|solaris-*: LIBS_PRIVATE *= -lrt } + +load(qt_module) diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 78ea489ebc0..362ac37a593 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -7,6 +7,7 @@ MODULE_CONFIG = moc resources !isEmpty(QT_NAMESPACE): MODULE_DEFINES = QT_NAMESPACE=$$QT_NAMESPACE CONFIG += $$MODULE_CONFIG +DEFINES += $$MODULE_DEFINES DEFINES += QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000 irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused @@ -29,7 +30,6 @@ ANDROID_PERMISSIONS = \ # variable and on FreeBSD, this variable is in the final executable itself freebsd: QMAKE_LFLAGS_NOUNDEF = -load(qt_module) load(qfeatures) include(animation/animation.pri) @@ -58,8 +58,6 @@ mac|darwin { LIBS_PRIVATE += -framework CoreFoundation LIBS_PRIVATE += -framework Foundation } -win32:DEFINES-=QT_NO_CAST_TO_ASCII -DEFINES += $$MODULE_DEFINES QMAKE_LIBS += $$QMAKE_LIBS_CORE @@ -76,6 +74,11 @@ qt_conf.variable = QT_CONFIG QMAKE_PKGCONFIG_VARIABLES += host_bins qt_conf +load(qt_module) + +# Override qt_module, so the symbols are actually included into the library. +win32: DEFINES -= QT_NO_CAST_TO_ASCII + ctest_macros_file.input = $$PWD/Qt5CTestMacros.cmake ctest_macros_file.output = $$DESTDIR/cmake/Qt5Core/Qt5CTestMacros.cmake ctest_macros_file.CONFIG = verbatim diff --git a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc index 6f183d3e713..216bd985db4 100644 --- a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc +++ b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc @@ -251,7 +251,8 @@ This example illustrates that objects can work together without needing to know any information about each other. To enable this, the objects only need to be connected together, and this can be achieved with some simple - QObject::connect() function calls, or with \c{uic}'s {automatic connections} feature. + QObject::connect() function calls, or with \c{uic}'s + \l{Automatic Connections}{automatic connections} feature. \section1 A Real Example diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 5e340dbd27f..46cfe9e2b93 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1191,7 +1191,7 @@ static void slog2_default_handler(QtMsgType msgType, const char *message) buffer_config.buffer_set_name = __progname; buffer_config.num_buffers = 1; - buffer_config.verbosity_level = SLOG2_INFO; + buffer_config.verbosity_level = SLOG2_DEBUG1; buffer_config.buffer_config[0].buffer_name = "default"; buffer_config.buffer_config[0].num_pages = 8; diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index 22f01fc70ba..97f750a3a68 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -131,6 +131,9 @@ # if defined(WINCE) || defined(_WIN32_WCE) # define Q_OS_WINCE # elif defined(WINAPI_FAMILY) +# ifndef WINAPI_FAMILY_PC_APP +# define WINAPI_FAMILY_PC_APP WINAPI_FAMILY_APP +# endif # if defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP # define Q_OS_WINPHONE # define Q_OS_WINRT diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h index f7337fe1b5a..8ac3c2135d9 100644 --- a/src/corelib/global/qt_windows.h +++ b/src/corelib/global/qt_windows.h @@ -45,22 +45,14 @@ #pragma qt_sync_stop_processing #endif -#if defined(Q_CC_BOR) -// Borland's windows.h does not set these correctly, resulting in -// unusable WinSDK standard dialogs -#ifndef WINVER -# define WINVER 0x0501 -#endif -#ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0501 -#endif -#endif - #if defined(Q_CC_MINGW) // mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation -#ifndef WINVER -# define WINVER 0x501 -#endif +# ifndef WINVER +# define WINVER 0x501 +# endif +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +# endif #endif #ifndef NOMINMAX diff --git a/src/corelib/io/qfilesystemiterator_win.cpp b/src/corelib/io/qfilesystemiterator_win.cpp index 2caf87a7b41..ba195b23305 100644 --- a/src/corelib/io/qfilesystemiterator_win.cpp +++ b/src/corelib/io/qfilesystemiterator_win.cpp @@ -37,13 +37,6 @@ ** ****************************************************************************/ -#if !defined(WINAPI_FAMILY) -# if _WIN32_WINNT < 0x0500 -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x0500 -# endif // _WIN32_WINNT < 0x500 -#endif // !WINAPI_FAMILY - #include "qfilesystemiterator_p.h" #include "qfilesystemengine_p.h" #include "qplatformdefs.h" diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h index fd835d18b1c..4ce05037619 100644 --- a/src/corelib/io/qprocess.h +++ b/src/corelib/io/qprocess.h @@ -269,7 +269,7 @@ Q_SIGNALS: void finished(int exitCode); // ### Qt 6: merge the two signals with a default value void finished(int exitCode, QProcess::ExitStatus exitStatus); #if QT_DEPRECATED_SINCE(5,6) - QT_MOC_COMPAT void error(QProcess::ProcessError error); + void error(QProcess::ProcessError error); #endif void errorOccurred(QProcess::ProcessError error); void stateChanged(QProcess::ProcessState state, QPrivateSignal); diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 611ce34550f..ef787832a4e 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -665,7 +665,8 @@ bool QProcessPrivate::waitForReadyRead(int msecs) return false; if (WaitForSingleObjectEx(pid->hProcess, 0, false) == WAIT_OBJECT_0) { bool readyReadEmitted = drainOutputPipes(); - _q_processDied(); + if (pid) + _q_processDied(); return readyReadEmitted; } @@ -770,7 +771,8 @@ bool QProcessPrivate::waitForFinished(int msecs) if (WaitForSingleObject(pid->hProcess, timer.nextSleepTime()) == WAIT_OBJECT_0) { drainOutputPipes(); - _q_processDied(); + if (pid) + _q_processDied(); return true; } diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index f74f52df895..05ed51e999a 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -510,6 +510,12 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa return false; } + // workaround for rare cases where trailing '\0' are missing in registry + if (dataType == REG_SZ || dataType == REG_EXPAND_SZ) + dataSize += 2; + else if (dataType == REG_MULTI_SZ) + dataSize += 4; + // get the value QByteArray data(dataSize, 0); res = RegQueryValueEx(handle, reinterpret_cast<const wchar_t *>(rSubkeyName.utf16()), 0, 0, diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index bc4a5fa538b..27b75702261 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -456,6 +456,10 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes) bytesRead = device->read(buf, sizeof(buf)); } + // reset the Text flag. + if (textModeEnabled) + device->setTextModeEnabled(true); + if (bytesRead <= 0) return false; @@ -491,10 +495,6 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes) readBuffer += QString::fromLatin1(buf, bytesRead); #endif - // reset the Text flag. - if (textModeEnabled) - device->setTextModeEnabled(true); - // remove all '\r\n' in the string. if (readBuffer.size() > oldReadBufferSize && textModeEnabled) { QChar CR = QLatin1Char('\r'); @@ -593,17 +593,18 @@ void QTextStreamPrivate::flushWriteBuffer() qDebug("QTextStreamPrivate::flushWriteBuffer(), device->write(\"%s\") == %d", qt_prettyDebug(data.constData(), qMin(data.size(),32), data.size()).constData(), int(bytesWritten)); #endif - if (bytesWritten <= 0) { - status = QTextStream::WriteFailed; - return; - } #if defined (Q_OS_WIN) - // replace the text flag + // reset the text flag if (textModeEnabled) device->setTextModeEnabled(true); #endif + if (bytesWritten <= 0) { + status = QTextStream::WriteFailed; + return; + } + // flush the file #ifndef QT_NO_QOBJECT QFileDevice *file = qobject_cast<QFileDevice *>(device); diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h index 4c628ff1feb..e5010c2da71 100644 --- a/src/corelib/json/qjson_p.h +++ b/src/corelib/json/qjson_p.h @@ -151,6 +151,13 @@ public: return *this; } }; +} // namespace QJsonPrivate + +template <typename T> +class QTypeInfo<QJsonPrivate::q_littleendian<T> > + : public QTypeInfoMerger<QJsonPrivate::q_littleendian<T>, T> {}; + +namespace QJsonPrivate { typedef q_littleendian<short> qle_short; typedef q_littleendian<unsigned short> qle_ushort; @@ -402,7 +409,7 @@ public: // pack with itself, we'll discard the high part anyway chunk = _mm_packus_epi16(chunk, chunk); // unaligned 64-bit store - *(quint64*)&l[i] = _mm_cvtsi128_si64(chunk); + qUnalignedStore(l + i, _mm_cvtsi128_si64(chunk)); i += 8; } # endif diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp index 9bafcc4c5f1..a896d17519a 100644 --- a/src/corelib/json/qjsonparser.cpp +++ b/src/corelib/json/qjsonparser.cpp @@ -738,7 +738,7 @@ bool Parser::parseNumber(QJsonPrivate::Value *val, int baseOffset) } int pos = reserveSpace(sizeof(double)); - *(quint64 *)(data + pos) = qToLittleEndian(ui); + qToLittleEndian(ui, reinterpret_cast<uchar *>(data + pos)); if (current - baseOffset >= Value::MaxSize) { lastError = QJsonParseError::DocumentTooLarge; return false; diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 79a3254a390..6ccc7b729b1 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -674,7 +674,7 @@ QCoreApplication::QCoreApplication(QCoreApplicationPrivate &p) : QObject(p, 0) #endif { - init(); + d_func()->q_ptr = this; // note: it is the subclasses' job to call // QCoreApplicationPrivate::eventDispatcher->startingUp(); } @@ -723,27 +723,26 @@ QCoreApplication::QCoreApplication(int &argc, char **argv : QObject(*new QCoreApplicationPrivate(argc, argv, _internal)) #endif { - init(); + d_func()->q_ptr = this; + d_func()->init(); #ifndef QT_NO_QOBJECT QCoreApplicationPrivate::eventDispatcher->startingUp(); #endif } -// ### move to QCoreApplicationPrivate constructor? -void QCoreApplication::init() +void QCoreApplicationPrivate::init() { - d_ptr->q_ptr = this; - Q_D(QCoreApplication); + Q_Q(QCoreApplication); - QCoreApplicationPrivate::initLocale(); + initLocale(); - Q_ASSERT_X(!self, "QCoreApplication", "there should be only one application object"); - QCoreApplication::self = this; + Q_ASSERT_X(!QCoreApplication::self, "QCoreApplication", "there should be only one application object"); + QCoreApplication::self = q; // Store app name (so it's still available after QCoreApplication is destroyed) if (!coreappdata()->applicationNameSet) - coreappdata()->application = d_func()->appName(); + coreappdata()->application = appName(); QLoggingRegistry::instance()->init(); @@ -759,7 +758,7 @@ void QCoreApplication::init() // anywhere in the list, we can just linearly scan the lists and find the items that // have been removed. Once the original list is exhausted we know all the remaining // items have been added. - QStringList newPaths(libraryPaths()); + QStringList newPaths(q->libraryPaths()); for (int i = manualPaths->length(), j = appPaths->length(); i > 0 || j > 0; qt_noop()) { if (--j < 0) { newPaths.prepend((*manualPaths)[--i]); @@ -779,28 +778,28 @@ void QCoreApplication::init() #ifndef QT_NO_QOBJECT // use the event dispatcher created by the app programmer (if any) - if (!QCoreApplicationPrivate::eventDispatcher) - QCoreApplicationPrivate::eventDispatcher = d->threadData->eventDispatcher.load(); + if (!eventDispatcher) + eventDispatcher = threadData->eventDispatcher.load(); // otherwise we create one - if (!QCoreApplicationPrivate::eventDispatcher) - d->createEventDispatcher(); - Q_ASSERT(QCoreApplicationPrivate::eventDispatcher != 0); + if (!eventDispatcher) + createEventDispatcher(); + Q_ASSERT(eventDispatcher); - if (!QCoreApplicationPrivate::eventDispatcher->parent()) { - QCoreApplicationPrivate::eventDispatcher->moveToThread(d->threadData->thread); - QCoreApplicationPrivate::eventDispatcher->setParent(this); + if (!eventDispatcher->parent()) { + eventDispatcher->moveToThread(threadData->thread); + eventDispatcher->setParent(q); } - d->threadData->eventDispatcher = QCoreApplicationPrivate::eventDispatcher; - d->eventDispatcherReady(); + threadData->eventDispatcher = eventDispatcher; + eventDispatcherReady(); #endif #ifdef QT_EVAL extern void qt_core_eval_init(QCoreApplicationPrivate::Type); - qt_core_eval_init(d->application_type); + qt_core_eval_init(application_type); #endif - d->processCommandLineArguments(); + processCommandLineArguments(); qt_call_pre_routines(); qt_startup_hook(); @@ -810,7 +809,7 @@ void QCoreApplication::init() #endif #ifndef QT_NO_QOBJECT - QCoreApplicationPrivate::is_app_running = true; // No longer starting up. + is_app_running = true; // No longer starting up. #endif } diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index 3131265fd5e..a22e1c4f9e6 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -206,8 +206,6 @@ private: static bool notifyInternal2(QObject *receiver, QEvent *); #endif - void init(); - static QCoreApplication *self; Q_DISABLE_COPY(QCoreApplication) diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 482429f0739..445bae01b46 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -80,6 +80,8 @@ public: QCoreApplicationPrivate(int &aargc, char **aargv, uint flags); ~QCoreApplicationPrivate(); + void init(); + QString appName() const; #ifdef Q_OS_MAC diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index 95068e6a674..7e962f816ed 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -325,6 +325,11 @@ private: friend class QGraphicsView; friend class QGraphicsScene; friend class QGraphicsScenePrivate; + // from QtTest: + friend class QSpontaneKeyEvent; + // needs this: + Q_ALWAYS_INLINE + void setSpontaneous() { spont = true; } }; class Q_CORE_EXPORT QTimerEvent : public QEvent diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 2a6e24533a2..951668fe552 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -159,6 +159,12 @@ inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {} # define Q_OBJECT_NO_OVERRIDE_WARNING #endif +#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && Q_CC_GNU >= 600 +# define Q_OBJECT_NO_ATTRIBUTES_WARNING QT_WARNING_DISABLE_GCC("-Wattributes") +#else +# define Q_OBJECT_NO_ATTRIBUTES_WARNING +#endif + /* qmake ignore Q_OBJECT */ #define Q_OBJECT \ public: \ @@ -169,10 +175,11 @@ public: \ virtual const QMetaObject *metaObject() const; \ virtual void *qt_metacast(const char *); \ virtual int qt_metacall(QMetaObject::Call, int, void **); \ - QT_WARNING_POP \ QT_TR_FUNCTIONS \ private: \ + Q_OBJECT_NO_ATTRIBUTES_WARNING \ Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \ + QT_WARNING_POP \ struct QPrivateSignal {}; /* qmake ignore Q_OBJECT */ @@ -186,7 +193,11 @@ public: \ void qt_check_for_QGADGET_macro(); \ typedef void QtGadgetHelper; \ private: \ - Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); + QT_WARNING_PUSH \ + Q_OBJECT_NO_ATTRIBUTES_WARNING \ + Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \ + QT_WARNING_POP \ + /*end*/ #endif // QT_NO_META_MACROS #else // Q_MOC_RUN diff --git a/src/corelib/mimetypes/qmimemagicrule.cpp b/src/corelib/mimetypes/qmimemagicrule.cpp index 528dca3ff5b..4ba98ad2c4e 100644 --- a/src/corelib/mimetypes/qmimemagicrule.cpp +++ b/src/corelib/mimetypes/qmimemagicrule.cpp @@ -48,6 +48,7 @@ #include <QtCore/QList> #include <QtCore/QDebug> #include <qendian.h> +#include <private/qsimd_p.h> // for qUnalignedLoad QT_BEGIN_NAMESPACE @@ -163,7 +164,7 @@ bool QMimeMagicRule::matchNumber(const QByteArray &data) const const char *p = data.constData() + m_startPos; const char *e = data.constData() + qMin(data.size() - int(sizeof(T)), m_endPos + 1); for ( ; p <= e; ++p) { - if ((*reinterpret_cast<const T*>(p) & mask) == (value & mask)) + if ((qUnalignedLoad<T>(p) & mask) == (value & mask)) return true; } diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index dd60c5af08b..c2add4aeefa 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -597,9 +597,8 @@ void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data) const QStringRef name = xml.attributes().value(QLatin1String("type")); if (name.isEmpty()) continue; - if (name != data.name) { + if (name.compare(data.name, Qt::CaseInsensitive)) qWarning() << "Got name" << name << "in file" << file << "expected" << data.name; - } while (xml.readNextStartElement()) { const QStringRef tag = xml.name(); diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 635282d5c4a..ef1799a021a 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -37,12 +37,6 @@ ** ****************************************************************************/ -//#define WINVER 0x0500 -#if !defined(WINAPI_FAMILY) && (_WIN32_WINNT < 0x0400) -#define _WIN32_WINNT 0x0400 -#endif - - #include "qthread.h" #include "qthread_p.h" #include "qthreadstorage.h" diff --git a/src/corelib/thread/thread.pri b/src/corelib/thread/thread.pri index 2cb00a6cf44..0a989cfcaf7 100644 --- a/src/corelib/thread/thread.pri +++ b/src/corelib/thread/thread.pri @@ -43,24 +43,20 @@ SOURCES += thread/qatomic.cpp \ thread/qthreadpool.cpp \ thread/qthreadstorage.cpp -unix:SOURCES += thread/qthread_unix.cpp \ - thread/qwaitcondition_unix.cpp - -win32:SOURCES += thread/qthread_win.cpp \ - thread/qwaitcondition_win.cpp - -integrity:SOURCES += thread/qthread_unix.cpp \ - thread/qwaitcondition_unix.cpp - -false { - # files #included by others, but listed here so IDEs parsing this file know - # they are part of QtCore. Usually, qmake can find out that certain files - # are #included by others and thus remove from SOURCES, but it gets lost - # with qmutex.cpp. +win32 { SOURCES += \ - thread/qmutex_linux.cpp \ - thread/qmutex_mac.cpp \ - thread/qmutex_unix.cpp \ - thread/qmutex_win.cpp + thread/qmutex_win.cpp \ + thread/qthread_win.cpp \ + thread/qwaitcondition_win.cpp +} else { + darwin { + SOURCES += thread/qmutex_mac.cpp + } else: linux { + SOURCES += thread/qmutex_linux.cpp + } else { + SOURCES += thread/qmutex_unix.cpp + } + SOURCES += \ + thread/qthread_unix.cpp \ + thread/qwaitcondition_unix.cpp } - diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 1001f2a06cd..8ab98bd5094 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -113,24 +113,24 @@ static uint crc32(const Char *ptr, size_t len, uint h) p += 8; for ( ; p <= e; p += 8) - h2 = _mm_crc32_u64(h2, *reinterpret_cast<const qlonglong *>(p - 8)); + h2 = _mm_crc32_u64(h2, qUnalignedLoad<qlonglong>(p - 8)); h = h2; p -= 8; len = e - p; if (len & 4) { - h = _mm_crc32_u32(h, *reinterpret_cast<const uint *>(p)); + h = _mm_crc32_u32(h, qUnalignedLoad<uint>(p)); p += 4; } # else p += 4; for ( ; p <= e; p += 4) - h = _mm_crc32_u32(h, *reinterpret_cast<const uint *>(p - 4)); + h = _mm_crc32_u32(h, qUnalignedLoad<uint>(p - 4)); p -= 4; len = e - p; # endif if (len & 2) { - h = _mm_crc32_u16(h, *reinterpret_cast<const ushort *>(p)); + h = _mm_crc32_u16(h, qUnalignedLoad<ushort>(p)); p += 2; } if (sizeof(Char) == 1 && len & 1) diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 5bce42fd5a0..9037442d9d5 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -747,4 +747,26 @@ void qDumpCPUFeatures() puts(""); } +/*! + \internal + \fn T qUnalignedLoad(const void *ptr) + \since 5.6.1 + + Loads a \c{T} from address \a ptr, which may be misaligned. + + Use of this function avoid the undefined behavior that the C++ standard + otherwise attributes to unaligned loads. +*/ + +/*! + \internal + \fn void qUnalignedStore(void *ptr, T t) + \since 5.6.1 + + Stores \a t to address \a ptr, which may be misaligned. + + Use of this function avoid the undefined behavior that the C++ standard + otherwise attributes to unaligned stores. +*/ + QT_END_NAMESPACE diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 02439a2a9c2..1a795a670df 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -521,6 +521,32 @@ unsigned _bit_scan_forward(unsigned val) #define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \ for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x3)) & 0x3))); ++i) +template <typename T> +Q_ALWAYS_INLINE +T qUnalignedLoad(const void *ptr) Q_DECL_NOTHROW +{ + T result; +#if QT_HAS_BUILTIN(__builtin_memcpy) + __builtin_memcpy +#else + memcpy +#endif + /*memcpy*/(&result, ptr, sizeof result); + return result; +} + +template <typename T> +Q_ALWAYS_INLINE +void qUnalignedStore(void *ptr, T t) Q_DECL_NOTHROW +{ +#if QT_HAS_BUILTIN(__builtin_memcpy) + __builtin_memcpy +#else + memcpy +#endif + /*memcpy*/(ptr, &t, sizeof t); +} + QT_END_NAMESPACE #endif // QSIMD_P_H diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 943d8efe1de..c7cd1a77516 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -584,7 +584,7 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l) // we'll read uc[offset..offset+7] (16 bytes) and c[offset..offset+7] (8 bytes) if (uc + offset + 7 < e) { // same, but we're using an 8-byte load - __m128i chunk = _mm_cvtsi64_si128(*(const long long *)(c + offset)); + __m128i chunk = _mm_cvtsi64_si128(qUnalignedLoad<long long>(c + offset)); __m128i secondHalf = _mm_unpacklo_epi8(chunk, nullmask); __m128i ucdata = _mm_loadu_si128((const __m128i*)(uc + offset)); @@ -6177,11 +6177,7 @@ QString QString::vasprintf(const char *cformat, va_list ap) } case 'p': { void *arg = va_arg(ap, void*); -#ifdef Q_OS_WIN64 - quint64 i = reinterpret_cast<quint64>(arg); -#else - quint64 i = reinterpret_cast<unsigned long>(arg); -#endif + const quint64 i = reinterpret_cast<quintptr>(arg); flags |= QLocaleData::Alternate; subst = QLocaleData::c()->unsLongLongToString(i, precision, 16, width, flags); ++c; diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro index ebeab5c1b09..4c1aec7bb37 100644 --- a/src/dbus/dbus.pro +++ b/src/dbus/dbus.pro @@ -25,8 +25,6 @@ win32 { QMAKE_DOCS = $$PWD/doc/qtdbus.qdocconf -load(qt_module) - PUB_HEADERS = qdbusargument.h \ qdbusconnectioninterface.h \ qdbusmacros.h \ @@ -91,3 +89,5 @@ SOURCES += qdbusconnection.cpp \ qdbusservicewatcher.cpp \ qdbusunixfiledescriptor.cpp \ qdbusvirtualobject.cpp + +load(qt_module) diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 55837bcf3b3..462f133ff8e 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -23,8 +23,6 @@ win32:contains(QT_CONFIG, angle)|contains(QT_CONFIG, dynamicgl) { \$\$QT_MODULE_INCLUDE_BASE/QtANGLE } -load(qt_module) - # Code coverage with TestCocoon # The following is required as extra compilers use $$QMAKE_CXX instead of $(CXX). # Without this, testcocoon.prf is read only after $$QMAKE_CXX is used by the @@ -50,6 +48,7 @@ include(itemmodels/itemmodels.pri) QMAKE_LIBS += $$QMAKE_LIBS_GUI +load(qt_module) load(cmake_functions) win32: CMAKE_WINDOWS_BUILD = True diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 37b7b185222..f902f1b715d 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4416,7 +4416,8 @@ QImage QImage::smoothScaled(int w, int h) const { src = src.convertToFormat(QImage::Format_RGB32); } src = qSmoothScaleImage(src, w, h); - copyMetadata(src.d, d); + if (!src.isNull()) + copyMetadata(src.d, d); return src; } diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 78a4dc4f35e..d8b1367833d 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -761,6 +761,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, int delta, : QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons), ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false) { + if (!QGuiApplicationPrivate::scrollNoPhaseAllowed) + ph = Qt::ScrollUpdate; g = QCursor::pos(); if (orient == Qt::Vertical) angleD = QPoint(0, delta); @@ -796,6 +798,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons), ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false) { + if (!QGuiApplicationPrivate::scrollNoPhaseAllowed) + ph = Qt::ScrollUpdate; if (orient == Qt::Vertical) angleD = QPoint(0, delta); else @@ -832,7 +836,10 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false) -{} +{ + if (!QGuiApplicationPrivate::scrollNoPhaseAllowed) + ph = Qt::ScrollUpdate; +} /*! Constructs a wheel event object. diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 1d050bba975..a79a6020884 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -199,6 +199,9 @@ bool QGuiApplicationPrivate::obey_desktop_settings = true; QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0; +// enable the fix for QTBUG-50199; TODO remove this check in 5.7 +bool QGuiApplicationPrivate::scrollNoPhaseAllowed = false; + static qreal fontSmoothingGamma = 1.7; extern void qRegisterGuiVariant(); @@ -587,7 +590,7 @@ QGuiApplication::QGuiApplication(int &argc, char **argv, int flags) QGuiApplication::QGuiApplication(QGuiApplicationPrivate &p) : QCoreApplication(p) { - d_func()->init(); } +} /*! Destructs the application. @@ -1300,6 +1303,8 @@ void QGuiApplicationPrivate::eventDispatcherReady() void QGuiApplicationPrivate::init() { + QCoreApplicationPrivate::init(); + QCoreApplicationPrivate::is_app_running = false; // Starting up. bool loadTestability = false; @@ -1453,6 +1458,8 @@ void QGuiApplicationPrivate::init() if (layout_direction == Qt::LayoutDirectionAuto || force_reverse) QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight); + + scrollNoPhaseAllowed = qEnvironmentVariableIsSet("QT_ENABLE_MOUSE_WHEEL_TRACKING"); } extern void qt_cleanupFontDatabase(); diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index c1efb5c0c08..830d716ed82 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -81,6 +81,8 @@ public: QGuiApplicationPrivate(int &argc, char **argv, int flags); ~QGuiApplicationPrivate(); + void init(); + void createPlatformIntegration(); void createEventDispatcher() Q_DECL_OVERRIDE; void eventDispatcherReady() Q_DECL_OVERRIDE; @@ -300,6 +302,9 @@ public: static void setApplicationState(Qt::ApplicationState state, bool forcePropagate = false); + // enable the fix for QTBUG-50199; TODO remove this check in 5.7 + static bool scrollNoPhaseAllowed; + protected: virtual void notifyThemeChanged(); bool tryCloseRemainingWindows(QWindowList processedWindows); @@ -310,8 +315,6 @@ protected: private: friend class QDragManager; - void init(); - static QGuiApplicationPrivate *self; static QTouchDevice *m_fakeTouchDevice; static int m_fakeMouseSourcePointId; diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 7547e58346e..01e27d72d40 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -318,6 +318,9 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local, void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source, bool invertedScrolling) { + if (!QGuiApplicationPrivate::scrollNoPhaseAllowed && phase == Qt::NoScrollPhase) + phase = Qt::ScrollUpdate; + // Qt 4 sends two separate wheel events for horizontal and vertical // deltas. For Qt 5 we want to send the deltas in one event, but at the // same time preserve source and behavior compatibility with Qt 4. @@ -865,7 +868,9 @@ Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF &local, const QP { bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents; QWindowSystemInterface::setSynchronousWindowSystemEvents(true); - QWindowSystemInterface::handleMouseEvent(w, timestamp, local, global, b, mods); + const qreal factor = QHighDpiScaling::factor(w); + QWindowSystemInterface::handleMouseEvent(w, timestamp, local * factor, + global * factor, b, mods); QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous); } @@ -914,36 +919,14 @@ Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int #endif } -static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt) -{ - QWindowSystemInterface::TouchPoint p; - p.id = pt.id(); - p.flags = pt.flags(); - p.normalPosition = pt.normalizedPos(); - p.area = pt.screenRect(); - p.pressure = pt.pressure(); - p.state = pt.state(); - p.velocity = pt.velocity(); - p.rawPositions = pt.rawScreenPositions(); - return p; -} -static QList<struct QWindowSystemInterface::TouchPoint> touchPointList(const QList<QTouchEvent::TouchPoint>& pointList) -{ - QList<struct QWindowSystemInterface::TouchPoint> newList; - newList.reserve(pointList.size()); - for (const QTouchEvent::TouchPoint &p : pointList) - newList.append(touchPoint(p)); - - return newList; -} - Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device, const QList<QTouchEvent::TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier) { bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents; QWindowSystemInterface::setSynchronousWindowSystemEvents(true); - QWindowSystemInterface::handleTouchEvent(w, device, touchPointList(points), mods); + QWindowSystemInterface::handleTouchEvent(w, device, + QWindowSystemInterfacePrivate::toNativeTouchPoints(points, w), mods); QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous); } @@ -958,5 +941,13 @@ bool QWindowSystemEventHandler::sendEvent(QWindowSystemInterfacePrivate::WindowS return true; } +QWindowSystemInterfacePrivate::WheelEvent::WheelEvent(QWindow *w, ulong time, const QPointF &local, const QPointF &global, QPoint pixelD, + QPoint angleD, int qt4D, Qt::Orientation qt4O, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource src, bool inverted) + : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), + qt4Orientation(qt4O), localPos(local), globalPos(global), + phase(!QGuiApplicationPrivate::scrollNoPhaseAllowed && phase == Qt::NoScrollPhase ? Qt::ScrollUpdate : phase), + source(src), inverted(inverted) +{ +} QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index 4bb0e83a971..3ccf815c542 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -242,8 +242,7 @@ public: class WheelEvent : public InputEvent { public: WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, QPoint pixelD, QPoint angleD, int qt4D, Qt::Orientation qt4O, - Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized, bool inverted = false) - : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase), source(src), inverted(inverted) { } + Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized, bool inverted = false); QPoint pixelDelta; QPoint angleDelta; int qt4Delta; diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index 5cbcdf83d47..ba0d1871d10 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -147,12 +147,14 @@ inline void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage) if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom()) return; - int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ; - int lasty = stroker->spans[stroker->current_span-1].y; + if (stroker->current_span > 0) { + const int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ; + const int lasty = stroker->spans[stroker->current_span-1].y; - if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) { - stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData); - stroker->current_span = 0; + if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) { + stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData); + stroker->current_span = 0; + } } stroker->spans[stroker->current_span].x = ushort(x); diff --git a/src/gui/painting/qdrawhelper_mips_dsp.cpp b/src/gui/painting/qdrawhelper_mips_dsp.cpp index 81ae0f43ba7..b72ca3da3d0 100644 --- a/src/gui/painting/qdrawhelper_mips_dsp.cpp +++ b/src/gui/painting/qdrawhelper_mips_dsp.cpp @@ -495,7 +495,7 @@ void QT_FASTCALL comp_func_SourceOut_mips_dsp(uint *dest, const uint *src, int l const uint * QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { - uchar *line = (uchar *)data->texture.scanLine(y) + x; + const uchar *line = data->texture.scanLine(y) + x * 3; fetchUntransformed_888_asm_mips_dsp(buffer, line, length); return buffer; } @@ -503,7 +503,7 @@ const uint * QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer, const const uint * QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { - uchar *line = (uchar *)data->texture.scanLine(y) + x; + const uchar *line = data->texture.scanLine(y) + x * 2; fetchUntransformed_444_asm_mips_dsp(buffer, line, length); return buffer; } @@ -511,7 +511,7 @@ const uint * QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer, const const uint * QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { - uchar *line = (uchar *)data->texture.scanLine(y) + x; + const uchar *line = data->texture.scanLine(y) + x * 3; fetchUntransformed_argb8565_premultiplied_asm_mips_dsp(buffer, line, length); return buffer; } diff --git a/src/gui/painting/qpagelayout.cpp b/src/gui/painting/qpagelayout.cpp index 317e6d241a8..f3f7f5f9563 100644 --- a/src/gui/painting/qpagelayout.cpp +++ b/src/gui/painting/qpagelayout.cpp @@ -949,40 +949,37 @@ QRect QPageLayout::paintRectPixels(int resolution) const QDebug operator<<(QDebug dbg, const QPageLayout &layout) { QDebugStateSaver saver(dbg); + dbg.nospace(); + dbg.noquote(); + dbg << "QPageLayout("; if (layout.isValid()) { - QString output = QStringLiteral("QPageLayout(%1, %2, l:%3 r:%4 t:%5 b:%6 %7)"); - QString units; + const QMarginsF margins = layout.margins(); + dbg << '"' << layout.pageSize().name() << "\", " + << (layout.orientation() == QPageLayout::Portrait ? "Portrait" : "Landscape") + << ", l:" << margins.left() << " r:" << margins.right() << " t:" + << margins.top() << " b:" << margins.bottom() << ' '; switch (layout.units()) { case QPageLayout::Millimeter: - units = QStringLiteral("mm"); + dbg << "mm"; break; case QPageLayout::Point: - units = QStringLiteral("pt"); + dbg << "pt"; break; case QPageLayout::Inch: - units = QStringLiteral("in"); + dbg << "in"; break; case QPageLayout::Pica: - units = QStringLiteral("pc"); + dbg << "pc"; break; case QPageLayout::Didot: - units = QStringLiteral("DD"); + dbg << "DD"; break; case QPageLayout::Cicero: - units = QStringLiteral("CC"); + dbg << "CC"; break; } - output = output.arg(layout.pageSize().name()) - .arg(layout.orientation() == QPageLayout::Portrait ? QStringLiteral("Portrait") : QStringLiteral("Landscape")) - .arg(layout.margins().left()) - .arg(layout.margins().right()) - .arg(layout.margins().top()) - .arg(layout.margins().bottom()) - .arg(units); - dbg.nospace() << output; - } else { - dbg.nospace() << "QPageLayout()"; } + dbg << ')'; return dbg; } #endif diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp index c5a2e7288bb..f53285d9cb3 100644 --- a/src/gui/painting/qpagesize.cpp +++ b/src/gui/painting/qpagesize.cpp @@ -1861,17 +1861,17 @@ QSize QPageSize::sizePixels(PageSizeId pageSizeId, int resolution) QDebug operator<<(QDebug dbg, const QPageSize &pageSize) { QDebugStateSaver saver(dbg); + dbg.nospace(); + dbg.noquote(); + dbg << "QPageSize("; if (pageSize.isValid()) { - QString output = QStringLiteral("QPageSize(\"%1\", \"%2\", %3x%4pt, %5)"); - output = output.arg(pageSize.name()) - .arg(pageSize.key()) - .arg(pageSize.sizePoints().width()) - .arg(pageSize.sizePoints().height()) - .arg(pageSize.id()); - dbg.nospace() << output; + dbg << '"' << pageSize.name() << "\", key=\"" << pageSize.key() + << "\", " << pageSize.sizePoints().width() << 'x' + << pageSize.sizePoints().height() << "pt, id=" << pageSize.id(); } else { dbg.nospace() << "QPageSize()"; } + dbg << ')'; return dbg; } #endif diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 861d6517562..48ae3cfc808 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -258,8 +258,6 @@ class SegmentTree public: SegmentTree(QPathSegments &segments); - QRectF boundingRect() const; - void produceIntersections(int segment); private: @@ -310,12 +308,6 @@ SegmentTree::SegmentTree(QPathSegments &segments) m_tree[0] = root; } -QRectF SegmentTree::boundingRect() const -{ - return QRectF(QPointF(m_bounds.x1, m_bounds.y1), - QPointF(m_bounds.x2, m_bounds.y2)); -} - static inline qreal coordinate(const QPointF &pos, int axis) { return axis == 0 ? pos.x() : pos.y(); diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 32073257559..9d62a03f4c9 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1075,8 +1075,8 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, if (glyph_buffer_size < pitch * info.height) { glyph_buffer_size = pitch * info.height; glyph_buffer.reset(new uchar[glyph_buffer_size]); + memset(glyph_buffer.data(), 0, glyph_buffer_size); } - memset(glyph_buffer.data(), 0, glyph_buffer_size); if (slot->format == FT_GLYPH_FORMAT_OUTLINE) { FT_Bitmap bitmap; diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 3ee6177f3c7..fa73507c164 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2753,8 +2753,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int QFixed ellipsisWidth; QString ellipsisText; { - QFontEngine *fe = fnt.d->engineForScript(QChar::Script_Common); - QFontEngine *engine = fe->type() == QFontEngine::Multi ? static_cast<QFontEngineMulti *>(fe)->engine(0) : fe; + QFontEngine *engine = fnt.d->engineForScript(QChar::Script_Common); QChar ellipsisChar(0x2026); diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index f4510c34983..3601c36bc2c 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -558,9 +558,8 @@ qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) if (c == '\n') { // check for possible header endings. As per HTTP rfc, // the header endings will be marked by CRLFCRLF. But - // we will allow CRLFCRLF, CRLFLF, LFLF - if (fragment.endsWith("\r\n\r\n") - || fragment.endsWith("\r\n\n") + // we will allow CRLFCRLF, CRLFLF, LFCRLF, LFLF + if (fragment.endsWith("\n\r\n") || fragment.endsWith("\n\n")) allHeaders = true; diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h index 653097fed33..da39633dd19 100644 --- a/src/network/access/qhttpnetworkreply_p.h +++ b/src/network/access/qhttpnetworkreply_p.h @@ -181,7 +181,7 @@ private: }; -class QHttpNetworkReplyPrivate : public QObjectPrivate, public QHttpNetworkHeaderPrivate +class Q_AUTOTEST_EXPORT QHttpNetworkReplyPrivate : public QObjectPrivate, public QHttpNetworkHeaderPrivate { public: QHttpNetworkReplyPrivate(const QUrl &newUrl = QUrl()); diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 2f4a1e5462d..aed05575e3d 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -682,18 +682,19 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq if (newHttpRequest.attribute(QNetworkRequest::FollowRedirectsAttribute).toBool()) httpRequest.setFollowRedirects(true); - bool loadedFromCache = false; httpRequest.setPriority(convert(newHttpRequest.priority())); switch (operation) { case QNetworkAccessManager::GetOperation: httpRequest.setOperation(QHttpNetworkRequest::Get); - loadedFromCache = loadFromCacheIfAllowed(httpRequest); + if (loadFromCacheIfAllowed(httpRequest)) + return; // no need to send the request! :) break; case QNetworkAccessManager::HeadOperation: httpRequest.setOperation(QHttpNetworkRequest::Head); - loadedFromCache = loadFromCacheIfAllowed(httpRequest); + if (loadFromCacheIfAllowed(httpRequest)) + return; // no need to send the request! :) break; case QNetworkAccessManager::PostOperation: @@ -725,10 +726,6 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq break; // can't happen } - if (loadedFromCache) { - return; // no need to send the request! :) - } - QList<QByteArray> headers = newHttpRequest.rawHeaderList(); if (resumeOffset != 0) { const int rangeIndex = headers.indexOf("Range"); @@ -757,10 +754,10 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq foreach (const QByteArray &header, headers) httpRequest.setHeaderField(header, newHttpRequest.rawHeader(header)); - if (newHttpRequest.attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool() == true) + if (newHttpRequest.attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool()) httpRequest.setPipeliningAllowed(true); - if (request.attribute(QNetworkRequest::SpdyAllowedAttribute).toBool() == true) + if (request.attribute(QNetworkRequest::SpdyAllowedAttribute).toBool()) httpRequest.setSPDYAllowed(true); if (static_cast<QNetworkRequest::LoadControl> @@ -768,7 +765,7 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual) httpRequest.setWithCredentials(false); - if (request.attribute(QNetworkRequest::EmitAllUploadProgressSignalsAttribute).toBool() == true) + if (request.attribute(QNetworkRequest::EmitAllUploadProgressSignalsAttribute).toBool()) emitAllUploadProgressSignals = true; @@ -1755,10 +1752,8 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation() QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); return; } -#endif if (!start(request)) { -#ifndef QT_NO_BEARERMANAGEMENT // backend failed to start because the session state is not Connected. // QNetworkAccessManager will call reply->backend->start() again for us when the session // state changes. @@ -1780,29 +1775,25 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation() QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); return; } + } else if (session) { + QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)), + q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), + Qt::QueuedConnection); + } #else + if (!start(request)) { qWarning("Backend start failed"); QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, Q_ARG(QNetworkReply::NetworkError, QNetworkReply::UnknownNetworkError), Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "backend start error."))); QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); return; -#endif - } else { -#ifndef QT_NO_BEARERMANAGEMENT - if (session) - QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)), - q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection); -#endif } +#endif // QT_NO_BEARERMANAGEMENT if (synchronous) { state = Finished; q_func()->setFinished(true); - } else { - if (state != Finished) { - - } } } diff --git a/src/network/network.pro b/src/network/network.pro index 4cced923f7a..cdea1902221 100644 --- a/src/network/network.pro +++ b/src/network/network.pro @@ -11,13 +11,8 @@ DEFINES += QT_NO_USING_NAMESPACE #DEFINES += QUDPSOCKET_DEBUG QUDPSERVER_DEBUG win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x64000000 -MODULE_PLUGIN_TYPES = \ - bearer - QMAKE_DOCS = $$PWD/doc/qtnetwork.qdocconf -load(qt_module) - include(access/access.pri) include(bearer/bearer.pri) include(kernel/kernel.pri) @@ -36,3 +31,7 @@ MODULE_PLUGIN_TYPES = \ bearer ANDROID_PERMISSIONS += \ android.permission.ACCESS_NETWORK_STATE + +MODULE_PLUGIN_TYPES = \ + bearer +load(qt_module) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index c4bc46a630f..c6f5b8864bb 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -2180,8 +2180,10 @@ bool QAbstractSocket::waitForReadyRead(int msecs) return false; } - Q_ASSERT(d->socketEngine); do { + if (state() != ConnectedState) + return false; + bool readyToRead = false; bool readyToWrite = false; if (!d->socketEngine->waitForReadOrWrite(&readyToRead, &readyToWrite, true, !d->writeBuffer.isEmpty(), @@ -2203,9 +2205,6 @@ bool QAbstractSocket::waitForReadyRead(int msecs) if (readyToWrite) d->canWriteNotification(); - - if (state() != ConnectedState) - return false; } while (msecs == -1 || qt_subtract_from_timeout(msecs, stopWatch.elapsed()) > 0); return false; } diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 9c62d41d3ea..007f73c45f3 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -8,8 +8,6 @@ irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused QMAKE_DOCS = $$PWD/doc/qtopengl.qdocconf -load(qt_module) - contains(QT_CONFIG, opengl):CONFIG += opengl contains(QT_CONFIG, opengles2):CONFIG += opengles2 @@ -53,3 +51,5 @@ SOURCES += qglshaderprogram.cpp \ gl2paintengineex/qpaintengineex_opengl2.cpp \ gl2paintengineex/qglcustomshaderstage.cpp \ gl2paintengineex/qtextureglyphcache_gl.cpp + +load(qt_module) diff --git a/src/openglextensions/openglextensions.pro b/src/openglextensions/openglextensions.pro index 948465165ef..18eec27e1c1 100644 --- a/src/openglextensions/openglextensions.pro +++ b/src/openglextensions/openglextensions.pro @@ -4,11 +4,11 @@ CONFIG += static contains(QT_CONFIG, opengl):CONFIG += opengl contains(QT_CONFIG, opengles2):CONFIG += opengles2 -load(qt_module) - DEFINES += QT_NO_CAST_FROM_ASCII PRECOMPILED_HEADER = HEADERS = qopenglextensions.h SOURCES = qopenglextensions.cpp + +load(qt_module) diff --git a/src/platformheaders/xcbfunctions/qxcbscreenfunctions.h b/src/platformheaders/xcbfunctions/qxcbscreenfunctions.h new file mode 100644 index 00000000000..7773c275b9d --- /dev/null +++ b/src/platformheaders/xcbfunctions/qxcbscreenfunctions.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBSCREENFUNCTIONS_H +#define QXCBSCREENFUNCTIONS_H + +#include <QtPlatformHeaders/QPlatformHeaderHelper> + +QT_BEGIN_NAMESPACE + +class QScreen; + +class QXcbScreenFunctions +{ +public: + typedef bool (*VirtualDesktopNumber)(const QScreen *screen); + static const QByteArray virtualDesktopNumberIdentifier() { return QByteArrayLiteral("XcbVirtualDesktopNumber"); } + static int virtualDesktopNumber(const QScreen *screen) + { + return QPlatformHeaderHelper::callPlatformFunction<int, VirtualDesktopNumber, const QScreen *>(virtualDesktopNumberIdentifier(), screen); + } +}; + +QT_END_NAMESPACE + +#endif /*QXCBSCREENFUNCTIONS_H*/ diff --git a/src/platformheaders/xcbfunctions/xcbfunctions.pri b/src/platformheaders/xcbfunctions/xcbfunctions.pri index 7f611d80bd5..3f2bcb2b34c 100644 --- a/src/platformheaders/xcbfunctions/xcbfunctions.pri +++ b/src/platformheaders/xcbfunctions/xcbfunctions.pri @@ -1,3 +1,4 @@ HEADERS += \ $$PWD/qxcbwindowfunctions.h \ - $$PWD/qxcbintegrationfunctions.h + $$PWD/qxcbintegrationfunctions.h \ + $$PWD/qxcbscreenfunctions.h diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 5ca07497873..b288a05e32c 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -868,7 +868,7 @@ void QFontconfigDatabase::setupFontEngine(QFontEngineFT *engine, const QFontDef const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services(); bool useXftConf = (services && (services->desktopEnvironment() == "GNOME" || services->desktopEnvironment() == "UNITY")); - if (useXftConf) { + if (useXftConf && !forcedAntialiasSetting) { void *antialiasResource = QGuiApplication::platformNativeInterface()->nativeResourceForScreen("antialiasingEnabled", QGuiApplication::primaryScreen()); diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 9dba1ca1f17..d7020092b54 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -524,9 +524,6 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo if (&CTFontCopyDefaultCascadeListForLanguages) #endif { - if (fallbackLists.contains(family)) - return fallbackLists.value(family); - QCFType<CFMutableDictionaryRef> attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, QCFString(family)); if (QCFType<CTFontDescriptorRef> fontDescriptor = CTFontDescriptorCreateWithAttributes(attributes)) { @@ -554,12 +551,9 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo fallbackList.append(QStringLiteral("Arial Unicode MS")); #endif - fallbackLists[family] = fallbackList; + return fallbackList; } } - - if (fallbackLists.contains(family)) - return fallbackLists.value(family); } } #endif diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index cec596ebb2d..6b98ed30a90 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -538,9 +538,16 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) it.next(); Contact &contact(it.value()); int key = m_typeB ? it.key() : contact.trackingId; - if (!m_contacts.contains(key)) { - contact.state = Qt::TouchPointReleased; - addTouchPoint(contact, &combinedStates); + if (m_typeB) { + if (contact.trackingId != m_contacts[key].trackingId && contact.state) { + contact.state = Qt::TouchPointReleased; + addTouchPoint(contact, &combinedStates); + } + } else { + if (!m_contacts.contains(key)) { + contact.state = Qt::TouchPointReleased; + addTouchPoint(contact, &combinedStates); + } } } diff --git a/src/plugins/bearer/android/src/src.pro b/src/plugins/bearer/android/src/src.pro index 1050601896e..eb0738386c6 100644 --- a/src/plugins/bearer/android/src/src.pro +++ b/src/plugins/bearer/android/src/src.pro @@ -1,11 +1,5 @@ -include(wrappers/wrappers.pri) - TARGET = qandroidbearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QAndroidBearerEnginePlugin -load(qt_plugin) - QT = core-private network-private HEADERS += qandroidbearerengine.h \ @@ -15,3 +9,9 @@ HEADERS += qandroidbearerengine.h \ SOURCES += main.cpp \ qandroidbearerengine.cpp \ ../../qnetworksession_impl.cpp + +include(wrappers/wrappers.pri) + +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QAndroidBearerEnginePlugin +load(qt_plugin) diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro index efa13a6ebdc..9f3fff304bd 100644 --- a/src/plugins/bearer/connman/connman.pro +++ b/src/plugins/bearer/connman/connman.pro @@ -1,9 +1,5 @@ TARGET = qconnmanbearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QConnmanEnginePlugin -load(qt_plugin) - QT = core network-private dbus CONFIG += link_pkgconfig @@ -21,3 +17,6 @@ SOURCES += main.cpp \ OTHER_FILES += connman.json +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QConnmanEnginePlugin +load(qt_plugin) diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index 674af0cbbe7..ab0257aecda 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -1,9 +1,5 @@ TARGET = qcorewlanbearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QCoreWlanEnginePlugin -load(qt_plugin) - QT = core-private network-private LIBS += -framework Foundation -framework SystemConfiguration @@ -21,3 +17,7 @@ SOURCES += main.cpp \ OBJECTIVE_SOURCES += qcorewlanengine.mm OTHER_FILES += corewlan.json + +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QCoreWlanEnginePlugin +load(qt_plugin) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index aab8a5e05bb..3f8f80fc857 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -164,6 +164,7 @@ void QScanThread::run() mutex.lock(); CWInterface *currentInterface = [CWInterface interfaceWithName: QCFString::toNSString(interfaceName)]; mutex.unlock(); + const bool currentInterfaceServiceActive = currentInterface.serviceActive; if (currentInterface.powerOn) { NSError *err = nil; @@ -178,7 +179,7 @@ void QScanThread::run() QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; bool known = isKnownSsid(networkSsid); - if (currentInterface.serviceActive) { + if (currentInterfaceServiceActive) { if( networkSsid == QCFString::toQString( [currentInterface ssid])) { state = QNetworkConfiguration::Active; } @@ -221,7 +222,7 @@ void QScanThread::run() interfaceName = ij.value(); } - if (currentInterface.serviceActive) { + if (currentInterfaceServiceActive) { if( networkSsid == QCFString::toQString([currentInterface ssid])) { state = QNetworkConfiguration::Active; } diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro index d0e17380e3f..f71a9013415 100644 --- a/src/plugins/bearer/generic/generic.pro +++ b/src/plugins/bearer/generic/generic.pro @@ -1,9 +1,5 @@ TARGET = qgenericbearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QGenericEnginePlugin -load(qt_plugin) - QT = core-private network-private HEADERS += qgenericengine.h \ @@ -15,3 +11,7 @@ SOURCES += qgenericengine.cpp \ main.cpp OTHER_FILES += generic.json + +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QGenericEnginePlugin +load(qt_plugin) diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro index e372c8ca05c..da7f2da353e 100644 --- a/src/plugins/bearer/nativewifi/nativewifi.pro +++ b/src/plugins/bearer/nativewifi/nativewifi.pro @@ -1,9 +1,5 @@ TARGET = qnativewifibearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QNativeWifiEnginePlugin -load(qt_plugin) - QT = core-private network-private HEADERS += qnativewifiengine.h \ @@ -16,3 +12,7 @@ SOURCES += main.cpp \ ../qnetworksession_impl.cpp OTHER_FILES += nativewifi.json + +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QNativeWifiEnginePlugin +load(qt_plugin) diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index b3a270615cc..e71c93f66f0 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -1,9 +1,5 @@ TARGET = qnmbearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QNetworkManagerEnginePlugin -load(qt_plugin) - QT = core network-private dbus HEADERS += qnetworkmanagerservice.h \ @@ -19,3 +15,7 @@ SOURCES += main.cpp \ ../qnetworksession_impl.cpp OTHER_FILES += networkmanager.json + +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QNetworkManagerEnginePlugin +load(qt_plugin) diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro index bac76084779..32ff5446e51 100644 --- a/src/plugins/bearer/nla/nla.pro +++ b/src/plugins/bearer/nla/nla.pro @@ -1,9 +1,5 @@ TARGET = qnlabearer -PLUGIN_TYPE = bearer -PLUGIN_CLASS_NAME = QNlaEnginePlugin -load(qt_plugin) - QT = core core-private network network-private !wince* { @@ -22,3 +18,7 @@ SOURCES += main.cpp \ ../qnetworksession_impl.cpp OTHER_FILES += nla.json + +PLUGIN_TYPE = bearer +PLUGIN_CLASS_NAME = QNlaEnginePlugin +load(qt_plugin) diff --git a/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro b/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro index 101ea30bcca..d23ad3bad08 100644 --- a/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro +++ b/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro @@ -1,10 +1,5 @@ TARGET = qevdevkeyboardplugin -PLUGIN_TYPE = generic -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QEvdevKeyboardPlugin -load(qt_plugin) - QT += core-private platformsupport-private gui-private SOURCES = main.cpp @@ -12,3 +7,7 @@ SOURCES = main.cpp OTHER_FILES += \ evdevkeyboard.json +PLUGIN_TYPE = generic +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QEvdevKeyboardPlugin +load(qt_plugin) diff --git a/src/plugins/generic/evdevmouse/evdevmouse.pro b/src/plugins/generic/evdevmouse/evdevmouse.pro index 57a67ead8da..1a0bc088537 100644 --- a/src/plugins/generic/evdevmouse/evdevmouse.pro +++ b/src/plugins/generic/evdevmouse/evdevmouse.pro @@ -1,10 +1,5 @@ TARGET = qevdevmouseplugin -PLUGIN_TYPE = generic -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QEvdevMousePlugin -load(qt_plugin) - QT += core-private platformsupport-private gui-private SOURCES = main.cpp @@ -12,3 +7,7 @@ SOURCES = main.cpp OTHER_FILES += \ evdevmouse.json +PLUGIN_TYPE = generic +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QEvdevMousePlugin +load(qt_plugin) diff --git a/src/plugins/generic/evdevtablet/evdevtablet.pro b/src/plugins/generic/evdevtablet/evdevtablet.pro index 8ffc0db84d5..aaf0ef4c678 100644 --- a/src/plugins/generic/evdevtablet/evdevtablet.pro +++ b/src/plugins/generic/evdevtablet/evdevtablet.pro @@ -1,13 +1,13 @@ TARGET = qevdevtabletplugin -PLUGIN_TYPE = generic -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QEvdevTabletPlugin -load(qt_plugin) - SOURCES = main.cpp QT += core-private platformsupport-private gui-private OTHER_FILES += \ evdevtablet.json + +PLUGIN_TYPE = generic +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QEvdevTabletPlugin +load(qt_plugin) diff --git a/src/plugins/generic/evdevtouch/evdevtouch.pro b/src/plugins/generic/evdevtouch/evdevtouch.pro index 1f4d1b7e935..4d61db4eb05 100644 --- a/src/plugins/generic/evdevtouch/evdevtouch.pro +++ b/src/plugins/generic/evdevtouch/evdevtouch.pro @@ -1,10 +1,5 @@ TARGET = qevdevtouchplugin -PLUGIN_TYPE = generic -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QEvdevTouchScreenPlugin -load(qt_plugin) - SOURCES = main.cpp QT += core-private platformsupport-private gui-private @@ -12,3 +7,7 @@ QT += core-private platformsupport-private gui-private OTHER_FILES += \ evdevtouch.json +PLUGIN_TYPE = generic +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QEvdevTouchScreenPlugin +load(qt_plugin) diff --git a/src/plugins/generic/libinput/libinput.pro b/src/plugins/generic/libinput/libinput.pro index 17dbb23ef0b..335605d354a 100644 --- a/src/plugins/generic/libinput/libinput.pro +++ b/src/plugins/generic/libinput/libinput.pro @@ -1,12 +1,12 @@ TARGET = qlibinputplugin -PLUGIN_TYPE = generic -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QLibInputPlugin -load(qt_plugin) - QT += core-private platformsupport-private gui-private SOURCES = main.cpp OTHER_FILES = libinput.json + +PLUGIN_TYPE = generic +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QLibInputPlugin +load(qt_plugin) diff --git a/src/plugins/generic/tslib/tslib.pro b/src/plugins/generic/tslib/tslib.pro index be6fc4fbea9..200d231cc8e 100644 --- a/src/plugins/generic/tslib/tslib.pro +++ b/src/plugins/generic/tslib/tslib.pro @@ -1,10 +1,5 @@ TARGET = qtslibplugin -PLUGIN_TYPE = generic -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QTsLibPlugin -load(qt_plugin) - SOURCES = main.cpp QT += gui-private platformsupport-private @@ -12,3 +7,8 @@ QT += gui-private platformsupport-private LIBS += -lts OTHER_FILES += tslib.json + +PLUGIN_TYPE = generic +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QTsLibPlugin +load(qt_plugin) diff --git a/src/plugins/generic/tuiotouch/tuiotouch.pro b/src/plugins/generic/tuiotouch/tuiotouch.pro index 5e53403f5b0..ae2ccde0582 100644 --- a/src/plugins/generic/tuiotouch/tuiotouch.pro +++ b/src/plugins/generic/tuiotouch/tuiotouch.pro @@ -1,10 +1,5 @@ TARGET = qtuiotouchplugin -PLUGIN_TYPE = generic -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QTuioTouchPlugin -load(qt_plugin) - QT += \ core-private \ gui-private \ @@ -24,3 +19,8 @@ HEADERS += \ OTHER_FILES += \ tuiotouch.json + +PLUGIN_TYPE = generic +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QTuioTouchPlugin +load(qt_plugin) diff --git a/src/plugins/imageformats/gif/gif.pro b/src/plugins/imageformats/gif/gif.pro index 2a5048bb1c7..a361bc25321 100644 --- a/src/plugins/imageformats/gif/gif.pro +++ b/src/plugins/imageformats/gif/gif.pro @@ -1,11 +1,11 @@ TARGET = qgif -PLUGIN_TYPE = imageformats -PLUGIN_CLASS_NAME = QGifPlugin -load(qt_plugin) - include(../../../gui/image/qgifhandler.pri) INCLUDEPATH += ../../../gui/image SOURCES += $$PWD/main.cpp HEADERS += $$PWD/main.h OTHER_FILES += gif.json + +PLUGIN_TYPE = imageformats +PLUGIN_CLASS_NAME = QGifPlugin +load(qt_plugin) diff --git a/src/plugins/imageformats/ico/ico.pro b/src/plugins/imageformats/ico/ico.pro index 4250fcb4bcb..60afdaed709 100644 --- a/src/plugins/imageformats/ico/ico.pro +++ b/src/plugins/imageformats/ico/ico.pro @@ -1,12 +1,12 @@ TARGET = qico -PLUGIN_TYPE = imageformats -PLUGIN_CLASS_NAME = QICOPlugin -load(qt_plugin) - QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-ico)" HEADERS += qicohandler.h main.h SOURCES += main.cpp \ qicohandler.cpp OTHER_FILES += ico.json + +PLUGIN_TYPE = imageformats +PLUGIN_CLASS_NAME = QICOPlugin +load(qt_plugin) diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro index e33fde1cdbb..526556179c5 100644 --- a/src/plugins/imageformats/jpeg/jpeg.pro +++ b/src/plugins/imageformats/jpeg/jpeg.pro @@ -1,9 +1,5 @@ TARGET = qjpeg -PLUGIN_TYPE = imageformats -PLUGIN_CLASS_NAME = QJpegPlugin -load(qt_plugin) - QT += core-private QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-jpeg)" @@ -13,3 +9,7 @@ INCLUDEPATH += ../../../gui/image SOURCES += main.cpp HEADERS += main.h OTHER_FILES += jpeg.json + +PLUGIN_TYPE = imageformats +PLUGIN_CLASS_NAME = QJpegPlugin +load(qt_plugin) diff --git a/src/plugins/platforminputcontexts/compose/compose.pro b/src/plugins/platforminputcontexts/compose/compose.pro index a4b5280e64c..86bdd4729ba 100644 --- a/src/plugins/platforminputcontexts/compose/compose.pro +++ b/src/plugins/platforminputcontexts/compose/compose.pro @@ -1,10 +1,5 @@ TARGET = composeplatforminputcontextplugin -PLUGIN_TYPE = platforminputcontexts -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QComposePlatformInputContextPlugin -load(qt_plugin) - QT += core-private gui-private DEFINES += X11_PREFIX='\\"$$QMAKE_X11_PREFIX\\"' @@ -27,3 +22,8 @@ contains(QT_CONFIG, xkbcommon-qt): { } OTHER_FILES += $$PWD/compose.json + +PLUGIN_TYPE = platforminputcontexts +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QComposePlatformInputContextPlugin +load(qt_plugin) diff --git a/src/plugins/platforminputcontexts/ibus/ibus.pro b/src/plugins/platforminputcontexts/ibus/ibus.pro index 401be6d42fc..9f6c848e6ac 100644 --- a/src/plugins/platforminputcontexts/ibus/ibus.pro +++ b/src/plugins/platforminputcontexts/ibus/ibus.pro @@ -1,10 +1,5 @@ TARGET = ibusplatforminputcontextplugin -PLUGIN_TYPE = platforminputcontexts -PLUGIN_EXTENDS = - -PLUGIN_CLASS_NAME = QIbusPlatformInputContextPlugin -load(qt_plugin) - QT += dbus gui-private SOURCES += $$PWD/qibusplatforminputcontext.cpp \ $$PWD/qibusproxy.cpp \ @@ -18,3 +13,8 @@ HEADERS += $$PWD/qibusplatforminputcontext.h \ $$PWD/qibustypes.h OTHER_FILES += $$PWD/ibus.json + +PLUGIN_TYPE = platforminputcontexts +PLUGIN_EXTENDS = - +PLUGIN_CLASS_NAME = QIbusPlatformInputContextPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/android/android.pro b/src/plugins/platforms/android/android.pro index 3ba817bf5bc..045e55ec657 100644 --- a/src/plugins/platforms/android/android.pro +++ b/src/plugins/platforms/android/android.pro @@ -1,13 +1,9 @@ TARGET = qtforandroid -PLUGIN_TYPE = platforms - # STATICPLUGIN needed because there's a Q_IMPORT_PLUGIN in androidjnimain.cpp # Yes, the plugin imports itself statically DEFINES += QT_STATICPLUGIN -load(qt_plugin) - LIBS += -ljnigraphics -landroid QT += core-private gui-private platformsupport-private @@ -79,6 +75,9 @@ HEADERS += $$PWD/qandroidplatformintegration.h \ android-style-assets: SOURCES += $$PWD/extract.cpp else: SOURCES += $$PWD/extract-dummy.cpp +PLUGIN_TYPE = platforms +load(qt_plugin) + #Non-standard install directory, QTBUG-29859 DESTDIR = $$DESTDIR/android target.path = $${target.path}/android diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index fec1da334f7..5e3703a6747 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -1,10 +1,5 @@ TARGET = qcocoa -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QCocoaIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - OBJECTIVE_SOURCES += main.mm \ qcocoaintegration.mm \ qcocoatheme.mm \ @@ -112,3 +107,8 @@ OTHER_FILES += cocoa.json # Window debug support #DEFINES += QT_COCOA_ENABLE_WINDOW_DEBUG + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QCocoaIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm index 7fd55372150..be5fa61b8be 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm @@ -153,6 +153,7 @@ static QMacPaletteMap mac_widget_colors[] = { QMacPaletteMap(QPlatformTheme::LabelPalette, kThemeTextColorPlacardActive, kThemeTextColorPlacardInactive), QMacPaletteMap(QPlatformTheme::GroupBoxPalette, kThemeTextColorPlacardActive, kThemeTextColorPlacardInactive), QMacPaletteMap(QPlatformTheme::MenuPalette, kThemeTextColorMenuItemActive, kThemeTextColorMenuItemDisabled), + QMacPaletteMap(QPlatformTheme::MenuBarPalette, kThemeTextColorMenuItemActive, kThemeTextColorMenuItemDisabled), //### TODO: The zeros below gives white-on-black text. QMacPaletteMap(QPlatformTheme::TextEditPalette, 0, 0), QMacPaletteMap(QPlatformTheme::TextLineEditPalette, 0, 0), @@ -177,7 +178,8 @@ QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes() pal.setColor(QPalette::Disabled, QPalette::WindowText, qc); pal.setColor(QPalette::Disabled, QPalette::HighlightedText, qc); } - if (mac_widget_colors[i].paletteRole == QPlatformTheme::MenuPalette) { + if (mac_widget_colors[i].paletteRole == QPlatformTheme::MenuPalette + || mac_widget_colors[i].paletteRole == QPlatformTheme::MenuBarPalette) { pal.setBrush(QPalette::Background, qt_mac_brushForTheme(kThemeBrushMenuBackground)); qc = qt_mac_colorForThemeTextColor(kThemeTextColorMenuItemActive); pal.setBrush(QPalette::ButtonText, qc); diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index aaa00014dd8..632bda29e23 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -361,6 +361,8 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; if (m_platformWindow->m_nsWindow && geometry == m_platformWindow->geometry()) return; + const bool isResize = geometry.size() != m_platformWindow->geometry().size(); + // It can happen that self.window is nil (if we are changing // styleMask from/to borderless and content view is being re-parented) // - this results in an invalid coordinates. @@ -390,7 +392,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; // calles, which Qt and Qt applications do not excpect. if (!m_platformWindow->m_inSetGeometry) QWindowSystemInterface::flushWindowSystemEvents(); - else + else if (isResize) m_backingStore = 0; } } @@ -1412,6 +1414,8 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) m_scrolling = false; } else if (phase == NSEventPhaseNone && momentumPhase == NSEventPhaseNone) { ph = Qt::NoScrollPhase; + if (!QGuiApplicationPrivate::scrollNoPhaseAllowed) + ph = Qt::ScrollUpdate; } // "isInverted": natural OS X scrolling, inverted from the Qt/other platform/Jens perspective. bool isInverted = [theEvent isDirectionInvertedFromDevice]; diff --git a/src/plugins/platforms/direct2d/direct2d.pro b/src/plugins/platforms/direct2d/direct2d.pro index 8f2ccc3aa65..005a4da6db8 100644 --- a/src/plugins/platforms/direct2d/direct2d.pro +++ b/src/plugins/platforms/direct2d/direct2d.pro @@ -1,10 +1,5 @@ TARGET = qdirect2d -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QWindowsDirect2DIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT *= core-private QT *= gui-private QT *= platformsupport-private @@ -40,3 +35,8 @@ HEADERS += \ qwindowsdirect2dwindow.h OTHER_FILES += direct2d.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QWindowsDirect2DIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro index 89d8d42ceae..5c81e0283a1 100644 --- a/src/plugins/platforms/directfb/directfb.pro +++ b/src/plugins/platforms/directfb/directfb.pro @@ -1,10 +1,5 @@ TARGET = qdirectfb -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QDirectFbIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private LIBS += $$QMAKE_LIBS_DIRECTFB @@ -51,3 +46,8 @@ contains(QT_CONFIG, directfb_egl) { CONFIG += qpa/genericunixfontdatabase OTHER_FILES += directfb.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QDirectFbIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro index 2026b6a6c6b..e2ebf9f7ee5 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro @@ -1,9 +1,5 @@ TARGET = qeglfs-brcm-integration -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSBrcmIntegrationPlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. @@ -21,3 +17,7 @@ SOURCES += $$PWD/qeglfsbrcmmain.cpp \ HEADERS += $$PWD/qeglfsbrcmintegration.h OTHER_FILES += $$PWD/eglfs_brcm.json + +PLUGIN_TYPE = egldeviceintegrations +PLUGIN_CLASS_NAME = QEglFSBrcmIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro index e53793ce546..12ae0a13b1a 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro @@ -1,9 +1,5 @@ TARGET = qeglfs-kms-integration -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSKmsIntegrationPlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. @@ -29,3 +25,7 @@ HEADERS += $$PWD/qeglfskmsintegration.h \ $$PWD/qeglfskmscursor.h OTHER_FILES += $$PWD/eglfs_kms.json + +PLUGIN_TYPE = egldeviceintegrations +PLUGIN_CLASS_NAME = QEglFSKmsIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro index 393ddd14a5d..1932f861b9a 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro @@ -1,9 +1,5 @@ TARGET = qeglfs-kms-egldevice-integration -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSKmsEglDeviceIntegrationPlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. @@ -21,3 +17,7 @@ HEADERS += $$PWD/qeglfskmsegldeviceintegration.h OTHER_FILES += $$PWD/eglfs_kms_egldevice.json LIBS += -ldrm + +PLUGIN_TYPE = egldeviceintegrations +PLUGIN_CLASS_NAME = QEglFSKmsEglDeviceIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro index 33f219db96e..7fc4568ae3f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro @@ -1,9 +1,5 @@ TARGET = qeglfs-mali-integration -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSMaliIntegrationPlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private eglfs_device_lib-private # Avoid X11 header collision @@ -19,3 +15,7 @@ SOURCES += $$PWD/qeglfsmalimain.cpp \ HEADERS += $$PWD/qeglfsmaliintegration.h OTHER_FILES += $$PWD/eglfs_mali.json + +PLUGIN_TYPE = egldeviceintegrations +PLUGIN_CLASS_NAME = QEglFSMaliIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro index fc0533127cb..6fac2f529ab 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro @@ -1,9 +1,5 @@ TARGET = qeglfs-viv-integration -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSVivIntegrationPlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. @@ -18,3 +14,7 @@ SOURCES += $$PWD/qeglfsvivmain.cpp \ HEADERS += $$PWD/qeglfsvivintegration.h OTHER_FILES += $$PWD/eglfs_viv.json + +PLUGIN_TYPE = egldeviceintegrations +PLUGIN_CLASS_NAME = QEglFSVivIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro index 26b6a2e9eab..44f75c40e04 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro @@ -1,9 +1,5 @@ TARGET = qeglfs-viv-wl-integration -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSVivWaylandIntegrationPlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private eglfs_device_lib-private INCLUDEPATH += $$PWD/../.. @@ -21,3 +17,7 @@ OTHER_FILES += $$PWD/eglfs_viv_wl.json CONFIG += link_pkgconfig PKGCONFIG_PRIVATE += wayland-server + +PLUGIN_TYPE = egldeviceintegrations +PLUGIN_CLASS_NAME = QEglFSVivWaylandIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro index 86fefac8aa2..83f0c74910b 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro @@ -1,9 +1,5 @@ TARGET = qeglfs-x11-integration -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSX11IntegrationPlugin -load(qt_plugin) - QT += core-private gui-private platformsupport-private eglfs_device_lib-private # Avoid X11 header collision @@ -21,3 +17,7 @@ SOURCES += $$PWD/qeglfsx11main.cpp \ HEADERS += $$PWD/qeglfsx11integration.h OTHER_FILES += $$PWD/eglfs_x11.json + +PLUGIN_TYPE = egldeviceintegrations +PLUGIN_CLASS_NAME = QEglFSX11IntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/eglfs-plugin.pro b/src/plugins/platforms/eglfs/eglfs-plugin.pro index 0f493fdc01d..a628cdccd93 100644 --- a/src/plugins/platforms/eglfs/eglfs-plugin.pro +++ b/src/plugins/platforms/eglfs/eglfs-plugin.pro @@ -1,12 +1,12 @@ TARGET = qeglfs -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QEglFSIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += platformsupport-private eglfs_device_lib-private SOURCES += $$PWD/qeglfsmain.cpp OTHER_FILES += $$PWD/eglfs.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QEglFSIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/eglfs_device_lib.pro b/src/plugins/platforms/eglfs/eglfs_device_lib.pro index 4fe2ce4897f..f784020fb62 100644 --- a/src/plugins/platforms/eglfs/eglfs_device_lib.pro +++ b/src/plugins/platforms/eglfs/eglfs_device_lib.pro @@ -6,8 +6,6 @@ TARGET = QtEglDeviceIntegration CONFIG += no_module_headers internal_module -load(qt_module) - QT += core-private gui-private platformsupport-private LIBS += $$QMAKE_LIBS_DYNLOAD @@ -52,3 +50,5 @@ INCLUDEPATH += $$PWD CONFIG += egl qpa/genericunixfontdatabase !contains(DEFINES, QT_NO_CURSOR): RESOURCES += $$PWD/cursor.qrc + +load(qt_module) diff --git a/src/plugins/platforms/haiku/haiku.pro b/src/plugins/platforms/haiku/haiku.pro index 87f31997a31..ea5bb632db3 100644 --- a/src/plugins/platforms/haiku/haiku.pro +++ b/src/plugins/platforms/haiku/haiku.pro @@ -1,7 +1,4 @@ TARGET = qhaiku -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QHaikuIntegrationPlugin -load(qt_plugin) QT += platformsupport-private core-private gui-private @@ -40,3 +37,7 @@ LIBS += -lbe OTHER_FILES += haiku.json include (../../../platformsupport/fontdatabases/fontdatabases.pri) + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QHaikuIntegrationPlugin +load(qt_plugin) diff --git a/src/plugins/platforms/ios/ios.pro b/src/plugins/platforms/ios/ios.pro index b1075d3c0f6..d82b47fb74e 100644 --- a/src/plugins/platforms/ios/ios.pro +++ b/src/plugins/platforms/ios/ios.pro @@ -1,10 +1,5 @@ TARGET = qios -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QIOSIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private LIBS += -framework Foundation -framework UIKit -framework QuartzCore -framework AssetsLibrary -framework AudioToolbox @@ -61,3 +56,8 @@ HEADERS = \ OTHER_FILES = \ quiview_textinput.mm \ quiview_accessibility.mm + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QIOSIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro index 389d45c29c4..b5de1923467 100644 --- a/src/plugins/platforms/linuxfb/linuxfb.pro +++ b/src/plugins/platforms/linuxfb/linuxfb.pro @@ -1,10 +1,5 @@ TARGET = qlinuxfb -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QLinuxFbIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private SOURCES = main.cpp qlinuxfbintegration.cpp qlinuxfbscreen.cpp @@ -13,3 +8,8 @@ HEADERS = qlinuxfbintegration.h qlinuxfbscreen.h CONFIG += qpa/genericunixfontdatabase OTHER_FILES += linuxfb.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QLinuxFbIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro index 3ed4d2cdde1..d6914026ae5 100644 --- a/src/plugins/platforms/minimal/minimal.pro +++ b/src/plugins/platforms/minimal/minimal.pro @@ -1,10 +1,5 @@ TARGET = qminimal -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private SOURCES = main.cpp \ @@ -14,3 +9,8 @@ HEADERS = qminimalintegration.h \ qminimalbackingstore.h OTHER_FILES += minimal.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/minimalegl/minimalegl.pro b/src/plugins/platforms/minimalegl/minimalegl.pro index e78dcb8bc50..ac672495914 100644 --- a/src/plugins/platforms/minimalegl/minimalegl.pro +++ b/src/plugins/platforms/minimalegl/minimalegl.pro @@ -1,10 +1,5 @@ TARGET = qminimalegl -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QMinimalEglIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private #DEFINES += QEGL_EXTRA_DEBUG @@ -29,3 +24,8 @@ CONFIG += egl qpa/genericunixfontdatabase OTHER_FILES += \ minimalegl.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QMinimalEglIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/mirclient/mirclient.pro b/src/plugins/platforms/mirclient/mirclient.pro index 0851e8d7192..d5d35f1632e 100644 --- a/src/plugins/platforms/mirclient/mirclient.pro +++ b/src/plugins/platforms/mirclient/mirclient.pro @@ -1,10 +1,4 @@ -TARGET = mirclient -TEMPLATE = lib - -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = MirServerIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) +TARGET = qmirclient QT += core-private gui-private platformsupport-private dbus @@ -47,3 +41,8 @@ HEADERS = \ qmirclientscreen.h \ qmirclienttheme.h \ qmirclientwindow.h + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = MirServerIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/offscreen/offscreen.pro b/src/plugins/platforms/offscreen/offscreen.pro index 94eeac6accb..999550a7e16 100644 --- a/src/plugins/platforms/offscreen/offscreen.pro +++ b/src/plugins/platforms/offscreen/offscreen.pro @@ -1,10 +1,5 @@ TARGET = qoffscreen -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QOffscreenIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private SOURCES = main.cpp \ @@ -25,3 +20,8 @@ contains(QT_CONFIG, xlib):contains(QT_CONFIG, opengl):!contains(QT_CONFIG, openg } else { SOURCES += qoffscreenintegration_dummy.cpp } + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QOffscreenIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/openwfd/openwf.pro b/src/plugins/platforms/openwfd/openwf.pro index 38bac057bd4..152e4f57d7e 100644 --- a/src/plugins/platforms/openwfd/openwf.pro +++ b/src/plugins/platforms/openwfd/openwf.pro @@ -1,10 +1,5 @@ TARGET = qopenwf -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QOpenWFDIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private CONFIG += qpa/genericunixfontdatabase @@ -38,3 +33,7 @@ SOURCES += \ LIBS += -lWFD -lgbm -lGLESv2 -lEGL +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QOpenWFDIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/windows/openglblacklists/default.json b/src/plugins/platforms/windows/openglblacklists/default.json index 767eac161cb..f7a88446111 100644 --- a/src/plugins/platforms/windows/openglblacklists/default.json +++ b/src/plugins/platforms/windows/openglblacklists/default.json @@ -78,6 +78,18 @@ "features": [ "disable_rotation" ] + }, + { + "id": 7, + "description": "AMD FirePro V5900 driver causes crashes in Direct3D on Windows.", + "vendor_id": "0x1002", + "device_id": ["0x6707"], + "os": { + "type": "win" + }, + "features": [ + "disable_angle" + ] } ] } diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 72d9d5a71b0..0eab37aed2d 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -1472,18 +1472,21 @@ public: }; // Return the first suffix from the name filter "Foo files (*.foo;*.bar)" -> "foo". +// Also handles the simple name filter case "*.txt" -> "txt" static inline QString suffixFromFilter(const QString &filter) { - int suffixPos = filter.indexOf(QLatin1String("(*.")); + int suffixPos = filter.indexOf(QLatin1String("*.")); if (suffixPos < 0) return QString(); - suffixPos += 3; + suffixPos += 2; int endPos = filter.indexOf(QLatin1Char(' '), suffixPos + 1); if (endPos < 0) endPos = filter.indexOf(QLatin1Char(';'), suffixPos + 1); if (endPos < 0) endPos = filter.indexOf(QLatin1Char(')'), suffixPos + 1); - return endPos >= 0 ? filter.mid(suffixPos, endPos - suffixPos) : QString(); + if (endPos < 0) + endPos = filter.size(); + return filter.mid(suffixPos, endPos - suffixPos); } void QWindowsNativeSaveFileDialog::setNameFilters(const QStringList &f) diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 743408949d2..966be8c9918 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1769,28 +1769,35 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, lf.lfFaceName[nameSubstituteLength] = 0; } - IDWriteFont *directWriteFont = 0; - HRESULT hr = data->directWriteGdiInterop->CreateFontFromLOGFONT(&lf, &directWriteFont); - if (FAILED(hr)) { - const QString errorString = qt_error_string(int(GetLastError())); - qWarning().noquote().nospace() << "DirectWrite: CreateFontFromLOGFONT() failed (" - << errorString << ") for " << request << ' ' << lf << " dpi=" << dpi; + HFONT hfont = CreateFontIndirect(&lf); + if (!hfont) { + qErrnoWarning("%s: CreateFontIndirect failed", __FUNCTION__); } else { + HGDIOBJ oldFont = SelectObject(data->hdc, hfont); + IDWriteFontFace *directWriteFontFace = NULL; - hr = directWriteFont->CreateFontFace(&directWriteFontFace); + HRESULT hr = data->directWriteGdiInterop->CreateFontFaceFromHdc(data->hdc, &directWriteFontFace); if (FAILED(hr)) { - const QString errorString = qt_error_string(int(GetLastError())); - qWarning().noquote() << "DirectWrite: CreateFontFace() failed (" + const QString errorString = qt_error_string(int(hr)); + qWarning().noquote().nospace() << "DirectWrite: CreateFontFaceFromHDC() failed (" << errorString << ") for " << request << ' ' << lf << " dpi=" << dpi; } else { QWindowsFontEngineDirectWrite *fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace, request.pixelSize, data); - fedw->initFontInfo(request, dpi, directWriteFont); + + wchar_t n[64]; + GetTextFace(data->hdc, 64, n); + + QFontDef fontDef = request; + fontDef.family = QString::fromWCharArray(n); + + fedw->initFontInfo(fontDef, dpi); fe = fedw; } - directWriteFont->Release(); + SelectObject(data->hdc, oldFont); + DeleteObject(hfont); } } #endif // QT_NO_DIRECTWRITE diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 143d39dc3d5..a3e3870d90d 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -37,11 +37,6 @@ ** ****************************************************************************/ -#if _WIN32_WINNT < 0x0500 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0500 -#endif - #include "qwindowsintegration.h" #include "qwindowsfontengine.h" #include "qwindowsnativeimage.h" diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 2831962ef4e..eeb9e5eb6e3 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -39,15 +39,6 @@ #ifndef QT_NO_DIRECTWRITE -#if WINVER < 0x0600 -# undef WINVER -# define WINVER 0x0600 -#endif -#if _WIN32_WINNT < 0x0600 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif - #include "qwindowsfontenginedirectwrite.h" #include "qwindowsfontdatabase.h" #include "qwindowscontext.h" @@ -654,71 +645,11 @@ QFontEngine *QWindowsFontEngineDirectWrite::cloneWithSize(qreal pixelSize) const return fontEngine; } -// Dynamically resolve GetUserDefaultLocaleName, which is available from Windows -// Vista onwards. ### fixme 5.7: Consider reverting to direct linking. -typedef int (WINAPI *GetUserDefaultLocaleNamePtr)(LPWSTR, int); - -static inline GetUserDefaultLocaleNamePtr resolveGetUserDefaultLocaleName() -{ - QSystemLibrary library(QStringLiteral("kernel32")); - return (GetUserDefaultLocaleNamePtr)library.resolve("GetUserDefaultLocaleName"); -} - void QWindowsFontEngineDirectWrite::initFontInfo(const QFontDef &request, - int dpi, IDWriteFont *font) + int dpi) { fontDef = request; - IDWriteFontFamily *fontFamily = NULL; - HRESULT hr = font->GetFontFamily(&fontFamily); - - IDWriteLocalizedStrings *familyNames = NULL; - if (SUCCEEDED(hr)) - hr = fontFamily->GetFamilyNames(&familyNames); - - UINT32 index = 0; - - if (SUCCEEDED(hr)) { - BOOL exists = false; - - wchar_t localeName[LOCALE_NAME_MAX_LENGTH]; - static const GetUserDefaultLocaleNamePtr getUserDefaultLocaleName = resolveGetUserDefaultLocaleName(); - const int defaultLocaleSuccess = getUserDefaultLocaleName - ? getUserDefaultLocaleName(localeName, LOCALE_NAME_MAX_LENGTH) : 0; - if (defaultLocaleSuccess) - hr = familyNames->FindLocaleName(localeName, &index, &exists); - - if (SUCCEEDED(hr) && !exists) - hr = familyNames->FindLocaleName(L"en-us", &index, &exists); - - if (!exists) - index = 0; - } - - // Get the family name. - if (SUCCEEDED(hr)) { - UINT32 length = 0; - - hr = familyNames->GetStringLength(index, &length); - - if (SUCCEEDED(hr)) { - QVarLengthArray<wchar_t, 128> name(length+1); - - hr = familyNames->GetString(index, name.data(), name.size()); - - if (SUCCEEDED(hr)) - fontDef.family = QString::fromWCharArray(name.constData()); - } - } - - if (familyNames != NULL) - familyNames->Release(); - if (fontFamily) - fontFamily->Release(); - - if (FAILED(hr)) - qErrnoWarning(hr, "initFontInfo: Failed to get family name"); - if (fontDef.pointSize < 0) fontDef.pointSize = fontDef.pixelSize * 72. / dpi; else if (fontDef.pixelSize == -1) diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h index 25709d8ee18..4558cfbdcc3 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h @@ -65,7 +65,7 @@ public: const QSharedPointer<QWindowsFontEngineData> &d); ~QWindowsFontEngineDirectWrite(); - void initFontInfo(const QFontDef &request, int dpi, IDWriteFont *font); + void initFontInfo(const QFontDef &request, int dpi); QFixed lineThickness() const Q_DECL_OVERRIDE; QFixed underlinePosition() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index d9a75860967..1d435330522 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1668,11 +1668,11 @@ void QWindowsWindow::releaseDC() bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message, WPARAM, LPARAM) { + if (message == WM_ERASEBKGND) // Backing store - ignored. + return true; // Ignore invalid update bounding rectangles if (!GetUpdateRect(m_data.hwnd, 0, FALSE)) return false; - if (message == WM_ERASEBKGND) // Backing store - ignored. - return true; PAINTSTRUCT ps; // Observed painting problems with Aero style disabled (QTBUG-7865). diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index cc0373c0770..2e0f7236939 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -1,10 +1,5 @@ TARGET = qwindows -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QWindowsIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT *= core-private QT *= gui-private QT *= platformsupport-private @@ -25,3 +20,8 @@ HEADERS += \ qwindowsgdinativeinterface.h OTHER_FILES += windows.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QWindowsIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/winrt/winrt.pro b/src/plugins/platforms/winrt/winrt.pro index 991ec1789b0..261295ef0b9 100644 --- a/src/plugins/platforms/winrt/winrt.pro +++ b/src/plugins/platforms/winrt/winrt.pro @@ -1,10 +1,6 @@ TARGET = qwinrt -CONFIG -= precompile_header -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QWinRTIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) +CONFIG -= precompile_header QT += core-private gui-private platformsupport-private @@ -50,3 +46,8 @@ HEADERS = \ qwinrtwindow.h OTHER_FILES += winrt.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QWinRTIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro index 28a572a2c9e..6d52332bad0 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro @@ -1,10 +1,5 @@ TARGET = qxcb-egl-integration -PLUGIN_CLASS_NAME = QXcbEglIntegrationPlugin -PLUGIN_TYPE = xcbglintegrations - -load(qt_plugin) - include(../gl_integrations_plugin_base.pri) CONFIG += egl @@ -22,3 +17,7 @@ SOURCES += \ qxcbeglwindow.cpp \ qxcbeglmain.cpp \ qxcbeglnativeinterfacehandler.cpp + +PLUGIN_CLASS_NAME = QXcbEglIntegrationPlugin +PLUGIN_TYPE = xcbglintegrations +load(qt_plugin) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro index 1c577e5dc96..67fd68765af 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro @@ -1,10 +1,5 @@ TARGET = qxcb-glx-integration -PLUGIN_CLASS_NAME = QXcbGlxIntegrationPlugin -PLUGIN_TYPE = xcbglintegrations - -load(qt_plugin) - include(../gl_integrations_plugin_base.pri) #should be removed from the sources @@ -31,3 +26,7 @@ SOURCES += \ qxcbglxwindow.cpp \ qglxintegration.cpp \ qxcbglxnativeinterfacehandler.cpp + +PLUGIN_CLASS_NAME = QXcbGlxIntegrationPlugin +PLUGIN_TYPE = xcbglintegrations +load(qt_plugin) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 998f4884aab..5c6db2797fe 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1962,7 +1962,9 @@ static const char * xcb_atomnames = { "_COMPIZ_DECOR_PENDING\0" "_COMPIZ_DECOR_REQUEST\0" "_COMPIZ_DECOR_DELETE_PIXMAP\0" - "_COMPIZ_TOOLKIT_ACTION\0" // \0\0 terminates loop. + "_COMPIZ_TOOLKIT_ACTION\0" + "_GTK_LOAD_ICONTHEMES\0" + // \0\0 terminates loop. }; QXcbAtom::Atom QXcbConnection::qatom(xcb_atom_t xatom) const diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 02dc95e8529..9fed7b52f14 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -294,6 +294,7 @@ namespace QXcbAtom { _COMPIZ_DECOR_REQUEST, _COMPIZ_DECOR_DELETE_PIXMAP, _COMPIZ_TOOLKIT_ACTION, + _GTK_LOAD_ICONTHEMES, NPredefinedAtoms, @@ -355,7 +356,7 @@ public: virtual void handleFocusOutEvent(const xcb_focus_out_event_t *) {} virtual void handlePropertyNotifyEvent(const xcb_property_notify_event_t *) {} #ifdef XCB_USE_XINPUT22 - virtual void handleXIMouseEvent(xcb_ge_event_t *) {} + virtual void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource = Qt::MouseEventNotSynthesized) {} virtual void handleXIEnterLeave(xcb_ge_event_t *) {} #endif virtual QXcbWindow *toWindow() { return 0; } diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index e94433dd4b3..63a650a514c 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -1136,7 +1136,7 @@ bool QXcbConnection::xi2HandleTabletEvent(void *event, TabletData *tabletData, Q // Synthesize mouse events since otherwise there are no mouse events from // the pen on the XI 2.2+ path. if (xi2MouseEvents() && eventListener) - eventListener->handleXIMouseEvent(reinterpret_cast<xcb_ge_event_t *>(event)); + eventListener->handleXIMouseEvent(reinterpret_cast<xcb_ge_event_t *>(event), Qt::MouseEventSynthesizedByQt); #else Q_UNUSED(eventListener); #endif diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index eb7c5d2b027..a59b5ab23ff 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -55,6 +55,7 @@ #include <QtPlatformHeaders/qxcbwindowfunctions.h> #include <QtPlatformHeaders/qxcbintegrationfunctions.h> +#include <QtPlatformHeaders/qxcbscreenfunctions.h> #ifndef QT_NO_DBUS #include "QtPlatformSupport/private/qdbusmenuconnection_p.h" @@ -83,7 +84,7 @@ 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"), QByteArrayLiteral("atspibus"), QByteArrayLiteral("compositingenabled") @@ -381,6 +382,10 @@ QFunctionPointer QXcbNativeInterface::platformFunction(const QByteArray &functio if (function == QXcbWindowFunctions::visualIdIdentifier()) { return QFunctionPointer(QXcbWindowFunctions::VisualId(QXcbWindow::visualIdStatic)); } + + if (function == QXcbScreenFunctions::virtualDesktopNumberIdentifier()) + return QFunctionPointer(QXcbScreenFunctions::VirtualDesktopNumber(QXcbScreen::virtualDesktopNumberStatic)); + return Q_NULLPTR; } diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 339529edf17..18b06673902 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -444,6 +444,14 @@ void QXcbScreen::setOutput(xcb_randr_output_t outputId, // TODO: Send an event to the QScreen instance that the screen changed its name } +int QXcbScreen::virtualDesktopNumberStatic(const QScreen *screen) +{ + if (screen && screen->handle()) + return static_cast<const QXcbScreen *>(screen->handle())->screenNumber(); + + return 0; +} + /*! \brief handle the XCB screen change event and update properties diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index e97631e2afd..30c5073459e 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -139,6 +139,7 @@ public: bool isPrimary() const { return m_primary; } int screenNumber() const { return m_virtualDesktop->number(); } + static int virtualDesktopNumberStatic(const QScreen *screen); xcb_screen_t *screen() const { return m_virtualDesktop->screen(); } xcb_window_t root() const { return screen()->root; } diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 6ac28684a85..8baad5090d0 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -40,6 +40,7 @@ #include "qxcbwindow.h" #include <QtDebug> +#include <QMetaEnum> #include <QScreen> #include <QtGui/QIcon> #include <QtGui/QRegion> @@ -2063,8 +2064,9 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even } else if (event->type == atom(QXcbAtom::_COMPIZ_DECOR_PENDING) || event->type == atom(QXcbAtom::_COMPIZ_DECOR_REQUEST) || event->type == atom(QXcbAtom::_COMPIZ_DECOR_DELETE_PIXMAP) - || event->type == atom(QXcbAtom::_COMPIZ_TOOLKIT_ACTION)) { - //silence the _COMPIZ messages for now + || event->type == atom(QXcbAtom::_COMPIZ_TOOLKIT_ACTION) + || event->type == atom(QXcbAtom::_GTK_LOAD_ICONTHEMES)) { + //silence the _COMPIZ and _GTK messages for now } else { qWarning() << "QXcbWindow: Unhandled client message:" << connection()->atomName(event->type); } @@ -2185,7 +2187,7 @@ void QXcbWindow::handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event) } void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, int root_y, - int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp) + int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source) { const bool isWheel = detail >= 4 && detail <= 7; if (!isWheel && window() != QGuiApplication::focusWindow()) { @@ -2221,11 +2223,11 @@ void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, in return; } - handleMouseEvent(timestamp, local, global, modifiers); + handleMouseEvent(timestamp, local, global, modifiers, source); } void QXcbWindow::handleButtonReleaseEvent(int event_x, int event_y, int root_x, int root_y, - int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp) + int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source) { QPoint local(event_x, event_y); QPoint global(root_x, root_y); @@ -2235,7 +2237,7 @@ void QXcbWindow::handleButtonReleaseEvent(int event_x, int event_y, int root_x, return; } - handleMouseEvent(timestamp, local, global, modifiers); + handleMouseEvent(timestamp, local, global, modifiers, source); } static bool ignoreLeaveEvent(quint8 mode, quint8 detail) @@ -2318,11 +2320,11 @@ void QXcbWindow::handleLeaveNotifyEvent(int root_x, int root_y, } void QXcbWindow::handleMotionNotifyEvent(int event_x, int event_y, int root_x, int root_y, - Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp) + Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source) { QPoint local(event_x, event_y); QPoint global(root_x, root_y); - handleMouseEvent(timestamp, local, global, modifiers); + handleMouseEvent(timestamp, local, global, modifiers, source); } // Handlers for plain xcb events. Used only when XI 2.2 or newer is not available. @@ -2353,7 +2355,7 @@ static inline int fixed1616ToInt(FP1616 val) } // With XI 2.2+ press/release/motion comes here instead of the above handlers. -void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event) +void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource source) { QXcbConnection *conn = connection(); xXIDeviceEvent *ev = reinterpret_cast<xXIDeviceEvent *>(event); @@ -2373,20 +2375,27 @@ void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event) conn->setButton(conn->translateMouseButton(i), XIMaskIsSet(buttonMask, i)); } + const char *sourceName = nullptr; + if (lcQpaXInput().isDebugEnabled()) { + const QMetaObject *metaObject = qt_getEnumMetaObject(source); + const QMetaEnum me = metaObject->enumerator(metaObject->indexOfEnumerator(qt_getEnumName(source))); + sourceName = me.valueToKey(source); + } + switch (ev->evtype) { case XI_ButtonPress: - qCDebug(lcQpaXInput, "XI2 mouse press, button %d, time %d", button, ev->time); + qCDebug(lcQpaXInput, "XI2 mouse press, button %d, time %d, source %s", button, ev->time, sourceName); conn->setButton(button, true); - handleButtonPressEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time); + handleButtonPressEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, source); break; case XI_ButtonRelease: - qCDebug(lcQpaXInput, "XI2 mouse release, button %d, time %d", button, ev->time); + qCDebug(lcQpaXInput, "XI2 mouse release, button %d, time %d, source %s", button, ev->time, sourceName); conn->setButton(button, false); - handleButtonReleaseEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time); + handleButtonReleaseEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, source); break; case XI_Motion: - qCDebug(lcQpaXInput, "XI2 mouse motion %d,%d, time %d", event_x, event_y, ev->time); - handleMotionNotifyEvent(event_x, event_y, root_x, root_y, modifiers, ev->time); + qCDebug(lcQpaXInput, "XI2 mouse motion %d,%d, time %d, source %s", event_x, event_y, ev->time, sourceName); + handleMotionNotifyEvent(event_x, event_y, root_x, root_y, modifiers, ev->time, source); break; default: qWarning() << "Unrecognized XI2 mouse event" << ev->evtype; @@ -2429,10 +2438,11 @@ void QXcbWindow::handleXIEnterLeave(xcb_ge_event_t *event) QXcbWindow *QXcbWindow::toWindow() { return this; } -void QXcbWindow::handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global, Qt::KeyboardModifiers modifiers) +void QXcbWindow::handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global, + Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source) { connection()->setTime(time); - QWindowSystemInterface::handleMouseEvent(window(), time, local, global, connection()->buttons(), modifiers); + QWindowSystemInterface::handleMouseEvent(window(), time, local, global, connection()->buttons(), modifiers, source); } void QXcbWindow::handleEnterNotifyEvent(const xcb_enter_notify_event_t *event) diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 72688cdf168..7b70dc2ef83 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -139,13 +139,14 @@ public: void handleFocusOutEvent(const xcb_focus_out_event_t *event) Q_DECL_OVERRIDE; void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) Q_DECL_OVERRIDE; #ifdef XCB_USE_XINPUT22 - void handleXIMouseEvent(xcb_ge_event_t *) Q_DECL_OVERRIDE; + void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized) Q_DECL_OVERRIDE; void handleXIEnterLeave(xcb_ge_event_t *) Q_DECL_OVERRIDE; #endif QXcbWindow *toWindow() Q_DECL_OVERRIDE; - void handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global, Qt::KeyboardModifiers modifiers); + void handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global, + Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source); void updateNetWmUserTime(xcb_timestamp_t timestamp); @@ -214,13 +215,13 @@ protected: bool compressExposeEvent(QRegion &exposeRegion); void handleButtonPressEvent(int event_x, int event_y, int root_x, int root_y, - int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp); + int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); void handleButtonReleaseEvent(int event_x, int event_y, int root_x, int root_y, - int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp); + int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); void handleMotionNotifyEvent(int event_x, int event_y, int root_x, int root_y, - Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp); + Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); void handleEnterNotifyEvent(int event_x, int event_y, int root_x, int root_y, quint8 mode, quint8 detail, xcb_timestamp_t timestamp); diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro index 09ab1ad77a9..75684a769b3 100644 --- a/src/plugins/platforms/xcb/xcb-plugin.pro +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -1,13 +1,12 @@ TARGET = qxcb -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QXcbIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private xcb_qpa_lib-private SOURCES = \ qxcbmain.cpp OTHER_FILES += xcb.json README +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QXcbIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 302d87e0079..f4a4e5a78a8 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -1,8 +1,6 @@ TARGET = QtXcbQpa CONFIG += no_module_headers internal_module -load(qt_module) - QT += core-private gui-private platformsupport-private SOURCES = \ @@ -105,3 +103,4 @@ contains(QT_CONFIG, xkbcommon-qt) { QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON } +load(qt_module) diff --git a/src/plugins/printsupport/cocoa/cocoa.pro b/src/plugins/printsupport/cocoa/cocoa.pro index c993b425742..242c596bcd0 100644 --- a/src/plugins/printsupport/cocoa/cocoa.pro +++ b/src/plugins/printsupport/cocoa/cocoa.pro @@ -1,8 +1,5 @@ TARGET = cocoaprintersupport MODULE = cocoaprintersupport -PLUGIN_TYPE = printsupport -PLUGIN_CLASS_NAME = QCocoaPrinterSupportPlugin -load(qt_plugin) QT += gui-private printsupport-private LIBS += -framework AppKit @@ -10,3 +7,7 @@ LIBS += -framework AppKit SOURCES += main.cpp OTHER_FILES += cocoa.json + +PLUGIN_TYPE = printsupport +PLUGIN_CLASS_NAME = QCocoaPrinterSupportPlugin +load(qt_plugin) diff --git a/src/plugins/printsupport/cups/cups.pro b/src/plugins/printsupport/cups/cups.pro index cdbb08b10a5..757408e7f72 100644 --- a/src/plugins/printsupport/cups/cups.pro +++ b/src/plugins/printsupport/cups/cups.pro @@ -1,8 +1,5 @@ TARGET = cupsprintersupport MODULE = cupsprintersupport -PLUGIN_TYPE = printsupport -PLUGIN_CLASS_NAME = QCupsPrinterSupportPlugin -load(qt_plugin) QT += core-private gui-private printsupport printsupport-private @@ -20,3 +17,7 @@ HEADERS += qcupsprintersupport_p.h \ qcupsprintengine_p.h OTHER_FILES += cups.json + +PLUGIN_TYPE = printsupport +PLUGIN_CLASS_NAME = QCupsPrinterSupportPlugin +load(qt_plugin) diff --git a/src/plugins/printsupport/windows/windows.pro b/src/plugins/printsupport/windows/windows.pro index 3366262ef03..06694fb7fe6 100644 --- a/src/plugins/printsupport/windows/windows.pro +++ b/src/plugins/printsupport/windows/windows.pro @@ -1,8 +1,5 @@ TARGET = windowsprintersupport MODULE = windowsprintersupport -PLUGIN_TYPE = printsupport -PLUGIN_CLASS_NAME = QWindowsPrinterSupportPlugin -load(qt_plugin) QT *= core-private QT *= gui-private @@ -22,3 +19,7 @@ HEADERS += \ OTHER_FILES += windows.json LIBS += -lwinspool -lcomdlg32 -lgdi32 -luser32 + +PLUGIN_TYPE = printsupport +PLUGIN_CLASS_NAME = QWindowsPrinterSupportPlugin +load(qt_plugin) diff --git a/src/printsupport/kernel/qplatformprintdevice.cpp b/src/printsupport/kernel/qplatformprintdevice.cpp index a725a4a7d6d..9ddef85bf9c 100644 --- a/src/printsupport/kernel/qplatformprintdevice.cpp +++ b/src/printsupport/kernel/qplatformprintdevice.cpp @@ -59,6 +59,9 @@ QPlatformPrintDevice::QPlatformPrintDevice() m_haveOutputBins(false), m_haveDuplexModes(false), m_haveColorModes(false) +#ifndef QT_NO_MIMETYPES + , m_haveMimeTypes(false) +#endif { } @@ -74,6 +77,9 @@ QPlatformPrintDevice::QPlatformPrintDevice(const QString &id) m_haveOutputBins(false), m_haveDuplexModes(false), m_haveColorModes(false) +#ifndef QT_NO_MIMETYPES + , m_haveMimeTypes(false) +#endif { } diff --git a/src/printsupport/printsupport.pro b/src/printsupport/printsupport.pro index 6dd3eaab3c0..52eab672d33 100644 --- a/src/printsupport/printsupport.pro +++ b/src/printsupport/printsupport.pro @@ -3,15 +3,14 @@ QT = core-private gui-private widgets-private DEFINES += QT_NO_USING_NAMESPACE -MODULE_PLUGIN_TYPES = \ - printsupport - QMAKE_DOCS = $$PWD/doc/qtprintsupport.qdocconf -load(qt_module) - QMAKE_LIBS += $$QMAKE_LIBS_PRINTSUPPORT include(kernel/kernel.pri) include(widgets/widgets.pri) include(dialogs/dialogs.pri) + +MODULE_PLUGIN_TYPES = \ + printsupport +load(qt_module) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 139b2a8f2b9..29b7b20d85f 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -1931,11 +1931,14 @@ bool QODBCDriver::open(const QString & db, if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) { qSqlWarning(QLatin1String("QODBCDriver::open: Unable to allocate connection"), d); setOpenError(true); + cleanup(); return false; } - if (!d->setConnectionOptions(connOpts)) + if (!d->setConnectionOptions(connOpts)) { + cleanup(); return false; + } // Create the connection string QString connQStr; @@ -1968,6 +1971,7 @@ bool QODBCDriver::open(const QString & db, if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) { setLastError(qMakeError(tr("Unable to connect"), QSqlError::ConnectionError, d)); setOpenError(true); + cleanup(); return false; } @@ -1975,6 +1979,7 @@ bool QODBCDriver::open(const QString & db, setLastError(qMakeError(tr("Unable to connect - Driver doesn't support all " "functionality required"), QSqlError::ConnectionError, d)); setOpenError(true); + cleanup(); return false; } diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index b75c9ee29c7..fcf75af298f 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -1421,8 +1421,10 @@ bool QPSQLDriver::subscribeToNotification(const QString &name) PGresult *result = d->exec(query); if (PQresultStatus(result) != PGRES_COMMAND_OK) { setLastError(qMakeError(tr("Unable to subscribe"), QSqlError::StatementError, d, result)); + PQclear(result); return false; } + PQclear(result); if (!d->sn) { d->sn = new QSocketNotifier(socket, QSocketNotifier::Read); @@ -1454,8 +1456,10 @@ bool QPSQLDriver::unsubscribeFromNotification(const QString &name) PGresult *result = d->exec(query); if (PQresultStatus(result) != PGRES_COMMAND_OK) { setLastError(qMakeError(tr("Unable to unsubscribe"), QSqlError::StatementError, d, result)); + PQclear(result); return false; } + PQclear(result); d->seid.removeAll(name); diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp index 46b0a356d37..67c24e41680 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp +++ b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp @@ -144,8 +144,6 @@ public: QVector<QVariant> firstRow; }; -static const uint initial_cache_size = 128; - QSQLite2ResultPrivate::QSQLite2ResultPrivate(QSQLite2Result *q, const QSQLite2Driver *drv) : QSqlCachedResultPrivate(q, drv), currentTail(0), diff --git a/src/sql/sql.pro b/src/sql/sql.pro index 10004cb445d..218671d7e72 100644 --- a/src/sql/sql.pro +++ b/src/sql/sql.pro @@ -4,13 +4,8 @@ QT = core-private DEFINES += QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000 -MODULE_PLUGIN_TYPES = \ - sqldrivers - QMAKE_DOCS = $$PWD/doc/qtsql.qdocconf -load(qt_module) - DEFINES += QT_NO_CAST_FROM_ASCII PRECOMPILED_HEADER = ../corelib/global/qt_pch.h SQL_P = sql @@ -18,3 +13,7 @@ SQL_P = sql include(kernel/kernel.pri) include(drivers/drivers.pri) include(models/models.pri) + +MODULE_PLUGIN_TYPES = \ + sqldrivers +load(qt_module) diff --git a/src/testlib/qtestspontaneevent.h b/src/testlib/qtestspontaneevent.h index f8982325ec1..ae10fabd31a 100644 --- a/src/testlib/qtestspontaneevent.h +++ b/src/testlib/qtestspontaneevent.h @@ -82,17 +82,10 @@ public: } #endif + // ### Qt 6: remove everything except this function: static inline void setSpontaneous(QEvent *ev) { - // use a union instead of a reinterpret_cast to prevent alignment warnings - union - { - QSpontaneKeyEvent *skePtr; - QEvent *evPtr; - } helper; - - helper.evPtr = ev; - helper.skePtr->setSpontaneous(); + ev->setSpontaneous(); } protected: diff --git a/src/tools/bootstrap-dbus/bootstrap-dbus.pro b/src/tools/bootstrap-dbus/bootstrap-dbus.pro index 4c466ba0e94..3b28c233114 100644 --- a/src/tools/bootstrap-dbus/bootstrap-dbus.pro +++ b/src/tools/bootstrap-dbus/bootstrap-dbus.pro @@ -9,8 +9,6 @@ DEFINES += \ MODULE_INCNAME = QtDBus -load(qt_module) - QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS SOURCES = \ @@ -25,5 +23,7 @@ SOURCES = \ ../../dbus/qdbus_symbols.cpp \ ../../dbus/qdbusunixfiledescriptor.cpp +load(qt_module) + lib.CONFIG = dummy_install INSTALLS = lib diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 522e13b17be..3cfdbf34293 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -27,11 +27,6 @@ DEFINES += \ DEFINES -= QT_EVAL -load(qt_module) - -# otherwise mingw headers do not declare common functions like putenv -mingw: CONFIG -= strict_c++ - SOURCES += \ ../../corelib/codecs/qlatincodec.cpp \ ../../corelib/codecs/qtextcodec.cpp \ @@ -143,5 +138,10 @@ else:include(../../3rdparty/zlib_dependency.pri) win32:LIBS += -luser32 -lole32 -ladvapi32 -lshell32 +load(qt_module) + +# otherwise mingw headers do not declare common functions like putenv +mingw: CONFIG -= strict_c++ + lib.CONFIG = dummy_install INSTALLS += lib diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 67195c5f8b5..026d099dc09 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -1262,7 +1262,10 @@ void WriteInitialization::writeProperties(const QString &varName, } else { setFunction = QLatin1String("->setProperty(\""); setFunction += propertyName; - setFunction += QLatin1String("\", QVariant("); + setFunction += QLatin1String("\", QVariant"); + if (p->kind() == DomProperty::Enum) + setFunction += QLatin1String("::fromValue"); + setFunction += QLatin1Char('('); } QString varNewName = varName; diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index d0627f31a75..3bfef49965e 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -39,6 +39,7 @@ #include "qaccessiblewidgets_p.h" #include "qaccessiblemenu_p.h" +#include "private/qwidget_p.h" #include "simplewidgets_p.h" #include "rangecontrols_p.h" #include "complexwidgets_p.h" @@ -59,7 +60,15 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje QAccessibleInterface *iface = 0; if (!object || !object->isWidgetType()) return iface; + QWidget *widget = static_cast<QWidget*>(object); + // QWidget emits destroyed() from its destructor instead of letting the QObject + // destructor do it, which means the QWidget is unregistered from the accessibillity + // cache. But QWidget destruction also emits enter and leave events, which may end + // up here, so we have to ensure that we don't fill the cache with an entry of + // a widget that is going away. + if (QWidgetPrivate::get(widget)->data.in_destructor) + return iface; if (false) { #ifndef QT_NO_LINEEDIT diff --git a/src/widgets/accessible/widgets.pro b/src/widgets/accessible/widgets.pro index c6af6d3f716..da8607c6378 100644 --- a/src/widgets/accessible/widgets.pro +++ b/src/widgets/accessible/widgets.pro @@ -1,10 +1,5 @@ TARGET = qtaccessiblewidgets -PLUGIN_TYPE = accessible -PLUGIN_EXTENDS = widgets -PLUGIN_CLASS_NAME = AccessibleFactory -load(qt_plugin) - QT += core-private gui-private widgets-private QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)" @@ -24,4 +19,7 @@ HEADERS += qaccessiblewidgets.h \ qaccessiblemenu.h \ itemviews.h - +PLUGIN_TYPE = accessible +PLUGIN_EXTENDS = widgets +PLUGIN_CLASS_NAME = AccessibleFactory +load(qt_plugin) diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 9f86bea0ca0..98f1f4870d9 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -196,7 +196,6 @@ public: QSize sizeHint() const Q_DECL_OVERRIDE; virtual void setCellBrush(int row, int col, const QBrush &); - QBrush cellBrush(int row, int col); inline int cellWidth() const { return cellw; } @@ -465,20 +464,6 @@ void QWellArray::setCellBrush(int row, int col, const QBrush &b) d->brush[row*numCols()+col] = b; } -/* - Returns the brush set for the cell at \a row, \a column. If no brush is - set, Qt::NoBrush is returned. -*/ - -QBrush QWellArray::cellBrush(int row, int col) -{ - if (d && row >= 0 && row < numRows() && col >= 0 && col < numCols()) - return d->brush[row*numCols()+col]; - return Qt::NoBrush; -} - - - /*!\reimp */ diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index 93381ce7b0f..8bc5ba7f567 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -53,18 +53,6 @@ #include <QtGui/QWindow> #include <QtWidgets/QDesktopWidget> -// Note, these tests are duplicates in qwindowsxpstyle_p.h. -#ifdef Q_CC_GNU -# include <w32api.h> -# if (__W32API_MAJOR_VERSION >= 3 || (__W32API_MAJOR_VERSION == 2 && __W32API_MINOR_VERSION >= 5)) -# ifdef _WIN32_WINNT -# undef _WIN32_WINNT -# endif -# define _WIN32_WINNT 0x0501 -# include <commctrl.h> -# endif -#endif - #include <uxtheme.h> Q_DECLARE_METATYPE(QMargins) diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 1f33649668c..c7085a0dc2e 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -1989,6 +1989,11 @@ int QCommonListViewBase::horizontalScrollToValue(const int /*index*/, QListView: /* * ListMode ListView Implementation */ +QListModeViewBase::QListModeViewBase(QListView *q, QListViewPrivate *d) + : QCommonListViewBase(q, d) +{ + dd->defaultDropAction = Qt::CopyAction; +} #ifndef QT_NO_DRAGANDDROP QAbstractItemView::DropIndicatorPosition QListModeViewBase::position(const QPoint &pos, const QRect &rect, const QModelIndex &index) const @@ -2755,7 +2760,7 @@ bool QIconModeViewBase::filterStartDrag(Qt::DropActions supportedActions) drag->setMimeData(dd->model->mimeData(indexes)); drag->setPixmap(pixmap); drag->setHotSpot(dd->pressedPosition - rect.topLeft()); - Qt::DropAction action = drag->exec(supportedActions, Qt::CopyAction); + Qt::DropAction action = drag->exec(supportedActions, dd->defaultDropAction); draggedItems.clear(); if (action == Qt::MoveAction) dd->clearOrRemove(); diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h index 2e6f69713f8..90fb9e1407d 100644 --- a/src/widgets/itemviews/qlistview_p.h +++ b/src/widgets/itemviews/qlistview_p.h @@ -196,7 +196,7 @@ public: class QListModeViewBase : public QCommonListViewBase { public: - QListModeViewBase(QListView *q, QListViewPrivate *d) : QCommonListViewBase(q, d) {} + QListModeViewBase(QListView *q, QListViewPrivate *d); QVector<int> flowPositions; QVector<int> segmentPositions; diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 1d5bdc2db70..5d934fe8ec3 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -424,7 +424,7 @@ QWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard inpu QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus #ifndef QT_NO_WHEELEVENT int QApplicationPrivate::wheel_scroll_lines; // number of lines to scroll -QWidget *QApplicationPrivate::wheel_widget = Q_NULLPTR; +QPointer<QWidget> QApplicationPrivate::wheel_widget; #endif bool qt_in_tab_key_event = false; int qt_antialiasing_threshold = -1; @@ -569,13 +569,18 @@ QApplication::QApplication(int &argc, char **argv) QApplication::QApplication(int &argc, char **argv, int _internal) #endif : QGuiApplication(*new QApplicationPrivate(argc, argv, _internal)) -{ Q_D(QApplication); d->construct(); } +{ + Q_D(QApplication); + d->init(); +} /*! \internal */ -void QApplicationPrivate::construct() +void QApplicationPrivate::init() { + QGuiApplicationPrivate::init(); + initResources(); qt_is_gui_used = (application_type != QApplicationPrivate::Tty); @@ -3319,9 +3324,32 @@ bool QApplication::notify(QObject *receiver, QEvent *e) const bool spontaneous = wheel->spontaneous(); const Qt::ScrollPhase phase = wheel->phase(); - if (phase == Qt::NoScrollPhase || phase == Qt::ScrollBegin - || (phase == Qt::ScrollUpdate && !QApplicationPrivate::wheel_widget)) { - + // Ideally, we should lock on a widget when it starts receiving wheel + // events. This avoids other widgets to start receiving those events + // as the mouse cursor hovers them. However, given the way common + // wheeled mice work, there's no certain way of connecting different + // wheel events as a stream. This results in the NoScrollPhase case, + // where we just send the event from the original receiver and up its + // hierarchy until the event gets accepted. + // + // In the case of more evolved input devices, like Apple's trackpad or + // Magic Mouse, we receive the scroll phase information. This helps us + // connect wheel events as a stream and therefore makes it easier to + // lock on the widget onto which the scrolling was initiated. + // + // We assume that, when supported, the phase cycle follows the pattern: + // + // ScrollBegin (ScrollUpdate* ScrollEnd)+ + // + // This means that we can have scrolling sequences (starting with ScrollBegin) + // or partial sequences (after a ScrollEnd and starting with ScrollUpdate). + // If wheel_widget is null because it was deleted, we also take the same + // code path as an initial sequence. + if (phase == Qt::NoScrollPhase || phase == Qt::ScrollBegin || !QApplicationPrivate::wheel_widget) { + + // A system-generated ScrollBegin event starts a new user scrolling + // sequence, so we reset wheel_widget in case no one accepts the event + // or if we didn't get (or missed) a ScrollEnd previously. if (spontaneous && phase == Qt::ScrollBegin) QApplicationPrivate::wheel_widget = Q_NULLPTR; @@ -3339,7 +3367,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e) res = d->notify_helper(w, &we); eventAccepted = we.isAccepted(); if (res && eventAccepted) { - if (spontaneous && phase != Qt::NoScrollPhase) + // A new scrolling sequence or partial sequence starts and w has accepted + // the event. Therefore, we can set wheel_widget, but only if it's not + // the end of a sequence. + if (spontaneous && (phase == Qt::ScrollBegin || phase == Qt::ScrollUpdate) && QGuiApplicationPrivate::scrollNoPhaseAllowed) QApplicationPrivate::wheel_widget = w; break; } @@ -3350,25 +3381,27 @@ bool QApplication::notify(QObject *receiver, QEvent *e) w = w->parentWidget(); } wheel->setAccepted(eventAccepted); - } else if (QApplicationPrivate::wheel_widget) { - if (!spontaneous) { - // wheel_widget may forward the wheel event to a delegate widget, - // either directly or indirectly (e.g. QAbstractScrollArea will - // forward to its QScrollBars through viewportEvent()). In that - // case, the event will not be spontaneous but synthesized, so - // we can send it straigth to the receiver. - d->notify_helper(w, wheel); - } else { - const QPoint &relpos = QApplicationPrivate::wheel_widget->mapFromGlobal(wheel->globalPos()); - QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(), - wheel->modifiers(), wheel->phase(), wheel->source()); - we.spont = true; - we.ignore(); - d->notify_helper(QApplicationPrivate::wheel_widget, &we); - wheel->setAccepted(we.isAccepted()); - if (phase == Qt::ScrollEnd) - QApplicationPrivate::wheel_widget = Q_NULLPTR; - } + } else if (!spontaneous) { + // wheel_widget may forward the wheel event to a delegate widget, + // either directly or indirectly (e.g. QAbstractScrollArea will + // forward to its QScrollBars through viewportEvent()). In that + // case, the event will not be spontaneous but synthesized, so + // we can send it straight to the receiver. + d->notify_helper(w, wheel); + } else { + // The phase is either ScrollUpdate or ScrollEnd, and wheel_widget + // is set. Since it accepted the wheel event previously, we continue + // sending those events until we get a ScrollEnd, which signifies + // the end of the natural scrolling sequence. + const QPoint &relpos = QApplicationPrivate::wheel_widget->mapFromGlobal(wheel->globalPos()); + QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(), + wheel->modifiers(), wheel->phase(), wheel->source()); + we.spont = true; + we.ignore(); + d->notify_helper(QApplicationPrivate::wheel_widget, &we); + wheel->setAccepted(we.isAccepted()); + if (phase == Qt::ScrollEnd) + QApplicationPrivate::wheel_widget = Q_NULLPTR; } } break; @@ -3546,6 +3579,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e) QApplicationPrivate::giveFocusAccordingToFocusPolicy(widget, e, localPos); } +#ifndef QT_NO_GESTURES + QPointer<QWidget> gesturePendingWidget; +#endif + while (widget) { // first, try to deliver the touch event acceptTouchEvents = widget->testAttribute(Qt::WA_AcceptTouchEvents); @@ -3563,14 +3600,16 @@ bool QApplication::notify(QObject *receiver, QEvent *e) touchEvent->spont = false; if (res && eventAccepted) { // the first widget to accept the TouchBegin gets an implicit grab. - for (int i = 0; i < touchEvent->touchPoints().count(); ++i) { - const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i); - d->activeTouchPoints[QGuiApplicationPrivate::ActiveTouchPointsKey(touchEvent->device(), touchPoint.id())].target = widget; - } - break; - } else if (p.isNull() || widget->isWindow() || widget->testAttribute(Qt::WA_NoMousePropagation)) { + d->activateImplicitTouchGrab(widget, touchEvent); break; } +#ifndef QT_NO_GESTURES + if (gesturePendingWidget.isNull() && widget && QGestureManager::gesturePending(widget)) + gesturePendingWidget = widget; +#endif + if (p.isNull() || widget->isWindow() || widget->testAttribute(Qt::WA_NoMousePropagation)) + break; + QPoint offset = widget->pos(); widget = widget->parentWidget(); touchEvent->setTarget(widget); @@ -3584,9 +3623,27 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } } +#ifndef QT_NO_GESTURES + if (!eventAccepted && !gesturePendingWidget.isNull()) { + // the first widget subscribed to a gesture gets an implicit grab + d->activateImplicitTouchGrab(gesturePendingWidget, touchEvent); + } +#endif + touchEvent->setAccepted(eventAccepted); break; } + case QEvent::TouchUpdate: + case QEvent::TouchEnd: + { + QWidget *widget = static_cast<QWidget *>(receiver); + // We may get here if the widget is subscribed to a gesture, + // but has not accepted TouchBegin. Propagate touch events + // only if TouchBegin has been accepted. + if (widget && widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent)) + res = d->notify_helper(widget, e); + break; + } case QEvent::RequestSoftwareInputPanel: inputMethod()->show(); break; @@ -4327,6 +4384,17 @@ QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device, return static_cast<QWidget *>(closestTarget); } +void QApplicationPrivate::activateImplicitTouchGrab(QWidget *widget, QTouchEvent *touchEvent) +{ + if (touchEvent->type() != QEvent::TouchBegin) + return; + + for (int i = 0, tc = touchEvent->touchPoints().count(); i < tc; ++i) { + const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().at(i); + activeTouchPoints[QGuiApplicationPrivate::ActiveTouchPointsKey(touchEvent->device(), touchPoint.id())].target = widget; + } +} + bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, QTouchDevice *device, const QList<QTouchEvent::TouchPoint> &touchPoints, @@ -4457,10 +4525,11 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, || QGestureManager::gesturePending(widget) #endif ) { - if (touchEvent.type() == QEvent::TouchEnd) - widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, false); if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) accepted = true; + // widget can be deleted on TouchEnd + if (touchEvent.type() == QEvent::TouchEnd && !widget.isNull()) + widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, false); } break; } diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 0482f83a8a5..3358cce7442 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -156,7 +156,7 @@ public: bool notify_helper(QObject *receiver, QEvent * e); - void construct( + void init( #ifdef Q_DEAD_CODE_FROM_QT4_X11 Display *dpy = 0, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0 #endif @@ -208,7 +208,7 @@ public: static QWidget *active_window; #ifndef QT_NO_WHEELEVENT static int wheel_scroll_lines; - static QWidget *wheel_widget; + static QPointer<QWidget> wheel_widget; #endif static int enabledAnimations; // Combination of QPlatformTheme::UiEffect @@ -288,6 +288,7 @@ public: QWidget *findClosestTouchPointTarget(QTouchDevice *device, const QTouchEvent::TouchPoint &touchPoint); void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint); void removeTouchPoint(int touchPointId); + void activateImplicitTouchGrab(QWidget *widget, QTouchEvent *touchBeginEvent); static bool translateRawTouchEvent(QWidget *widget, QTouchDevice *device, const QList<QTouchEvent::TouchPoint> &touchPoints, diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index 9a3e9291bf3..8af3516d4bc 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -555,9 +555,9 @@ bool QGestureManager::filterEvent(QObject *receiver, QEvent *event) if (widgetWindow) return filterEvent(widgetWindow->widget(), event); - if (!m_gestureToRecognizer.contains(static_cast<QGesture *>(receiver))) + QGesture *state = qobject_cast<QGesture *>(receiver); + if (!state || !m_gestureToRecognizer.contains(state)) return false; - QGesture *state = static_cast<QGesture *>(receiver); QMultiMap<QObject *, Qt::GestureType> contexts; contexts.insert(state, state->gestureType()); return filterEventThroughContexts(contexts, event); diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 3490d09fdfb..782077fe70d 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -4584,7 +4584,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter HIRect menuRect = qt_hirectForQRect(mi->menuRect); HIRect itemRect = qt_hirectForQRect(mi->rect); - if ((opt->state & State_Selected) && (opt->state & State_Enabled) && (opt->state & State_Sunken)){ + const bool selected = (opt->state & State_Selected) && (opt->state & State_Enabled) && (opt->state & State_Sunken); + if (selected) { // Draw a selected menu item background: HIThemeMenuItemDrawInfo mdi; mdi.version = qt_mac_hitheme_version; @@ -4612,7 +4613,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter Qt::AlignCenter | Qt::TextHideMnemonic | Qt::TextDontClip | Qt::TextSingleLine, mi->palette, mi->state & State_Enabled, - mi->text, QPalette::ButtonText); + mi->text, selected ? QPalette::HighlightedText : QPalette::ButtonText); } } break; diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h index 7daef62ce0e..31977304fe4 100644 --- a/src/widgets/styles/qwindowsxpstyle_p_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p_p.h @@ -56,18 +56,6 @@ #include <qmap.h> #include <qt_windows.h> -// Note, these tests are duplicated in qwizard_win.cpp. -#ifdef Q_CC_GNU -# include <w32api.h> -# if (__W32API_MAJOR_VERSION >= 3 || (__W32API_MAJOR_VERSION == 2 && __W32API_MINOR_VERSION >= 5)) -# ifdef _WIN32_WINNT -# undef _WIN32_WINNT -# endif -# define _WIN32_WINNT 0x0501 -# include <commctrl.h> -# endif -#endif - #include <uxtheme.h> #if WINVER >= 0x0600 diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h index e2b65ba2110..10dde975c0f 100644 --- a/src/widgets/util/qcompleter_p.h +++ b/src/widgets/util/qcompleter_p.h @@ -128,7 +128,7 @@ private: }; struct QMatchData { - QMatchData() : exactMatchIndex(-1) { } + QMatchData() : exactMatchIndex(-1), partial(false) { } QMatchData(const QIndexMapper& indices, int em, bool p) : indices(indices), exactMatchIndex(em), partial(p) { } QIndexMapper indices; diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp index adf193bb668..f34714c0161 100644 --- a/src/widgets/util/qsystemtrayicon_win.cpp +++ b/src/widgets/util/qsystemtrayicon_win.cpp @@ -40,13 +40,6 @@ #include "qsystemtrayicon_p.h" #ifndef QT_NO_SYSTEMTRAYICON -#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600 -# undef _WIN32_WINNT -#endif -#if !defined(_WIN32_WINNT) -# define _WIN32_WINNT 0x0600 -#endif - #if defined(_WIN32_IE) && _WIN32_IE < 0x0600 # undef _WIN32_IE #endif diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro index ceb6f96f7cf..b609e4c4340 100644 --- a/src/widgets/widgets.pro +++ b/src/widgets/widgets.pro @@ -8,13 +8,8 @@ DEFINES += QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000 irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused -MODULE_PLUGIN_TYPES += \ - styles - QMAKE_DOCS = $$PWD/doc/qtwidgets.qdocconf -load(qt_module) - #platforms mac:include(kernel/mac.pri) win32:include(kernel/win.pri) @@ -45,3 +40,7 @@ QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtWidgets.dynlist testcocoon { load(testcocoon) } + +MODULE_PLUGIN_TYPES += \ + styles +load(qt_module) diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index 913f1042873..66e4a89fe91 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -655,7 +655,6 @@ public: int dateEditAcceptDelay() const; void setDateEditAcceptDelay(int delay); - QDate date() const; void setDate(const QDate &date); bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE; @@ -691,11 +690,6 @@ void QCalendarTextNavigator::setWidget(QWidget *widget) m_widget = widget; } -QDate QCalendarTextNavigator::date() const -{ - return m_date; -} - void QCalendarTextNavigator::setDate(const QDate &date) { m_date = date; diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 261ff0bca3b..8fb02aaa721 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -696,7 +696,8 @@ void QMenuBarPrivate::init() q->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); q->setAttribute(Qt::WA_CustomWhatsThis); - platformMenuBar = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar(); + if (!QApplication::instance()->testAttribute(Qt::AA_DontUseNativeMenuBar)) + platformMenuBar = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar(); if (platformMenuBar) q->hide(); diff --git a/src/xml/xml.pro b/src/xml/xml.pro index 57bf11e5aa2..f281e35444e 100644 --- a/src/xml/xml.pro +++ b/src/xml/xml.pro @@ -6,11 +6,11 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x61000000 QMAKE_DOCS = $$PWD/doc/qtxml.qdocconf -load(qt_module) - HEADERS += qtxmlglobal.h PRECOMPILED_HEADER = include(dom/dom.pri) include(sax/sax.pri) + +load(qt_module) diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index e5195000aab..c47e88b0e6b 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -141,6 +141,8 @@ private slots: void startStopStartStop(); void startStopStartStopBuffers_data(); void startStopStartStopBuffers(); + void processEventsInAReadyReadSlot_data(); + void processEventsInAReadyReadSlot(); // keep these at the end, since they use lots of processes and sometimes // caused obscure failures to occur in tests that followed them (esp. on the Mac) @@ -153,6 +155,7 @@ private slots: protected slots: void readFromProcess(); void exitLoopSlot(); + void processApplicationEvents(); #ifndef Q_OS_WINCE void restartProcess(); void waitForReadyReadInAReadyReadSlotSlot(); @@ -471,6 +474,11 @@ void tst_QProcess::exitLoopSlot() QTestEventLoop::instance().exitLoop(); } +void tst_QProcess::processApplicationEvents() +{ + QCoreApplication::processEvents(); +} + #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::echoTest2() @@ -688,11 +696,7 @@ void tst_QProcess::waitForFinished() process.start("testProcessOutput/testProcessOutput"); -#if !defined(Q_OS_WINCE) - QVERIFY(process.waitForFinished(5000)); -#else - QVERIFY(process.waitForFinished(30000)); -#endif + QVERIFY(process.waitForFinished()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); #if defined (Q_OS_WINCE) @@ -916,12 +920,7 @@ void tst_QProcess::hardExit() proc.start("testProcessEcho/testProcessEcho"); #endif -#ifndef Q_OS_WINCE - QVERIFY(proc.waitForStarted(5000)); -#else - QVERIFY(proc.waitForStarted(10000)); -#endif - + QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); proc.kill(); QVERIFY(proc.waitForFinished(5000)); @@ -1417,24 +1416,17 @@ void tst_QProcess::spaceArgsTest() QString program = programs.at(i); process.start(program, args); -#if defined(Q_OS_WINCE) - const int timeOutMS = 10000; -#else - const int timeOutMS = 5000; -#endif QByteArray errorMessage; - bool started = process.waitForStarted(timeOutMS); + bool started = process.waitForStarted(); if (!started) errorMessage = startFailMessage(program, process); QVERIFY2(started, errorMessage.constData()); - QVERIFY(process.waitForFinished(timeOutMS)); + QVERIFY(process.waitForFinished()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); #if !defined(Q_OS_WINCE) QStringList actual = QString::fromLatin1(process.readAll()).split("|"); -#endif -#if !defined(Q_OS_WINCE) QVERIFY(!actual.isEmpty()); // not interested in the program name, it might be different. actual.removeFirst(); @@ -1459,8 +1451,6 @@ void tst_QProcess::spaceArgsTest() #if !defined(Q_OS_WINCE) actual = QString::fromLatin1(process.readAll()).split("|"); -#endif -#if !defined(Q_OS_WINCE) QVERIFY(!actual.isEmpty()); // not interested in the program name, it might be different. actual.removeFirst(); @@ -1482,13 +1472,8 @@ void tst_QProcess::nativeArguments() proc.start(QString::fromLatin1("testProcessSpacesArgs/nospace"), QStringList()); -#if !defined(Q_OS_WINCE) - QVERIFY(proc.waitForStarted(5000)); - QVERIFY(proc.waitForFinished(5000)); -#else - QVERIFY(proc.waitForStarted(10000)); - QVERIFY(proc.waitForFinished(10000)); -#endif + QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); + QVERIFY(proc.waitForFinished()); QCOMPARE(proc.exitStatus(), QProcess::NormalExit); QCOMPARE(proc.exitCode(), 0); @@ -2550,6 +2535,31 @@ void tst_QProcess::startStopStartStopBuffers() } } +void tst_QProcess::processEventsInAReadyReadSlot_data() +{ + QTest::addColumn<bool>("callWaitForReadyRead"); + + QTest::newRow("no waitForReadyRead") << false; + QTest::newRow("waitForReadyRead") << true; +} + +void tst_QProcess::processEventsInAReadyReadSlot() +{ + // Test whether processing events in a readyReadXXX slot crashes. (QTBUG-48697) + QFETCH(bool, callWaitForReadyRead); + QProcess process; + QObject::connect(&process, &QProcess::readyReadStandardOutput, + this, &tst_QProcess::processApplicationEvents); + process.start("testProcessEcho/testProcessEcho"); + QVERIFY(process.waitForStarted()); + const QByteArray data(156, 'x'); + process.write(data.constData(), data.size() + 1); + if (callWaitForReadyRead) + QVERIFY(process.waitForReadyRead()); + if (process.state() == QProcess::Running) + QVERIFY(process.waitForFinished()); +} + #endif //QT_NO_PROCESS QTEST_MAIN(tst_QProcess) diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index 439da8b1a37..2852420557e 100644 --- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -223,6 +223,8 @@ private slots: void alignAccountingStyle(); void setCodec(); + void textModeOnEmptyRead(); + private: void generateLineData(bool for_QString); void generateAllData(bool for_QString); @@ -3040,6 +3042,21 @@ void tst_QTextStream::int_write_with_locale() QCOMPARE(result, output); } +void tst_QTextStream::textModeOnEmptyRead() +{ + const QString filename("textmodetest.txt"); + QFile::remove(filename); // Remove file if exists + + + QFile file(filename); + QVERIFY(file.open(QIODevice::ReadWrite | QIODevice::Text)); + QTextStream stream(&file); + QVERIFY(file.isTextModeEnabled()); + QString emptyLine = stream.readLine(); // Text mode flag cleared here + QVERIFY(file.isTextModeEnabled()); +} + + // ------------------------------------------------------------------------------ QTEST_MAIN(tst_QTextStream) diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index b1ae4292d02..fbb6a309176 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -1473,7 +1473,7 @@ static QByteArray createTypeName(const char *begin, const char *va) } if (tn.endsWith('>')) tn += ' '; - tn += ">"; + tn += '>'; return tn; } #endif diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 540cd667155..23f8ff58577 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -275,8 +275,10 @@ static void playWithObjects() void tst_QObject::initTestCase() { +#ifndef QT_NO_PROCESS const QString testDataDir = QFileInfo(QFINDTESTDATA("signalbug")).absolutePath(); QVERIFY2(QDir::setCurrent(testDataDir), qPrintable("Could not chdir to " + testDataDir)); +#endif } void tst_QObject::disconnect() diff --git a/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro b/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro index a36b15c9065..69062a97413 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro +++ b/tests/auto/corelib/kernel/qsharedmemory/qsharedmemory.pro @@ -1,3 +1,5 @@ TEMPLATE = subdirs -SUBDIRS = sharedmemoryhelper test +!winrt: SUBDIRS = sharedmemoryhelper + +SUBDIRS += test diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp index a4c918ed230..b6f6d2a7f3f 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp @@ -133,7 +133,9 @@ tst_QSharedMemory::~tst_QSharedMemory() void tst_QSharedMemory::initTestCase() { +#ifndef QT_NO_PROCESS QVERIFY2(!m_helperBinary.isEmpty(), "Could not find helper binary"); +#endif } void tst_QSharedMemory::init() diff --git a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp index 3bed64a76a2..fe465df3959 100644 --- a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp +++ b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp @@ -357,28 +357,46 @@ void tst_QAtomicIntegerXX::loadAcquireStoreRelease() void tst_QAtomicIntegerXX::refDeref() { QFETCH(LargeInt, value); - T nextValue = T(value + 1); - T prevValue = T(value - 1); + const bool needToPreventOverflow = TypeIsSigned && value == std::numeric_limits<T>::max(); + const bool needToPreventUnderflow = TypeIsSigned && value == std::numeric_limits<T>::min(); + T nextValue = T(value); + if (!needToPreventOverflow) + ++nextValue; + T prevValue = T(value); + if (!needToPreventUnderflow) + --prevValue; QAtomicInteger<T> atomic(value); + if (!needToPreventOverflow) { QCOMPARE(atomic.ref(), (nextValue != 0)); QCOMPARE(atomic.load(), nextValue); QCOMPARE(atomic.deref(), (value != 0)); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.deref(), (prevValue != 0)); QCOMPARE(atomic.load(), prevValue); QCOMPARE(atomic.ref(), (value != 0)); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(++atomic, nextValue); QCOMPARE(--atomic, T(value)); + } + if (!needToPreventUnderflow) { QCOMPARE(--atomic, prevValue); QCOMPARE(++atomic, T(value)); + } + if (!needToPreventOverflow) { QCOMPARE(atomic++, T(value)); QCOMPARE(atomic--, nextValue); + } + if (!needToPreventUnderflow) { QCOMPARE(atomic--, T(value)); QCOMPARE(atomic++, prevValue); + } QCOMPARE(atomic.load(), T(value)); } @@ -481,53 +499,80 @@ void tst_QAtomicIntegerXX::fetchAndAdd() QFETCH(LargeInt, value); QAtomicInteger<T> atomic(value); - // note: this test has undefined behavior for signed max and min T parcel1 = 42; T parcel2 = T(0-parcel1); - T newValue1 = T(value) + parcel1; - T newValue2 = T(value) + parcel2; + const bool needToPreventOverflow = TypeIsSigned && value > std::numeric_limits<T>::max() + parcel2; + const bool needToPreventUnderflow = TypeIsSigned && value < std::numeric_limits<T>::min() + parcel1; + + T newValue1 = T(value); + if (!needToPreventOverflow) + newValue1 += parcel1; + T newValue2 = T(value); + if (!needToPreventUnderflow) + newValue2 += parcel2; + + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndAddRelaxed(parcel1), T(value)); QCOMPARE(atomic.load(), newValue1); QCOMPARE(atomic.fetchAndAddRelaxed(parcel2), newValue1); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndAddRelaxed(parcel2), T(value)); QCOMPARE(atomic.load(), newValue2); QCOMPARE(atomic.fetchAndAddRelaxed(parcel1), newValue2); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndAddAcquire(parcel1), T(value)); QCOMPARE(atomic.load(), newValue1); QCOMPARE(atomic.fetchAndAddAcquire(parcel2), newValue1); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndAddAcquire(parcel2), T(value)); QCOMPARE(atomic.load(), newValue2); QCOMPARE(atomic.fetchAndAddAcquire(parcel1), newValue2); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndAddRelease(parcel1), T(value)); QCOMPARE(atomic.loadAcquire(), newValue1); QCOMPARE(atomic.fetchAndAddRelease(parcel2), newValue1); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndAddRelease(parcel2), T(value)); QCOMPARE(atomic.loadAcquire(), newValue2); QCOMPARE(atomic.fetchAndAddRelease(parcel1), newValue2); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndAddOrdered(parcel1), T(value)); QCOMPARE(atomic.loadAcquire(), newValue1); QCOMPARE(atomic.fetchAndAddOrdered(parcel2), newValue1); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndAddOrdered(parcel2), T(value)); QCOMPARE(atomic.loadAcquire(), newValue2); QCOMPARE(atomic.fetchAndAddOrdered(parcel1), newValue2); + } QCOMPARE(atomic.loadAcquire(), T(value)); // operator+= + if (!needToPreventOverflow) { QCOMPARE(atomic += parcel1, newValue1); QCOMPARE(atomic += parcel2, T(value)); + } + if (!needToPreventUnderflow) { QCOMPARE(atomic += parcel2, newValue2); QCOMPARE(atomic += parcel1, T(value)); + } } void tst_QAtomicIntegerXX::fetchAndSub() @@ -535,53 +580,80 @@ void tst_QAtomicIntegerXX::fetchAndSub() QFETCH(LargeInt, value); QAtomicInteger<T> atomic(value); - // note: this test has undefined behavior for signed max and min T parcel1 = 42; T parcel2 = T(0-parcel1); - T newValue1 = T(value) - parcel1; - T newValue2 = T(value) - parcel2; + const bool needToPreventOverflow = TypeIsSigned && value > std::numeric_limits<T>::max() - parcel1; + const bool needToPreventUnderflow = TypeIsSigned && value < std::numeric_limits<T>::min() - parcel2; + + T newValue1 = T(value); + if (!needToPreventUnderflow) + newValue1 -= parcel1; + T newValue2 = T(value); + if (!needToPreventOverflow) + newValue2 -= parcel2; + + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndSubRelaxed(parcel1), T(value)); QCOMPARE(atomic.load(), newValue1); QCOMPARE(atomic.fetchAndSubRelaxed(parcel2), newValue1); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndSubRelaxed(parcel2), T(value)); QCOMPARE(atomic.load(), newValue2); QCOMPARE(atomic.fetchAndSubRelaxed(parcel1), newValue2); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndSubAcquire(parcel1), T(value)); QCOMPARE(atomic.load(), newValue1); QCOMPARE(atomic.fetchAndSubAcquire(parcel2), newValue1); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndSubAcquire(parcel2), T(value)); QCOMPARE(atomic.load(), newValue2); QCOMPARE(atomic.fetchAndSubAcquire(parcel1), newValue2); + } QCOMPARE(atomic.load(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndSubRelease(parcel1), T(value)); QCOMPARE(atomic.loadAcquire(), newValue1); QCOMPARE(atomic.fetchAndSubRelease(parcel2), newValue1); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndSubRelease(parcel2), T(value)); QCOMPARE(atomic.loadAcquire(), newValue2); QCOMPARE(atomic.fetchAndSubRelease(parcel1), newValue2); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventUnderflow) { QCOMPARE(atomic.fetchAndSubOrdered(parcel1), T(value)); QCOMPARE(atomic.loadAcquire(), newValue1); QCOMPARE(atomic.fetchAndSubOrdered(parcel2), newValue1); + } QCOMPARE(atomic.loadAcquire(), T(value)); + if (!needToPreventOverflow) { QCOMPARE(atomic.fetchAndSubOrdered(parcel2), T(value)); QCOMPARE(atomic.loadAcquire(), newValue2); QCOMPARE(atomic.fetchAndSubOrdered(parcel1), newValue2); + } QCOMPARE(atomic.loadAcquire(), T(value)); // operator-= + if (!needToPreventUnderflow) { QCOMPARE(atomic -= parcel1, newValue1); QCOMPARE(atomic -= parcel2, T(value)); + } + if (!needToPreventOverflow) { QCOMPARE(atomic -= parcel2, newValue2); QCOMPARE(atomic -= parcel1, T(value)); + } } void tst_QAtomicIntegerXX::addSub() diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index ba5cfd17573..c12c8a9cf49 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -109,7 +109,7 @@ void tst_QImageWriter::initTestCase() prefix = QFINDTESTDATA("images/"); if (prefix.isEmpty()) QFAIL("Can't find images directory!"); - writePrefix = m_temporaryDir.path(); + writePrefix = m_temporaryDir.path() + QLatin1Char('/'); } // Testing get/set functions diff --git a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp index bd68400047e..db0bfaf6228 100644 --- a/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp +++ b/tests/auto/gui/kernel/qkeyevent/tst_qkeyevent.cpp @@ -137,7 +137,7 @@ void tst_QKeyEvent::modifiers_data() for (quint64 bitmask = 1; bitmask < (1 << kNumModifiers) ; ++bitmask) { QVector<int> modifierCombination; for (quint64 modifier = 0; modifier < kNumModifiers; ++modifier) { - if (bitmask & (1 << modifier)) + if (bitmask & (quint64(1) << modifier)) modifierCombination.append(modifier); } modifierCombinations.append(modifierCombination); diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp index 7f4a11c5a56..096b8200044 100644 --- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp @@ -592,6 +592,29 @@ void tst_QStaticText::plainTextVsRichText() QCOMPARE(imagePlainText, imageRichText); } +static bool checkPixels(const QImage &image, + Qt::GlobalColor expectedColor1, Qt::GlobalColor expectedColor2, + QByteArray *errorMessage) +{ + const QRgb expectedRgb1 = QColor(expectedColor1).rgba(); + const QRgb expectedRgb2 = QColor(expectedColor2).rgba(); + + for (int x = 0, w = image.width(); x < w; ++x) { + for (int y = 0, h = image.height(); y < h; ++y) { + const QRgb pixel = image.pixel(x, y); + if (pixel != expectedRgb1 && pixel != expectedRgb2) { + QString message; + QDebug(&message) << "Color mismatch in image" << image + << "at" << x << ',' << y << ':' << showbase << hex << pixel + << "(expected: " << expectedRgb1 << ',' << expectedRgb2 << ')'; + *errorMessage = message.toLocal8Bit(); + return false; + } + } + } + return true; +} + void tst_QStaticText::setPenPlainText_data() { QTest::addColumn<QImage::Format>("format"); @@ -622,13 +645,9 @@ void tst_QStaticText::setPenPlainText() p.drawStaticText(0, 0, staticText); } - for (int x=0; x<image.width(); ++x) { - for (int y=0; y<image.height(); ++y) { - QRgb pixel = image.pixel(x, y); - QVERIFY(pixel == QColor(Qt::white).rgba() - || pixel == QColor(Qt::yellow).rgba()); - } - } + QByteArray errorMessage; + QVERIFY2(checkPixels(image, Qt::yellow, Qt::white, &errorMessage), + errorMessage.constData()); } void tst_QStaticText::setPenRichText() @@ -650,14 +669,9 @@ void tst_QStaticText::setPenRichText() p.drawStaticText(0, 0, staticText); } - QImage img = image.toImage(); - for (int x=0; x<img.width(); ++x) { - for (int y=0; y<img.height(); ++y) { - QRgb pixel = img.pixel(x, y); - QVERIFY(pixel == QColor(Qt::white).rgba() - || pixel == QColor(Qt::green).rgba()); - } - } + QByteArray errorMessage; + QVERIFY2(checkPixels(image.toImage(), Qt::green, Qt::white, &errorMessage), + errorMessage.constData()); } void tst_QStaticText::richTextOverridesPen() @@ -679,14 +693,9 @@ void tst_QStaticText::richTextOverridesPen() p.drawStaticText(0, 0, staticText); } - QImage img = image.toImage(); - for (int x=0; x<img.width(); ++x) { - for (int y=0; y<img.height(); ++y) { - QRgb pixel = img.pixel(x, y); - QVERIFY(pixel == QColor(Qt::white).rgba() - || pixel == QColor(Qt::red).rgba()); - } - } + QByteArray errorMessage; + QVERIFY2(checkPixels(image.toImage(), Qt::red, Qt::white, &errorMessage), + errorMessage.constData()); } void tst_QStaticText::drawStruckOutText() diff --git a/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp index 3373324c191..ec965a61b2f 100644 --- a/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp +++ b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp @@ -28,6 +28,9 @@ #include <QtTest/QtTest> +#include <QtCore/QBuffer> +#include <QtCore/QByteArray> + #include "private/qhttpnetworkconnection_p.h" class tst_QHttpNetworkReply: public QObject @@ -36,6 +39,9 @@ class tst_QHttpNetworkReply: public QObject private Q_SLOTS: void parseHeader_data(); void parseHeader(); + + void parseEndOfHeader_data(); + void parseEndOfHeader(); }; void tst_QHttpNetworkReply::parseHeader_data() @@ -95,5 +101,66 @@ void tst_QHttpNetworkReply::parseHeader() } } +class TestHeaderSocket : public QAbstractSocket +{ +public: + explicit TestHeaderSocket(const QByteArray &input) : QAbstractSocket(QAbstractSocket::TcpSocket, Q_NULLPTR) + { + inputBuffer.setData(input); + inputBuffer.open(QIODevice::ReadOnly | QIODevice::Unbuffered); + open(QIODevice::ReadOnly | QIODevice::Unbuffered); + } + + qint64 readData(char *data, qint64 maxlen) { return inputBuffer.read(data, maxlen); } + + QBuffer inputBuffer; +}; + +class TestHeaderReply : public QHttpNetworkReply +{ +public: + QHttpNetworkReplyPrivate *replyPrivate() { return static_cast<QHttpNetworkReplyPrivate *>(d_ptr.data()); } +}; + +void tst_QHttpNetworkReply::parseEndOfHeader_data() +{ + QTest::addColumn<QByteArray>("headers"); + QTest::addColumn<qint64>("lengths"); + + QTest::newRow("CRLFCRLF") << QByteArray("Content-Type: text/html; charset=utf-8\r\n" + "Content-Length:\r\n 1024\r\n" + "Content-Encoding: gzip\r\n\r\nHTTPBODY") + << qint64(90); + + QTest::newRow("CRLFLF") << QByteArray("Content-Type: text/html; charset=utf-8\r\n" + "Content-Length:\r\n 1024\r\n" + "Content-Encoding: gzip\r\n\nHTTPBODY") + << qint64(89); + + QTest::newRow("LFCRLF") << QByteArray("Content-Type: text/html; charset=utf-8\r\n" + "Content-Length:\r\n 1024\r\n" + "Content-Encoding: gzip\n\r\nHTTPBODY") + << qint64(89); + + QTest::newRow("LFLF") << QByteArray("Content-Type: text/html; charset=utf-8\r\n" + "Content-Length:\r\n 1024\r\n" + "Content-Encoding: gzip\n\nHTTPBODY") + << qint64(88); +} + +void tst_QHttpNetworkReply::parseEndOfHeader() +{ + QFETCH(QByteArray, headers); + QFETCH(qint64, lengths); + + TestHeaderSocket socket(headers); + + TestHeaderReply reply; + + QHttpNetworkReplyPrivate *replyPrivate = reply.replyPrivate(); + qint64 headerBytes = replyPrivate->readHeader(&socket); + QCOMPARE(headerBytes, lengths); +} + QTEST_MAIN(tst_QHttpNetworkReply) #include "tst_qhttpnetworkreply.moc" diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index 3ec580dddee..0605677e29c 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -7,3 +7,7 @@ ubuntu-14.04 * [backgroundRequestInterruption:ftp, bg, nobg] * +[authenticationCacheAfterCancel:http+socksauth] +rhel-7.1 +[authenticationCacheAfterCancel:https+socksauth] +rhel-7.1 diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index d037826410f..ef47b45e9e5 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -490,7 +490,11 @@ void tst_QLocalSocket::connectWithOldOpen() void tst_QLocalSocket::sendData_data() { - listenAndConnect_data(); + QTest::addColumn<QString>("name"); + QTest::addColumn<bool>("canListen"); + + QTest::newRow("null") << QString() << false; + QTest::newRow("tst_localsocket") << "tst_localsocket" << true; } void tst_QLocalSocket::sendData() diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 8895c652a59..5154351bb1a 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -126,6 +126,33 @@ typedef struct { int doNotConfuseMoc; } OldStyleCStruct; +namespace { + + class GadgetInUnnamedNS + { + Q_GADGET + Q_PROPERTY(int x READ x WRITE setX) + Q_PROPERTY(int y READ y WRITE setY) + public: + explicit GadgetInUnnamedNS(int x, int y) : m_x(x), m_y(y) {} + int x() const { return m_x; } + int y() const { return m_y; } + void setX(int x) { m_x = x; } + void setY(int y) { m_y = y; } + + private: + int m_x, m_y; + }; + + class ObjectInUnnamedNS : public QObject + { + Q_OBJECT + public: + explicit ObjectInUnnamedNS(QObject *parent = Q_NULLPTR) : QObject(parent) {} + }; + +} + class Sender : public QObject { Q_OBJECT @@ -592,6 +619,7 @@ private slots: void relatedMetaObjectsNameConflict_data(); void relatedMetaObjectsNameConflict(); void strignLiteralsInMacroExtension(); + void unnamedNamespaceObjectsAndGadgets(); void veryLongStringData(); void gadgetHierarchy(); @@ -3417,6 +3445,28 @@ class VeryLongStringData : public QObject #undef repeat65534 }; +void tst_Moc::unnamedNamespaceObjectsAndGadgets() +{ + // these just test very basic functionality of gadgets and objects + // defined in unnamed namespaces. + { + GadgetInUnnamedNS gadget(21, 42); + QCOMPARE(gadget.x(), 21); + QCOMPARE(gadget.y(), 42); + gadget.staticMetaObject.property(0).writeOnGadget(&gadget, 12); + gadget.staticMetaObject.property(1).writeOnGadget(&gadget, 24); + QCOMPARE(gadget.x(), 12); + QCOMPARE(gadget.y(), 24); + } + + { + ObjectInUnnamedNS object; + QObject *qObject = &object; + QCOMPARE(static_cast<ObjectInUnnamedNS *>(qObject), + qobject_cast<ObjectInUnnamedNS *>(qObject)); + } +} + void tst_Moc::veryLongStringData() { const QMetaObject *mobj = &VeryLongStringData::staticMetaObject; diff --git a/tests/auto/tools/uic/baseline/enumnostdset.ui b/tests/auto/tools/uic/baseline/enumnostdset.ui new file mode 100644 index 00000000000..59e27b1be3f --- /dev/null +++ b/tests/auto/tools/uic/baseline/enumnostdset.ui @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Form</class> + <widget class="QWidget" name="Form"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <widget class="WorldTimeClock" name="worldTimeClock"> + <property name="geometry"> + <rect> + <x>100</x> + <y>100</y> + <width>100</width> + <height>100</height> + </rect> + </property> + <property name="penStyle" stdset="0"> + <enum>Qt::DashDotLine</enum> + </property> + </widget> + </widget> + <customwidgets> + <customwidget> + <class>WorldTimeClock</class> + <extends>QWidget</extends> + <header>worldtimeclock.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/tests/auto/tools/uic/baseline/enumnostdset.ui.h b/tests/auto/tools/uic/baseline/enumnostdset.ui.h new file mode 100644 index 00000000000..89a8411b4a4 --- /dev/null +++ b/tests/auto/tools/uic/baseline/enumnostdset.ui.h @@ -0,0 +1,55 @@ +/******************************************************************************** +** Form generated from reading UI file 'enumnostdset.ui' +** +** Created by: Qt User Interface Compiler version 5.6.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef ENUMNOSTDSET_H +#define ENUMNOSTDSET_H + +#include <QtCore/QVariant> +#include <QtWidgets/QAction> +#include <QtWidgets/QApplication> +#include <QtWidgets/QButtonGroup> +#include <QtWidgets/QHeaderView> +#include <QtWidgets/QWidget> +#include "worldtimeclock.h" + +QT_BEGIN_NAMESPACE + +class Ui_Form +{ +public: + WorldTimeClock *worldTimeClock; + + void setupUi(QWidget *Form) + { + if (Form->objectName().isEmpty()) + Form->setObjectName(QStringLiteral("Form")); + Form->resize(400, 300); + worldTimeClock = new WorldTimeClock(Form); + worldTimeClock->setObjectName(QStringLiteral("worldTimeClock")); + worldTimeClock->setGeometry(QRect(100, 100, 100, 100)); + worldTimeClock->setProperty("penStyle", QVariant::fromValue(Qt::DashDotLine)); + + retranslateUi(Form); + + QMetaObject::connectSlotsByName(Form); + } // setupUi + + void retranslateUi(QWidget *Form) + { + Form->setWindowTitle(QApplication::translate("Form", "Form", 0)); + } // retranslateUi + +}; + +namespace Ui { + class Form: public Ui_Form {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // ENUMNOSTDSET_H diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index 6528c24c1a9..e6a0c5e86b8 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -50,7 +50,7 @@ QT_FORWARD_DECLARE_CLASS(QDialog) class DummyDialog : public QDialog { public: - DummyDialog(): QDialog(0, Qt::X11BypassWindowManagerHint) {} + DummyDialog(): QDialog() {} using QDialog::showExtension; }; @@ -60,10 +60,8 @@ class tst_QDialog : public QObject public: tst_QDialog(); -public slots: - void initTestCase(); - void cleanupTestCase(); private slots: + void cleanup(); void getSetCheck(); void showExtension_data(); void showExtension(); @@ -86,9 +84,6 @@ private slots: void transientParent_data(); void transientParent(); void dialogInGraphicsView(); - -private: - DummyDialog *testWidget; }; // Testing get/set functions @@ -144,25 +139,12 @@ private: }; tst_QDialog::tst_QDialog() - { } -void tst_QDialog::initTestCase() +void tst_QDialog::cleanup() { - // Create the test class - testWidget = new DummyDialog; - testWidget->resize(200,200); - testWidget->show(); - qApp->setActiveWindow(testWidget); -} - -void tst_QDialog::cleanupTestCase() -{ - if (testWidget) { - delete testWidget; - testWidget = 0; - } + QVERIFY(QApplication::topLevelWidgets().isEmpty()); } void tst_QDialog::showExtension_data() @@ -185,44 +167,52 @@ void tst_QDialog::showExtension() QFETCH( QSize, extSize ); QFETCH( bool, horizontal ); - // set geometry of main dialog and extension widget - testWidget->setFixedSize( dlgSize ); - QWidget *ext = new QWidget( testWidget ); + DummyDialog testWidget; + testWidget.resize(200, 200); + testWidget.setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1Char(':') + + QLatin1String(QTest::currentDataTag())); + testWidget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&testWidget)); + + testWidget.setFixedSize( dlgSize ); + QWidget *ext = new QWidget( &testWidget ); ext->setFixedSize( extSize ); - testWidget->setExtension( ext ); - testWidget->setOrientation( horizontal ? Qt::Horizontal : Qt::Vertical ); + testWidget.setExtension( ext ); + testWidget.setOrientation( horizontal ? Qt::Horizontal : Qt::Vertical ); - QCOMPARE( testWidget->size(), dlgSize ); - QPoint oldPosition = testWidget->pos(); + QCOMPARE( testWidget.size(), dlgSize ); + QPoint oldPosition = testWidget.pos(); // show - testWidget->showExtension( true ); + testWidget.showExtension( true ); // while ( testWidget->size() == dlgSize ) // qApp->processEvents(); - QTEST( testWidget->size(), "result" ); + QTEST( testWidget.size(), "result" ); - QCOMPARE(testWidget->pos(), oldPosition); + QCOMPARE(testWidget.pos(), oldPosition); // hide extension. back to old size ? - testWidget->showExtension( false ); - QCOMPARE( testWidget->size(), dlgSize ); + testWidget.showExtension( false ); + QCOMPARE( testWidget.size(), dlgSize ); - testWidget->setExtension( 0 ); + testWidget.setExtension( 0 ); } void tst_QDialog::defaultButtons() { - QLineEdit *lineEdit = new QLineEdit(testWidget); - QPushButton *push = new QPushButton("Button 1", testWidget); - QPushButton *pushTwo = new QPushButton("Button 2", testWidget); - QPushButton *pushThree = new QPushButton("Button 3", testWidget); + DummyDialog testWidget; + testWidget.resize(200, 200); + testWidget.setWindowTitle(QTest::currentTestFunction()); + QLineEdit *lineEdit = new QLineEdit(&testWidget); + QPushButton *push = new QPushButton("Button 1", &testWidget); + QPushButton *pushTwo = new QPushButton("Button 2", &testWidget); + QPushButton *pushThree = new QPushButton("Button 3", &testWidget); pushThree->setAutoDefault(false); - //we need to show the buttons. Otherwise they won't get the focus - push->show(); - pushTwo->show(); - pushThree->show(); + testWidget.show(); + QApplication::setActiveWindow(&testWidget); + QVERIFY(QTest::qWaitForWindowActive(&testWidget)); push->setDefault(true); QVERIFY(push->isDefault()); @@ -375,11 +365,15 @@ void tst_QDialog::showAsTool() #if defined(Q_OS_UNIX) QSKIP("Qt/X11: Skipped since activeWindow() is not respected by all window managers"); #endif - ToolDialog dialog(testWidget); - testWidget->activateWindow(); + DummyDialog testWidget; + testWidget.resize(200, 200); + testWidget.setWindowTitle(QTest::currentTestFunction()); + ToolDialog dialog(&testWidget); + testWidget.show(); + testWidget.activateWindow(); + QVERIFY(QTest::qWaitForWindowActive(&testWidget)); dialog.exec(); - QTest::qWait(100); - if (testWidget->style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, testWidget)) { + if (testWidget.style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, &testWidget)) { QCOMPARE(dialog.wasActive(), true); } else { QCOMPARE(dialog.wasActive(), false); @@ -602,7 +596,6 @@ void tst_QDialog::transientParent_data() void tst_QDialog::transientParent() { QFETCH(bool, nativewidgets); - testWidget->hide(); QWidget topLevel; topLevel.resize(200, 200); topLevel.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(100, 100)); diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 515ddf480fe..ae48445363c 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -442,6 +442,7 @@ private slots: void touchEventSynthesizedMouseEvent(); void touchUpdateOnNewTouch(); + void touchEventsForGesturePendingWidgets(); void styleSheetPropagation(); @@ -9783,6 +9784,7 @@ public: m_touchUpdateCount(0), m_touchEndCount(0), m_touchEventCount(0), + m_gestureEventCount(0), m_acceptTouch(false), m_mouseEventCount(0), m_acceptMouse(true) @@ -9820,6 +9822,9 @@ protected: else e->ignore(); return true; + case QEvent::Gesture: + ++m_gestureEventCount; + return true; case QEvent::MouseButtonPress: case QEvent::MouseMove: @@ -9842,6 +9847,7 @@ public: int m_touchUpdateCount; int m_touchEndCount; int m_touchEventCount; + int m_gestureEventCount; bool m_acceptTouch; int m_mouseEventCount; bool m_acceptMouse; @@ -9997,6 +10003,48 @@ void tst_QWidget::touchUpdateOnNewTouch() QCOMPARE(widget.m_touchEndCount, 1); } +void tst_QWidget::touchEventsForGesturePendingWidgets() +{ + QTouchDevice *device = new QTouchDevice; + device->setType(QTouchDevice::TouchScreen); + QWindowSystemInterface::registerTouchDevice(device); + + TouchMouseWidget parent; + TouchMouseWidget child(&parent); + parent.grabGesture(Qt::TapAndHoldGesture); + parent.show(); + + QWindow* window = parent.windowHandle(); + QVERIFY(QTest::qWaitForWindowExposed(window)); + QTest::qWait(500); // needed for QApplication::topLevelAt(), which is used by QGestureManager + QCOMPARE(child.m_touchEventCount, 0); + QCOMPARE(child.m_gestureEventCount, 0); + QCOMPARE(parent.m_touchEventCount, 0); + QCOMPARE(parent.m_gestureEventCount, 0); + QTest::touchEvent(window, device).press(0, QPoint(20, 20), window); + QCOMPARE(child.m_touchEventCount, 0); + QCOMPARE(child.m_gestureEventCount, 0); + QCOMPARE(parent.m_touchBeginCount, 1); // QTapAndHoldGestureRecognizer::create() sets Qt::WA_AcceptTouchEvents + QCOMPARE(parent.m_touchUpdateCount, 0); + QCOMPARE(parent.m_touchEndCount, 0); + QCOMPARE(parent.m_gestureEventCount, 0); + QTest::touchEvent(window, device).move(0, QPoint(25, 25), window); + QCOMPARE(child.m_touchEventCount, 0); + QCOMPARE(child.m_gestureEventCount, 0); + QCOMPARE(parent.m_touchBeginCount, 1); + QCOMPARE(parent.m_touchUpdateCount, 0); + QCOMPARE(parent.m_touchEndCount, 0); + QCOMPARE(parent.m_gestureEventCount, 0); + QTest::qWait(1000); + QTest::touchEvent(window, device).release(0, QPoint(25, 25), window); + QCOMPARE(child.m_touchEventCount, 0); + QCOMPARE(child.m_gestureEventCount, 0); + QCOMPARE(parent.m_touchBeginCount, 1); + QCOMPARE(parent.m_touchUpdateCount, 0); + QCOMPARE(parent.m_touchEndCount, 0); + QVERIFY(parent.m_gestureEventCount > 0); +} + void tst_QWidget::styleSheetPropagation() { QTableView tw; diff --git a/tests/manual/touch/main.cpp b/tests/manual/touch/main.cpp index 588fef9fd0b..fb0c8559f95 100644 --- a/tests/manual/touch/main.cpp +++ b/tests/manual/touch/main.cpp @@ -86,24 +86,6 @@ static void drawArrow(const QPointF ¢er, qreal length, qreal angleDegrees, painter.restore(); } -QDebug operator<<(QDebug debug, const QTouchDevice *d) -{ - QDebugStateSaver saver(debug); - debug.nospace(); - debug << "QTouchDevice(" << d->name() << ','; - switch (d->type()) { - case QTouchDevice::TouchScreen: - debug << "TouchScreen"; - break; - case QTouchDevice::TouchPad: - debug << "TouchPad"; - break; - } - debug << ", capabilities=" << d->capabilities() - << ", maximumTouchPoints=" << d->maximumTouchPoints() << ')'; - return debug; -} - // Hierarchy of classes containing gesture parameters and drawing functionality. class Gesture { Q_DISABLE_COPY(Gesture) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index f532ae82d08..46959653dbe 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1321,6 +1321,14 @@ void Configure::parseCmdLine() dictionary[ "ANDROID_PLATFORM" ] = configCmdLine.at(i); } + else if (configCmdLine.at(i) == "-android-ndk-host") { + ++i; + if (i == argCount) + break; + + dictionary[ "ANDROID_HOST" ] = configCmdLine.at(i); + } + else if (configCmdLine.at(i) == "-android-arch") { ++i; if (i == argCount) @@ -3355,7 +3363,9 @@ void Configure::generateQDevicePri() deviceStream << "android_install {" << endl; deviceStream << " DEFAULT_ANDROID_SDK_ROOT = " << formatPath(dictionary["ANDROID_SDK_ROOT"]) << endl; deviceStream << " DEFAULT_ANDROID_NDK_ROOT = " << formatPath(dictionary["ANDROID_NDK_ROOT"]) << endl; - if (QSysInfo::WordSize == 64) + if (dictionary.contains("ANDROID_HOST")) + deviceStream << " DEFAULT_ANDROID_NDK_HOST = " << dictionary["ANDROID_HOST"] << endl; + else if (QSysInfo::WordSize == 64) deviceStream << " DEFAULT_ANDROID_NDK_HOST = windows-x86_64" << endl; else deviceStream << " DEFAULT_ANDROID_NDK_HOST = windows" << endl; |