diff --git a/INSTALL b/INSTALL index 5004e75947..400f6fab14 100644 --- a/INSTALL +++ b/INSTALL @@ -1,12 +1,10 @@ INSTALLING Qt Source Package Version %VERSION%. For full installation instructions for each supported platform, please -see http://qt-project.org/doc/qt-%SHORTVERSION%/installation.html, the file -doc/html/installation.html in this package, or follow one of the following -links: +see http://qt-project.org/doc/qt-%SHORTVERSION%/qtdoc/installation.html, +or follow one of these links: -Embedded Linux: http://qt-project.org/doc/qt-%SHORTVERSION%/qt-embedded-install.html -Mac OS X: http://qt-project.org/doc/qt-%SHORTVERSION%/install-mac.html -Windows: http://qt-project.org/doc/qt-%SHORTVERSION%/install-win.html -Windows CE: http://qt-project.org/doc/qt-%SHORTVERSION%/install-wince.html -X11 Platforms: http://qt-project.org/doc/qt-%SHORTVERSION%/install-x11.html +Mac OS X: http://qt-project.org/doc/qt-%SHORTVERSION%/qtdoc/install-mac.html +Windows: http://qt-project.org/doc/qt-%SHORTVERSION%/qtdoc/install-win.html +Windows CE: http://qt-project.org/doc/qt-%SHORTVERSION%/qtdoc/install-wince.html +X11 Platforms: http://qt-project.org/doc/qt-%SHORTVERSION%/qtdoc/install-x11.html diff --git a/configure b/configure index cf72e2ba39..7f71b9312a 100755 --- a/configure +++ b/configure @@ -2565,14 +2565,7 @@ if [ -z "$PLATFORM" ]; then " ;; Linux:*) - case "$UNAME_MACHINE" in - x86_64|s390x|ppc64) - PLATFORM=linux-g++-64 - ;; - *) - PLATFORM=linux-g++ - ;; - esac + PLATFORM=linux-g++ PLATFORM_NOTES=" - Also available for Linux: linux-kcc linux-icc linux-cxx " diff --git a/dist/changes-5.0.2 b/dist/changes-5.0.2 index a9d715d1e6..209f963c65 100644 --- a/dist/changes-5.0.2 +++ b/dist/changes-5.0.2 @@ -22,18 +22,12 @@ information about a particular change. General Improvements -------------------- -Third party components ----------------------- - -Legal ------ - + - Lots of fixes to enable static builds on Windows, Linux and Mac. **************************************************************************** * Library * **************************************************************************** - QtCore ----- @@ -44,29 +38,35 @@ QtCore QtGui ----- + - [QTBUG-14766] Fixed potential access violation in QPixmap::copy() for <32 bit pixmaps. + - [QTBUG-24762] Fixed dashes being rendered differently depending on system clip. + - [QTBUG-25036] Fixed artifacts when drawing same line with different clips. + - [QTBUG-29643] Fixed crashes when using QImage in combination with QCoreApplication. + QtWidgets --------- -- [QTBUG-28817] Fixed QColorDialog::setOption(), QFontDialog::setOption(). + - [QTBUG-28817] Fixed QColorDialog::setOption(), QFontDialog::setOption(). + - [QTBUG-29680] Fix mouse double click events not bubbling up to parent widgets. QtNetwork --------- -QtDBus ------- + - [QTBUG-29103] Toggle on demand loading of root certs properly. QtConcurrent ------------ -QtOpenGL --------- - -QtTest ------- + - [QTBUG-28984] Fix compilation of Qt Concurrent with gcc 4.3. QtSql ----- + - Fix QSqlTableModel:revert() for OnFieldChange. + - [QTBUG-29102] Support refreshing inserted rows with auto columns. + - [QTBUG-29108] Fix QSqlTableModel::headerData() for empty query with inserted row. + - [QTBUG-29217] Fix QSqlTableModel::setData() for non-change detection. + **************************************************************************** * Database Drivers * **************************************************************************** @@ -84,16 +84,23 @@ postgres Qt for Linux/X11 ---------------- + - Fix focus handling of native child widgets in xcb. + - Fixed crash when VNCing and trying to use non-present XFixes extension. + Qt for Windows -------------- - - [QTBUG-30185] Fixed adding of suffixes in Window native file save dialog. + - [QTBUG-28439] Implement QPlatformWindow::isExposed() on Windows. - [QTBUG-29010, QTBUG-28531] Fixed handling of layered windows required for translucent or non-opaque windows. + - [QTBUG-30185] Fixed adding of suffixes in Window native file save dialog. Qt for Mac OS X --------------- + - [QTBUG-29389] Fix transient scroll bar appearance before the proper one. + - [QTBUG-25297, QTBUG-29434] Add QMdiSubWindow size grip back. + Qt for BlackBerry ----------------- @@ -103,11 +110,14 @@ Qt for Embedded Linux Qt for Windows CE ----------------- + - Removed User32.dll usage. + - Fix compilation with QT_NO_CURSOR. **************************************************************************** * Compiler Specific Changes * **************************************************************************** + - [QTBUG-29099] Fix gcc OOM error when compiling in release mode. **************************************************************************** * Tools * diff --git a/mkspecs/android-g++/qmake.conf b/mkspecs/android-g++/qmake.conf index e12bb03560..c780e2f0d5 100644 --- a/mkspecs/android-g++/qmake.conf +++ b/mkspecs/android-g++/qmake.conf @@ -6,10 +6,11 @@ QMAKE_COMPILER = gcc CONFIG += android_install DEFINES += QT_NO_PRINTDIALOG -include(../qdevice.pri) include(../common/linux.conf) include(../common/gcc-base-unix.conf) +load(device_config) + # Passing in -win32 to qmake (from NQTC) causes this condition to pass, however # qmake complains that -win32 is deprecated; should find another way, Q_OS_WIN # should really be all QMAKE_HOST.os needs to depend on? diff --git a/mkspecs/features/ctest_testcase.prf b/mkspecs/features/ctest_testcase.prf index 7faf738d6e..c88fc961cf 100644 --- a/mkspecs/features/ctest_testcase.prf +++ b/mkspecs/features/ctest_testcase.prf @@ -38,6 +38,10 @@ isEmpty(CMAKE_VERSION) { CMAKE_BUILD_TYPE = Debug CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release win32-g++*:CMAKE_GENERATOR = -G \"MinGW Makefiles\" + win32:equals(QT_ARCH, x86_64) { + win32-msvc2010:CMAKE_GENERATOR = -G \"Visual Studio 10 Win64\" + win32-msvc2012:CMAKE_GENERATOR = -G \"Visual Studio 11 Win64\" + } BUILD_DIR = $$replace($$list($$OUT_PWD/build), /, $$QMAKE_DIR_SEP) @@ -53,9 +57,6 @@ isEmpty(CMAKE_VERSION) { dependentmodules -= $$CMAKE_QT_MODULES_UNDER_TEST dependentmodules = $$cmakeModuleList($$dependentmodules) - SET = set - equals(QMAKE_DIR_SEP, "/"):SET = export - CMAKE_MODULE_VERSIONS = CMAKE_MODULES_UNDER_TEST = for (MODULE_UNDER_TEST, CMAKE_QT_MODULES_UNDER_TEST) { @@ -69,8 +70,9 @@ isEmpty(CMAKE_VERSION) { CMAKE_MODULES_UNDER_TEST = $$join(CMAKE_MODULES_UNDER_TEST, ;) check.commands = \ - $(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && $$SET VERBOSE=1 && \ + $(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && \ cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR \ + -DCMAKE_VERBOSE_MAKEFILE=1 \ $$CMAKE_MODULE_DEFINES \ -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} \ -DCMAKE_PREFIX_PATH=$$CMAKE_PREFIX_PATH \ diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in index 65ba03d44c..d88f6e1224 100644 --- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in @@ -45,22 +45,23 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) !!IF !no_module_headers !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE) - set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\") + set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\") set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}/$${MODULE_INCNAME}\" ) !!ELSE - set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR\" \"$${CMAKE_INCLUDE_DIR}Qt$${CMAKE_MODULE_NAME}\") + set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR\" \"$${CMAKE_INCLUDE_DIR}Qt$${CMAKE_MODULE_NAME}\") set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}\" \"$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}/$${MODULE_INCNAME}\" ) !!ENDIF !!ELSE - set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS) + set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS) set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS) !!ENDIF + set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS}) set(Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS -D$${MODULE_DEFINE}) set(Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS $${MODULE_DEFINE}) @@ -122,7 +123,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) !!ENDIF set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY - INTERFACE_INCLUDE_DIRECTORIES ${Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS}) + INTERFACE_INCLUDE_DIRECTORIES ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS}) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY INTERFACE_COMPILE_DEFINITIONS $${MODULE_DEFINE}) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 9cb63ce539..2a99b5dd34 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -221,7 +221,11 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) do_incremental = false; t << "DIST = " << valList(fileFixify(project->values("DISTFILES").toQStringList())) << endl; t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; - t << "DESTDIR = " << var("DESTDIR") << endl; + // The comment is important for mingw32-make.exe on Windows as otherwise trailing slashes + // would be interpreted as line continuation. The lack of spacing between the value and the + // comment is also important as otherwise quoted use of "$(DESTDIR)" would include this + // spacing. + t << "DESTDIR = " << var("DESTDIR") << "#avoid trailing-slash linebreak" << endl; if(project->isActiveConfig("compile_libtool")) t << "TARGETL = " << var("TARGET_la") << endl; t << "TARGET = " << escapeFilePath(var("TARGET")) << endl; @@ -546,7 +550,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << var("QMAKE_LINK_SHLIB_CMD"); if(!destdir.isEmpty()) t << "\n\t" - << "-$(MOVE) $(TARGET) " << destdir; + << "-$(MOVE) $(TARGET) " << destdir << " "; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; @@ -579,10 +583,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "-$(DEL_FILE) " << destdir << "$(TARGET0)\n\t" << "-$(DEL_FILE) " << destdir << "$(TARGET1)\n\t" << "-$(DEL_FILE) " << destdir << "$(TARGET2)\n\t" - << "-$(MOVE) $(TARGET) " << destdir << "\n\t" - << "-$(MOVE) $(TARGET0) " << destdir << "\n\t" - << "-$(MOVE) $(TARGET1) " << destdir << "\n\t" - << "-$(MOVE) $(TARGET2) " << destdir << "\n\t"; + << "-$(MOVE) $(TARGET) " << destdir << " \n\t" + << "-$(MOVE) $(TARGET0) " << destdir << " \n\t" + << "-$(MOVE) $(TARGET1) " << destdir << " \n\t" + << "-$(MOVE) $(TARGET2) " << destdir << " \n\t"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; @@ -595,8 +599,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\n\t" << "-$(DEL_FILE) " << destdir << "$(TARGET)\n\t" << "-$(DEL_FILE) " << destdir << "$(TARGET0)\n\t" - << "-$(MOVE) $(TARGET) " << destdir << "\n\t" - << "-$(MOVE) $(TARGET0) " << destdir << "\n\t"; + << "-$(MOVE) $(TARGET) " << destdir << " \n\t" + << "-$(MOVE) $(TARGET0) " << destdir << " \n\t"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; @@ -635,7 +639,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; if(!destdir.isEmpty()) t << "\t" << "-$(DEL_FILE) " << destdir << "$(TARGET)" << "\n" - << "\t" << "-$(MOVE) $(TARGET) " << destdir << "\n"; + << "\t" << "-$(MOVE) $(TARGET) " << destdir << " \n"; } else { int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); ProStringList objs = project->values("OBJECTS") + project->values("OBJCOMP"), @@ -666,7 +670,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t" << "$(RANLIB) " << (*libit) << "\n"; if(!destdir.isEmpty()) t << "\t" << "-$(DEL_FILE) " << destdir << (*libit) << "\n" - << "\t" << "-$(MOVE) " << (*libit) << " " << destdir << "\n"; + << "\t" << "-$(MOVE) " << (*libit) << " " << destdir << " \n"; } } t << endl << endl; diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 2a9e657304..6fdd2f4bd2 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -87,6 +87,7 @@ const char _CompileOnly[] = "CompileOnly"; const char _ConfigurationType[] = "ConfigurationType"; const char _Culture[] = "Culture"; const char _DLLDataFileName[] = "DLLDataFileName"; +const char _DataExecutionPrevention[] = "DataExecutionPrevention"; const char _DebugInformationFormat[] = "DebugInformationFormat"; const char _DefaultCharIsUnsigned[] = "DefaultCharIsUnsigned"; const char _DefaultCharType[] = "DefaultCharType"; @@ -179,6 +180,7 @@ const char _ProgramDatabase[] = "ProgramDatabase"; const char _ProgramDataBaseFileName[] = "ProgramDataBaseFileName"; const char _ProgramDatabaseFile[] = "ProgramDatabaseFile"; const char _ProxyFileName[] = "ProxyFileName"; +const char _RandomizedBaseAddress[] = "RandomizedBaseAddress"; const char _RedirectOutputAndErrors[] = "RedirectOutputAndErrors"; const char _RegisterOutput[] = "RegisterOutput"; const char _RelativePath[] = "RelativePath"; @@ -2560,6 +2562,7 @@ void VCProjectWriter::write(XmlOutput &xml, const VCLinkerTool &tool) << attrX(_AdditionalOptions, tool.AdditionalOptions, " ") << attrX(_AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly) << attrS(_BaseAddress, tool.BaseAddress) + << attrT(_DataExecutionPrevention, tool.DataExecutionPrevention) << attrX(_DelayLoadDLLs, tool.DelayLoadDLLs) << attrE(_EnableCOMDATFolding, tool.EnableCOMDATFolding, /*ifNot*/ optFoldingDefault) << attrS(_EntryPointSymbol, tool.EntryPointSymbol) @@ -2590,6 +2593,7 @@ void VCProjectWriter::write(XmlOutput &xml, const VCLinkerTool &tool) << attrE(_OptimizeReferences, tool.OptimizeReferences, /*ifNot*/ optReferencesDefault) << attrS(_OutputFile, tool.OutputFile) << attr(_ProgramDatabaseFile, tool.ProgramDatabaseFile) + << attrT(_RandomizedBaseAddress, tool.RandomizedBaseAddress) << attrT(_RegisterOutput, tool.RegisterOutput) << attrT(_ResourceOnlyDLL, tool.ResourceOnlyDLL) << attrT(_SetChecksum, tool.SetChecksum) diff --git a/src/angle/src/config.pri b/src/angle/src/config.pri index 923a40597e..465bcf6a1e 100644 --- a/src/angle/src/config.pri +++ b/src/angle/src/config.pri @@ -54,12 +54,13 @@ angle_d3d11 { CONFIG(debug, debug|release) { DEFINES += _DEBUG } else { + CONFIG += rtti_off DEFINES += NDEBUG } # c++11 is needed by MinGW to get support for unordered_map. CONFIG -= qt -CONFIG += stl rtti_off exceptions c++11 +CONFIG += stl exceptions c++11 contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release contains(QT_CONFIG, build_all):CONFIG += build_all diff --git a/src/corelib/Qt5CTestMacros.cmake b/src/corelib/Qt5CTestMacros.cmake index e507c8009e..126a348b47 100644 --- a/src/corelib/Qt5CTestMacros.cmake +++ b/src/corelib/Qt5CTestMacros.cmake @@ -19,6 +19,10 @@ if (CMAKE_TOOLCHAIN_FILE) list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") endif() +if (CMAKE_VERBOSE_MAKEFILE) + list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_VERBOSE_MAKEFILE=1") +endif() + if (NO_WIDGETS) list(APPEND BUILD_OPTIONS_LIST "-DNO_WIDGETS=True") endif() @@ -110,24 +114,29 @@ function(test_module_includes) "${packages_string} find_package(Qt5${qtmodule} 5.0.0 REQUIRED) include_directories(\${Qt5${qtmodule}_INCLUDE_DIRS}) - add_definitions(\${Qt5${qtmodule}_DEFINITIONS}) + add_definitions(\${Qt5${qtmodule}_DEFINITIONS})\n") - if(NOT \"\${Qt5${qtmodule}_VERSION}\" VERSION_EQUAL ${CMAKE_MODULE_VERSION}) - message(SEND_ERROR \"Qt5${qtmodule}_VERSION variable was not ${CMAKE_MODULE_VERSION}. Got \${Qt5${qtmodule}_VERSION} instead.\") - endif() - if(NOT \"\${Qt5${qtmodule}_VERSION_MAJOR}\" VERSION_EQUAL ${CMAKE_${qtmodule}_MODULE_MAJOR_VERSION}) - message(SEND_ERROR \"Qt5${qtmodule}_VERSION_MAJOR variable was not ${CMAKE_${qtmodule}_MODULE_MAJOR_VERSION}. Got \${Qt5${qtmodule}_VERSION_MAJOR} instead.\") - endif() - if(NOT \"\${Qt5${qtmodule}_VERSION_MINOR}\" VERSION_EQUAL ${CMAKE_${qtmodule}_MODULE_MINOR_VERSION}) - message(SEND_ERROR \"Qt5${qtmodule}_VERSION_MINOR variable was not ${CMAKE_${qtmodule}_MODULE_MINOR_VERSION}. Got \${Qt5${qtmodule}_VERSION_MINOR} instead.\") - endif() - if(NOT \"\${Qt5${qtmodule}_VERSION_PATCH}\" VERSION_EQUAL ${CMAKE_${qtmodule}_MODULE_PATCH_VERSION}) - message(SEND_ERROR \"Qt5${qtmodule}_VERSION_PATCH variable was not ${CMAKE_${qtmodule}_MODULE_PATCH_VERSION}. Got \${Qt5${qtmodule}_VERSION_PATCH} instead.\") - endif() - if(NOT \"\${Qt5${qtmodule}_VERSION_STRING}\" VERSION_EQUAL ${CMAKE_MODULE_VERSION}) - message(SEND_ERROR \"Qt5${qtmodule}_VERSION_STRING variable was not ${CMAKE_MODULE_VERSION}. Got \${Qt5${qtmodule}_VERSION_STRING} instead.\") - endif()\n" - ) + list(FIND CMAKE_MODULES_UNDER_TEST ${qtmodule} _findIndex) + if (NOT _findIndex STREQUAL -1) + set(packages_string + "${packages_string} + if(NOT \"\${Qt5${qtmodule}_VERSION}\" VERSION_EQUAL ${CMAKE_MODULE_VERSION}) + message(SEND_ERROR \"Qt5${qtmodule}_VERSION variable was not ${CMAKE_MODULE_VERSION}. Got \${Qt5${qtmodule}_VERSION} instead.\") + endif() + if(NOT \"\${Qt5${qtmodule}_VERSION_MAJOR}\" VERSION_EQUAL ${CMAKE_${qtmodule}_MODULE_MAJOR_VERSION}) + message(SEND_ERROR \"Qt5${qtmodule}_VERSION_MAJOR variable was not ${CMAKE_${qtmodule}_MODULE_MAJOR_VERSION}. Got \${Qt5${qtmodule}_VERSION_MAJOR} instead.\") + endif() + if(NOT \"\${Qt5${qtmodule}_VERSION_MINOR}\" VERSION_EQUAL ${CMAKE_${qtmodule}_MODULE_MINOR_VERSION}) + message(SEND_ERROR \"Qt5${qtmodule}_VERSION_MINOR variable was not ${CMAKE_${qtmodule}_MODULE_MINOR_VERSION}. Got \${Qt5${qtmodule}_VERSION_MINOR} instead.\") + endif() + if(NOT \"\${Qt5${qtmodule}_VERSION_PATCH}\" VERSION_EQUAL ${CMAKE_${qtmodule}_MODULE_PATCH_VERSION}) + message(SEND_ERROR \"Qt5${qtmodule}_VERSION_PATCH variable was not ${CMAKE_${qtmodule}_MODULE_PATCH_VERSION}. Got \${Qt5${qtmodule}_VERSION_PATCH} instead.\") + endif() + if(NOT \"\${Qt5${qtmodule}_VERSION_STRING}\" VERSION_EQUAL ${CMAKE_MODULE_VERSION}) + message(SEND_ERROR \"Qt5${qtmodule}_VERSION_STRING variable was not ${CMAKE_MODULE_VERSION}. Got \${Qt5${qtmodule}_VERSION_STRING} instead.\") + endif()\n" + ) + endif() set(libraries_string "${libraries_string} Qt5::${qtmodule}") endwhile() diff --git a/src/corelib/Qt5Config.cmake.in b/src/corelib/Qt5Config.cmake.in index 408dd64496..a7e9a042e8 100644 --- a/src/corelib/Qt5Config.cmake.in +++ b/src/corelib/Qt5Config.cmake.in @@ -18,7 +18,7 @@ if (Qt5_FIND_QUIETLY) set(_Qt5_FIND_PARTS_QUIET QUIET) endif() -get_filename_component(_qt5_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE) +get_filename_component(_qt5_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/..\" ABSOLUTE) set(_Qt5_NOTFOUND_MESSAGE) @@ -30,9 +30,9 @@ foreach(module ${Qt5_FIND_COMPONENTS}) ) if (NOT Qt5${module}_FOUND) if (Qt5_FIND_REQUIRED_${module}) - set(_Qt5_NOTFOUND_MESSAGE \"${_Qt5_NOTFOUND_MESSAGE}Failed to find Qt5 component \\\"${module}\\\" config file at \\\"${_qt5_install_prefix}/lib/cmake/Qt5${module}/Qt5${module}Config.cmake\\\"\\n\") + set(_Qt5_NOTFOUND_MESSAGE \"${_Qt5_NOTFOUND_MESSAGE}Failed to find Qt5 component \\\"${module}\\\" config file at \\\"${_qt5_install_prefix}/Qt5${module}/Qt5${module}Config.cmake\\\"\\n\") elseif(NOT Qt5_FIND_QUIETLY) - message(WARNING \"Failed to find Qt5 component \\\"${module}\\\" config file at \\\"${_qt5_install_prefix}/lib/cmake/Qt5${module}/Qt5${module}Config.cmake\\\"\") + message(WARNING \"Failed to find Qt5 component \\\"${module}\\\" config file at \\\"${_qt5_install_prefix}/Qt5${module}/Qt5${module}Config.cmake\\\"\") endif() endif() endforeach() diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index e3115db8ee..b6124b40cd 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -215,6 +215,7 @@ function(QT5_ADD_RESOURCES outfiles ) set(${outfiles} ${${outfiles}} PARENT_SCOPE) endfunction() +set(_Qt5_COMPONENT_PATH "${CMAKE_CURRENT_LIST_DIR}/..") if (NOT CMAKE_VERSION VERSION_LESS 2.8.9) macro(qt5_use_modules _target _link_type) @@ -234,7 +235,7 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.9) foreach(_module ${_qt5_modules}) if (NOT Qt5${_module}_FOUND) - find_package(Qt5${_module} PATHS ${_qt5Core_install_prefix} NO_DEFAULT_PATH) + find_package(Qt5${_module} PATHS "${_Qt5_COMPONENT_PATH}" NO_DEFAULT_PATH) if (NOT Qt5${_module}_FOUND) message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.") endif() diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index f95e1e9447..c8293beb4e 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -876,7 +876,13 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con #if defined(QT_USE_SLOG2) slog2_default_handler(type, logMessage.toLocal8Bit().constData()); #elif defined(Q_OS_ANDROID) - android_default_message_handler(type, context, logMessage); + static bool logToAndroid = qEnvironmentVariableIsEmpty("QT_ANDROID_PLAIN_LOG"); + if (logToAndroid) { + android_default_message_handler(type, context, logMessage); + } else { + fprintf(stderr, "%s", logMessage.toLocal8Bit().constData()); + fflush(stderr); + } #else fprintf(stderr, "%s", logMessage.toLocal8Bit().constData()); fflush(stderr); diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp index ab575371c8..e9ff786074 100644 --- a/src/corelib/kernel/qtcore_eval.cpp +++ b/src/corelib/kernel/qtcore_eval.cpp @@ -496,6 +496,7 @@ public: setParent(parentWidget(), Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); QTimer::singleShot(7000, this, SLOT(close())); setAttribute(Qt::WA_DeleteOnClose); + setAttribute(Qt::WA_QuitOnClose, false); } setFixedSize(sizeHint()); diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index a06fb7b4eb..816e1f15f6 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -493,7 +493,7 @@ void QVector::reallocData(const int asize, const int aalloc, QArrayData::Allo } x->capacityReserved = d->capacityReserved; } else { - Q_ASSERT(d->alloc == aalloc); // resize, without changing allocation size + Q_ASSERT(int(d->alloc) == aalloc); // resize, without changing allocation size Q_ASSERT(isDetached()); // can be done only on detached d Q_ASSERT(x == d); // in this case we do not need to allocate anything if (asize <= d->size) { diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 7487aabde5..4fd595ed5a 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -1507,7 +1507,7 @@ QAccessibleInterface *QAccessibleEvent::accessibleInterface() const QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object); if (!iface || !iface->isValid()) { static bool hasWarned = false; - if (!hasWarned) { + if (!iface && !hasWarned) { qWarning() << "Problem creating accessible interface for: " << m_object << endl << "Make sure to deploy Qt with accessibility plugins."; hasWarned = true; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c2e19ca2a8..432929fec5 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -602,6 +602,12 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking return false; } +bool QGuiApplicationPrivate::synthesizeMouseFromTouchEventsEnabled() +{ + return QCoreApplication::testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents) + && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::SynthesizeMouseFromTouchEvents).toBool(); +} + /*! Returns the QWindow that receives events tied to focus, such as key events. @@ -2054,7 +2060,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To } QGuiApplication::sendSpontaneousEvent(w, &touchEvent); - if (!e->synthetic && !touchEvent.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)) { + if (!e->synthetic && !touchEvent.isAccepted() && synthesizeMouseFromTouchEventsEnabled()) { // exclude touchpads as those generate their own mouse events if (touchEvent.device()->type() != QTouchDevice::TouchPad) { Qt::MouseButtons b = eventType == QEvent::TouchEnd ? Qt::NoButton : Qt::LeftButton; diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 22d95b2121..376890ef47 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -191,6 +191,8 @@ public: static void updateBlockedStatus(QWindow *window); virtual bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = 0) const; + static bool synthesizeMouseFromTouchEventsEnabled(); + static Qt::MouseButtons buttons; static ulong mousePressTime; static Qt::MouseButton mousePressButton; diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index fc694dc497..1d6cf3ceca 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -191,8 +191,8 @@ QFontPrivate::QFontPrivate(const QFontPrivate &other) QFontPrivate::~QFontPrivate() { - if (engineData) - engineData->ref.deref(); + if (engineData && !engineData->ref.deref()) + delete engineData; engineData = 0; if (scFont && scFont != this) scFont->ref.deref(); @@ -210,7 +210,8 @@ QFontEngine *QFontPrivate::engineForScript(int script) const script = QChar::Script_Common; if (engineData && engineData->fontCache != QFontCache::instance()) { // throw out engineData that came from a different thread - engineData->ref.deref(); + if (!engineData->ref.deref()) + delete engineData; engineData = 0; } if (!engineData || !QT_FONT_ENGINE_FROM_DATA(engineData, script)) @@ -316,13 +317,14 @@ void QFontPrivate::resolve(uint mask, const QFontPrivate *other) QFontEngineData::QFontEngineData() - : ref(1), fontCache(QFontCache::instance()) + : ref(0), fontCache(QFontCache::instance()) { memset(engines, 0, QChar::ScriptCount * sizeof(QFontEngine *)); } QFontEngineData::~QFontEngineData() { + Q_ASSERT(ref.load() == 0); for (int i = 0; i < QChar::ScriptCount; ++i) { if (engines[i]) { if (!engines[i]->ref.deref()) @@ -637,8 +639,8 @@ QFont::QFont(QFontPrivate *data) void QFont::detach() { if (d->ref.load() == 1) { - if (d->engineData) - d->engineData->ref.deref(); + if (d->engineData && !d->engineData->ref.deref()) + delete d->engineData; d->engineData = 0; if (d->scFont && d->scFont != d.data()) d->scFont->ref.deref(); @@ -2641,7 +2643,7 @@ QFontCache::~QFontCache() EngineDataCache::ConstIterator it = engineDataCache.constBegin(), end = engineDataCache.constEnd(); while (it != end) { - if (it.value()->ref.load() == 0) + if (!it.value()->ref.deref()) delete it.value(); else FC_DEBUG("QFontCache::~QFontCache: engineData %p still has refcount %d", @@ -2713,7 +2715,9 @@ void QFontCache::insertEngineData(const QFontDef &def, QFontEngineData *engineDa def.pixelSize, def.weight, def.style, def.fixedPitch); } #endif + Q_ASSERT(!engineDataCache.contains(def)); + engineData->ref.ref(); engineDataCache.insert(def, engineData); increaseCost(sizeof(QFontEngineData)); } @@ -2829,7 +2833,7 @@ void QFontCache::timerEvent(QTimerEvent *) for (; it != end; ++it) { FC_DEBUG(" %p: ref %2d", it.value(), int(it.value()->ref.load())); - if (it.value()->ref.load() != 0) + if (it.value()->ref.load() != 1) in_use_cost += engine_data_cost; } } @@ -2894,9 +2898,10 @@ void QFontCache::timerEvent(QTimerEvent *) // clean out all unused engine data EngineDataCache::Iterator it = engineDataCache.begin(); while (it != engineDataCache.end()) { - if (it.value()->ref.load() == 0) { + if (it.value()->ref.load() == 1) { FC_DEBUG(" %p", it.value()); decreaseCost(sizeof(QFontEngineData)); + it.value()->ref.deref(); delete it.value(); it = engineDataCache.erase(it); } else { diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 4cbf51d59c..115e866f24 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -143,6 +143,9 @@ public: QFontCache *fontCache; QFontEngine *engines[QChar::ScriptCount]; + +private: + Q_DISABLE_COPY(QFontEngineData) }; diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index e3270b430f..62379cd592 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -344,6 +344,7 @@ struct QtFontFamily bool askedForFallback; unsigned char writingSystems[QFontDatabase::WritingSystemsCount]; + bool matchesFamilyName(const QString &familyName) const; QtFontFoundry *foundry(const QString &f, bool = false); }; @@ -383,6 +384,11 @@ QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create) return foundries[count++]; } +bool QtFontFamily::matchesFamilyName(const QString &familyName) const +{ + return name.compare(familyName, Qt::CaseInsensitive) == 0 || aliases.contains(familyName, Qt::CaseInsensitive); +} + class QFontDatabasePrivate { @@ -613,9 +619,8 @@ static void getEngineData(const QFontPrivate *d, const QFontDef &def) // create a new one d->engineData = new QFontEngineData; QFontCache::instance()->insertEngineData(def, d->engineData); - } else { - d->engineData->ref.ref(); } + d->engineData->ref.ref(); } static QStringList familyList(const QFontDef &req) @@ -852,19 +857,7 @@ static bool matchFamilyName(const QString &familyName, QtFontFamily *f) { if (familyName.isEmpty()) return true; - - if (f->name.compare(familyName, Qt::CaseInsensitive) == 0) - return true; - - QStringList::const_iterator it = f->aliases.constBegin(); - while (it != f->aliases.constEnd()) { - if ((*it).compare(familyName, Qt::CaseInsensitive) == 0) - return true; - - ++it; - } - - return false; + return f->matchesFamilyName(familyName); } /*! diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index be42e892fa..32580ada7a 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -110,8 +110,7 @@ static QStringList fallbackFamilies(const QString &family, QFont::Style style, Q for (i = retList.begin(); i != retList.end(); ++i) { bool contains = false; for (int j = 0; j < db->count; j++) { - QtFontFamily *qtFamily = db->families[j]; - if (!(i->compare(qtFamily->name,Qt::CaseInsensitive))) { + if (db->families[j]->matchesFamilyName(*i)) { contains = true; break; } diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 19b4411b47..10225febcb 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -232,7 +232,7 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id, QScopedPointer newFreetype(new QFreetypeFace); FT_Face face; if (!face_id.filename.isEmpty()) { - QString fileName = QString::fromUtf8(face_id.filename); + QString fileName = QFile::decodeName(face_id.filename); if (face_id.filename.startsWith(":qmemoryfonts/")) { // from qfontdatabase.cpp QByteArray idx = face_id.filename; diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp index edde5a4687..31aaa6e1c5 100644 --- a/src/network/socket/qlocalsocket_tcp.cpp +++ b/src/network/socket/qlocalsocket_tcp.cpp @@ -234,7 +234,7 @@ bool QLocalSocket::open(OpenMode openMode) } const QLatin1String prefix("QLocalServer/"); - if (name.startsWith(prefix)) + if (d->serverName.startsWith(prefix)) d->fullServerName = d->serverName; else d->fullServerName = prefix + d->serverName; diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp index 49440c8566..9b87418846 100644 --- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp @@ -123,7 +123,7 @@ QFontEngine *QBasicFontDatabase::fontEngine(const QFontDef &fontDef, QChar::Scri QFontEngineFT *engine; FontFile *fontfile = static_cast (usrPtr); QFontEngine::FaceId fid; - fid.filename = fontfile->fileName.toLocal8Bit(); + fid.filename = QFile::encodeName(fontfile->fileName); fid.index = fontfile->indexValue; engine = new QFontEngineFT(fontDef); diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 6ba71d112e..8d6f415fba 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -356,7 +356,7 @@ static bool isSymbolFont(FontFile *fontFile) return false; QFontEngine::FaceId id; - id.filename = fontFile->fileName.toLocal8Bit(); + id.filename = QFile::encodeName(fontFile->fileName); id.index = fontFile->indexValue; QFreetypeFace *f = QFreetypeFace::getFace(id); @@ -370,6 +370,8 @@ static bool isSymbolFont(FontFile *fontFile) return hasSymbolMap; } +Q_GUI_EXPORT void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias); + void QFontconfigDatabase::populateFontDatabase() { FcFontSet *fonts; @@ -511,6 +513,9 @@ void QFontconfigDatabase::populateFontDatabase() QString styleName = style_value ? QString::fromUtf8((const char *) style_value) : QString(); QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile); // qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size; + + for (int k = 1; FcPatternGetString(fonts->fonts[i], FC_FAMILY, k, &value) == FcResultMatch; ++k) + qt_registerAliasToFontFamily(familyName, QString::fromUtf8((const char *)value)); } FcFontSetDestroy (fonts); @@ -562,7 +567,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QChar::Script sc QFontEngineFT *engine; FontFile *fontfile = static_cast (usrPtr); QFontEngine::FaceId fid; - fid.filename = fontfile->fileName.toLocal8Bit(); + fid.filename = QFile::encodeName(fontfile->fileName); fid.index = fontfile->indexValue; bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias); diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 1e9acd79ed..7093d27efe 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -211,7 +211,7 @@ static QString strippedText(QString s) - (void)closePanel { - *mCurrentSelection = QT_PREPEND_NAMESPACE(QCFString::toQString)([[mSavePanel URL] path]); + *mCurrentSelection = QT_PREPEND_NAMESPACE(QCFString::toQString)([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C); if ([mSavePanel respondsToSelector:@selector(close)]) [mSavePanel close]; if ([mSavePanel isSheet]) @@ -376,11 +376,11 @@ static QString strippedText(QString s) QStringList result; NSArray* array = [mOpenPanel URLs]; for (NSUInteger i=0; i<[array count]; ++i) - result << QCFString::toQString([[array objectAtIndex:i] path]); + result << QCFString::toQString([[array objectAtIndex:i] path]).normalized(QString::NormalizationForm_C); return result; } else { QStringList result; - QString filename = QT_PREPEND_NAMESPACE(QCFString::toQString)([[mSavePanel URL] path]); + QString filename = QT_PREPEND_NAMESPACE(QCFString::toQString)([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C); result << filename.remove(QLatin1String("___qt_very_unlikely_prefix_")); return result; } @@ -586,7 +586,7 @@ QString QCocoaFileDialogHelper::directory() const { QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast(mDelegate); if (delegate) - return QCFString::toQString([[delegate->mSavePanel directoryURL] path]); + return QCFString::toQString([[delegate->mSavePanel directoryURL] path]).normalized(QString::NormalizationForm_C); return QString(); } diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 59e7ce1526..2b10a26c88 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -507,6 +507,7 @@ void QQnxIntegration::createDisplay(screen_display_t display, bool isPrimary) QQnxScreen *screen = new QQnxScreen(m_screenContext, display, isPrimary); m_screens.append(screen); screenAdded(screen); + screen->adjustOrientation(); QObject::connect(m_screenEventHandler, SIGNAL(newWindowCreated(void*)), screen, SLOT(newWindowCreated(void*))); diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 7614abdc6a..2b81559ab6 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -498,6 +498,18 @@ void QQnxScreen::onWindowPost(QQnxWindow *window) } } +void QQnxScreen::adjustOrientation() +{ + if (!m_primaryScreen) + return; + + bool ok = false; + const int rotation = qgetenv("ORIENTATION").toInt(&ok); + + if (ok) + setRotation(rotation); +} + QPlatformCursor * QQnxScreen::cursor() const { return m_cursor; diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index 41dc675599..98f2a90fbc 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -92,6 +92,7 @@ public: void updateHierarchy(); void onWindowPost(QQnxWindow *window); + void adjustOrientation(); QSharedPointer rootWindow() const; diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 545484de8d..3f4555a31f 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -271,22 +271,19 @@ QWindowsContextPrivate::QWindowsContextPrivate() : m_eventType(QByteArrayLiteral("windows_generic_MSG")), m_lastActiveWindow(0), m_asyncExpose(0) { + const QSysInfo::WinVersion ver = QSysInfo::windowsVersion(); #ifndef Q_OS_WINCE QWindowsContext::user32dll.init(); QWindowsContext::shell32dll.init(); -#endif // Ensure metrics functions report correct data, QTBUG-30063. if (QWindowsContext::user32dll.setProcessDPIAware) QWindowsContext::user32dll.setProcessDPIAware(); - m_displayContext = GetDC(0); - m_defaultDPI = GetDeviceCaps(m_displayContext, LOGPIXELSY); - const QSysInfo::WinVersion ver = QSysInfo::windowsVersion(); -#ifndef Q_OS_WINCE if (hasTouchSupport(ver) && QWindowsContext::user32dll.initTouch()) m_systemInfo |= QWindowsContext::SI_SupportsTouch; -#endif - +#endif // !Q_OS_WINCE + m_displayContext = GetDC(0); + m_defaultDPI = GetDeviceCaps(m_displayContext, LOGPIXELSY); if (useRTL_Extensions(ver)) { m_systemInfo |= QWindowsContext::SI_RTL_Extensions; m_keyMapper.setUseRTLExtensions(true); @@ -417,10 +414,7 @@ QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL) if (icon) cname += QStringLiteral("Icon"); - HBRUSH brush = 0; - if (!isGL) - brush = GetSysColorBrush(COLOR_WINDOW); - return registerWindowClass(cname, qWindowsWndProc, style, brush, icon); + return registerWindowClass(cname, qWindowsWndProc, style, GetSysColorBrush(COLOR_WINDOW), icon); } QString QWindowsContext::registerWindowClass(QString cname, diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index 98b4e7af62..7f97d58be4 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -285,7 +285,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet, return false; if (!QDir::isAbsolutePath(value)) - value.prepend(QString::fromLocal8Bit(qgetenv("windir") + "\\Fonts\\")); + value.prepend(QFile::decodeName(qgetenv("windir") + "\\Fonts\\")); QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index c402f00453..5757bcad4e 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -190,7 +190,7 @@ void QWindowsFontEngine::getCMap() unitsPerEm = otm->otmEMSquare; x_height = (int)otm->otmsXHeight; loadKerningPairs(designToDevice); - _faceId.filename = QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFullName)).toLatin1(); + _faceId.filename = QFile::encodeName(QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFullName))); lineWidth = otm->otmsUnderscoreSize; fsType = otm->otmfsType; free(otm); diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h index ea57ac5b8c..4d70aff27e 100644 --- a/src/testlib/qtestmouse.h +++ b/src/testlib/qtestmouse.h @@ -84,6 +84,9 @@ namespace QTest QTEST_ASSERT(window); extern int Q_TESTLIB_EXPORT defaultMouseDelay(); + if (!window->geometry().contains(pos)) + QTest::qWarn("Mouse event occurs outside of target window."); + static Qt::MouseButton lastButton = Qt::NoButton; if (delay == -1 || delay < defaultMouseDelay()) diff --git a/src/tools/qdoc/quoter.h b/src/tools/qdoc/quoter.h index 223fdd96b3..622e225421 100644 --- a/src/tools/qdoc/quoter.h +++ b/src/tools/qdoc/quoter.h @@ -83,7 +83,6 @@ private: int unindent = 0); bool silent; - bool validRegExp; QStringList plainLines; QStringList markedLines; Location codeLocation; diff --git a/src/tools/uic/databaseinfo.cpp b/src/tools/uic/databaseinfo.cpp index 9832f332db..a052cdf55a 100644 --- a/src/tools/uic/databaseinfo.cpp +++ b/src/tools/uic/databaseinfo.cpp @@ -46,8 +46,7 @@ QT_BEGIN_NAMESPACE -DatabaseInfo::DatabaseInfo(Driver *drv) - : driver(drv) +DatabaseInfo::DatabaseInfo() { } diff --git a/src/tools/uic/databaseinfo.h b/src/tools/uic/databaseinfo.h index 043407d4f7..db60a1b0ff 100644 --- a/src/tools/uic/databaseinfo.h +++ b/src/tools/uic/databaseinfo.h @@ -53,7 +53,7 @@ class Driver; class DatabaseInfo : public TreeWalker { public: - DatabaseInfo(Driver *driver); + DatabaseInfo(); void acceptUI(DomUI *node); void acceptWidget(DomWidget *node); @@ -68,7 +68,6 @@ public: { return m_fields.value(connection); } private: - Driver *driver; QStringList m_connections; QMap m_cursors; QMap m_fields; diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp index 1afa19b321..be4df64696 100644 --- a/src/tools/uic/uic.cpp +++ b/src/tools/uic/uic.cpp @@ -67,7 +67,6 @@ Uic::Uic(Driver *d) : drv(d), out(d->output()), opt(d->option()), - info(d), externalPix(true) { } diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index ac25d3ed7f..d036f6bada 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3210,7 +3210,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) res = acceptTouchEvents && d->notify_helper(widget, touchEvent); // If the touch event wasn't accepted, synthesize a mouse event and see if the widget wants it. - if (!touchEvent->isAccepted()) + if (!touchEvent->isAccepted() && QGuiApplicationPrivate::synthesizeMouseFromTouchEventsEnabled()) res = d->translateTouchToMouse(widget, touchEvent); break; } @@ -3237,7 +3237,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) res = acceptTouchEvents && d->notify_helper(widget, touchEvent); // If the touch event wasn't accepted, synthesize a mouse event and see if the widget wants it. - if (!touchEvent->isAccepted()) { + if (!touchEvent->isAccepted() && QGuiApplicationPrivate::synthesizeMouseFromTouchEventsEnabled()) { res = d->translateTouchToMouse(widget, touchEvent); eventAccepted = touchEvent->isAccepted(); if (eventAccepted) @@ -3801,10 +3801,6 @@ private: bool QApplicationPrivate::translateTouchToMouse(QWidget *widget, QTouchEvent *event) { - // Check if the platform wants synthesized mouse events. - if (!QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::SynthesizeMouseFromTouchEvents).toBool()) - return false; - Q_FOREACH (const QTouchEvent::TouchPoint &p, event->touchPoints()) { const QEvent::Type eventType = (p.state() & Qt::TouchPointPressed) ? QEvent::MouseButtonPress : (p.state() & Qt::TouchPointReleased) ? QEvent::MouseButtonRelease @@ -3841,7 +3837,7 @@ bool QApplicationPrivate::translateTouchToMouse(QWidget *widget, QTouchEvent *ev return false; } -void QApplicationPrivate::translateRawTouchEvent(QWidget *window, +bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, QTouchDevice *device, const QList &touchPoints, ulong timestamp) @@ -3903,8 +3899,9 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, } if (widgetsNeedingEvents.isEmpty()) - return; + return false; + bool accepted = false; QHash::ConstIterator it = widgetsNeedingEvents.constBegin(); const QHash::ConstIterator end = widgetsNeedingEvents.constEnd(); for (; it != end; ++it) { @@ -3943,19 +3940,23 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, { // if the TouchBegin handler recurses, we assume that means the event // has been implicitly accepted and continue to send touch events - widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent); - (void ) QApplication::sendSpontaneousEvent(widget, &touchEvent); + if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) { + accepted = true; + widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent); + } break; } default: if (widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent)) { if (touchEvent.type() == QEvent::TouchEnd) widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, false); - (void) QApplication::sendSpontaneousEvent(widget, &touchEvent); + if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) + accepted = true; } break; } } + return accepted; } void QApplicationPrivate::translateTouchCancel(QTouchDevice *device, ulong timestamp) diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index ca1bccb727..87cf259ba5 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -284,7 +284,7 @@ public: void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint); void removeTouchPoint(int touchPointId); bool translateTouchToMouse(QWidget *widget, QTouchEvent *event); - static void translateRawTouchEvent(QWidget *widget, + static bool translateRawTouchEvent(QWidget *widget, QTouchDevice *device, const QList &touchPoints, ulong timestamp); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index ddb570d6c7..bedcfe78bf 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -473,10 +473,12 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) void QWidgetWindow::handleTouchEvent(QTouchEvent *event) { - if (event->type() == QEvent::TouchCancel) + if (event->type() == QEvent::TouchCancel) { QApplicationPrivate::translateTouchCancel(event->device(), event->timestamp()); - else - QApplicationPrivate::translateRawTouchEvent(m_widget, event->device(), event->touchPoints(), event->timestamp()); + event->accept(); + } else { + event->setAccepted(QApplicationPrivate::translateRawTouchEvent(m_widget, event->device(), event->touchPoints(), event->timestamp())); + } } void QWidgetWindow::handleKeyEvent(QKeyEvent *event) diff --git a/tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp b/tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp index d588373034..5a64c5963f 100644 --- a/tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp +++ b/tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp @@ -39,8 +39,6 @@ ** ****************************************************************************/ -#define QT_DEPRECATED -#define QT_DISABLE_DEPRECATED_BEFORE 0 #include "private/qdataurl_p.h" #include #include diff --git a/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro index 9ab494d3d5..14df20c986 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro +++ b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro @@ -2,4 +2,3 @@ CONFIG += testcase parallel_test TARGET = tst_qcoreapplication QT = core testlib core-private SOURCES = tst_qcoreapplication.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index 10c00e2a67..ff1d8b2a36 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -643,7 +643,7 @@ void tst_QCoreApplication::customEventDispatcher() QCOMPARE(QCoreApplication::eventDispatcher(), ed); // test the alternative API of QAbstractEventDispatcher QCOMPARE(QAbstractEventDispatcher::instance(), ed); - QWeakPointer weak_ed(ed); + QPointer weak_ed(ed); QVERIFY(!weak_ed.isNull()); { int argc = 1; diff --git a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro index 7734b0d519..41c3dea924 100644 --- a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro +++ b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro @@ -5,4 +5,3 @@ SOURCES = tst_qtranslator.cpp RESOURCES += qtranslator.qrc TESTDATA += hellotr_la.qm msgfmt_from_po.qm -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp index 9b22ebc1e8..5818077e3d 100644 --- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp +++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp @@ -200,10 +200,9 @@ void tst_QTranslator::plural() tor.load("hellotr_la"); QVERIFY(!tor.isEmpty()); QCoreApplication::installTranslator(&tor); - QCoreApplication::Encoding e = QCoreApplication::UnicodeUTF8; - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, e, 0), QString::fromLatin1("Hallo 0 Welten!")); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, e, 1), QString::fromLatin1("Hallo 1 Welt!")); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, e, 2), QString::fromLatin1("Hallo 2 Welten!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 0), QString::fromLatin1("Hallo 0 Welten!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 1), QString::fromLatin1("Hallo 1 Welt!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 2), QString::fromLatin1("Hallo 2 Welten!")); } void tst_QTranslator::translate_qm_file_generated_with_msgfmt() @@ -253,10 +252,9 @@ void tst_QTranslator::dependencies() // plural QCoreApplication::installTranslator(&tor); - QCoreApplication::Encoding e = QCoreApplication::UnicodeUTF8; - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, e, 0), QString::fromLatin1("Hallo 0 Welten!")); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, e, 1), QString::fromLatin1("Hallo 1 Welt!")); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, e, 2), QString::fromLatin1("Hallo 2 Welten!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 0), QString::fromLatin1("Hallo 0 Welten!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 1), QString::fromLatin1("Hallo 1 Welt!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 2), QString::fromLatin1("Hallo 2 Welten!")); // pick up translation from the file with dependencies QCOMPARE(tor.translate("QPushButton", "It's a small world"), QString::fromLatin1("Es ist eine kleine Welt")); diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index b67920737e..29c72cc02e 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -41,6 +41,8 @@ #include #include +#include +#include #include @@ -484,6 +486,8 @@ void tst_QWindow::testInputEvents() void tst_QWindow::touchToMouseTranslation() { + if (!QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::SynthesizeMouseFromTouchEvents).toBool()) + QSKIP("Mouse events are synthesized by the system on this platform."); InputTestWindow window; window.ignoreTouch = true; window.setGeometry(80, 80, 40, 40); @@ -684,6 +688,8 @@ void tst_QWindow::touchCancel() void tst_QWindow::touchCancelWithTouchToMouse() { + if (!QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::SynthesizeMouseFromTouchEvents).toBool()) + QSKIP("Mouse events are synthesized by the system on this platform."); InputTestWindow window; window.ignoreTouch = true; window.setGeometry(80, 80, 40, 40); diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 0162c467d4..b8cce2671f 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -690,33 +690,36 @@ void tst_QFont::defaultFamily() void tst_QFont::sharing() { + // QFontCache references the engineData + int refs_by_cache = 1; + QFont f; f.setStyleHint(QFont::Serif); f.exactMatch(); // loads engine QCOMPARE(QFontPrivate::get(f)->ref.load(), 1); QVERIFY(QFontPrivate::get(f)->engineData); - QCOMPARE(QFontPrivate::get(f)->engineData->ref.load(), 1); + QCOMPARE(QFontPrivate::get(f)->engineData->ref.load(), 1 + refs_by_cache); QFont f2(f); QVERIFY(QFontPrivate::get(f2) == QFontPrivate::get(f)); QCOMPARE(QFontPrivate::get(f2)->ref.load(), 2); QVERIFY(QFontPrivate::get(f2)->engineData); QVERIFY(QFontPrivate::get(f2)->engineData == QFontPrivate::get(f)->engineData); - QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 1); + QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 1 + refs_by_cache); f2.setKerning(!f.kerning()); QVERIFY(QFontPrivate::get(f2) != QFontPrivate::get(f)); QCOMPARE(QFontPrivate::get(f2)->ref.load(), 1); QVERIFY(QFontPrivate::get(f2)->engineData); QVERIFY(QFontPrivate::get(f2)->engineData == QFontPrivate::get(f)->engineData); - QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 2); + QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 2 + refs_by_cache); f2 = f; QVERIFY(QFontPrivate::get(f2) == QFontPrivate::get(f)); QCOMPARE(QFontPrivate::get(f2)->ref.load(), 2); QVERIFY(QFontPrivate::get(f2)->engineData); QVERIFY(QFontPrivate::get(f2)->engineData == QFontPrivate::get(f)->engineData); - QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 1); + QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 1 + refs_by_cache); if (f.pointSize() > 0) f2.setPointSize(f.pointSize() * 2 / 3); diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 7c468fcaed..36b83eefda 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -74,19 +74,23 @@ #include #include +static inline void setFrameless(QWidget *w) +{ + Qt::WindowFlags flags = w->windowFlags(); + flags |= Qt::FramelessWindowHint; + flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); + w->setWindowFlags(flags); +} + class tst_QComboBox : public QObject { Q_OBJECT public: - tst_QComboBox(); - ~tst_QComboBox(); + tst_QComboBox() {} public slots: - void initTestCase(); - void cleanupTestCase(); void init(); - void cleanup(); private slots: void getSetCheck(); @@ -156,11 +160,6 @@ private slots: void maxVisibleItems(); void task_QTBUG_10491_currentIndexAndModelColumn(); void highlightedSignal(); - -private: - QComboBox *testWidget; - QWidget *parent; - QPushButton* ok; }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -373,53 +372,40 @@ typedef QList IconList; Q_DECLARE_METATYPE(QComboBox::InsertPolicy) -tst_QComboBox::tst_QComboBox() +class TestWidget : public QWidget { - parent = 0; -} +public: + TestWidget() : QWidget(0, Qt::Window), m_comboBox(new QComboBox(this)) + { + setObjectName("parent"); + move(200, 200); + resize(400, 400); + m_comboBox->setGeometry(0, 0, 100, 100); + m_comboBox->setObjectName("testObject"); + m_comboBox->setEditable(false); + } -tst_QComboBox::~tst_QComboBox() -{ -} + QComboBox *comboBox() const { return m_comboBox; } + +private: + QComboBox *m_comboBox; -void tst_QComboBox::initTestCase() -{ - // Create the test class - parent = new QWidget(0, Qt::Window); - parent->setObjectName("parent"); - parent->resize(400, 400); - testWidget = new QComboBox(parent); - testWidget->setObjectName("testObject"); - testWidget->setGeometry(0, 0, 100, 100); - parent->show(); -} - -void tst_QComboBox::cleanupTestCase() -{ - delete parent; - parent = 0; -} - +}; void tst_QComboBox::init() { - // all tests starts with a clean non-editable combobox - testWidget->setEditable(false); - testWidget->clear(); #ifdef Q_OS_WINCE //disable magic for WindowsCE qApp->setAutoMaximizeThreshold(-1); #endif } -void tst_QComboBox::cleanup() -{ - //nothing -} - - void tst_QComboBox::setEditable() { + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); // make sure we have no lineedit QVERIFY(!testWidget->lineEdit()); // test setEditable(true) @@ -442,10 +428,14 @@ void tst_QComboBox::setEditable() void tst_QComboBox::setPalette() { #ifdef Q_OS_MAC - if (testWidget->style()->inherits("QMacStyle")) { + if (QApplication::style()->inherits("QMacStyle")) { QSKIP("This test doesn't make sense for pixmap-based styles"); } #endif + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); QPalette pal = testWidget->palette(); pal.setColor(QPalette::Base, Qt::red); testWidget->setPalette(pal); @@ -477,6 +467,10 @@ void tst_QComboBox::setPalette() void tst_QComboBox::sizeAdjustPolicy() { + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); // test that adding new items will not change the sizehint for AdjustToContentsOnFirstShow QVERIFY(!testWidget->count()); QVERIFY(testWidget->sizeAdjustPolicy() == QComboBox::AdjustToContentsOnFirstShow); @@ -537,6 +531,10 @@ void tst_QComboBox::sizeAdjustPolicy() void tst_QComboBox::clear() { + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); // first non editable combobox testWidget->addItem("foo"); testWidget->addItem("bar"); @@ -711,6 +709,10 @@ void tst_QComboBox::insertPolicy() QFETCH(QString, userInput); QFETCH(QStringList, result); + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); testWidget->clear(); testWidget->setInsertPolicy(insertPolicy); testWidget->addItems(initialEntries); @@ -740,6 +742,10 @@ void tst_QComboBox::insertPolicy() // Apps running with valgrind are not fast enough. void tst_QComboBox::virtualAutocompletion() { + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); testWidget->clear(); testWidget->setAutoCompletion(true); testWidget->addItem("Foo"); @@ -792,9 +798,13 @@ void tst_QComboBox::autoCompletionCaseSensitivity() { //we have put the focus because the completer //is only used when the widget actually has the focus + TestWidget topLevel; + topLevel.show(); + QComboBox *testWidget = topLevel.comboBox(); + qApp->setActiveWindow(&topLevel); testWidget->setFocus(); - qApp->setActiveWindow(testWidget); - QTRY_COMPARE(qApp->focusWidget(), (QWidget *)testWidget); + QVERIFY(QTest::qWaitForWindowActive(&topLevel)); + QCOMPARE(qApp->focusWidget(), (QWidget *)testWidget); testWidget->clear(); testWidget->setAutoCompletion(true); @@ -886,6 +896,10 @@ void tst_QComboBox::autoCompletionCaseSensitivity() void tst_QComboBox::hide() { + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); testWidget->addItem("foo"); testWidget->showPopup(); //allow combobox effect to complete @@ -1101,6 +1115,10 @@ void tst_QComboBox::currentIndex() QFETCH(QString, expectedCurrentText); QFETCH(int, expectedSignalCount); + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); // test both editable/non-editable combobox for (int edit = 0; edit < 2; ++edit) { testWidget->clear(); @@ -1196,6 +1214,10 @@ void tst_QComboBox::insertItems() QFETCH(int, insertIndex); QFETCH(int, expectedIndex); + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); testWidget->insertItems(0, initialItems); QCOMPARE(testWidget->count(), initialItems.count()); @@ -1234,6 +1256,10 @@ void tst_QComboBox::insertItem() QFETCH(int, expectedIndex); QFETCH(bool, editable); + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); testWidget->insertItems(0, initialItems); QCOMPARE(testWidget->count(), initialItems.count()); @@ -1251,6 +1277,10 @@ void tst_QComboBox::insertItem() void tst_QComboBox::insertOnCurrentIndex() { + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); testWidget->setEditable(true); testWidget->addItem("first item"); testWidget->setCurrentIndex(0); @@ -1308,6 +1338,10 @@ void tst_QComboBox::textpixmapdata() QVERIFY(text.count() == icons.count() && text.count() == variant.count()); + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); for (int i = 0; iinsertItem(i, text.at(i)); testWidget->setItemIcon(i, icons.at(i)); @@ -1333,6 +1367,10 @@ void tst_QComboBox::textpixmapdata() void tst_QComboBox::setCurrentIndex() { + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); QCOMPARE(testWidget->count(), 0); testWidget->addItem("foo"); testWidget->addItem("bar"); @@ -1360,6 +1398,10 @@ void tst_QComboBox::setCurrentText() { QFETCH(bool, editable); + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); QCOMPARE(testWidget->count(), 0); testWidget->addItems(QStringList() << "foo" << "bar"); QCOMPARE(testWidget->count(), 2); @@ -1411,6 +1453,10 @@ void tst_QComboBox::currentTextChanged() { QFETCH(bool, editable); + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); QCOMPARE(testWidget->count(), 0); testWidget->addItems(QStringList() << "foo" << "bar"); QCOMPARE(testWidget->count(), 2); @@ -1455,6 +1501,10 @@ void tst_QComboBox::currentTextChanged() void tst_QComboBox::editTextChanged() { + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); QCOMPARE(testWidget->count(), 0); testWidget->addItem("foo"); testWidget->addItem("bar"); @@ -1677,6 +1727,7 @@ public: void tst_QComboBox::ensureReturnIsIgnored() { ReturnClass r; + r.move(200, 200); r.show(); QTest::keyClick(r.edit, Qt::Key_Return); @@ -1716,6 +1767,10 @@ void tst_QComboBox::findText() QFETCH(QString, search); QFETCH(int, result); + TestWidget topLevel; + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QComboBox *testWidget = topLevel.comboBox(); testWidget->clear(); testWidget->addItems(items); @@ -1824,6 +1879,7 @@ void tst_QComboBox::flaggedItems() QFETCH(int, expectedIndex); QComboBox comboBox; + setFrameless(&comboBox); QListWidget listWidget; listWidget.addItems(itemList); @@ -1836,6 +1892,7 @@ void tst_QComboBox::flaggedItems() comboBox.setModel(listWidget.model()); comboBox.setView(&listWidget); + comboBox.move(200, 200); comboBox.show(); QApplication::setActiveWindow(&comboBox); comboBox.activateWindow(); @@ -1987,6 +2044,8 @@ void tst_QComboBox::itemListPosition() //we test QFontComboBox because it has the specific behaviour to set a fixed size //to the list view QWidget topLevel; + topLevel.resize(200, 200); + topLevel.move(100, 100); QFontComboBox combo(&topLevel); //the code to get the available screen space is copied from QComboBox code @@ -2047,6 +2106,8 @@ void tst_QComboBox::task190351_layout() QApplication::setStyle(QStyleFactory::create(QLatin1String("Fusion"))); QComboBox listCombo; + listCombo.move(200, 200); + setFrameless(&listCombo); QListWidget *list = new QListWidget(); listCombo.setModel(list->model()); listCombo.setView(list); @@ -2111,7 +2172,10 @@ void tst_QComboBox::task191329_size() const QString oldStyle = QApplication::style()->objectName(); QApplication::setStyle(QStyleFactory::create(QLatin1String("Fusion"))); + QComboBox tableCombo; + setFrameless(&tableCombo); + tableCombo.move(200, 200); int rows; if (QApplication::desktop()->screenGeometry().height() < 480) rows = 8; @@ -2159,6 +2223,8 @@ void tst_QComboBox::task190205_setModelAdjustToContents() finalContent << "bar" << "foooooooobar"; QComboBox box; + setFrameless(&box); + box.move(100, 100); box.setSizeAdjustPolicy(QComboBox::AdjustToContents); box.addItems(initialContent); box.show(); @@ -2169,6 +2235,9 @@ void tst_QComboBox::task190205_setModelAdjustToContents() box.setModel(new QStringListModel(finalContent)); QComboBox correctBox; + setFrameless(&correctBox); + correctBox.move(400, 100); + correctBox.addItems(finalContent); correctBox.show(); @@ -2210,6 +2279,8 @@ void tst_QComboBox::task248169_popupWithMinimalSize() void tst_QComboBox::task247863_keyBoardSelection() { QComboBox combo; + setFrameless(&combo); + combo.move(200, 200); combo.setEditable(false); combo.addItem( QLatin1String("111")); combo.addItem( QLatin1String("222")); @@ -2230,6 +2301,8 @@ void tst_QComboBox::task247863_keyBoardSelection() void tst_QComboBox::task220195_keyBoardSelection2() { QComboBox combo; + setFrameless(&combo); + combo.move(200, 200); combo.setEditable(false); combo.addItem( QLatin1String("foo1")); combo.addItem( QLatin1String("foo2")); @@ -2315,6 +2388,7 @@ void tst_QComboBox::noScrollbar() QWidget topLevel; QComboBox comboBox(&topLevel); comboBox.addItems(initialContent); + topLevel.move(200, 200); topLevel.show(); comboBox.resize(200, comboBox.height()); QTRY_VERIFY(comboBox.isVisible()); @@ -2331,6 +2405,7 @@ void tst_QComboBox::noScrollbar() QComboBox comboBox; comboBox.setModel(table->model()); comboBox.setView(table); + comboBox.move(200, 200); comboBox.show(); QTRY_VERIFY(comboBox.isVisible()); comboBox.resize(200, comboBox.height()); @@ -2447,6 +2522,7 @@ void tst_QComboBox::task260974_menuItemRectangleForComboBoxPopup() QComboBox comboBox; comboBox.setStyle(&style); comboBox.addItem("Item 1"); + comboBox.move(200, 200); comboBox.show(); QTRY_VERIFY(comboBox.isVisible()); @@ -2511,8 +2587,11 @@ void tst_QComboBox::keyBoardNavigationWithMouse() { QComboBox combo; combo.setEditable(false); + setFrameless(&combo); + combo.move(200, 200); for (int i = 0; i < 80; i++) combo.addItem( QString::number(i)); + combo.show(); QApplication::setActiveWindow(&combo); QVERIFY(QTest::qWaitForWindowActive(&combo)); @@ -2523,7 +2602,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse() combo.setFocus(); QTRY_VERIFY(combo.hasFocus()); - QTest::keyClick(testWidget->lineEdit(), Qt::Key_Space); + QTest::keyClick(combo.lineEdit(), Qt::Key_Space); QTest::qWait(30); QTRY_VERIFY(combo.view()); QTRY_VERIFY(combo.view()->isVisible()); @@ -2568,6 +2647,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse() void tst_QComboBox::task_QTBUG_1071_changingFocusEmitsActivated() { QWidget w; + w.move(200, 200); QVBoxLayout layout(&w); QComboBox cb; cb.setEditable(true); @@ -2603,6 +2683,7 @@ void tst_QComboBox::maxVisibleItems() content += QString::number(i); comboBox.addItems(content); + comboBox.move(200, 200); comboBox.show(); comboBox.resize(200, comboBox.height()); QTRY_VERIFY(comboBox.isVisible());