diff --git a/examples/examples.pro b/examples/examples.pro index d2ce1fd294..4ec5ca60e2 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -3,19 +3,19 @@ CONFIG += no_docs_target SUBDIRS = \ corelib \ - dbus \ embedded \ - gui \ - network \ qpa \ - qtconcurrent \ - qtestlib \ - sql \ - touch \ - widgets \ - xml + touch +qtHaveModule(dbus): SUBDIRS += dbus +qtHaveModule(network): SUBDIRS += network +qtHaveModule(testlib): SUBDIRS += qtestlib +qtHaveModule(concurrent): SUBDIRS += qtconcurrent +qtHaveModule(sql): SUBDIRS += sql +qtHaveModule(widgets): SUBDIRS += widgets +qtHaveModule(xml): SUBDIRS += xml qtHaveModule(gui) { + SUBDIRS += gui qtConfig(opengl): SUBDIRS += opengl qtConfig(vulkan): SUBDIRS += vulkan } diff --git a/examples/sql/sql.pro b/examples/sql/sql.pro index e7bf3e76d9..135d05b4e2 100644 --- a/examples/sql/sql.pro +++ b/examples/sql/sql.pro @@ -8,7 +8,7 @@ SUBDIRS = books \ relationaltablemodel \ sqlwidgetmapper -!wince: SUBDIRS += masterdetail +!wince:qtHaveModule(xml): SUBDIRS += masterdetail !wince: SUBDIRS += \ querymodel \ diff --git a/examples/widgets/itemviews/itemviews.pro b/examples/widgets/itemviews/itemviews.pro index a76c8a1077..787217a8e8 100644 --- a/examples/widgets/itemviews/itemviews.pro +++ b/examples/widgets/itemviews/itemviews.pro @@ -20,3 +20,4 @@ SUBDIRS = addressbook \ stardelegate \ storageview contains(DEFINES, QT_NO_DRAGANDDROP): SUBDIRS -= puzzle +!qtHaveModule(xml): SUBDIRS -= simpledommodel diff --git a/mkspecs/devices/common/freebsd_device_post.conf b/mkspecs/devices/common/freebsd_device_post.conf index 1d9694af31..173eeb00ad 100644 --- a/mkspecs/devices/common/freebsd_device_post.conf +++ b/mkspecs/devices/common/freebsd_device_post.conf @@ -1,5 +1,7 @@ +defineTest(qtConfSanitizeMkspec) { + deviceSanityCheckCompiler() +} + QMAKE_CFLAGS += $$COMPILER_FLAGS QMAKE_CXXFLAGS += $$COMPILER_FLAGS QMAKE_LFLAGS += $$LINKER_FLAGS - -deviceSanityCheckCompiler() diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf index 3da6bf8c11..ea235514b7 100644 --- a/mkspecs/features/qt_common.prf +++ b/mkspecs/features/qt_common.prf @@ -90,7 +90,7 @@ warnings_are_errors:warning_clean { # (NULL in C++ is usually a literal 0) QMAKE_CXXFLAGS_WARN_ON += -Werror -ww177,1224,1478,1881 $$WERROR } - } else:gcc:!clang:!intel_icc { + } else:gcc:!clang:!intel_icc:!rim_qcc { # GCC 4.6-4.9, 5.x, ... ver = $${QT_GCC_MAJOR_VERSION}.$${QT_GCC_MINOR_VERSION} contains(ver, "(4\\.[6789]|[5-9]\\..)") { diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index 22ead1b2b4..36f632e8ca 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -41,8 +41,12 @@ host_build { } } -CONFIG(shared, static|shared):qtConfig(framework): \ - CONFIG += lib_bundle +qtConfig(framework) { + minimal_syncqt: \ + CONFIG += module_frameworks + else: CONFIG(shared, static|shared): \ + CONFIG += module_frameworks lib_bundle +} CONFIG += relative_qt_rpath # Qt libraries should be relocatable diff --git a/mkspecs/features/qt_module_headers.prf b/mkspecs/features/qt_module_headers.prf index 06117a6bc2..9248be2d68 100644 --- a/mkspecs/features/qt_module_headers.prf +++ b/mkspecs/features/qt_module_headers.prf @@ -59,7 +59,9 @@ load(qt_build_paths) # even beyond the module's own build. The implication of this is that # qmake might never use a framework's headers in a non-prefix build, # as there is no separate set of .pri files for users outside Qt. -prefix_build:lib_bundle: \ +# Borrowing is assumed to happen from modules which, in a framework build, +# actually are frameworks. +prefix_build:module_frameworks: \ fwd = _FWD # When using a split include path during the build, the installed module's # include path is also structurally different from that in the build dir. @@ -82,7 +84,7 @@ for(mod, MODULE_INCNAME) { generated_privates: \ MODULE$${sfwd}$${prv}_INCLUDES += $$mbibase/$$VERSION $$mbibase/$$VERSION/$$mod } - prefix_build:lib_bundle { + prefix_build:module_frameworks { mfbase = \$\$QT_MODULE_LIB_BASE/$${mod}.framework/Headers MODULE_INCLUDES += $$mfbase MODULE$${prv}_INCLUDES += $$mfbase/$$VERSION $$mfbase/$$VERSION/$$mod @@ -179,7 +181,7 @@ headersclean:!internal_module { -Dforeach=public: \ -Dforever=public: - gcc { + gcc:!rim_qcc { # Turn on some extra warnings not found in -Wall -Wextra. # Common to GCC, Clang and ICC (and other compilers that masquerade as GCC): hcleanFLAGS = -Wall -Wextra -Werror \ diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf index 72d676da6f..163f52f23f 100644 --- a/mkspecs/features/qt_module_pris.prf +++ b/mkspecs/features/qt_module_pris.prf @@ -83,10 +83,10 @@ defineReplace(qtExportLibsForModule) { module_build_type = v2 static: \ module_build_type += staticlib - lib_bundle { + lib_bundle: \ module_build_type += lib_bundle + module_frameworks: \ MODULE_FRAMEWORKS = " \$\$QT_MODULE_LIB_BASE" - } internal_module: \ module_build_type += internal_module ltcg: \ diff --git a/mkspecs/features/wayland-scanner.prf b/mkspecs/features/wayland-scanner.prf index 7319392d85..9166ae7750 100644 --- a/mkspecs/features/wayland-scanner.prf +++ b/mkspecs/features/wayland-scanner.prf @@ -1,7 +1,16 @@ # # Extra-compilers for handling files specified in -# the WAYLANDSERVERSOURCES and WAYLANDCLIENTSOURCES variables +# the WAYLANDSERVERSOURCES and WAYLANDCLIENTSOURCES variables. # +# WAYLANDSERVERSOURCES_SYSTEM and WAYLANDCLIENTSOURCES_SYSTEM +# are for protocols where the wayland-scanner output is already +# included in the system libraries. In that case, .c files must +# not be generated, to avoid the Qt version replacing driver-specific +# functions. These files are therefore omitted from wayland_code.input. +# Header files are still generated because they are used to build QtWayland. +# +# qtwaylandscanner must be used even in the _SYSTEM case, since the system +# Wayland libraries do not contain Qt code. isEmpty(QMAKE_WAYLAND_SCANNER):error("QMAKE_WAYLAND_SCANNER not defined for this mkspec") @@ -9,9 +18,9 @@ defineReplace(waylandScannerHeaderFiles) { side = $$1 path = $$2 isEqual(side, "server"): \ - sources_list = $$WAYLANDSERVERSOURCES + sources_list = $$WAYLANDSERVERSOURCES $$WAYLANDSERVERSOURCES_SYSTEM else: \ - sources_list = $$WAYLANDCLIENTSOURCES + sources_list = $$WAYLANDCLIENTSOURCES $$WAYLANDCLIENTSOURCES_SYSTEM wayland_header_files_for_side = for(file, sources_list) { basenameFile = $$basename(file) @@ -50,7 +59,7 @@ qt_install_headers { } wayland_server_header.name = wayland ${QMAKE_FILE_BASE} -wayland_server_header.input = WAYLANDSERVERSOURCES +wayland_server_header.input = WAYLANDSERVERSOURCES WAYLANDSERVERSOURCES_SYSTEM wayland_server_header.variable_out = HEADERS wayland_server_header.output = $${WAYLAND_SERVER_HEADER_DEST}wayland-${QMAKE_FILE_BASE}-server-protocol$${first(QMAKE_EXT_H)} wayland_server_header.commands = $$QMAKE_WAYLAND_SCANNER server-header < ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} @@ -58,7 +67,7 @@ silent:wayland_server_header.commands = @echo Wayland server header ${QMAKE_FILE QMAKE_EXTRA_COMPILERS += wayland_server_header wayland_client_header.name = wayland ${QMAKE_FILE_BASE} -wayland_client_header.input = WAYLANDCLIENTSOURCES +wayland_client_header.input = WAYLANDCLIENTSOURCES WAYLANDCLIENTSOURCES_SYSTEM wayland_client_header.variable_out = HEADERS wayland_client_header.output = $${WAYLAND_CLIENT_HEADER_DEST}wayland-${QMAKE_FILE_BASE}-client-protocol$${first(QMAKE_EXT_H)} wayland_client_header.commands = $$QMAKE_WAYLAND_SCANNER client-header < ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} @@ -76,7 +85,7 @@ QMAKE_EXTRA_COMPILERS += wayland_code qtPrepareTool(QMAKE_QTWAYLANDSCANNER, qtwaylandscanner) qtwayland_client_header.name = qtwayland ${QMAKE_FILE_BASE} -qtwayland_client_header.input = WAYLANDCLIENTSOURCES +qtwayland_client_header.input = WAYLANDCLIENTSOURCES WAYLANDCLIENTSOURCES_SYSTEM qtwayland_client_header.variable_out = HEADERS qtwayland_client_header.depends += $$QMAKE_QTWAYLANDSCANNER_EXE $${WAYLAND_CLIENT_HEADER_DEST}wayland-${QMAKE_FILE_BASE}-client-protocol$${first(QMAKE_EXT_H)} qtwayland_client_header.output = $${WAYLAND_CLIENT_HEADER_DEST}qwayland-${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)} @@ -85,7 +94,7 @@ silent:qtwayland_client_header.commands = @echo QtWayland client header ${QMAKE_ QMAKE_EXTRA_COMPILERS += qtwayland_client_header qtwayland_client_code.name = qtwayland ${QMAKE_FILE_BASE} -qtwayland_client_code.input = WAYLANDCLIENTSOURCES +qtwayland_client_code.input = WAYLANDCLIENTSOURCES WAYLANDCLIENTSOURCES_SYSTEM qtwayland_client_code.variable_out = SOURCES qtwayland_client_code.depends += $$QMAKE_QTWAYLANDSCANNER_EXE $${WAYLAND_CLIENT_HEADER_DEST}qwayland-${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)} qtwayland_client_code.output = qwayland-${QMAKE_FILE_BASE}.cpp @@ -94,7 +103,7 @@ silent:qtwayland_client_code.commands = @echo QtWayland client code ${QMAKE_FILE QMAKE_EXTRA_COMPILERS += qtwayland_client_code qtwayland_server_header.name = qtwayland ${QMAKE_FILE_BASE} -qtwayland_server_header.input = WAYLANDSERVERSOURCES +qtwayland_server_header.input = WAYLANDSERVERSOURCES WAYLANDSERVERSOURCES_SYSTEM qtwayland_server_header.variable_out = HEADERS qtwayland_server_header.depends += $$QMAKE_QTWAYLANDSCANNER_EXE $${WAYLAND_SERVER_HEADER_DEST}wayland-${QMAKE_FILE_BASE}-server-protocol$${first(QMAKE_EXT_H)} qtwayland_server_header.output = $${WAYLAND_SERVER_HEADER_DEST}qwayland-server-${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)} @@ -103,7 +112,7 @@ silent:qtwayland_server_header.commands = @echo QtWayland server header ${QMAKE_ QMAKE_EXTRA_COMPILERS += qtwayland_server_header qtwayland_server_code.name = qtwayland ${QMAKE_FILE_BASE} -qtwayland_server_code.input = WAYLANDSERVERSOURCES +qtwayland_server_code.input = WAYLANDSERVERSOURCES WAYLANDSERVERSOURCES_SYSTEM qtwayland_server_code.variable_out = SOURCES qtwayland_server_code.depends += $$QMAKE_QTWAYLANDSCANNER_EXE $${WAYLAND_SERVER_HEADER_DEST}qwayland-server-${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)} qtwayland_server_code.output = qwayland-server-${QMAKE_FILE_BASE}.cpp diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 4936b3587e..f62b4cfeba 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -21,8 +21,7 @@ CFLAGS_EXTRA = -fms-compatibility-version=19.00.23506 -Wno-microsoft-enum-v !else CXX = cl LINKER = link -CFLAGS_EXTRA = /MP /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS \ - /wd4577 $(CFLAGS_CRT) +CFLAGS_EXTRA = /MP /wd4577 $(CFLAGS_CRT) !endif # !win32-icc !if "$(QMAKESPEC)" != "win32-clang-msvc" @@ -37,6 +36,7 @@ CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \ -I$(INC_PATH) -I$(INC_PATH)\QtCore -I$(INC_PATH)\QtCore\$(QT_VERSION) -I$(INC_PATH)\QtCore\$(QT_VERSION)\QtCore \ -I$(BUILD_PATH)\src\corelib\global \ -I$(SOURCE_PATH)\mkspecs\$(QMAKESPEC) \ + -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS \ -DQT_VERSION_STR=\"$(QT_VERSION)\" -DQT_VERSION_MAJOR=$(QT_MAJOR_VERSION) -DQT_VERSION_MINOR=$(QT_MINOR_VERSION) -DQT_VERSION_PATCH=$(QT_PATCH_VERSION) \ -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL \ -DQT_NO_FOREACH -DUNICODE diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 34975f2b7b..1093d9849e 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -1216,6 +1216,7 @@ VCLinkerTool::VCLinkerTool() : DataExecutionPrevention(unset), EnableCOMDATFolding(optFoldingDefault), GenerateDebugInformation(unset), + DebugInfoOption(linkerDebugOptionNone), GenerateMapFile(unset), HeapCommitSize(-1), HeapReserveSize(-1), diff --git a/src/3rdparty/gradle/LICENSE-GRADLEW.txt b/src/3rdparty/gradle/LICENSE-GRADLEW.txt new file mode 100644 index 0000000000..0f3f8864f6 --- /dev/null +++ b/src/3rdparty/gradle/LICENSE-GRADLEW.txt @@ -0,0 +1,965 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + +============================================================================== +Gradle Subcomponents: + +------------------------------------------------------------------------------ +License for the slf4j package +------------------------------------------------------------------------------ +SLF4J License + +Copyright (c) 2004-2007 QOS.ch +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +These terms are identical to those of the MIT License, also called the X License or the X11 License, +which is a simple, permissive non-copyleft free software license. It is deemed compatible with virtually +all types of licenses, commercial or otherwise. In particular, the Free Software Foundation has declared it +compatible with GNU GPL. It is also known to be approved by the Apache Software Foundation as compatible +with Apache Software License. + + +------------------------------------------------------------------------------ +License for the JUnit package +------------------------------------------------------------------------------ +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC +LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM +CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and + +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and are +distributed by that particular Contributor. A Contribution 'originates' from a +Contributor if it was added to the Program by such Contributor itself or anyone +acting on such Contributor's behalf. Contributions do not include additions to +the Program which: (i) are separate modules of software distributed in +conjunction with the Program under their own license agreement, and (ii) are not +derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are +necessarily infringed by the use or sale of its Contribution alone or when +combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, +including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide, royalty-free copyright license to +reproduce, prepare derivative works of, publicly display, publicly perform, +distribute and sublicense the Contribution of such Contributor, if any, and such +derivative works, in source code and object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed +Patents to make, use, sell, offer to sell, import and otherwise transfer the +Contribution of such Contributor, if any, in source code and object code form. +This patent license shall apply to the combination of the Contribution and the +Program if, at the time the Contribution is added by the Contributor, such +addition of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other combinations +which include the Contribution. No hardware per se is licensed hereunder. + +c) Recipient understands that although each Contributor grants the licenses +to its Contributions set forth herein, no assurances are provided by any +Contributor that the Program does not infringe the patent or other intellectual +property rights of any other entity. Each Contributor disclaims any liability to +Recipient for claims brought by any other entity based on infringement of +intellectual property rights or otherwise. As a condition to exercising the +rights and licenses granted hereunder, each Recipient hereby assumes sole +responsibility to secure any other intellectual property rights needed, if any. +For example, if a third party patent license is required to allow Recipient to +distribute the Program, it is Recipient's responsibility to acquire that license +before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright license set +forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its +own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties and +conditions, express and implied, including warranties or conditions of title and +non-infringement, and implied warranties or conditions of merchantability and +fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability for +damages, including direct, indirect, special, incidental and consequential +damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are offered +by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable manner on or +through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the +Program. + +Each Contributor must identify itself as the originator of its Contribution, if +any, in a manner that reasonably allows subsequent Recipients to identify the +originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with +respect to end users, business partners and the like. While this license is +intended to facilitate the commercial use of the Program, the Contributor who +includes the Program in a commercial product offering should do so in a manner +which does not create potential liability for other Contributors. Therefore, if +a Contributor includes the Program in a commercial product offering, such +Contributor ("Commercial Contributor") hereby agrees to defend and indemnify +every other Contributor ("Indemnified Contributor") against any losses, damages +and costs (collectively "Losses") arising from claims, lawsuits and other legal +actions brought by a third party against the Indemnified Contributor to the +extent caused by the acts or omissions of such Commercial Contributor in +connection with its distribution of the Program in a commercial product +offering. The obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In order +to qualify, an Indemnified Contributor must: a) promptly notify the Commercial +Contributor in writing of such claim, and b) allow the Commercial Contributor to +control, and cooperate with the Commercial Contributor in, the defense and any +related settlement negotiations. The Indemnified Contributor may participate in +any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product +offering, Product X. That Contributor is then a Commercial Contributor. If that +Commercial Contributor then makes performance claims, or offers warranties +related to Product X, those performance claims and warranties are such +Commercial Contributor's responsibility alone. Under this section, the +Commercial Contributor would have to defend claims against the other +Contributors related to those performance claims and warranties, and if a court +requires any other Contributor to pay any damages as a result, the Commercial +Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR +IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, +NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each +Recipient is solely responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its exercise of +rights under this Agreement, including but not limited to the risks and costs of +program errors, compliance with applicable laws, damage to or loss of data, +programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY +CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST +PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS +GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable +law, it shall not affect the validity or enforceability of the remainder of the +terms of this Agreement, and without further action by the parties hereto, such +provision shall be reformed to the minimum extent necessary to make such +provision valid and enforceable. + +If Recipient institutes patent litigation against a Contributor with respect to +a patent applicable to software (including a cross-claim or counterclaim in a +lawsuit), then any patent licenses granted by that Contributor to such Recipient +under this Agreement shall terminate as of the date such litigation is filed. In +addition, if Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that the Program +itself (excluding combinations of the Program with other software or hardware) +infringes such Recipient's patent(s), then such Recipient's rights granted under +Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to +comply with any of the material terms or conditions of this Agreement and does +not cure such failure in a reasonable period of time after becoming aware of +such noncompliance. If all Recipient's rights under this Agreement terminate, +Recipient agrees to cease use and distribution of the Program as soon as +reasonably practicable. However, Recipient's obligations under this Agreement +and any licenses granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in +order to avoid inconsistency the Agreement is copyrighted and may only be +modified in the following manner. The Agreement Steward reserves the right to +publish new versions (including revisions) of this Agreement from time to time. +No one other than the Agreement Steward has the right to modify this Agreement. +IBM is the initial Agreement Steward. IBM may assign the responsibility to serve +as the Agreement Steward to a suitable separate entity. Each new version of the +Agreement will be given a distinguishing version number. The Program (including +Contributions) may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the Agreement +is published, Contributor may elect to distribute the Program (including its +Contributions) under the new version. Except as expressly stated in Sections +2(a) and 2(b) above, Recipient receives no rights or licenses to the +intellectual property of any Contributor under this Agreement, whether +expressly, by implication, estoppel or otherwise. All rights in the Program not +expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the +intellectual property laws of the United States of America. No party to this +Agreement will bring a legal action under this Agreement more than one year +after the cause of action arose. Each party waives its rights to a jury trial in +any resulting litigation. + +------------------------------------------------------------------------------ +License for the JCIFS package +------------------------------------------------------------------------------ +JCIFS License + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + diff --git a/src/3rdparty/gradle/gradle.pro b/src/3rdparty/gradle/gradle.pro new file mode 100644 index 0000000000..bad41e3468 --- /dev/null +++ b/src/3rdparty/gradle/gradle.pro @@ -0,0 +1,23 @@ +CONFIG -= qt android_install + +gradle.files = \ + $$PWD/gradlew \ + $$PWD/gradlew.bat \ + $$PWD/gradle + +gradle.path = $$[QT_INSTALL_PREFIX]/src/3rdparty/gradle + +INSTALLS += gradle + +!prefix_build:!equals(OUT_PWD, $$PWD) { + RETURN = $$escape_expand(\\n\\t) + equals(QMAKE_HOST.os, Windows) { + RETURN = $$escape_expand(\\r\\n\\t) + } + OUT_PATH = $$shell_path($$OUT_PWD) + + QMAKE_POST_LINK += \ + $${QMAKE_COPY} $$shell_path($$PWD/gradlew) $$OUT_PATH $$RETURN \ + $${QMAKE_COPY} $$shell_path($$PWD/gradlew.bat) $$OUT_PATH $$RETURN \ + $${QMAKE_COPY_DIR} $$shell_path($$PWD/gradle) $$OUT_PATH +} diff --git a/src/3rdparty/gradle/gradle/wrapper/gradle-wrapper.jar b/src/3rdparty/gradle/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..2b338a935b Binary files /dev/null and b/src/3rdparty/gradle/gradle/wrapper/gradle-wrapper.jar differ diff --git a/src/3rdparty/gradle/gradle/wrapper/gradle-wrapper.properties b/src/3rdparty/gradle/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..4244097b7b --- /dev/null +++ b/src/3rdparty/gradle/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Feb 20 10:43:22 EST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-bin.zip diff --git a/src/3rdparty/gradle/gradlew b/src/3rdparty/gradle/gradlew new file mode 100755 index 0000000000..eeff5ccf0e --- /dev/null +++ b/src/3rdparty/gradle/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="-Xmx1024m -Dfile.encoding=UTF-8" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save ( ) { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/src/3rdparty/gradle/gradlew.bat b/src/3rdparty/gradle/gradlew.bat new file mode 100644 index 0000000000..65b35a4602 --- /dev/null +++ b/src/3rdparty/gradle/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS=-Xmx1024m -Dfile.encoding=UTF-8 + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/src/3rdparty/gradle/qt_attribution.json b/src/3rdparty/gradle/qt_attribution.json new file mode 100644 index 0000000000..3545af0f0c --- /dev/null +++ b/src/3rdparty/gradle/qt_attribution.json @@ -0,0 +1,13 @@ +{ + "Id": "android-gradle-wrapper", + "Name": "Gradle wrapper", + "Homepage": "https://gradle.org", + "Version": "3.4.1", + "DownloadLocation": "https://github.com/gradle/gradle/releases/tag/v3.4.1", + "QtUsage": "Needed to create Android packages", + + "License": "Apache License 2.0", + "LicenseId": "Apache-2.0", + "LicenseFile": "LICENSE-GRADLEW.txt", + "Copyright": "Copyright (C) 2017 Gradle Inc." +} diff --git a/src/android/templates/build.gradle b/src/android/templates/build.gradle index ef416b0b88..dbe841255d 100644 --- a/src/android/templates/build.gradle +++ b/src/android/templates/build.gradle @@ -4,7 +4,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:1.1.0' + classpath 'com.android.tools.build:gradle:2.2.0' } } diff --git a/src/corelib/arch/qatomic_cxx11.h b/src/corelib/arch/qatomic_cxx11.h index 63b23b71ab..484ec73e7f 100644 --- a/src/corelib/arch/qatomic_cxx11.h +++ b/src/corelib/arch/qatomic_cxx11.h @@ -278,7 +278,7 @@ template struct QAtomicOps template static bool testAndSetRelaxed(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW { - bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_relaxed); + bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_relaxed, std::memory_order_relaxed); if (currentValue) *currentValue = expectedValue; return tmp; @@ -287,7 +287,7 @@ template struct QAtomicOps template static bool testAndSetAcquire(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW { - bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acquire); + bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acquire, std::memory_order_acquire); if (currentValue) *currentValue = expectedValue; return tmp; @@ -296,7 +296,7 @@ template struct QAtomicOps template static bool testAndSetRelease(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW { - bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_release); + bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_release, std::memory_order_relaxed); if (currentValue) *currentValue = expectedValue; return tmp; @@ -305,7 +305,7 @@ template struct QAtomicOps template static bool testAndSetOrdered(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW { - bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acq_rel); + bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acq_rel, std::memory_order_acquire); if (currentValue) *currentValue = expectedValue; return tmp; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index c44e95a84b..cd60774ee6 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1168,8 +1168,8 @@ and Windows) the window will take a modified appearance. This flag is set or cleared by QWidget::setWindowModified(). - \value WA_WindowPropagation Makes a toplevel window inherit font and - palette from its parent. + \value WA_WindowPropagation Makes a toplevel window inherit font, palette + and locale from its parent. \value WA_MacAlwaysShowToolWindow On \macos, show the tool window even when the application is not active. By default, all tool windows are diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index bfb91c131f..6d144cb65d 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -2105,11 +2105,11 @@ Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &name, bool all return name; int i = len - 1; - QVarLengthArray outVector(len); + QVarLengthArray outVector(len); int used = len; - QChar *out = outVector.data(); - const QChar *p = name.unicode(); - const QChar *prefix = p; + ushort *out = outVector.data(); + const ushort *p = name.utf16(); + const ushort *prefix = p; int up = 0; const int prefixLength = rootLength(name, allowUncPaths); @@ -2117,39 +2117,39 @@ Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &name, bool all i -= prefixLength; // replicate trailing slash (i > 0 checks for emptiness of input string p) - if (i > 0 && p[i].unicode() == '/') { - out[--used].unicode() = '/'; + if (i > 0 && p[i] == '/') { + out[--used] = '/'; --i; } while (i >= 0) { // remove trailing slashes - if (p[i].unicode() == '/') { + if (p[i] == '/') { --i; continue; } // remove current directory - if (p[i].unicode() == '.' && (i == 0 || p[i-1].unicode() == '/')) { + if (p[i] == '.' && (i == 0 || p[i-1] == '/')) { --i; continue; } // detect up dir - if (i >= 1 && p[i].unicode() == '.' && p[i-1].unicode() == '.' - && (i == 1 || (i >= 2 && p[i-2].unicode() == '/'))) { + if (i >= 1 && p[i] == '.' && p[i-1] == '.' + && (i == 1 || (i >= 2 && p[i-2] == '/'))) { ++up; i -= 2; continue; } // prepend a slash before copying when not empty - if (!up && used != len && out[used].unicode() != '/') - out[--used] = QLatin1Char('/'); + if (!up && used != len && out[used] != '/') + out[--used] = '/'; // skip or copy while (i >= 0) { - if (p[i].unicode() == '/') { // do not copy slashes + if (p[i] == '/') { // do not copy slashes --i; break; } @@ -2171,17 +2171,17 @@ Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &name, bool all // add remaining '..' while (up) { - if (used != len && out[used].unicode() != '/') // is not empty and there isn't already a '/' - out[--used] = QLatin1Char('/'); - out[--used] = QLatin1Char('.'); - out[--used] = QLatin1Char('.'); + if (used != len && out[used] != '/') // is not empty and there isn't already a '/' + out[--used] = '/'; + out[--used] = '.'; + out[--used] = '.'; --up; } bool isEmpty = used == len; if (prefixLength) { - if (!isEmpty && out[used].unicode() == '/') { + if (!isEmpty && out[used] == '/') { // Eventhough there is a prefix the out string is a slash. This happens, if the input // string only consists of a prefix followed by one or more slashes. Just skip the slash. ++used; @@ -2192,18 +2192,19 @@ Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &name, bool all if (isEmpty) { // After resolving the input path, the resulting string is empty (e.g. "foo/.."). Return // a dot in that case. - out[--used] = QLatin1Char('.'); - } else if (out[used].unicode() == '/') { + out[--used] = '.'; + } else if (out[used] == '/') { // After parsing the input string, out only contains a slash. That happens whenever all // parts are resolved and there is a trailing slash ("./" or "foo/../" for example). // Prepend a dot to have the correct return value. - out[--used] = QLatin1Char('.'); + out[--used] = '.'; } } // If path was not modified return the original value - QString ret = (used == 0 ? name : QString(out + used, len - used)); - return ret; + if (used == 0) + return name; + return QString::fromUtf16(out + used, len - used); } static QString qt_cleanPath(const QString &path, bool *ok) diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index ff77278dc1..4be4e893b3 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -688,6 +688,19 @@ QDateTime QFSFileEngine::fileTime(FileTime time) const uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFlags flags) { +#if (defined(Q_OS_LINUX) || defined(Q_OS_ANDROID)) && Q_PROCESSOR_WORDSIZE == 4 + // The Linux mmap2 system call on 32-bit takes a page-shifted 32-bit + // integer so the maximum offset is 1 << (32+12) (the shift is always 12, + // regardless of the actual page size). Unfortunately, the mmap64() + // function is known to be broken in all Linux libcs (glibc, uclibc, musl + // and Bionic): all of them do the right shift, but don't confirm that the + // result fits into the 32-bit parameter to the kernel. + + static qint64 MaxFileOffset = (Q_INT64_C(1) << (32+12)) - 1; +#else + static qint64 MaxFileOffset = std::numeric_limits::max(); +#endif + Q_Q(QFSFileEngine); Q_UNUSED(flags); if (openMode == QIODevice::NotOpen) { @@ -695,7 +708,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla return 0; } - if (offset < 0 || offset != qint64(QT_OFF_T(offset)) + if (offset < 0 || offset > MaxFileOffset || size < 0 || quint64(size) > quint64(size_t(-1))) { q->setError(QFile::UnspecifiedError, qt_error_string(int(EINVAL))); return 0; diff --git a/src/corelib/io/qlockfile.cpp b/src/corelib/io/qlockfile.cpp index cb1ff93ad3..48317d07e0 100644 --- a/src/corelib/io/qlockfile.cpp +++ b/src/corelib/io/qlockfile.cpp @@ -44,6 +44,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -226,6 +227,8 @@ bool QLockFile::tryLock(int timeout) return false; case LockFailedError: if (!d->isLocked && d->isApparentlyStale()) { + if (Q_UNLIKELY(QFileInfo(d->fileName).lastModified() > QDateTime::currentDateTime())) + qInfo("QLockFile: Lock file '%ls' has a modification time in the future", qUtf16Printable(d->fileName)); // Stale lock from another thread/process // Ensure two processes don't remove it at the same time QLockFile rmlock(d->fileName + QLatin1String(".rmlock")); diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index 3a80014c00..5a02741727 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -247,7 +247,7 @@ bool QLockFilePrivate::isApparentlyStale() const } } const qint64 age = QFileInfo(fileName).lastModified().msecsTo(QDateTime::currentDateTime()); - return staleLockTime > 0 && age > staleLockTime; + return staleLockTime > 0 && qAbs(age) > staleLockTime; } QString QLockFilePrivate::processNameByPid(qint64 pid) diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp index baaff8da17..4b43181686 100644 --- a/src/corelib/io/qlockfile_win.cpp +++ b/src/corelib/io/qlockfile_win.cpp @@ -160,7 +160,7 @@ bool QLockFilePrivate::isApparentlyStale() const Q_UNUSED(appname); #endif // Q_OS_WINRT const qint64 age = QFileInfo(fileName).lastModified().msecsTo(QDateTime::currentDateTime()); - return staleLockTime > 0 && age > staleLockTime; + return staleLockTime > 0 && qAbs(age) > staleLockTime; } QString QLockFilePrivate::processNameByPid(qint64 pid) diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm index a293d4862f..e25339a7d1 100644 --- a/src/corelib/io/qstandardpaths_mac.mm +++ b/src/corelib/io/qstandardpaths_mac.mm @@ -204,13 +204,14 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) CFBundleRef mainBundle = CFBundleGetMainBundle(); if (mainBundle) { CFURLRef bundleUrl = CFBundleCopyBundleURL(mainBundle); - CFStringRef cfBundlePath = CFURLCopyPath(bundleUrl); + CFStringRef cfBundlePath = CFURLCopyFileSystemPath(bundleUrl, kCFURLPOSIXPathStyle); QString bundlePath = QString::fromCFString(cfBundlePath); CFRelease(cfBundlePath); CFRelease(bundleUrl); CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(mainBundle); - CFStringRef cfResourcesPath = CFURLCopyPath(resourcesUrl); + CFStringRef cfResourcesPath = CFURLCopyFileSystemPath(resourcesUrl, + kCFURLPOSIXPathStyle); QString resourcesPath = QString::fromCFString(cfResourcesPath); CFRelease(cfResourcesPath); CFRelease(resourcesUrl); diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index 7974dc8cca..f0ff46fe7f 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -117,7 +117,7 @@ QString QStandardPaths::writableLocation(StandardLocation type) } case RuntimeLocation: { - const uid_t myUid = geteuid(); + const uint myUid = uint(geteuid()); // http://standards.freedesktop.org/basedir-spec/latest/ QFileInfo fileInfo; QString xdgRuntimeDir = QFile::decodeName(qgetenv("XDG_RUNTIME_DIR")); diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index fcc7b8ca50..b9c9883609 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -503,6 +503,8 @@ static QByteArray extractSubvolume(const QStorageIterator &it) // if we didn't find the subvolume name, return the subvolume ID return id; } +#else + Q_UNUSED(it); #endif return QByteArray(); } diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 18ad59f1cb..b5772b5ce2 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -4169,12 +4169,15 @@ QUrl QUrl::fromUserInput(const QString &userInput, const QString &workingDirecto return url; } + const QFileInfo fileInfo(QDir(workingDirectory), userInput); + if (fileInfo.exists()) { + return QUrl::fromLocalFile(fileInfo.absoluteFilePath()); + } + QUrl url = QUrl(userInput, QUrl::TolerantMode); // Check both QUrl::isRelative (to detect full URLs) and QDir::isAbsolutePath (since on Windows drive letters can be interpreted as schemes) - if (url.isRelative() && !QDir::isAbsolutePath(userInput)) { - QFileInfo fileInfo(QDir(workingDirectory), userInput); - if ((options & AssumeLocalFile) || fileInfo.exists()) - return QUrl::fromLocalFile(fileInfo.absoluteFilePath()); + if ((options & AssumeLocalFile) && url.isRelative() && !QDir::isAbsolutePath(userInput)) { + return QUrl::fromLocalFile(fileInfo.absoluteFilePath()); } return fromUserInput(trimmedString); diff --git a/src/corelib/json/qjsonwriter.cpp b/src/corelib/json/qjsonwriter.cpp index b1544c749d..12ce20ef09 100644 --- a/src/corelib/json/qjsonwriter.cpp +++ b/src/corelib/json/qjsonwriter.cpp @@ -38,6 +38,7 @@ ** ****************************************************************************/ +#include #include #include "qjsonwriter_p.h" #include "qjson_p.h" @@ -129,10 +130,12 @@ static void valueToJson(const QJsonPrivate::Base *b, const QJsonPrivate::Value & break; case QJsonValue::Double: { const double d = v.toDouble(b); - if (qIsFinite(d)) // +2 to format to ensure the expected precision - json += QByteArray::number(d, 'g', QLocale::FloatingPointShortest); - else + if (qIsFinite(d)) { // +2 to format to ensure the expected precision + const double abs = std::abs(d); + json += QByteArray::number(d, abs == static_cast(abs) ? 'f' : 'g', QLocale::FloatingPointShortest); + } else { json += "null"; // +INF || -INF || NaN (see RFC4627#section2.4) + } break; } case QJsonValue::String: diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 461fbd7840..0e6ff17b8f 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -175,6 +175,9 @@ unix|integrity { SOURCES += kernel/qsharedmemory_android.cpp \ kernel/qsystemsemaphore_android.cpp } + + # This is needed by QMetaType::typeName array implementation + integrity: QMAKE_CXXFLAGS += --pending_instantiations=128 } vxworks { diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 64e73d23c5..4efc38ac89 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -216,6 +216,7 @@ QT_BEGIN_NAMESPACE \omitvalue OkRequest \value TabletEnterProximity Wacom tablet enter proximity event (QTabletEvent), sent to QApplication. \value TabletLeaveProximity Wacom tablet leave proximity event (QTabletEvent), sent to QApplication. + \value TabletTrackingChange The Wacom tablet tracking state has changed (since Qt 5.9). \omitvalue ThemeChange \value ThreadChange The object is moved to another thread. This is the last event sent to this object in the previous thread. See QObject::moveToThread(). \value Timer Regular timer events (QTimerEvent). diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 79146dac34..74fa2d8d50 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -407,7 +407,9 @@ void QEventDispatcherWin32Private::unregisterTimer(WinTimerInfo *t) } else if (internalHwnd) { KillTimer(internalHwnd, t->timerId); } - delete t; + t->timerId = -1; + if (!t->inTimerEvent) + delete t; } void QEventDispatcherWin32Private::sendTimerEvent(int timerId) @@ -424,8 +426,9 @@ void QEventDispatcherWin32Private::sendTimerEvent(int timerId) QCoreApplication::sendEvent(t->obj, &e); // timer could have been removed - t = timerDict.value(timerId); - if (t) { + if (t->timerId == -1) { + delete t; + } else { t->inTimerEvent = false; } } @@ -1013,8 +1016,10 @@ bool QEventDispatcherWin32::event(QEvent *e) QTimerEvent te(zte->timerId()); QCoreApplication::sendEvent(t->obj, &te); - t = d->timerDict.value(zte->timerId()); - if (t) { + // timer could have been removed + if (t->timerId == -1) { + delete t; + } else { if (t->interval == 0 && t->inTimerEvent) { // post the next zero timer event as long as the timer was not restarted QCoreApplication::postEvent(this, new QZeroTimerEvent(zte->timerId())); diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 38e0d6055c..fc8d7dcfea 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -1341,7 +1341,6 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data) case QMetaType::UnknownType: case QMetaType::Void: case QMetaType::VoidStar: - case QMetaType::Nullptr: case QMetaType::QObjectStar: case QMetaType::QModelIndex: case QMetaType::QPersistentModelIndex: @@ -1350,6 +1349,8 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data) case QMetaType::QJsonArray: case QMetaType::QJsonDocument: return false; + case QMetaType::Nullptr: + return true; case QMetaType::Long: stream << qlonglong(*static_cast(data)); break; @@ -1563,7 +1564,6 @@ bool QMetaType::load(QDataStream &stream, int type, void *data) case QMetaType::UnknownType: case QMetaType::Void: case QMetaType::VoidStar: - case QMetaType::Nullptr: case QMetaType::QObjectStar: case QMetaType::QModelIndex: case QMetaType::QPersistentModelIndex: @@ -1572,6 +1572,8 @@ bool QMetaType::load(QDataStream &stream, int type, void *data) case QMetaType::QJsonArray: case QMetaType::QJsonDocument: return false; + case QMetaType::Nullptr: + return true; case QMetaType::Long: { qlonglong l; stream >> l; diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index db440390c1..085adb1859 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -642,9 +642,9 @@ QT_BEGIN_NAMESPACE Constructs a QChar corresponding to ASCII/Latin-1 character \a ch. \note This constructor is not available when \c QT_NO_CAST_FROM_ASCII - is defined. + or QT_RESTRICTED_CAST_FROM_ASCII is defined. - \sa QT_NO_CAST_FROM_ASCII + \sa QT_NO_CAST_FROM_ASCII, QT_RESTRICTED_CAST_FROM_ASCII */ /*! diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h index 8509e2e182..a1d31f6a68 100644 --- a/src/corelib/tools/qchar.h +++ b/src/corelib/tools/qchar.h @@ -585,17 +585,21 @@ Q_DECL_CONSTEXPR inline bool operator>=(QChar c1, QChar c2) Q_DECL_NOTHROW { ret Q_DECL_CONSTEXPR inline bool operator> (QChar c1, QChar c2) Q_DECL_NOTHROW { return operator< (c2, c1); } Q_DECL_CONSTEXPR inline bool operator<=(QChar c1, QChar c2) Q_DECL_NOTHROW { return !operator< (c2, c1); } -// disambiguate QChar == int (but only that, so constrain template to exactly 'int'): -template -Q_DECL_DEPRECATED_X("don't compare ints to QChars, compare them to QChar::unicode() instead") -Q_DECL_CONSTEXPR inline -typename std::enable_if::type, int>::value, bool>::type -operator==(QChar lhs, T rhs) Q_DECL_NOEXCEPT { return lhs == QChar(rhs); } -template -Q_DECL_DEPRECATED_X("don't compare ints to QChars, compare them to QChar::unicode() instead") -Q_DECL_CONSTEXPR inline -typename std::enable_if::type, int>::value, bool>::type -operator!=(QChar lhs, T rhs) Q_DECL_NOEXCEPT { return lhs != QChar(rhs); } + +Q_DECL_CONSTEXPR inline bool operator==(QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return lhs.isNull(); } +Q_DECL_CONSTEXPR inline bool operator< (QChar, std::nullptr_t) Q_DECL_NOTHROW { return false; } +Q_DECL_CONSTEXPR inline bool operator==(std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return rhs.isNull(); } +Q_DECL_CONSTEXPR inline bool operator< (std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return !rhs.isNull(); } + +Q_DECL_CONSTEXPR inline bool operator!=(QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return !operator==(lhs, nullptr); } +Q_DECL_CONSTEXPR inline bool operator>=(QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return !operator< (lhs, nullptr); } +Q_DECL_CONSTEXPR inline bool operator> (QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return operator< (nullptr, lhs); } +Q_DECL_CONSTEXPR inline bool operator<=(QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return !operator< (nullptr, lhs); } + +Q_DECL_CONSTEXPR inline bool operator!=(std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return !operator==(nullptr, rhs); } +Q_DECL_CONSTEXPR inline bool operator>=(std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return !operator< (nullptr, rhs); } +Q_DECL_CONSTEXPR inline bool operator> (std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return operator< (rhs, nullptr); } +Q_DECL_CONSTEXPR inline bool operator<=(std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return !operator< (rhs, nullptr); } #ifndef QT_NO_DATASTREAM Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, QChar); diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index c8aa4fbc89..62dd25e072 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -1243,6 +1243,49 @@ end: #endif // QT_NO_DATESTRING #ifndef QT_NO_TEXTDATE + +/* + \internal + \brief Returns the index in \a entries with the best prefix match to \a text + + Scans \a entries looking for an entry overlapping \a text as much as possible + (an exact match beats any prefix match; a match of the full entry as prefix of + text beats any entry but one matching a longer prefix; otherwise, the match of + longest prefix wins, earlier entries beating later on a draw). Records the + length of overlap in *used (if \a used is non-NULL) and the first entry that + overlapped this much in *usedText (if \a usedText is non-NULL). + */ +static int findTextEntry(const QString &text, const QVector &entries, QString *usedText, int *used) +{ + if (text.isEmpty()) + return -1; + + int bestMatch = -1; + int bestCount = 0; + for (int n = 0; n < entries.size(); ++n) + { + const QString &name = entries.at(n); + + const int limit = qMin(text.size(), name.size()); + int i = 0; + while (i < limit && text.at(i) == name.at(i).toLower()) + ++i; + // Full match beats an equal prefix match: + if (i > bestCount || (i == bestCount && i == name.size())) { + bestCount = i; + bestMatch = n; + if (i == name.size() && i == text.size()) + break; // Exact match, name == text, wins. + } + } + if (usedText && bestMatch != -1) + *usedText = entries.at(bestMatch); + if (used) + *used = bestCount; + + return bestMatch; +} + /*! \internal finds the first possible monthname that \a str1 can @@ -1252,99 +1295,40 @@ end: int QDateTimeParser::findMonth(const QString &str1, int startMonth, int sectionIndex, QString *usedMonth, int *used) const { - int bestMatch = -1; - int bestCount = 0; - if (!str1.isEmpty()) { - const SectionNode &sn = sectionNode(sectionIndex); - if (sn.type != MonthSection) { - qWarning("QDateTimeParser::findMonth Internal error"); - return -1; - } - - QLocale::FormatType type = sn.count == 3 ? QLocale::ShortFormat : QLocale::LongFormat; - QLocale l = locale(); - - for (int month=startMonth; month<=12; ++month) { - const QString monthName = l.monthName(month, type); - QString str2 = monthName.toLower(); - - if (str1.startsWith(str2)) { - if (used) { - QDTPDEBUG << "used is set to" << str2.size(); - *used = str2.size(); - } - if (usedMonth) - *usedMonth = monthName; - - return month; - } - if (context == FromString) - continue; - - const int limit = qMin(str1.size(), str2.size()); - - QDTPDEBUG << "limit is" << limit << str1 << str2; - bool equal = true; - for (int i=0; i bestCount) { - bestCount = i; - bestMatch = month; - } - break; - } - } - if (equal) { - if (used) - *used = limit; - if (usedMonth) - *usedMonth = monthName; - return month; - } - } - if (usedMonth && bestMatch != -1) - *usedMonth = l.monthName(bestMatch, type); + const SectionNode &sn = sectionNode(sectionIndex); + if (sn.type != MonthSection) { + qWarning("QDateTimeParser::findMonth Internal error"); + return -1; } - if (used) { - QDTPDEBUG << "used is set to" << bestCount; - *used = bestCount; - } - return bestMatch; + + QLocale::FormatType type = sn.count == 3 ? QLocale::ShortFormat : QLocale::LongFormat; + QLocale l = locale(); + QVector monthNames; + monthNames.reserve(13 - startMonth); + for (int month = startMonth; month <= 12; ++month) + monthNames.append(l.monthName(month, type)); + + const int index = findTextEntry(str1, monthNames, usedMonth, used); + return index < 0 ? index : index + startMonth; } int QDateTimeParser::findDay(const QString &str1, int startDay, int sectionIndex, QString *usedDay, int *used) const { - int bestMatch = -1; - int bestCount = 0; - if (!str1.isEmpty()) { - const SectionNode &sn = sectionNode(sectionIndex); - if (!(sn.type & DaySectionMask)) { - qWarning("QDateTimeParser::findDay Internal error"); - return -1; - } - const QLocale l = locale(); - for (int day=startDay; day<=7; ++day) { - const QString dayName = l.dayName(day, sn.count == 4 ? QLocale::LongFormat : QLocale::ShortFormat); - const QString str2 = dayName.toLower(); - - const int limit = qMin(str1.size(), str2.size()); - int i = 0; - while (i < limit && str1.at(i) == str2.at(i)) - ++i; - if (i > bestCount) { - bestCount = i; - bestMatch = day; - } - } - if (usedDay && bestMatch != -1) { - *usedDay = l.dayName(bestMatch, sn.count == 4 ? QLocale::LongFormat : QLocale::ShortFormat); - } + const SectionNode &sn = sectionNode(sectionIndex); + if (!(sn.type & DaySectionMask)) { + qWarning("QDateTimeParser::findDay Internal error"); + return -1; } - if (used) - *used = bestCount; - return bestMatch; + QLocale::FormatType type = sn.count == 4 ? QLocale::LongFormat : QLocale::ShortFormat; + QLocale l = locale(); + QVector daysOfWeek; + daysOfWeek.reserve(8 - startDay); + for (int day = startDay; day <= 7; ++day) + daysOfWeek.append(l.dayName(day, type)); + + const int index = findTextEntry(str1, daysOfWeek, usedDay, used); + return index < 0 ? index : index + startDay; } #endif // QT_NO_TEXTDATE diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 9270539f4f..334bd52f1e 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -325,7 +325,7 @@ static uint qt_create_qhash_seed() /* The QHash seed itself. */ -Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed = Q_BASIC_ATOMIC_INITIALIZER(-1); +static QBasicAtomicInt qt_qhash_seed = Q_BASIC_ATOMIC_INITIALIZER(-1); /*! \internal diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 66b5e75a1a..c59f789cb2 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -432,6 +432,7 @@ public: typedef const Key *pointer; typedef const Key &reference; + key_iterator() = default; explicit key_iterator(const_iterator o) : i(o) { } const Key &operator*() const { return i.key(); } diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index e6da2820f8..3ee6ab8c58 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -531,6 +531,7 @@ public: typedef const Key *pointer; typedef const Key &reference; + key_iterator() = default; explicit key_iterator(const_iterator o) : i(o) { } const Key &operator*() const { return i.key(); } diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index c73d6bfa43..9879d55967 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -357,6 +357,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray::realloc(int asize, int a int osize = s; const int copySize = qMin(asize, osize); + Q_ASSUME(copySize >= 0); if (aalloc != a) { if (aalloc > Prealloc) { T* newPtr = reinterpret_cast(malloc(aalloc * sizeof(T))); diff --git a/src/gui/configure.json b/src/gui/configure.json index 5163045343..91e6bebc7f 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -164,7 +164,9 @@ { "libs": "-llibpng", "condition": "config.msvc" }, { "libs": "-lpng", "condition": "!config.msvc" } ], - "use": "zlib" + "use": [ + { "lib": "zlib", "condition": "features.system-zlib" } + ] }, "mirclient": { "label": "Mir client libraries", @@ -703,6 +705,7 @@ "label": " Using system libpng", "disable": "input.libpng == 'qt'", "enable": "input.libpng == 'system'", + "autoDetect": "features.system-zlib", "condition": "features.png && libs.libpng", "output": [ "privateFeature" ] }, diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp index 19015c5dcd..155a4f88b4 100644 --- a/src/gui/image/qxbmhandler.cpp +++ b/src/gui/image/qxbmhandler.cpp @@ -143,6 +143,8 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage) return false; } + outImage->fill(Qt::color0); // in case the image data does not cover the full image + outImage->setColorCount(2); outImage->setColor(0, qRgb(255,255,255)); // white outImage->setColor(1, qRgb(0,0,0)); // black diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp index bde0d20ea8..090217187e 100644 --- a/src/gui/kernel/qguivariant.cpp +++ b/src/gui/kernel/qguivariant.cpp @@ -291,6 +291,7 @@ static bool convert(const QVariant::Private *d, int t, default: break; } + break; } #endif #ifndef QT_NO_ICON diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 8471102aee..3f5f71002b 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2735,26 +2735,29 @@ void QWindowPrivate::setCursor(const QCursor *newCursor) cursor = QCursor(Qt::ArrowCursor); hasCursor = false; } - // Only attempt to set cursor and emit signal if there is an actual platform cursor - QScreen* screen = q->screen(); - if (screen && screen->handle()->cursor()) { - applyCursor(); + // Only attempt to emit signal if there is an actual platform cursor + if (applyCursor()) { QEvent event(QEvent::CursorChange); QGuiApplication::sendEvent(q, &event); } } -void QWindowPrivate::applyCursor() +// Apply the cursor and returns true iff the platform cursor exists +bool QWindowPrivate::applyCursor() { Q_Q(QWindow); - if (platformWindow) { - if (QPlatformCursor *platformCursor = q->screen()->handle()->cursor()) { + if (QScreen *screen = q->screen()) { + if (QPlatformCursor *platformCursor = screen->handle()->cursor()) { + if (!platformWindow) + return true; QCursor *c = QGuiApplication::overrideCursor(); if (!c && hasCursor) c = &cursor; platformCursor->changeCursor(c, q); + return true; } } + return false; } #endif // QT_NO_CURSOR diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index e8d5830eee..cffe5b4125 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -121,7 +121,7 @@ public: void maybeQuitOnLastWindowClosed(); #ifndef QT_NO_CURSOR void setCursor(const QCursor *c = 0); - void applyCursor(); + bool applyCursor(); #endif void deliverUpdateRequest(); diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index c2458152a3..72feffda8c 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -82,27 +82,31 @@ QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &host : state(RunningState), networkLayerState(Unknown), hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true) + , activeChannelCount(type == QHttpNetworkConnection::ConnectionTypeHTTP2 #ifndef QT_NO_SSL -, channelCount((type == QHttpNetworkConnection::ConnectionTypeSPDY || type == QHttpNetworkConnection::ConnectionTypeHTTP2) - ? 1 : defaultHttpChannelCount) -#else -, channelCount(type == QHttpNetworkConnection::ConnectionTypeHTTP2 ? 1 : defaultHttpChannelCount) -#endif // QT_NO_SSL + || type == QHttpNetworkConnection::ConnectionTypeSPDY +#endif + ? 1 : defaultHttpChannelCount) + , channelCount(defaultHttpChannelCount) #ifndef QT_NO_NETWORKPROXY , networkProxy(QNetworkProxy::NoProxy) #endif , preConnectRequests(0) , connectionType(type) { + // We allocate all 6 channels even if it's SPDY or HTTP/2 enabled + // connection: in case the protocol negotiation via NPN/ALPN fails, + // we will have normally working HTTP/1.1. + Q_ASSERT(channelCount >= activeChannelCount); channels = new QHttpNetworkConnectionChannel[channelCount]; } -QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName, +QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(quint16 connectionCount, const QString &hostName, quint16 port, bool encrypt, QHttpNetworkConnection::ConnectionType type) : state(RunningState), networkLayerState(Unknown), hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true), - channelCount(channelCount) + activeChannelCount(connectionCount), channelCount(connectionCount) #ifndef QT_NO_NETWORKPROXY , networkProxy(QNetworkProxy::NoProxy) #endif @@ -147,7 +151,7 @@ void QHttpNetworkConnectionPrivate::pauseConnection() state = PausedState; // Disable all socket notifiers - for (int i = 0; i < channelCount; i++) { + for (int i = 0; i < activeChannelCount; i++) { if (channels[i].socket) { #ifndef QT_NO_SSL if (encrypt) @@ -163,7 +167,7 @@ void QHttpNetworkConnectionPrivate::resumeConnection() { state = RunningState; // Enable all socket notifiers - for (int i = 0; i < channelCount; i++) { + for (int i = 0; i < activeChannelCount; i++) { if (channels[i].socket) { #ifndef QT_NO_SSL if (encrypt) @@ -184,7 +188,7 @@ void QHttpNetworkConnectionPrivate::resumeConnection() int QHttpNetworkConnectionPrivate::indexOf(QAbstractSocket *socket) const { - for (int i = 0; i < channelCount; ++i) + for (int i = 0; i < activeChannelCount; ++i) if (channels[i].socket == socket) return i; @@ -210,7 +214,7 @@ bool QHttpNetworkConnectionPrivate::shouldEmitChannelError(QAbstractSocket *sock channels[otherSocket].ensureConnection(); } - if (channelCount == 1) { + if (activeChannelCount < channelCount) { if (networkLayerState == HostLookupPending || networkLayerState == IPv4or6) networkLayerState = QHttpNetworkConnectionPrivate::Unknown; channels[0].close(); @@ -405,7 +409,7 @@ void QHttpNetworkConnectionPrivate::copyCredentials(int fromChannel, QAuthentica // select another channel QAuthenticator* otherAuth = 0; - for (int i = 0; i < channelCount; ++i) { + for (int i = 0; i < activeChannelCount; ++i) { if (i == fromChannel) continue; if (isProxy) @@ -900,7 +904,7 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply) Q_Q(QHttpNetworkConnection); // check if the reply is currently being processed or it is pipelined in - for (int i = 0; i < channelCount; ++i) { + for (int i = 0; i < activeChannelCount; ++i) { // is the reply associated the currently processing of this channel? if (channels[i].reply == reply) { channels[i].reply = 0; @@ -1003,7 +1007,7 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() return; //resend the necessary ones. - for (int i = 0; i < channelCount; ++i) { + for (int i = 0; i < activeChannelCount; ++i) { if (channels[i].resendCurrent && (channels[i].state != QHttpNetworkConnectionChannel::ClosingState)) { channels[i].resendCurrent = false; @@ -1023,7 +1027,7 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() return; // try to get a free AND connected socket - for (int i = 0; i < channelCount; ++i) { + for (int i = 0; i < activeChannelCount; ++i) { if (channels[i].socket) { if (!channels[i].reply && !channels[i].isSocketBusy() && channels[i].socket->state() == QAbstractSocket::ConnectedState) { if (dequeueRequest(channels[i].socket)) @@ -1061,7 +1065,7 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() // return fast if there is nothing to pipeline if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty()) return; - for (int i = 0; i < channelCount; i++) + for (int i = 0; i < activeChannelCount; i++) if (channels[i].socket && channels[i].socket->state() == QAbstractSocket::ConnectedState) fillPipeline(channels[i].socket); @@ -1077,7 +1081,7 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() int normalRequests = queuedRequests - preConnectRequests; neededOpenChannels = qMax(normalRequests, preConnectRequests); } - for (int i = 0; i < channelCount && neededOpenChannels > 0; ++i) { + for (int i = 0; i < activeChannelCount && neededOpenChannels > 0; ++i) { bool connectChannel = false; if (channels[i].socket) { if ((channels[i].socket->state() == QAbstractSocket::ConnectingState) @@ -1107,7 +1111,7 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest() void QHttpNetworkConnectionPrivate::readMoreLater(QHttpNetworkReply *reply) { - for (int i = 0 ; i < channelCount; ++i) { + for (int i = 0 ; i < activeChannelCount; ++i) { if (channels[i].reply == reply) { // emulate a readyRead() from the socket QMetaObject::invokeMethod(&channels[i], "_q_readyRead", Qt::QueuedConnection); @@ -1226,7 +1230,7 @@ void QHttpNetworkConnectionPrivate::_q_hostLookupFinished(const QHostInfo &info) // connection will then be disconnected. void QHttpNetworkConnectionPrivate::startNetworkLayerStateLookup() { - if (channelCount > 1) { + if (activeChannelCount > 1) { // At this time all channels should be unconnected. Q_ASSERT(!channels[0].isSocketBusy()); Q_ASSERT(!channels[1].isSocketBusy()); @@ -1264,7 +1268,7 @@ void QHttpNetworkConnectionPrivate::startNetworkLayerStateLookup() void QHttpNetworkConnectionPrivate::networkLayerDetected(QAbstractSocket::NetworkLayerProtocol protocol) { - for (int i = 0 ; i < channelCount; ++i) { + for (int i = 0 ; i < activeChannelCount; ++i) { if ((channels[i].networkLayerPreference != protocol) && (channels[i].state == QHttpNetworkConnectionChannel::ConnectingState)) { channels[i].close(); } @@ -1361,7 +1365,7 @@ void QHttpNetworkConnection::setCacheProxy(const QNetworkProxy &networkProxy) d->networkProxy = networkProxy; // update the authenticator if (!d->networkProxy.user().isEmpty()) { - for (int i = 0; i < d->channelCount; ++i) { + for (int i = 0; i < d->activeChannelCount; ++i) { d->channels[i].proxyAuthenticator.setUser(d->networkProxy.user()); d->channels[i].proxyAuthenticator.setPassword(d->networkProxy.password()); } @@ -1377,7 +1381,7 @@ QNetworkProxy QHttpNetworkConnection::cacheProxy() const void QHttpNetworkConnection::setTransparentProxy(const QNetworkProxy &networkProxy) { Q_D(QHttpNetworkConnection); - for (int i = 0; i < d->channelCount; ++i) + for (int i = 0; i < d->activeChannelCount; ++i) d->channels[i].setProxy(networkProxy); } @@ -1409,7 +1413,7 @@ void QHttpNetworkConnection::setSslConfiguration(const QSslConfiguration &config return; // set the config on all channels - for (int i = 0; i < d->channelCount; ++i) + for (int i = 0; i < d->activeChannelCount; ++i) d->channels[i].setSslConfiguration(config); } @@ -1432,7 +1436,7 @@ void QHttpNetworkConnection::ignoreSslErrors(int channel) return; if (channel == -1) { // ignore for all channels - for (int i = 0; i < d->channelCount; ++i) { + for (int i = 0; i < d->activeChannelCount; ++i) { d->channels[i].ignoreSslErrors(); } @@ -1448,7 +1452,7 @@ void QHttpNetworkConnection::ignoreSslErrors(const QList &errors, int return; if (channel == -1) { // ignore for all channels - for (int i = 0; i < d->channelCount; ++i) { + for (int i = 0; i < d->activeChannelCount; ++i) { d->channels[i].ignoreSslErrors(errors); } diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index 430c715717..3dd9bde9bd 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -243,6 +243,9 @@ public: bool encrypt; bool delayIpv4; + // Number of channels we are trying to use at the moment: + int activeChannelCount; + // The total number of channels we reserved: const int channelCount; QTimer delayedConnectionTimer; QHttpNetworkConnectionChannel *channels; // parallel connections to the server diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 668409a988..c86cc9d8c9 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -1083,12 +1083,36 @@ void QHttpNetworkConnectionChannel::_q_encrypted() } } Q_FALLTHROUGH(); - case QSslConfiguration::NextProtocolNegotiationNone: + case QSslConfiguration::NextProtocolNegotiationNone: { protocolHandler.reset(new QHttpProtocolHandler(this)); + + QList protocols = sslConfiguration.allowedNextProtocols(); + const int nProtocols = protocols.size(); + // Clear the protocol that we failed to negotiate, so we do not try + // it again on other channels that our connection can create/open. + if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) + protocols.removeAll(QSslConfiguration::ALPNProtocolHTTP2); + else if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY) + protocols.removeAll(QSslConfiguration::NextProtocolSpdy3_0); + + if (nProtocols > protocols.size()) { + sslConfiguration.setAllowedNextProtocols(protocols); + const int channelCount = connection->d_func()->channelCount; + for (int i = 0; i < channelCount; ++i) + connection->d_func()->channels[i].setSslConfiguration(sslConfiguration); + } + connection->setConnectionType(QHttpNetworkConnection::ConnectionTypeHTTP); - // re-queue requests from SPDY queue to HTTP queue, if any - requeueSpdyRequests(); + // We use only one channel for SPDY or HTTP/2, but normally six for + // HTTP/1.1 - let's restore this number to the reserved number of + // channels: + if (connection->d_func()->activeChannelCount < connection->d_func()->channelCount) { + connection->d_func()->activeChannelCount = connection->d_func()->channelCount; + // re-queue requests from SPDY queue to HTTP queue, if any + requeueSpdyRequests(); + } break; + } default: emitFinishedWithError(QNetworkReply::SslHandshakeFailedError, "detected unknown Next Protocol Negotiation protocol"); diff --git a/src/network/network.pro b/src/network/network.pro index 75105bd681..98fbf82275 100644 --- a/src/network/network.pro +++ b/src/network/network.pro @@ -22,16 +22,18 @@ include(ssl/ssl.pri) QMAKE_LIBS += $$QMAKE_LIBS_NETWORK -ANDROID_BUNDLED_JAR_DEPENDENCIES = \ - jar/QtAndroidBearer-bundled.jar -ANDROID_JAR_DEPENDENCIES = \ - jar/QtAndroidBearer.jar -ANDROID_LIB_DEPENDENCIES = \ - plugins/bearer/libqandroidbearer.so -MODULE_PLUGIN_TYPES = \ - bearer -ANDROID_PERMISSIONS += \ - android.permission.ACCESS_NETWORK_STATE +qtConfig(bearermanagement) { + ANDROID_BUNDLED_JAR_DEPENDENCIES = \ + jar/QtAndroidBearer-bundled.jar + ANDROID_JAR_DEPENDENCIES = \ + jar/QtAndroidBearer.jar + ANDROID_LIB_DEPENDENCIES = \ + plugins/bearer/libqandroidbearer.so + MODULE_PLUGIN_TYPES = \ + bearer + ANDROID_PERMISSIONS += \ + android.permission.ACCESS_NETWORK_STATE +} MODULE_WINRT_CAPABILITIES = \ internetClient \ diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index b4109cadb5..84b8f3a8d9 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -326,6 +326,7 @@ #include #include #include +#include #include #include #include @@ -2679,31 +2680,35 @@ QSharedPointer QSslSocketPrivate::sslContext(QSslSocket *socket) bool QSslSocketPrivate::isMatchingHostname(const QSslCertificate &cert, const QString &peerName) { - const QString lowerPeerName = peerName.toLower(); + const QString lowerPeerName = QString::fromLatin1(QUrl::toAce(peerName)); const QStringList commonNames = cert.subjectInfo(QSslCertificate::CommonName); for (const QString &commonName : commonNames) { - if (isMatchingHostname(commonName.toLower(), lowerPeerName)) + if (isMatchingHostname(commonName, lowerPeerName)) return true; } const auto subjectAlternativeNames = cert.subjectAlternativeNames(); const auto altNames = subjectAlternativeNames.equal_range(QSsl::DnsEntry); for (auto it = altNames.first; it != altNames.second; ++it) { - if (isMatchingHostname(it->toLower(), lowerPeerName)) + if (isMatchingHostname(*it, lowerPeerName)) return true; } return false; } +/*! \internal + Checks if the certificate's name \a cn matches the \a hostname. + \a hostname must be normalized in ASCII-Compatible Encoding, but \a cn is not normalized + */ bool QSslSocketPrivate::isMatchingHostname(const QString &cn, const QString &hostname) { int wildcard = cn.indexOf(QLatin1Char('*')); // Check this is a wildcard cert, if not then just compare the strings if (wildcard < 0) - return cn == hostname; + return QLatin1String(QUrl::toAce(cn)) == hostname; int firstCnDot = cn.indexOf(QLatin1Char('.')); int secondCnDot = cn.indexOf(QLatin1Char('.'), firstCnDot+1); @@ -2720,13 +2725,21 @@ bool QSslSocketPrivate::isMatchingHostname(const QString &cn, const QString &hos if (cn.lastIndexOf(QLatin1Char('*')) != wildcard) return false; + // Reject wildcard character embedded within the A-labels or U-labels of an internationalized + // domain name (RFC6125 section 7.2) + if (cn.startsWith(QLatin1String("xn--"), Qt::CaseInsensitive)) + return false; + // Check characters preceding * (if any) match - if (wildcard && (hostname.leftRef(wildcard) != cn.leftRef(wildcard))) + if (wildcard && hostname.leftRef(wildcard).compare(cn.leftRef(wildcard), Qt::CaseInsensitive) != 0) return false; // Check characters following first . match - if (hostname.midRef(hostname.indexOf(QLatin1Char('.'))) != cn.midRef(firstCnDot)) + int hnDot = hostname.indexOf(QLatin1Char('.')); + if (hostname.midRef(hnDot + 1) != cn.midRef(firstCnDot + 1) + && hostname.midRef(hnDot + 1) != QLatin1String(QUrl::toAce(cn.mid(firstCnDot + 1)))) { return false; + } // Check if the hostname is an IP address, if so then wildcards are not allowed QHostAddress addr(hostname); diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index cec61d07c1..aec3437422 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -151,7 +151,8 @@ public: QRegExp::PatternSyntax syntax); static void addDefaultCaCertificate(const QSslCertificate &cert); static void addDefaultCaCertificates(const QList &certs); - static bool isMatchingHostname(const QSslCertificate &cert, const QString &peerName); + Q_AUTOTEST_EXPORT static bool isMatchingHostname(const QSslCertificate &cert, + const QString &peerName); Q_AUTOTEST_EXPORT static bool isMatchingHostname(const QString &cn, const QString &hostname); #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro index 02b3e96bfa..f30bdc4951 100644 --- a/src/plugins/bearer/generic/generic.pro +++ b/src/plugins/bearer/generic/generic.pro @@ -12,7 +12,7 @@ SOURCES += qgenericengine.cpp \ OTHER_FILES += generic.json -win32:!winrt:LIBS += -lIphlpapi +win32:!winrt:LIBS += -liphlpapi PLUGIN_TYPE = bearer PLUGIN_CLASS_NAME = QGenericEnginePlugin diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp index 3b1ce6d21d..eeaecd53b4 100644 --- a/src/plugins/platforms/android/androidjniaccessibility.cpp +++ b/src/plugins/platforms/android/androidjniaccessibility.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include "qdebug.h" @@ -137,7 +138,7 @@ namespace QtAndroidAccessibility QRect rect; QAccessibleInterface *iface = interfaceFromId(objectId); if (iface && iface->isValid()) { - rect = iface->rect(); + rect = QHighDpi::toNativePixels(iface->rect(), iface->window()); } jclass rectClass = env->FindClass("android/graphics/Rect"); @@ -150,11 +151,13 @@ namespace QtAndroidAccessibility { QAccessibleInterface *root = interfaceFromId(-1); if (root) { - QAccessibleInterface *child = root->childAt((int)x, (int)y); + QPoint pos = QHighDpi::fromNativePixels(QPoint(int(x), int(y)), root->window()); + + QAccessibleInterface *child = root->childAt(pos.x(), pos.y()); QAccessibleInterface *lastChild = 0; while (child && (child != lastChild)) { lastChild = child; - child = child->childAt((int)x, (int)y); + child = child->childAt(pos.x(), pos.y()); } if (lastChild) return QAccessible::uniqueId(lastChild); diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 1f681cc1a3..0fabb25233 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -402,11 +402,6 @@ namespace QtAndroid if (surfaceId == -1) return; - QMutexLocker lock(&m_surfacesMutex); - const auto &it = m_surfaces.find(surfaceId); - if (it != m_surfaces.end()) - m_surfaces.remove(surfaceId); - QJNIEnvironmentPrivate env; if (!env) return; @@ -583,14 +578,18 @@ static void setSurface(JNIEnv *env, jobject /*thiz*/, jint id, jobject jSurface, { QMutexLocker lock(&m_surfacesMutex); const auto &it = m_surfaces.find(id); - if (it.value() == nullptr) // This should never happen... - return; - if (it == m_surfaces.end()) { qWarning()<<"Can't find surface" << id; return; } - it.value()->surfaceChanged(env, jSurface, w, h); + auto surfaceClient = it.value(); + if (!surfaceClient) // This should never happen... + return; + + surfaceClient->surfaceChanged(env, jSurface, w, h); + + if (!jSurface) + m_surfaces.erase(it); } static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/, diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index 7368aabf7d..35ac7182af 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -286,7 +286,7 @@ QT_END_NAMESPACE if (qEnvironmentVariableIsEmpty("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM")) { if (QSysInfo::macVersion() >= QSysInfo::MV_10_12) { // Move the application window to front to avoid launching behind the terminal. - // Ignoring other apps is neccessary (we must ignore the terminal), but makes + // Ignoring other apps is necessary (we must ignore the terminal), but makes // Qt apps play slightly less nice with other apps when lanching from Finder // (See the activateIgnoringOtherApps docs.) [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 41a809cdd2..e39d5e4546 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -429,7 +429,7 @@ static QString strippedText(QString s) { // Call this functions if mFileMode, mFileOptions, // mNameFilterDropDownList or mQDirFilter changes. - // The savepanel does not contain the neccessary functions for this. + // The savepanel does not contain the necessary functions for this. const QFileDialogOptions::FileMode fileMode = mOptions->fileMode(); bool chooseFilesOnly = fileMode == QFileDialogOptions::ExistingFile || fileMode == QFileDialogOptions::ExistingFiles; diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 91f408e5c2..9dfcb82151 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -340,7 +340,7 @@ QCocoaIntegration::QCocoaIntegration(const QStringList ¶mList) // from the terminal. On 10.12+ this call has been moved to applicationDidFinishLauching // to work around issues with loss of focus at startup. if (QSysInfo::macVersion() < QSysInfo::MV_10_12) { - // Ignoring other apps is neccessary (we must ignore the terminal), but makes + // Ignoring other apps is necessary (we must ignore the terminal), but makes // Qt apps play slightly less nice with other apps when lanching from Finder // (See the activateIgnoringOtherApps docs.) [cocoaApplication activateIgnoringOtherApps : YES]; diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm index e09bb1e362..f3467fdc73 100644 --- a/src/plugins/platforms/cocoa/qmacclipboard.mm +++ b/src/plugins/platforms/cocoa/qmacclipboard.mm @@ -139,10 +139,22 @@ OSStatus QMacPasteboard::promiseKeeper(PasteboardRef paste, PasteboardItemID id, const long promise_id = (long)id; // Find the kept promise + QList availableConverters + = QMacInternalPasteboardMime::all(QMacInternalPasteboardMime::MIME_ALL); const QString flavorAsQString = QString::fromCFString(flavor); QMacPasteboard::Promise promise; for (int i = 0; i < qpaste->promises.size(); i++){ QMacPasteboard::Promise tmp = qpaste->promises[i]; + if (!availableConverters.contains(tmp.convertor)) { + // promise.converter is a pointer initialized by the value found + // in QMacInternalPasteboardMime's global list of QMacInternalPasteboardMimes. + // We add pointers to this list in QMacInternalPasteboardMime's ctor; + // we remove these pointers in QMacInternalPasteboardMime's dtor. + // If tmp.converter was not found in this list, we probably have a + // dangling pointer so let's skip it. + continue; + } + if (tmp.itemId == promise_id && tmp.convertor->canConvert(tmp.mime, flavorAsQString)){ promise = tmp; break; diff --git a/src/plugins/platforms/eglfs/eglfs-plugin.pro b/src/plugins/platforms/eglfs/eglfs-plugin.pro index 3844328ee0..ec229796e5 100644 --- a/src/plugins/platforms/eglfs/eglfs-plugin.pro +++ b/src/plugins/platforms/eglfs/eglfs-plugin.pro @@ -4,6 +4,9 @@ QT += eglfsdeviceintegration-private CONFIG += egl +# Avoid X11 header collision, use generic EGL native types +DEFINES += QT_EGL_NO_X11 + SOURCES += $$PWD/qeglfsmain.cpp OTHER_FILES += $$PWD/eglfs.json diff --git a/src/plugins/platforms/ios/qiostextinputoverlay.mm b/src/plugins/platforms/ios/qiostextinputoverlay.mm index 78f84729da..9b97ce17bb 100644 --- a/src/plugins/platforms/ios/qiostextinputoverlay.mm +++ b/src/plugins/platforms/ios/qiostextinputoverlay.mm @@ -116,6 +116,11 @@ static void executeBlockWithoutAnimation(Block block) dispatch_async(dispatch_get_main_queue (), ^{ self.visible = YES; }); } }]; + [center addObserverForName:UIKeyboardDidHideNotification object:nil queue:nil + usingBlock:^(NSNotification *) { + self.visible = NO; + }]; + } return self; diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h index a5c05bf1a3..e703b5d47e 100644 --- a/src/plugins/platforms/windows/qtwindowsglobal.h +++ b/src/plugins/platforms/windows/qtwindowsglobal.h @@ -120,6 +120,7 @@ enum WindowsEventType // Simplify event types QueryEndSessionApplicationEvent = ApplicationEventFlag + 4, EndSessionApplicationEvent = ApplicationEventFlag + 5, AppCommandEvent = ApplicationEventFlag + 6, + DeviceChangeEvent = ApplicationEventFlag + 7, InputMethodStartCompositionEvent = InputMethodEventFlag + 1, InputMethodCompositionEvent = InputMethodEventFlag + 2, InputMethodEndCompositionEvent = InputMethodEventFlag + 3, @@ -271,6 +272,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI #endif case WM_GESTURE: return QtWindows::GestureEvent; + case WM_DEVICECHANGE: + return QtWindows::DeviceChangeEvent; case WM_DPICHANGED: return QtWindows::DpiChangedEvent; default: diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 5745fc6d19..b7a866679f 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -79,6 +79,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -322,6 +323,13 @@ bool QWindowsContext::initTouch(unsigned integrationOptions) QWindowSystemInterface::registerTouchDevice(touchDevice); d->m_systemInfo |= QWindowsContext::SI_SupportsTouch; + + // A touch device was plugged while the app is running. Register all windows for touch. + if (QGuiApplicationPrivate::is_app_running) { + for (QWindowsWindow *w : qAsConst(d->m_windows)) + w->registerTouchWindow(); + } + return true; } @@ -965,6 +973,13 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, } switch (et) { + case QtWindows::DeviceChangeEvent: + if (d->m_systemInfo & QWindowsContext::SI_SupportsTouch) + break; + // See if there are any touch devices added + if (wParam == DBT_DEVNODES_CHANGED) + initTouch(); + break; case QtWindows::KeyboardLayoutChangeEvent: if (QWindowsInputContext *wic = windowsInputContext()) wic->handleInputLanguageChanged(wParam, lParam); diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp index 7f9c9bd205..48332b35f8 100644 --- a/src/plugins/platforms/windows/qwindowsservices.cpp +++ b/src/plugins/platforms/windows/qwindowsservices.cpp @@ -98,7 +98,11 @@ static inline QString mailCommand() RegQueryValueEx(handle, L"", 0, 0, reinterpret_cast(command), &bufferSize); RegCloseKey(handle); } - if (!command[0]) + // QTBUG-57816: As of Windows 10, if there is no mail client installed, an entry like + // "rundll32.exe .. url.dll,MailToProtocolHandler %l" is returned. Launching it + // silently fails or brings up a broken dialog after a long time, so exclude it and + // fall back to ShellExecute() which brings up the URL assocation dialog. + if (!command[0] || wcsstr(command, L",MailToProtocolHandler") != nullptr) return QString(); wchar_t expandedCommand[MAX_PATH] = {0}; return ExpandEnvironmentStrings(command, expandedCommand, MAX_PATH) ? diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index e30a7c1935..a3337509a7 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2532,7 +2532,8 @@ void QWindowsWindow::setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWind void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes) { - if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)) { + if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch) + && !testFlag(TouchRegistered)) { ULONG touchFlags = 0; const bool ret = QWindowsContext::user32dll.isTouchWindow(m_data.hwnd, &touchFlags); // Return if it is not a touch window or the flags are already set by a hook diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 16e579b79f..3d8c6de72f 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -893,19 +893,17 @@ void QXcbWindow::hide() } } -static QWindow *tlWindow(QWindow *window) -{ - if (window && window->parent()) - return tlWindow(window->parent()); - return window; -} - bool QXcbWindow::relayFocusToModalWindow() const { - QWindow *w = tlWindow(static_cast(QObjectPrivate::get(window()))->eventReceiver()); - QWindow *modal_window = 0; - if (QGuiApplicationPrivate::instance()->isWindowBlocked(w,&modal_window) && modal_window != w) { - modal_window->requestActivate(); + QWindow *w = static_cast(QObjectPrivate::get(window()))->eventReceiver(); + // get top-level window + while (w && w->parent()) + w = w->parent(); + + QWindow *modalWindow = 0; + const bool blocked = QGuiApplicationPrivate::instance()->isWindowBlocked(w, &modalWindow); + if (blocked && modalWindow != w) { + modalWindow->requestActivate(); connection()->flush(); return true; } diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp index 699b058932..8b6ec31400 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -static const char *standardButtonText(int button) +static QByteArray standardButtonText(int button) { return QGtk3Theme::defaultStandardButtonText(button).toUtf8(); } diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp index fecfda22d5..f8cab07597 100644 --- a/src/plugins/sqldrivers/psql/qsql_psql.cpp +++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #include @@ -618,13 +618,10 @@ static QString qCreateParamString(const QVector &boundValues, const QS return params; } -Q_GLOBAL_STATIC(QMutex, qMutex) QString qMakePreparedStmtId() { - qMutex()->lock(); - static unsigned int qPreparedStmtCount = 0; - QString id = QLatin1String("qpsqlpstmt_") + QString::number(++qPreparedStmtCount, 16); - qMutex()->unlock(); + static QBasicAtomicInt qPreparedStmtCount = Q_BASIC_ATOMIC_INITIALIZER(0); + QString id = QLatin1String("qpsqlpstmt_") + QString::number(qPreparedStmtCount.fetchAndAddRelaxed(1) + 1, 16); return id; } @@ -1311,7 +1308,9 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const // we force the value to be considered with a timezone information, and we force it to be UTC // this is safe since postgresql stores only the UTC value and not the timezone offset (only used // while parsing), so we have correct behavior in both case of with timezone and without tz - r = QLatin1String("TIMESTAMP WITH TIME ZONE ") + QLatin1Char('\'') + field.value().toDateTime().toUTC().toString(QLatin1String("yyyy-MM-ddThh:mm:ss.zzz")) + QLatin1Char('Z') + QLatin1Char('\''); + r = QLatin1String("TIMESTAMP WITH TIME ZONE ") + QLatin1Char('\'') + + QLocale::c().toString(field.value().toDateTime().toUTC(), QLatin1String("yyyy-MM-ddThh:mm:ss.zzz")) + + QLatin1Char('Z') + QLatin1Char('\''); } else { r = QLatin1String("NULL"); } diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json index 93d345840f..8d2a633481 100644 --- a/src/printsupport/configure.json +++ b/src/printsupport/configure.json @@ -48,7 +48,7 @@ "label": "QPrinter", "purpose": "Provides a printer backend of QPainter.", "section": "Painting", - "condition": "!config.android && !config.uikit && !config.winrt && features.picture && features.temporaryfile && features.pdf", + "condition": "!config.uikit && !config.winrt && features.picture && features.temporaryfile && features.pdf", "output": [ "publicFeature", "feature" ] }, "printpreviewwidget": { @@ -66,6 +66,7 @@ "features.buttongroup", "features.checkbox", "features.combobox", + "features.dialog", "features.datetimeedit", "features.dialogbuttonbox", "features.printer", diff --git a/src/printsupport/dialogs/qabstractprintdialog.h b/src/printsupport/dialogs/qabstractprintdialog.h index 6c57a301a6..e6d34cdb5b 100644 --- a/src/printsupport/dialogs/qabstractprintdialog.h +++ b/src/printsupport/dialogs/qabstractprintdialog.h @@ -41,13 +41,14 @@ #define QABSTRACTPRINTDIALOG_H #include + +#if QT_CONFIG(printdialog) + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_PRINTER - class QAbstractPrintDialogPrivate; class QPrinter; @@ -81,7 +82,6 @@ public: Q_DECLARE_FLAGS(PrintDialogOptions, PrintDialogOption) Q_FLAG(PrintDialogOptions) -#ifndef QT_NO_PRINTDIALOG explicit QAbstractPrintDialog(QPrinter *printer, QWidget *parent = Q_NULLPTR); ~QAbstractPrintDialog(); @@ -114,13 +114,12 @@ protected: private: Q_DISABLE_COPY(QAbstractPrintDialog) -#endif // QT_NO_PRINTDIALOG }; Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractPrintDialog::PrintDialogOptions) -#endif // QT_NO_PRINTER - QT_END_NAMESPACE +#endif // QT_NO_PRINTDIALOG + #endif // QABSTRACTPRINTDIALOG_H diff --git a/src/printsupport/dialogs/qabstractprintdialog_p.h b/src/printsupport/dialogs/qabstractprintdialog_p.h index fe4e18cfc3..12de4ee882 100644 --- a/src/printsupport/dialogs/qabstractprintdialog_p.h +++ b/src/printsupport/dialogs/qabstractprintdialog_p.h @@ -52,10 +52,10 @@ // #include -#include "private/qdialog_p.h" #ifndef QT_NO_PRINTDIALOG +#include "private/qdialog_p.h" #include "QtPrintSupport/qabstractprintdialog.h" QT_BEGIN_NAMESPACE diff --git a/src/printsupport/dialogs/qpagesetupdialog.h b/src/printsupport/dialogs/qpagesetupdialog.h index 124d215700..bc7462ebaa 100644 --- a/src/printsupport/dialogs/qpagesetupdialog.h +++ b/src/printsupport/dialogs/qpagesetupdialog.h @@ -41,13 +41,14 @@ #define QPAGESETUPDIALOG_H #include + +#ifndef QT_NO_PRINTDIALOG + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_PRINTDIALOG - class QPrinter; class QPageSetupDialogPrivate; @@ -74,8 +75,8 @@ public: QPrinter *printer(); }; -#endif // QT_NO_PRINTDIALOG - QT_END_NAMESPACE +#endif // QT_NO_PRINTDIALOG + #endif // QPAGESETUPDIALOG_H diff --git a/src/printsupport/dialogs/qpagesetupdialog_p.h b/src/printsupport/dialogs/qpagesetupdialog_p.h index 46e178fef9..98b466ccdc 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_p.h +++ b/src/printsupport/dialogs/qpagesetupdialog_p.h @@ -53,10 +53,11 @@ // #include -#include "private/qdialog_p.h" #ifndef QT_NO_PRINTDIALOG +#include "private/qdialog_p.h" + #include "qbytearray.h" #include "qpagesetupdialog.h" #include "qpointer.h" diff --git a/src/printsupport/dialogs/qprintdialog.h b/src/printsupport/dialogs/qprintdialog.h index f01e515af4..35d650a7fc 100644 --- a/src/printsupport/dialogs/qprintdialog.h +++ b/src/printsupport/dialogs/qprintdialog.h @@ -41,13 +41,14 @@ #define QPRINTDIALOG_H #include + +#ifndef QT_NO_PRINTDIALOG + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_PRINTDIALOG - class QPrintDialogPrivate; class QPushButton; class QPrinter; @@ -101,8 +102,8 @@ private: # endif // Q_OS_UNIX }; -#endif // QT_NO_PRINTDIALOG - QT_END_NAMESPACE +#endif // QT_NO_PRINTDIALOG + #endif // QPRINTDIALOG_H diff --git a/src/printsupport/dialogs/qprintpreviewdialog.cpp b/src/printsupport/dialogs/qprintpreviewdialog.cpp index 4bed0b6454..33ba842a1f 100644 --- a/src/printsupport/dialogs/qprintpreviewdialog.cpp +++ b/src/printsupport/dialogs/qprintpreviewdialog.cpp @@ -40,7 +40,6 @@ #include "qprintpreviewdialog.h" #include "qprintpreviewwidget.h" #include -#include "private/qdialog_p.h" #include "qprintdialog.h" #include @@ -59,6 +58,8 @@ #ifndef QT_NO_PRINTPREVIEWDIALOG +#include "private/qdialog_p.h" + #include #include diff --git a/src/printsupport/dialogs/qprintpreviewdialog.h b/src/printsupport/dialogs/qprintpreviewdialog.h index 903083167c..640369fdf3 100644 --- a/src/printsupport/dialogs/qprintpreviewdialog.h +++ b/src/printsupport/dialogs/qprintpreviewdialog.h @@ -41,10 +41,11 @@ #define QPRINTPREVIEWDIALOG_H #include -#include #ifndef QT_NO_PRINTPREVIEWDIALOG +#include + QT_BEGIN_NAMESPACE diff --git a/src/sql/configure.json b/src/sql/configure.json index e8d1fb6ce3..49444c7e5f 100644 --- a/src/sql/configure.json +++ b/src/sql/configure.json @@ -117,7 +117,7 @@ "-lsqlite3" ], "use": [ - { "lib": "zlib", "condition": "!config.win32" } + { "lib": "zlib", "condition": "!config.win32 && features.system-zlib" } ] } }, diff --git a/src/src.pro b/src/src.pro index cf65e4baf4..a2064b1362 100644 --- a/src/src.pro +++ b/src/src.pro @@ -100,6 +100,9 @@ src_3rdparty_libpng.target = sub-3rdparty-libpng src_3rdparty_freetype.subdir = $$PWD/3rdparty/freetype src_3rdparty_freetype.target = sub-3rdparty-freetype +src_3rdparty_gradle.subdir = $$PWD/3rdparty/gradle +src_3rdparty_gradle.target = sub-3rdparty-gradle + src_angle.subdir = $$PWD/angle src_angle.target = sub-angle @@ -212,7 +215,7 @@ SUBDIRS += src_plugins nacl: SUBDIRS -= src_network src_testlib -android: SUBDIRS += src_android +android: SUBDIRS += src_android src_3rdparty_gradle TR_EXCLUDE = \ src_tools_bootstrap src_tools_moc src_tools_rcc src_tools_uic src_tools_qlalr \ diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp index 587930ca73..0ebc800fe1 100644 --- a/src/testlib/qtestblacklist.cpp +++ b/src/testlib/qtestblacklist.cpp @@ -82,7 +82,9 @@ QT_BEGIN_NAMESPACE msvc-2010 Keys are lower-case. Distribution name and version are supported if - QSysInfo's productType() and productVersion() return them. + QSysInfo's productType() and productVersion() return them. Keys can be + added via the space-separated QTEST_ENVIRONMENT environment variable. + The other known keys are listed below: */ @@ -184,6 +186,11 @@ static QSet activeConditions() } } + if (qEnvironmentVariableIsSet("QTEST_ENVIRONMENT")) { + for (const QByteArray &k : qgetenv("QTEST_ENVIRONMENT").split(' ')) + result.insert(k); + } + return result; } diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 2a6cad698f..8b0820b941 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -2327,7 +2327,7 @@ void QTest::qSleep(int ms) #elif defined(Q_OS_WIN) Sleep(uint(ms)); #else - struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 }; + struct timespec ts = { time_t(ms / 1000), (ms % 1000) * 1000 * 1000 }; nanosleep(&ts, NULL); #endif } diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h index 4c611aab6b..f38a156936 100644 --- a/src/testlib/qtestsystem.h +++ b/src/testlib/qtestsystem.h @@ -114,14 +114,14 @@ namespace QTest #endif #ifdef QT_WIDGETS_LIB - inline static bool qWaitForWindowActive(QWidget *widget, int timeout = 1000) + inline static bool qWaitForWindowActive(QWidget *widget, int timeout = 5000) { if (QWindow *window = widget->window()->windowHandle()) return qWaitForWindowActive(window, timeout); return false; } - inline static bool qWaitForWindowExposed(QWidget *widget, int timeout = 1000) + inline static bool qWaitForWindowExposed(QWidget *widget, int timeout = 5000) { if (QWindow *window = widget->window()->windowHandle()) return qWaitForWindowExposed(window, timeout); @@ -131,7 +131,7 @@ namespace QTest #if QT_DEPRECATED_SINCE(5, 0) # ifdef QT_WIDGETS_LIB - QT_DEPRECATED inline static bool qWaitForWindowShown(QWidget *widget, int timeout = 1000) + QT_DEPRECATED inline static bool qWaitForWindowShown(QWidget *widget, int timeout = 5000) { return qWaitForWindowExposed(widget, timeout); } diff --git a/src/tools/qlalr/cppgenerator.cpp b/src/tools/qlalr/cppgenerator.cpp index efceb8c520..ed0f53d43e 100644 --- a/src/tools/qlalr/cppgenerator.cpp +++ b/src/tools/qlalr/cppgenerator.cpp @@ -36,6 +36,29 @@ #include #include +namespace { + +void generateSeparator(int i, QTextStream &out) +{ + if (!(i % 10)) { + if (i) + out << ","; + out << endl << " "; + } else { + out << ", "; + } +} + +void generateList(const QVector &list, QTextStream &out) +{ + for (int i = 0; i < list.size(); ++i) { + generateSeparator(i, out); + + out << list[i]; + } +} + +} QString CppGenerator::copyrightHeader() const { @@ -47,7 +70,7 @@ QString CppGenerator::copyrightHeader() const "**\n" "** This file is part of the Qt Toolkit.\n" "**\n" - "** $QT_BEGIN_LICENSE:LGPL$\n" + "** $QT_BEGIN_LICENSE:GPL-EXCEPT$\n" "** Commercial License Usage\n" "** Licensees holding valid commercial Qt licenses may use this file in\n" "** accordance with the commercial license agreement provided with the\n" @@ -56,24 +79,13 @@ QString CppGenerator::copyrightHeader() const "** and conditions see https://www.qt.io/terms-conditions. For further\n" "** information use the contact form at https://www.qt.io/contact-us.\n" "**\n" - "** GNU Lesser General Public License Usage\n" - "** Alternatively, this file may be used under the terms of the GNU Lesser\n" - "** General Public License version 3 as published by the Free Software\n" - "** Foundation and appearing in the file LICENSE.LGPL3 included in the\n" - "** packaging of this file. Please review the following information to\n" - "** ensure the GNU Lesser General Public License version 3 requirements\n" - "** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.\n" - "**\n" "** GNU General Public License Usage\n" "** Alternatively, this file may be used under the terms of the GNU\n" - "** General Public License version 2.0 or (at your option) the GNU General\n" - "** Public license version 3 or any later version approved by the KDE Free\n" - "** Qt Foundation. The licenses are as published by the Free Software\n" - "** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3\n" + "** General Public License version 3 as published by the Free Software\n" + "** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT\n" "** included in the packaging of this file. Please review the following\n" "** information to ensure the GNU General Public License requirements will\n" - "** be met: https://www.gnu.org/licenses/gpl-2.0.html and\n" - "** https://www.gnu.org/licenses/gpl-3.0.html.\n" + "** be met: https://www.gnu.org/licenses/gpl-3.0.html.\n" "**\n" "** $QT_END_LICENSE$\n" "**\n" @@ -446,7 +458,7 @@ void CppGenerator::generateDecl (QTextStream &out) out << "class " << grammar.table_name << endl << "{" << endl << "public:" << endl - << " enum VariousConstants {" << endl; + << " enum VariousConstants {" << endl; for (Name t : qAsConst(grammar.terminals)) { @@ -462,59 +474,59 @@ void CppGenerator::generateDecl (QTextStream &out) else name.prepend (grammar.token_prefix); - out << " " << name << " = " << value << "," << endl; + out << " " << name << " = " << value << "," << endl; } out << endl - << " ACCEPT_STATE = " << accept_state << "," << endl - << " RULE_COUNT = " << grammar.rules.size () << "," << endl - << " STATE_COUNT = " << state_count << "," << endl - << " TERMINAL_COUNT = " << terminal_count << "," << endl - << " NON_TERMINAL_COUNT = " << non_terminal_count << "," << endl + << " ACCEPT_STATE = " << accept_state << "," << endl + << " RULE_COUNT = " << grammar.rules.size () << "," << endl + << " STATE_COUNT = " << state_count << "," << endl + << " TERMINAL_COUNT = " << terminal_count << "," << endl + << " NON_TERMINAL_COUNT = " << non_terminal_count << "," << endl << endl - << " GOTO_INDEX_OFFSET = " << compressed_action.index.size () << "," << endl - << " GOTO_INFO_OFFSET = " << compressed_action.info.size () << "," << endl - << " GOTO_CHECK_OFFSET = " << compressed_action.check.size () << endl - << " };" << endl + << " GOTO_INDEX_OFFSET = " << compressed_action.index.size () << "," << endl + << " GOTO_INFO_OFFSET = " << compressed_action.info.size () << "," << endl + << " GOTO_CHECK_OFFSET = " << compressed_action.check.size () << endl + << " };" << endl << endl - << " static const char *const spell [];" << endl - << " static const short lhs [];" << endl - << " static const short rhs [];" << endl; + << " static const char *const spell[];" << endl + << " static const short lhs[];" << endl + << " static const short rhs[];" << endl; if (debug_info) { QString prot = debugInfoProt(); out << endl << "#ifndef " << prot << endl - << " static const int rule_index [];" << endl - << " static const int rule_info [];" << endl + << " static const int rule_index[];" << endl + << " static const int rule_info[];" << endl << "#endif // " << prot << endl << endl; } - out << " static const short goto_default [];" << endl - << " static const short action_default [];" << endl - << " static const short action_index [];" << endl - << " static const short action_info [];" << endl - << " static const short action_check [];" << endl + out << " static const short goto_default[];" << endl + << " static const short action_default[];" << endl + << " static const short action_index[];" << endl + << " static const short action_info[];" << endl + << " static const short action_check[];" << endl << endl - << " static inline int nt_action (int state, int nt)" << endl - << " {" << endl - << " const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;" << endl - << " if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt)" << endl - << " return goto_default [nt];" << endl + << " static inline int nt_action (int state, int nt)" << endl + << " {" << endl + << " const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;" << endl + << " if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt)" << endl + << " return goto_default [nt];" << endl << endl - << " return action_info [GOTO_INFO_OFFSET + yyn];" << endl - << " }" << endl + << " return action_info [GOTO_INFO_OFFSET + yyn];" << endl + << " }" << endl << endl - << " static inline int t_action (int state, int token)" << endl - << " {" << endl - << " const int yyn = action_index [state] + token;" << endl + << " static inline int t_action (int state, int token)" << endl + << " {" << endl + << " const int yyn = action_index [state] + token;" << endl << endl - << " if (yyn < 0 || action_check [yyn] != token)" << endl - << " return - action_default [state];" << endl + << " if (yyn < 0 || action_check [yyn] != token)" << endl + << " return - action_default [state];" << endl << endl - << " return action_info [yyn];" << endl - << " }" << endl + << " return action_info [yyn];" << endl + << " }" << endl << "};" << endl << endl << endl; @@ -539,11 +551,7 @@ void CppGenerator::generateImpl (QTextStream &out) name_ids.insert (t, idx); - if (idx) - out << ", "; - - if (! (idx % 10)) - out << endl << " "; + generateSeparator(idx, out); if (terminal) { @@ -569,35 +577,27 @@ void CppGenerator::generateImpl (QTextStream &out) if (debug_info) out << endl << "#endif // " << debugInfoProt() << endl; - out << "};" << endl << endl; + out << endl << "};" << endl << endl; out << "const short " << grammar.table_name << "::lhs [] = {"; idx = 0; for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx) { - if (idx) - out << ", "; - - if (! (idx % 10)) - out << endl << " "; + generateSeparator(idx, out); out << aut.id (rule->lhs); } - out << "};" << endl << endl; + out << endl << "};" << endl << endl; out << "const short " << grammar.table_name << "::rhs [] = {"; idx = 0; for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx) { - if (idx) - out << ", "; - - if (! (idx % 10)) - out << endl << " "; + generateSeparator(idx, out); out << rule->rhs.size (); } - out << "};" << endl << endl; + out << endl << "};" << endl << endl; if (debug_info) { @@ -608,35 +608,26 @@ void CppGenerator::generateImpl (QTextStream &out) idx = 0; for (auto rule = grammar.rules.cbegin (); rule != grammar.rules.cend (); ++rule, ++idx) { - out << endl << " "; - - if (idx) - out << ", "; - else - out << " "; + generateSeparator(idx, out); out << name_ids.value(rule->lhs); for (const Name &n : rule->rhs) out << ", " << name_ids.value (n); } - out << "};" << endl << endl; + out << endl << "};" << endl << endl; out << "const int " << grammar.table_name << "::rule_index [] = {"; idx = 0; int offset = 0; for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx) { - if (idx) - out << ", "; - - if (! (idx % 10)) - out << endl << " "; + generateSeparator(idx, out); out << offset; offset += rule->rhs.size () + 1; } - out << "};" << endl + out << endl << "};" << endl << "#endif // " << prot << endl << endl; } @@ -644,92 +635,34 @@ void CppGenerator::generateImpl (QTextStream &out) idx = 0; for (StatePointer state = aut.states.begin (); state != aut.states.end (); ++state, ++idx) { - if (state != aut.states.begin ()) - out << ", "; - - if (! (idx % 10)) - out << endl << " "; + generateSeparator(idx, out); if (state->defaultReduce != grammar.rules.end ()) out << aut.id (state->defaultReduce); else out << "0"; } - out << "};" << endl << endl; + out << endl << "};" << endl << endl; out << "const short " << grammar.table_name << "::goto_default [] = {"; - for (int i = 0; i < defgoto.size (); ++i) - { - if (i) - out << ", "; - - if (! (i % 10)) - out << endl << " "; - - out << defgoto [i]; - } - out << "};" << endl << endl; + generateList(defgoto, out); + out << endl << "};" << endl << endl; out << "const short " << grammar.table_name << "::action_index [] = {"; - for (int i = 0; i < compressed_action.index.size (); ++i) - { - if (! (i % 10)) - out << endl << " "; - - out << compressed_action.index [i] << ", "; - } - out << endl; - for (int i = 0; i < compressed_goto.index.size (); ++i) - { - if (i) - out << ", "; - - if (! (i % 10)) - out << endl << " "; - - out << compressed_goto.index [i]; - } - out << "};" << endl << endl; + generateList(compressed_action.index, out); + out << "," << endl; + generateList(compressed_goto.index, out); + out << endl << "};" << endl << endl; out << "const short " << grammar.table_name << "::action_info [] = {"; - for (int i = 0; i < compressed_action.info.size (); ++i) - { - if (! (i % 10)) - out << endl << " "; - - out << compressed_action.info [i] << ", "; - } - out << endl; - for (int i = 0; i < compressed_goto.info.size (); ++i) - { - if (i) - out << ", "; - - if (! (i % 10)) - out << endl << " "; - - out << compressed_goto.info [i]; - } - out << "};" << endl << endl; + generateList(compressed_action.info, out); + out << "," << endl; + generateList(compressed_goto.info, out); + out << endl << "};" << endl << endl; out << "const short " << grammar.table_name << "::action_check [] = {"; - for (int i = 0; i < compressed_action.check.size (); ++i) - { - if (! (i % 10)) - out << endl << " "; - - out << compressed_action.check [i] << ", "; - } - out << endl; - for (int i = 0; i < compressed_goto.check.size (); ++i) - { - if (i) - out << ", "; - - if (! (i % 10)) - out << endl << " "; - - out << compressed_goto.check [i]; - } - out << "};" << endl << endl; + generateList(compressed_action.check, out); + out << "," << endl; + generateList(compressed_goto.check, out); + out << endl << "};" << endl << endl; } diff --git a/src/tools/qlalr/grammar.cpp b/src/tools/qlalr/grammar.cpp index 1891a54860..f633962815 100644 --- a/src/tools/qlalr/grammar.cpp +++ b/src/tools/qlalr/grammar.cpp @@ -32,83 +32,89 @@ QT_BEGIN_NAMESPACE const char *const grammar::spell [] = { - "end of file", "identifier", "string literal", "%decl", "%expect", "%expect-lr", "%impl", "%left", "%merged_output", "%nonassoc", - "%parser", "%prec", "%right", "%start", "%token", "%token_prefix", ":", "|", ";", 0, - 0, 0}; + "end of file", "identifier", "string literal", "%decl", "%expect", "%expect-lr", "%impl", "%left", "%merged_output", "%nonassoc", + "%parser", "%prec", "%right", "%start", "%token", "%token_prefix", ":", "|", ";", 0, + 0, 0 +}; const short grammar::lhs [] = { - 22, 23, 23, 29, 25, 28, 28, 28, 28, 28, - 28, 28, 24, 24, 31, 32, 32, 33, 33, 34, - 34, 34, 31, 35, 35, 36, 37, 37, 38, 38, - 30, 30, 26, 26, 40, 39, 41, 41, 44, 43, - 43, 42, 42, 27, 45}; + 22, 23, 23, 29, 25, 28, 28, 28, 28, 28, + 28, 28, 24, 24, 31, 32, 32, 33, 33, 34, + 34, 34, 31, 35, 35, 36, 37, 37, 38, 38, + 30, 30, 26, 26, 40, 39, 41, 41, 44, 43, + 43, 42, 42, 27, 45 +}; const short grammar::rhs [] = { - 4, 1, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, - 1, 1, 2, 1, 2, 1, 1, 1, 1, 2, - 0, 1, 1, 2, 2, 4, 3, 6, 0, 0, - 2, 1, 2, 0, 2}; + 4, 1, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, + 1, 1, 2, 1, 2, 1, 1, 1, 1, 2, + 0, 1, 1, 2, 2, 4, 3, 6, 0, 0, + 2, 1, 2, 0, 2 +}; const short grammar::action_default [] = { - 44, 2, 44, 0, 0, 0, 0, 13, 0, 0, - 3, 0, 0, 0, 8, 10, 11, 9, 7, 6, - 12, 20, 22, 0, 21, 0, 44, 31, 0, 14, - 26, 24, 23, 25, 4, 33, 1, 0, 34, 44, - 35, 42, 39, 40, 0, 31, 44, 40, 43, 0, - 31, 41, 29, 27, 28, 32, 38, 30, 36, 31, - 37, 5, 44, 16, 15, 18, 19, 17, 45}; + 44, 2, 44, 0, 0, 0, 0, 13, 0, 0, + 3, 0, 0, 0, 8, 10, 11, 9, 7, 6, + 12, 20, 22, 0, 21, 0, 44, 31, 0, 14, + 26, 24, 23, 25, 4, 33, 1, 0, 34, 44, + 35, 42, 39, 40, 0, 31, 44, 40, 43, 0, + 31, 41, 29, 27, 28, 32, 38, 30, 36, 31, + 37, 5, 44, 16, 15, 18, 19, 17, 45 +}; const short grammar::goto_default [] = { - 3, 2, 13, 26, 36, 41, 10, 27, 61, 29, - 64, 63, 23, 32, 31, 52, 55, 38, 39, 42, - 43, 59, 44, 0}; + 3, 2, 13, 26, 36, 41, 10, 27, 61, 29, + 64, 63, 23, 32, 31, 52, 55, 38, 39, 42, + 43, 59, 44, 0 +}; const short grammar::action_index [] = { - -22, -22, 54, 1, 5, 15, 20, -22, -1, 6, - -22, 3, 2, 35, -22, -22, -22, -22, -22, -22, - -22, -22, -22, 10, -22, 7, -22, 14, 9, -22, - -22, -22, 8, -22, -22, -22, 11, -2, -22, -22, - -22, -22, -3, 16, 13, 14, -22, 17, -22, 4, - 14, -22, -22, -22, -22, 14, -22, -22, -22, 14, - -22, -22, 0, -22, 12, -22, -22, -22, -22, + -22, -22, 30, 1, 2, 3, 4, -22, 5, 6, + -22, 8, -1, 35, -22, -22, -22, -22, -22, -22, + -22, -22, -22, 13, -22, 7, -22, -2, 20, -22, + -22, -22, 11, -22, -22, -22, 15, -6, -22, -22, + -22, -22, -3, 19, -4, 12, -22, 18, -22, 10, + -2, -22, -22, -22, -22, -2, -22, -22, -22, -2, + -22, -22, 0, -22, 20, -22, -22, -22, -22, - 2, -24, -2, -24, -24, -24, -24, -24, -24, -24, - -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, - -24, -24, -24, -24, -24, -24, -4, -24, -24, -24, - -24, -24, -14, -24, -24, -24, -24, -24, -24, -24, - -24, -24, -24, -24, -24, 0, -16, -15, -24, -24, - 15, -24, -24, -24, -24, -10, -24, -24, -24, 1, - -24, -24, -3, -24, -1, -24, -24, -24, -24}; + 0, -24, 3, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -2, -24, -24, -24, + -24, -24, -7, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, 17, -19, -11, -24, -24, + 1, -24, -24, -24, -24, -15, -24, -24, -24, -6, + -24, -24, -1, -24, -5, -24, -24, -24, -24 +}; const short grammar::action_info [] = { - 17, 68, 66, 20, 19, 51, 14, 18, 34, 30, - 62, 30, 37, 62, 40, 45, 15, 48, 48, 0, - 0, 16, 0, 0, 0, 0, 0, 49, 49, 0, - 46, 0, 0, 53, 54, 0, 0, 0, 0, 0, - 0, 0, 21, 0, 22, 0, 0, 24, 25, 28, - 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, - 8, 0, 9, 0, 11, 0, 0, 0, 0, 12, - 0, 0, 0, 0, 0, 0, + 20, 68, 66, 14, 15, 16, 17, 18, 34, 19, + 40, 51, 30, 46, 30, 45, 37, 53, 54, 48, + 48, 62, 0, 0, 0, 0, 0, 0, 0, 49, + 49, 53, 54, 4, 5, 6, 8, 0, 9, 0, + 11, 0, 21, 0, 22, 12, 0, 24, 25, 28, + 0, 0, 0, 0, 0, 0, 0, - 33, 35, 65, 7, 47, 57, 50, 1, 58, 60, - 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0}; + 57, 47, 60, 35, 65, 1, 67, 33, 7, 56, + 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 58, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0 +}; const short grammar::action_check [] = { - 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 16, 18, 1, 1, 1, -1, - -1, 1, -1, -1, -1, -1, -1, 11, 11, -1, - 17, -1, -1, 19, 20, -1, -1, -1, -1, -1, - -1, -1, 7, -1, 9, -1, -1, 12, 13, 14, - -1, -1, -1, -1, -1, -1, -1, 3, 4, 5, - 6, -1, 8, -1, 10, -1, -1, -1, -1, 15, - -1, -1, -1, -1, -1, -1, + 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, + 16, 1, 1, 17, 1, 18, 1, 19, 20, 1, + 1, 1, -1, -1, -1, -1, -1, -1, -1, 11, + 11, 19, 20, 3, 4, 5, 6, -1, 8, -1, + 10, -1, 7, -1, 9, 15, -1, 12, 13, 14, + -1, -1, -1, -1, -1, -1, -1, - 14, 5, 5, 5, 20, 15, 21, 5, 8, 8, - 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1}; + 15, 20, 8, 5, 5, 5, 11, 14, 5, 8, + 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1 +}; QT_END_NAMESPACE diff --git a/src/tools/qlalr/grammar_p.h b/src/tools/qlalr/grammar_p.h index 1230a29b1c..8482f9bfe1 100644 --- a/src/tools/qlalr/grammar_p.h +++ b/src/tools/qlalr/grammar_p.h @@ -48,68 +48,68 @@ QT_BEGIN_NAMESPACE class grammar { public: - enum VariousConstants { - EOF_SYMBOL = 0, - COLON = 16, - DECL = 19, - DECL_FILE = 3, - ERROR = 21, - EXPECT = 4, - EXPECT_RR = 5, - ID = 1, - IMPL = 20, - IMPL_FILE = 6, - LEFT = 7, - MERGED_OUTPUT = 8, - NONASSOC = 9, - OR = 17, - PARSER = 10, - PREC = 11, - RIGHT = 12, - SEMICOLON = 18, - START = 13, - STRING_LITERAL = 2, - TOKEN = 14, - TOKEN_PREFIX = 15, + enum VariousConstants { + EOF_SYMBOL = 0, + COLON = 16, + DECL = 19, + DECL_FILE = 3, + ERROR = 21, + EXPECT = 4, + EXPECT_RR = 5, + ID = 1, + IMPL = 20, + IMPL_FILE = 6, + LEFT = 7, + MERGED_OUTPUT = 8, + NONASSOC = 9, + OR = 17, + PARSER = 10, + PREC = 11, + RIGHT = 12, + SEMICOLON = 18, + START = 13, + STRING_LITERAL = 2, + TOKEN = 14, + TOKEN_PREFIX = 15, - ACCEPT_STATE = 68, - RULE_COUNT = 45, - STATE_COUNT = 69, - TERMINAL_COUNT = 22, - NON_TERMINAL_COUNT = 24, + ACCEPT_STATE = 68, + RULE_COUNT = 45, + STATE_COUNT = 69, + TERMINAL_COUNT = 22, + NON_TERMINAL_COUNT = 24, - GOTO_INDEX_OFFSET = 69, - GOTO_INFO_OFFSET = 76, - GOTO_CHECK_OFFSET = 76 - }; + GOTO_INDEX_OFFSET = 69, + GOTO_INFO_OFFSET = 57, + GOTO_CHECK_OFFSET = 57 + }; - static const char *const spell []; - static const short lhs []; - static const short rhs []; - static const short goto_default []; - static const short action_default []; - static const short action_index []; - static const short action_info []; - static const short action_check []; + static const char *const spell[]; + static const short lhs[]; + static const short rhs[]; + static const short goto_default[]; + static const short action_default[]; + static const short action_index[]; + static const short action_info[]; + static const short action_check[]; - static inline int nt_action (int state, int nt) - { - const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt; - if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt) - return goto_default [nt]; + static inline int nt_action (int state, int nt) + { + const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt; + if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt) + return goto_default [nt]; - return action_info [GOTO_INFO_OFFSET + yyn]; - } + return action_info [GOTO_INFO_OFFSET + yyn]; + } - static inline int t_action (int state, int token) - { - const int yyn = action_index [state] + token; + static inline int t_action (int state, int token) + { + const int yyn = action_index [state] + token; - if (yyn < 0 || action_check [yyn] != token) - return - action_default [state]; + if (yyn < 0 || action_check [yyn] != token) + return - action_default [state]; - return action_info [yyn]; - } + return action_info [yyn]; + } }; diff --git a/src/tools/qlalr/lalr.g b/src/tools/qlalr/lalr.g index 65a63f8312..5e335c5a3b 100644 --- a/src/tools/qlalr/lalr.g +++ b/src/tools/qlalr/lalr.g @@ -61,8 +61,7 @@ %start Specification -/: -/**************************************************************************** +/:/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ @@ -163,8 +162,7 @@ protected: }; :/ -/. -/**************************************************************************** +/./**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ @@ -194,6 +192,8 @@ protected: #include "recognizer.h" +#include + #include #include #include @@ -344,7 +344,8 @@ int Recognizer::nextToken() text.clear (); if (! _M_no_lines) - text += QLatin1String ("\n#line ") + QString::number (_M_action_line) + " \"" + _M_input_file + "\"\n"; + text += QLatin1String("\n#line ") + QString::number(_M_action_line) + + QLatin1String(" \"") + QDir::fromNativeSeparators(_M_input_file) + QLatin1String("\"\n"); inp (); // skip ':' forever @@ -381,7 +382,8 @@ int Recognizer::nextToken() text.clear (); if (! _M_no_lines) - text += QLatin1String ("\n#line ") + QString::number (_M_action_line) + " \"" + _M_input_file + "\"\n"; + text += QLatin1String("\n#line ") + QString::number(_M_action_line) + + QLatin1String(" \"") + QDir::fromNativeSeparators(_M_input_file) + QLatin1String("\"\n"); inp (); // skip ':' diff --git a/src/tools/qlalr/recognizer.cpp b/src/tools/qlalr/recognizer.cpp index 69dad1a6c1..8c7665f1b9 100644 --- a/src/tools/qlalr/recognizer.cpp +++ b/src/tools/qlalr/recognizer.cpp @@ -28,6 +28,8 @@ #include "recognizer.h" +#include + #include #include #include @@ -178,8 +180,8 @@ int Recognizer::nextToken() text.clear (); if (! _M_no_lines) - text += QLatin1String("\n#line ") + QString::number (_M_action_line) - + QLatin1String(" \"") + _M_input_file + QLatin1String("\"\n"); + text += QLatin1String("\n#line ") + QString::number(_M_action_line) + + QLatin1String(" \"") + QDir::fromNativeSeparators(_M_input_file) + QLatin1String("\"\n"); inp (); // skip ':' forever @@ -216,8 +218,8 @@ int Recognizer::nextToken() text.clear (); if (! _M_no_lines) - text += QLatin1String ("\n#line ") + QString::number (_M_action_line) + - QLatin1String(" \"") + _M_input_file + QLatin1String("\"\n"); + text += QLatin1String("\n#line ") + QString::number(_M_action_line) + + QLatin1String(" \"") + QDir::fromNativeSeparators(_M_input_file) + QLatin1String("\"\n"); inp (); // skip ':' diff --git a/src/widgets/configure.json b/src/widgets/configure.json index 14e4d10d38..13c7c774ed 100644 --- a/src/widgets/configure.json +++ b/src/widgets/configure.json @@ -163,10 +163,17 @@ "condition": "features.rubberband", "output": [ "publicFeature", "feature" ] }, + "widgettextcontrol": { + "label": "QWidgetTextControl", + "purpose": "Provides text control functionality to other widgets.", + "section": "Widgets", + "output": [ "privateFeature" ] + }, "label": { "label": "QLabel", "purpose": "Provides a text or image display.", "section": "Widgets", + "condition": "features.widgettextcontrol", "output": [ "publicFeature" ] }, "formlayout": { @@ -193,6 +200,7 @@ "label": "QLineEdit", "purpose": "Provides single-line edits.", "section": "Widgets", + "condition": "features.widgettextcontrol", "output": [ "publicFeature", "feature" ] }, "radiobutton": { @@ -382,7 +390,7 @@ "label": "QGraphicsView", "purpose": "Provides a canvas/sprite framework.", "section": "Widgets", - "condition": "features.scrollarea", + "condition": "features.scrollarea && features.widgettextcontrol", "output": [ "publicFeature", "feature" ] }, "graphicseffect": { @@ -396,7 +404,7 @@ "label": "QTextEdit", "purpose": "Supports rich text editing.", "section": "Widgets", - "condition": "features.scrollarea && features.properties", + "condition": "features.scrollarea && features.properties && features.widgettextcontrol", "output": [ "publicFeature", "feature" ] }, "syntaxhighlighter": { @@ -460,11 +468,17 @@ "condition": "features.lineedit && features.shortcut", "output": [ "publicFeature", "feature" ] }, + "dialog" : { + "label": "QDialog", + "purpose": "Base class of dialog windows.", + "section": "Dialogs", + "output": [ "publicFeature" ] + }, "dialogbuttonbox": { "label": "QDialogButtonBox", "purpose": "Presents buttons in a layout that is appropriate for the current widget style.", "section": "Dialogs", - "condition": "features.pushbutton", + "condition": "features.dialog && features.pushbutton", "output": [ "publicFeature" ] }, "messagebox": { @@ -473,6 +487,7 @@ "section": "Dialogs", "condition" : [ "features.checkbox", + "features.dialog", "features.dialogbuttonbox", "features.label", "features.pushbutton" @@ -484,6 +499,7 @@ "purpose": "Provides a dialog widget for specifying colors.", "section": "Dialogs", "condition": [ + "features.dialog", "features.dialogbuttonbox", "features.label", "features.pushbutton", @@ -498,6 +514,7 @@ "condition": [ "features.buttongroup", "features.combobox", + "features.dialog", "features.dialogbuttonbox", "features.dirmodel", "features.label", @@ -516,6 +533,7 @@ "condition": [ "features.checkbox", "features.combobox", + "features.dialog", "features.dialogbuttonbox", "features.groupbox", "features.label", @@ -530,6 +548,7 @@ "purpose": "Provides feedback on the progress of a slow operation.", "section": "Dialogs", "condition": [ + "features.dialog", "features.label", "features.pushbutton", "features.progressbar" @@ -542,6 +561,7 @@ "section": "Dialogs", "condition": [ "features.combobox", + "features.dialog", "features.dialogbuttonbox", "features.label", "features.pushbutton", @@ -557,6 +577,7 @@ "section": "Dialogs", "condition": [ "features.checkbox", + "features.dialog", "features.textedit", "features.label", "features.pushbutton", @@ -569,6 +590,7 @@ "purpose": "Provides a framework for multi-page click-through dialogs.", "section": "Dialogs", "condition": [ + "features.dialog", "features.pushbutton", "features.properties", "features.label" diff --git a/src/widgets/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri index 4f4a9b1517..8614d2bcc6 100644 --- a/src/widgets/dialogs/dialogs.pri +++ b/src/widgets/dialogs/dialogs.pri @@ -3,8 +3,6 @@ HEADERS += \ dialogs/qcolordialog.h \ dialogs/qfscompleter_p.h \ - dialogs/qdialog.h \ - dialogs/qdialog_p.h \ dialogs/qerrormessage.h \ dialogs/qfiledialog.h \ dialogs/qfiledialog_p.h \ @@ -30,7 +28,6 @@ else: FORMS += dialogs/qfiledialog.ui INCLUDEPATH += $$PWD SOURCES += \ dialogs/qcolordialog.cpp \ - dialogs/qdialog.cpp \ dialogs/qerrormessage.cpp \ dialogs/qfiledialog.cpp \ dialogs/qfontdialog.cpp \ @@ -42,4 +39,13 @@ SOURCES += \ dialogs/qfileinfogatherer.cpp \ dialogs/qwizard.cpp \ +qtConfig(dialog) { + HEADERS += \ + dialogs/qdialog.h \ + dialogs/qdialog_p.h + + SOURCES += \ + dialogs/qdialog.cpp +} + RESOURCES += dialogs/qmessagebox.qrc diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h index 3b56f0b5d1..fb5b843ce4 100644 --- a/src/widgets/dialogs/qcolordialog.h +++ b/src/widgets/dialogs/qcolordialog.h @@ -41,13 +41,14 @@ #define QCOLORDIALOG_H #include + +#ifndef QT_NO_COLORDIALOG + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_COLORDIALOG - class QColorDialogPrivate; class Q_WIDGETS_EXPORT QColorDialog : public QDialog @@ -124,8 +125,8 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QColorDialog::ColorDialogOptions) -#endif // QT_NO_COLORDIALOG - QT_END_NAMESPACE +#endif // QT_NO_COLORDIALOG + #endif // QCOLORDIALOG_H diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h index d88ff4a841..72250172d3 100644 --- a/src/widgets/dialogs/qdialog.h +++ b/src/widgets/dialogs/qdialog.h @@ -43,6 +43,8 @@ #include #include +QT_REQUIRE_CONFIG(dialog); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h index 6723edae38..9ee89863f6 100644 --- a/src/widgets/dialogs/qdialog_p.h +++ b/src/widgets/dialogs/qdialog_p.h @@ -61,6 +61,8 @@ #endif #include +QT_REQUIRE_CONFIG(dialog); + QT_BEGIN_NAMESPACE class QSizeGrip; diff --git a/src/widgets/dialogs/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h index 5ffa568c10..976ba9abd5 100644 --- a/src/widgets/dialogs/qerrormessage.h +++ b/src/widgets/dialogs/qerrormessage.h @@ -41,13 +41,14 @@ #define QERRORMESSAGE_H #include + +#ifndef QT_NO_ERRORMESSAGE + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_ERRORMESSAGE - class QErrorMessagePrivate; class Q_WIDGETS_EXPORT QErrorMessage: public QDialog @@ -72,8 +73,8 @@ private: Q_DISABLE_COPY(QErrorMessage) }; -#endif // QT_NO_ERRORMESSAGE - QT_END_NAMESPACE +#endif // QT_NO_ERRORMESSAGE + #endif // QERRORMESSAGE_H diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h index 7959eebd7b..733dd03092 100644 --- a/src/widgets/dialogs/qfiledialog.h +++ b/src/widgets/dialogs/qfiledialog.h @@ -44,13 +44,14 @@ #include #include #include + +#ifndef QT_NO_FILEDIALOG + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_FILEDIALOG - class QModelIndex; class QItemSelection; struct QFileDialogArgs; @@ -313,8 +314,8 @@ inline void QFileDialog::setDirectory(const QDir &adirectory) Q_DECLARE_OPERATORS_FOR_FLAGS(QFileDialog::Options) -#endif // QT_NO_FILEDIALOG - QT_END_NAMESPACE +#endif // QT_NO_FILEDIALOG + #endif // QFILEDIALOG_H diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h index 276f8f5e83..da13a5ab99 100644 --- a/src/widgets/dialogs/qfontdialog.h +++ b/src/widgets/dialogs/qfontdialog.h @@ -42,14 +42,15 @@ #include #include -#include #include +#ifndef QT_NO_FONTDIALOG + +#include + QT_BEGIN_NAMESPACE -#ifndef QT_NO_FONTDIALOG - class QFontDialogPrivate; class Q_WIDGETS_EXPORT QFontDialog : public QDialog @@ -117,8 +118,8 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions) -#endif // QT_NO_FONTDIALOG - QT_END_NAMESPACE +#endif // QT_NO_FONTDIALOG + #endif // QFONTDIALOG_H diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h index 2fbea908cb..7b43e774a7 100644 --- a/src/widgets/dialogs/qinputdialog.h +++ b/src/widgets/dialogs/qinputdialog.h @@ -41,15 +41,16 @@ #define QINPUTDIALOG_H #include -#include #include #include +#ifndef QT_NO_INPUTDIALOG + +#include + QT_BEGIN_NAMESPACE -#ifndef QT_NO_INPUTDIALOG - class QInputDialogPrivate; class Q_WIDGETS_EXPORT QInputDialog : public QDialog @@ -209,8 +210,8 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDialog::InputDialogOptions) -#endif // QT_NO_INPUTDIALOG - QT_END_NAMESPACE +#endif // QT_NO_INPUTDIALOG + #endif // QINPUTDIALOG_H diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 3b0a71518d..fe32611ed8 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1834,7 +1834,7 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title) "

Qt and the Qt logo are trademarks of The Qt Company Ltd.

" "

Qt is The Qt Company Ltd product developed as an open source " "project. See %3 for more information.

" - ).arg(QStringLiteral("2016"), + ).arg(QStringLiteral("2017"), QStringLiteral("qt.io/licensing"), QStringLiteral("qt.io")); QMessageBox *msgBox = new QMessageBox(parent); diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h index 3e561a5161..40e5c701fe 100644 --- a/src/widgets/dialogs/qmessagebox.h +++ b/src/widgets/dialogs/qmessagebox.h @@ -41,13 +41,14 @@ #define QMESSAGEBOX_H #include + +#ifndef QT_NO_MESSAGEBOX + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_MESSAGEBOX - class QLabel; class QMessageBoxPrivate; class QAbstractButton; @@ -322,8 +323,8 @@ QString s = QApplication::tr("Executable '%1' requires Qt "\ str)).arg(QString::fromLatin1(qVersion())); QMessageBox::critical(0, QApplication::tr(\ "Incompatible Qt Library Error"), s, QMessageBox::Abort, 0); qFatal("%s", s.toLatin1().data()); }} -#endif // QT_NO_MESSAGEBOX - QT_END_NAMESPACE +#endif // QT_NO_MESSAGEBOX + #endif // QMESSAGEBOX_H diff --git a/src/widgets/dialogs/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h index a5e333259f..f4e63fb088 100644 --- a/src/widgets/dialogs/qprogressdialog.h +++ b/src/widgets/dialogs/qprogressdialog.h @@ -41,13 +41,14 @@ #define QPROGRESSDIALOG_H #include + +#ifndef QT_NO_PROGRESSDIALOG + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_PROGRESSDIALOG - class QPushButton; class QLabel; class QProgressBar; @@ -127,8 +128,8 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_disconnectOnClose()) }; -#endif // QT_NO_PROGRESSDIALOG - QT_END_NAMESPACE +#endif // QT_NO_PROGRESSDIALOG + #endif // QPROGRESSDIALOG_H diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 5e598ba990..d1abbc85d2 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -1089,7 +1089,7 @@ void QWizardPrivate::recreateLayout(const QWizardLayoutInfo &info) // ### hardcoded for now: titleFont = QFont(QLatin1String("Segoe UI"), 12); QPalette pal(titleLabel->palette()); - pal.setColor(QPalette::Text, "#003399"); + pal.setColor(QPalette::Text, QColor(0x00, 0x33, 0x99)); titleLabel->setPalette(pal); } diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h index 7915c9e7f8..3236ee90df 100644 --- a/src/widgets/dialogs/qwizard.h +++ b/src/widgets/dialogs/qwizard.h @@ -41,13 +41,14 @@ #define QWIZARD_H #include + +#ifndef QT_NO_WIZARD + #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_WIZARD - class QAbstractButton; class QWizardPage; class QWizardPrivate; diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 939e2a3d79..20002b1f82 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -1703,6 +1703,7 @@ bool QAbstractItemView::viewportEvent(QEvent *event) d->viewportEnteredNeeded = true; break; case QEvent::Leave: + d->setHoverIndex(QModelIndex()); // If we've left, no hover should be needed anymore #ifndef QT_NO_STATUSTIP if (d->shouldClearStatusTip && d->parent) { QString empty; diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp index b213a0859c..99704c7911 100644 --- a/src/widgets/itemviews/qdatawidgetmapper.cpp +++ b/src/widgets/itemviews/qdatawidgetmapper.cpp @@ -89,11 +89,11 @@ public: : model->index(itemPos, currentIdx(), rootIndex); } - inline void flipEventFilters(QAbstractItemDelegate *oldDelegate, - QAbstractItemDelegate *newDelegate) + void flipEventFilters(QAbstractItemDelegate *oldDelegate, + QAbstractItemDelegate *newDelegate) const { - for (QList::const_iterator it = widgetMap.cbegin(), end = widgetMap.cend(); it != end; ++it) { - QWidget *w = it->widget; + for (const WidgetMapper &e : widgetMap) { + QWidget *w = e.widget; if (!w) continue; w->removeEventFilter(oldDelegate); @@ -111,11 +111,6 @@ public: struct WidgetMapper { - inline WidgetMapper(QWidget *w = 0, int c = 0, const QModelIndex &i = QModelIndex()) - : widget(w), section(c), currentIndex(i) {} - inline WidgetMapper(QWidget *w, int c, const QModelIndex &i, const QByteArray &p) - : widget(w), section(c), currentIndex(i), property(p) {} - QPointer widget; int section; QPersistentModelIndex currentIndex; @@ -127,14 +122,15 @@ public: bool commit(const WidgetMapper &m); - QList widgetMap; + std::vector widgetMap; }; +Q_DECLARE_TYPEINFO(QDataWidgetMapperPrivate::WidgetMapper, Q_MOVABLE_TYPE); int QDataWidgetMapperPrivate::findWidget(QWidget *w) const { - for (QList::const_iterator it = widgetMap.cbegin(), end = widgetMap.cend(); it != end; ++it) { - if (it->widget == w) - return int(std::distance(widgetMap.cbegin(), it)); + for (const WidgetMapper &e : widgetMap) { + if (e.widget == w) + return int(&e - &widgetMap.front()); } return -1; } @@ -171,8 +167,8 @@ void QDataWidgetMapperPrivate::populate(WidgetMapper &m) void QDataWidgetMapperPrivate::populate() { - for (QList::iterator it = widgetMap.begin(), end = widgetMap.end(); it != end; ++it) - populate(*it); + for (WidgetMapper &e : widgetMap) + populate(e); } static bool qContainsIndex(const QModelIndex &idx, const QModelIndex &topLeft, @@ -187,9 +183,9 @@ void QDataWidgetMapperPrivate::_q_dataChanged(const QModelIndex &topLeft, const if (topLeft.parent() != rootIndex) return; // not in our hierarchy - for (QList::iterator it = widgetMap.begin(), end = widgetMap.end(); it != end; ++it) { - if (qContainsIndex(it->currentIndex, topLeft, bottomRight)) - populate(*it); + for (WidgetMapper &e : widgetMap) { + if (qContainsIndex(e.currentIndex, topLeft, bottomRight)) + populate(e); } } @@ -202,7 +198,7 @@ void QDataWidgetMapperPrivate::_q_commitData(QWidget *w) if (idx == -1) return; // not our widget - commit(widgetMap.at(idx)); + commit(widgetMap[idx]); } void QDataWidgetMapperPrivate::_q_closeEditor(QWidget *w, QAbstractItemDelegate::EndEditHint hint) @@ -479,7 +475,7 @@ void QDataWidgetMapper::addMapping(QWidget *widget, int section) Q_D(QDataWidgetMapper); removeMapping(widget); - d->widgetMap.append(QDataWidgetMapperPrivate::WidgetMapper(widget, section, d->indexAt(section))); + d->widgetMap.push_back({widget, section, d->indexAt(section), QByteArray()}); widget->installEventFilter(d->delegate); } @@ -497,7 +493,7 @@ void QDataWidgetMapper::addMapping(QWidget *widget, int section, const QByteArra Q_D(QDataWidgetMapper); removeMapping(widget); - d->widgetMap.append(QDataWidgetMapperPrivate::WidgetMapper(widget, section, d->indexAt(section), propertyName)); + d->widgetMap.push_back({widget, section, d->indexAt(section), propertyName}); widget->installEventFilter(d->delegate); } @@ -514,7 +510,7 @@ void QDataWidgetMapper::removeMapping(QWidget *widget) if (idx == -1) return; - d->widgetMap.removeAt(idx); + d->widgetMap.erase(d->widgetMap.begin() + idx); widget->removeEventFilter(d->delegate); } @@ -532,7 +528,7 @@ int QDataWidgetMapper::mappedSection(QWidget *widget) const if (idx == -1) return -1; - return d->widgetMap.at(idx).section; + return d->widgetMap[idx].section; } /*! @@ -550,7 +546,7 @@ QByteArray QDataWidgetMapper::mappedPropertyName(QWidget *widget) const int idx = d->findWidget(widget); if (idx == -1) return QByteArray(); - const QDataWidgetMapperPrivate::WidgetMapper &m = d->widgetMap.at(idx); + const auto &m = d->widgetMap[idx]; if (m.property.isEmpty()) return m.widget->metaObject()->userProperty().name(); else @@ -567,9 +563,9 @@ QWidget *QDataWidgetMapper::mappedWidgetAt(int section) const { Q_D(const QDataWidgetMapper); - for (QList::const_iterator it = d->widgetMap.cbegin(), end = d->widgetMap.cend(); it != end; ++it) { - if (it->section == section) - return it->widget; + for (auto &e : d->widgetMap) { + if (e.section == section) + return e.widget; } return 0; @@ -606,8 +602,8 @@ bool QDataWidgetMapper::submit() { Q_D(QDataWidgetMapper); - for (QList::const_iterator it = d->widgetMap.cbegin(), end = d->widgetMap.cend(); it != end; ++it) { - if (!d->commit(*it)) + for (auto &e : d->widgetMap) { + if (!d->commit(e)) return false; } @@ -746,9 +742,9 @@ void QDataWidgetMapper::clearMapping() { Q_D(QDataWidgetMapper); - QList copy; + decltype(d->widgetMap) copy; d->widgetMap.swap(copy); // a C++98 move - for (QList::const_reverse_iterator it = copy.crbegin(), end = copy.crend(); it != end; ++it) { + for (auto it = copy.crbegin(), end = copy.crend(); it != end; ++it) { if (it->widget) it->widget->removeEventFilter(d->delegate); } diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp index 747d5db782..6a6220cd0a 100644 --- a/src/widgets/itemviews/qitemdelegate.cpp +++ b/src/widgets/itemviews/qitemdelegate.cpp @@ -62,7 +62,6 @@ #include #include #include -#include #include #include diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp index e4115c9e60..4149d3ac3a 100644 --- a/src/widgets/itemviews/qstyleditemdelegate.cpp +++ b/src/widgets/itemviews/qstyleditemdelegate.cpp @@ -67,7 +67,6 @@ #include #include #include -#include #include #include diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 7c62edeb2f..ad82e5eb2a 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5987,7 +5987,7 @@ void QWidgetPrivate::resolveLocale() Q_Q(const QWidget); if (!q->testAttribute(Qt::WA_SetLocale)) { - setLocale_helper(q->isWindow() + setLocale_helper(q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation) ? QLocale() : q->parentWidget()->locale()); } diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 2b9f042862..260a660bf9 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -77,7 +77,9 @@ #include #include #include +#if QT_CONFIG(dialog) #include +#endif #include #include #if QT_CONFIG(label) @@ -2820,7 +2822,10 @@ void QStyleSheetStyle::polish(QWidget *w) #ifndef QT_NO_MENUBAR || qobject_cast(w) #endif - || qobject_cast(w)) { +#if QT_CONFIG(dialog) + || qobject_cast(w) +#endif + ) { w->setAttribute(Qt::WA_StyledBackground, true); } QWidget *ew = embeddedWidget(w); diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index fe1446660b..27ecc33dba 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -2082,15 +2082,15 @@ void QDockAreaLayoutInfo::reparentWidgets(QWidget *parent) const QDockAreaLayoutItem &item = item_list.at(i); if (item.flags & QDockAreaLayoutItem::GapItem) continue; - if (item.skip()) - continue; if (item.subinfo) item.subinfo->reparentWidgets(parent); if (item.widgetItem) { QWidget *w = item.widgetItem->widget(); + if (qobject_cast(w)) + continue; if (w->parent() != parent) { bool hidden = w->isHidden(); - w->setParent(parent); + w->setParent(parent, w->windowFlags()); if (!hidden) w->show(); } diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 1d81d1fcb5..68be82c71d 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -534,7 +534,19 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE #endif } // If there is a 'before' action, it takes preference + + // There's a bug in GHS compiler that causes internal error on the following code. + // The affected GHS compiler versions are 2016.5.4 and 2017.1 + // This temporary workaround allows to compile with GHS toolchain and should be + // removed when GHS provides a patch to fix the compiler issue. + +#if defined(Q_CC_GHS) + const SideWidgetLocation loc = {position, -1}; + const auto location = before ? findSideWidget(before) : loc; +#else const auto location = before ? findSideWidget(before) : SideWidgetLocation{position, -1}; +#endif + SideWidgetEntryList &list = location.position == QLineEdit::TrailingPosition ? trailingSideWidgets : leadingSideWidgets; list.insert(location.isValid() ? list.begin() + location.index : list.end(), SideWidgetEntry(w, newAction, flags)); diff --git a/src/widgets/widgets/qplaintextedit_p.h b/src/widgets/widgets/qplaintextedit_p.h index f0dd1c0ed4..803623c974 100644 --- a/src/widgets/widgets/qplaintextedit_p.h +++ b/src/widgets/widgets/qplaintextedit_p.h @@ -60,11 +60,12 @@ #include "QtWidgets/qmenu.h" #include "QtGui/qabstracttextdocumentlayout.h" #include "QtCore/qbasictimer.h" -#include "private/qwidgettextcontrol_p.h" #include "qplaintextedit.h" #ifndef QT_NO_TEXTEDIT +#include "private/qwidgettextcontrol_p.h" + QT_BEGIN_NAMESPACE class QMimeData; diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index 1beea7edc5..a4318681c9 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -40,8 +40,9 @@ #include "qapplication.h" #include "qbitmap.h" #include "qdesktopwidget.h" -#include "qdialog.h" +#if QT_CONFIG(dialog) #include +#endif #include "qdrawutil.h" #include "qevent.h" #include "qfontmetrics.h" @@ -288,6 +289,7 @@ QPushButton::~QPushButton() { } +#if QT_CONFIG(dialog) QDialog *QPushButtonPrivate::dialogParent() const { Q_Q(const QPushButton); @@ -299,6 +301,7 @@ QDialog *QPushButtonPrivate::dialogParent() const } return 0; } +#endif /*! Initialize \a option with the values from this QPushButton. This method is useful @@ -362,10 +365,12 @@ void QPushButton::setDefault(bool enable) if (d->defaultButton == enable) return; d->defaultButton = enable; +#if QT_CONFIG(dialog) if (d->defaultButton) { if (QDialog *dlg = d->dialogParent()) dlg->d_func()->setMainDefault(this); } +#endif update(); #ifndef QT_NO_ACCESSIBILITY QAccessible::State s; @@ -474,9 +479,11 @@ void QPushButton::focusInEvent(QFocusEvent *e) Q_D(QPushButton); if (e->reason() != Qt::PopupFocusReason && autoDefault() && !d->defaultButton) { d->defaultButton = true; +#if QT_CONFIG(dialog) QDialog *dlg = qobject_cast(window()); if (dlg) dlg->d_func()->setDefault(this); +#endif } QAbstractButton::focusInEvent(e); } @@ -488,11 +495,13 @@ void QPushButton::focusOutEvent(QFocusEvent *e) { Q_D(QPushButton); if (e->reason() != Qt::PopupFocusReason && autoDefault() && d->defaultButton) { +#if QT_CONFIG(dialog) QDialog *dlg = qobject_cast(window()); if (dlg) dlg->d_func()->setDefault(0); else d->defaultButton = false; +#endif } QAbstractButton::focusOutEvent(e); @@ -657,10 +666,12 @@ bool QPushButton::event(QEvent *e) { Q_D(QPushButton); if (e->type() == QEvent::ParentChange) { +#if QT_CONFIG(dialog) if (QDialog *dialog = d->dialogParent()) { if (d->defaultButton) dialog->d_func()->setMainDefault(this); } +#endif } else if (e->type() == QEvent::StyleChange #ifdef Q_OS_MAC || e->type() == QEvent::MacSizeChange diff --git a/src/widgets/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h index 198091503a..a32b599b94 100644 --- a/src/widgets/widgets/qpushbutton_p.h +++ b/src/widgets/widgets/qpushbutton_p.h @@ -81,7 +81,11 @@ public: #endif void resetLayoutItemMargins(); void _q_popupPressed(); +#if QT_CONFIG(dialog) QDialog *dialogParent() const; +#else + QDialog *dialogParent() const { return 0; }; +#endif QPointer menu; uint autoDefault : 2; diff --git a/src/widgets/widgets/qtextedit_p.h b/src/widgets/widgets/qtextedit_p.h index cca315ce30..13d0eb323a 100644 --- a/src/widgets/widgets/qtextedit_p.h +++ b/src/widgets/widgets/qtextedit_p.h @@ -61,13 +61,14 @@ #include "QtGui/qabstracttextdocumentlayout.h" #include "QtCore/qbasictimer.h" #include "QtCore/qurl.h" -#include "private/qwidgettextcontrol_p.h" #include "qtextedit.h" -QT_BEGIN_NAMESPACE - #ifndef QT_NO_TEXTEDIT +#include "private/qwidgettextcontrol_p.h" + +QT_BEGIN_NAMESPACE + class QMimeData; class QTextEditPrivate : public QAbstractScrollAreaPrivate { @@ -135,9 +136,9 @@ public: QBasicTimer deleteAllTimer; #endif }; -#endif // QT_NO_TEXTEDIT - QT_END_NAMESPACE +#endif // QT_NO_TEXTEDIT + #endif // QTEXTEDIT_P_H diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp index 2c74b5fa9d..8413827e30 100644 --- a/src/widgets/widgets/qtoolbox.cpp +++ b/src/widgets/widgets/qtoolbox.cpp @@ -117,7 +117,7 @@ public: void _q_buttonClicked(); void _q_widgetDestroyed(QObject*); - const Page *page(QWidget *widget) const; + const Page *page(const QObject *widget) const; const Page *page(int index) const; Page *page(int index); @@ -129,7 +129,7 @@ public: Page *currentPage; }; -const QToolBoxPrivate::Page *QToolBoxPrivate::page(QWidget *widget) const +const QToolBoxPrivate::Page *QToolBoxPrivate::page(const QObject *widget) const { if (!widget) return 0; @@ -449,11 +449,9 @@ void QToolBoxPrivate::relayout() void QToolBoxPrivate::_q_widgetDestroyed(QObject *object) { Q_Q(QToolBox); - // no verification - vtbl corrupted already - QWidget *p = (QWidget*)object; - const QToolBoxPrivate::Page *c = page(p); - if (!p || !c) + const QToolBoxPrivate::Page * const c = page(object); + if (!c) return; layout->removeWidget(c->sv); diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 9aec94d47f..9e848ca834 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -2055,16 +2055,59 @@ void QWidgetTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) preeditCursor = a.start; hideCursor = !a.length; } else if (a.type == QInputMethodEvent::TextFormat) { - QTextCharFormat f = qvariant_cast(a.value).toCharFormat(); + QTextCharFormat f = cursor.charFormat(); + f.merge(qvariant_cast(a.value).toCharFormat()); if (f.isValid()) { QTextLayout::FormatRange o; o.start = a.start + cursor.position() - block.position(); o.length = a.length; o.format = f; - overrides.append(o); + + // Make sure list is sorted by start index + QVector::iterator it = overrides.end(); + while (it != overrides.begin()) { + QVector::iterator previous = it - 1; + if (o.start >= previous->start) { + overrides.insert(it, o); + break; + } + it = previous; + } + + if (it == overrides.begin()) + overrides.prepend(o); } } } + + if (cursor.charFormat().isValid()) { + int start = cursor.position() - block.position(); + int end = start + e->preeditString().length(); + + QVector::iterator it = overrides.begin(); + while (it != overrides.end()) { + QTextLayout::FormatRange range = *it; + int rangeStart = range.start; + if (rangeStart > start) { + QTextLayout::FormatRange o; + o.start = start; + o.length = rangeStart - start; + o.format = cursor.charFormat(); + it = overrides.insert(it, o) + 1; + } + + ++it; + start = range.start + range.length; + } + + if (start < end) { + QTextLayout::FormatRange o; + o.start = start; + o.length = end - start; + o.format = cursor.charFormat(); + overrides.append(o); + } + } layout->setFormats(overrides); cursor.endEditBlock(); diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h index f540a3c9ad..e2539a30e7 100644 --- a/src/widgets/widgets/qwidgettextcontrol_p.h +++ b/src/widgets/widgets/qwidgettextcontrol_p.h @@ -65,6 +65,8 @@ #include #include +QT_REQUIRE_CONFIG(widgettextcontrol); + QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qwidgettextcontrol_p_p.h b/src/widgets/widgets/qwidgettextcontrol_p_p.h index 35027ff82a..357ffdc6bd 100644 --- a/src/widgets/widgets/qwidgettextcontrol_p_p.h +++ b/src/widgets/widgets/qwidgettextcontrol_p_p.h @@ -62,6 +62,8 @@ #include "QtCore/qpointer.h" #include "private/qobject_p.h" +QT_REQUIRE_CONFIG(widgettextcontrol); + QT_BEGIN_NAMESPACE class QMimeData; diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 22e083a3d4..086585f0e6 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -65,8 +65,6 @@ HEADERS += \ widgets/qfocusframe.h \ widgets/qscrollarea.h \ widgets/qwidgetanimator_p.h \ - widgets/qwidgettextcontrol_p.h \ - widgets/qwidgettextcontrol_p_p.h \ widgets/qwidgetlinecontrol_p.h \ widgets/qtoolbararealayout_p.h \ widgets/qplaintextedit.h \ @@ -120,7 +118,6 @@ SOURCES += \ widgets/qfocusframe.cpp \ widgets/qscrollarea.cpp \ widgets/qwidgetanimator.cpp \ - widgets/qwidgettextcontrol.cpp \ widgets/qwidgetlinecontrol.cpp \ widgets/qtoolbararealayout.cpp \ widgets/qplaintextedit.cpp @@ -194,6 +191,15 @@ qtConfig(dialogbuttonbox) { widgets/qdialogbuttonbox.cpp } +qtConfig(widgettextcontrol) { + HEADERS += \ + widgets/qwidgettextcontrol_p.h \ + widgets/qwidgettextcontrol_p_p.h + + SOURCES += \ + widgets/qwidgettextcontrol.cpp +} + macx { HEADERS += \ widgets/qmacnativewidget_mac.h \ diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index d3c4d470f5..f4ab0d8464 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -31,6 +31,8 @@ else:!qtConfig(process): SUBDIRS -= tools !qtHaveModule(concurrent): SUBDIRS -= concurrent !qtHaveModule(network): SUBDIRS -= network !qtHaveModule(dbus): SUBDIRS -= dbus +!qtHaveModule(xml): SUBDIRS -= xml +!qtHaveModule(sql): SUBDIRS -= sql # Disable the QtDBus tests if we can't connect to the session bus !cross_compile:qtHaveModule(dbus) { diff --git a/tests/auto/corelib/animation/qpauseanimation/BLACKLIST b/tests/auto/corelib/animation/qpauseanimation/BLACKLIST index 3b2cd84749..8fc1b07502 100644 --- a/tests/auto/corelib/animation/qpauseanimation/BLACKLIST +++ b/tests/auto/corelib/animation/qpauseanimation/BLACKLIST @@ -2,3 +2,5 @@ osx-10.9 [pauseAndPropertyAnimations] * +[multipleSequentialGroups] +osx diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro index 470a1dde26..01ed84fda9 100644 --- a/tests/auto/corelib/io/io.pro +++ b/tests/auto/corelib/io/io.pro @@ -50,6 +50,11 @@ SUBDIRS=\ qprocess \ qtextstream +!qtHaveModule(concurrent): SUBDIRS -= \ + qdebug \ + qlockfile \ + qurl + !qtConfig(private_tests): SUBDIRS -= \ qabstractfileengine \ qfileinfo \ diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 762cb539e0..330ff9312d 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -99,14 +99,11 @@ private slots: void entryListWithSymLinks(); - void mkdir_data(); - void mkdir(); + void mkdirRmdir_data(); + void mkdirRmdir(); void makedirReturnCode(); - void rmdir_data(); - void rmdir(); - void removeRecursively_data(); void removeRecursively(); void removeRecursivelyFailure(); @@ -342,26 +339,29 @@ void tst_QDir::setPath() QCOMPARE(shared.entryList(), entries2); } -void tst_QDir::mkdir_data() +void tst_QDir::mkdirRmdir_data() { QTest::addColumn("path"); QTest::addColumn("recurse"); QStringList dirs; - dirs << QDir::currentPath() + "/testdir/one/two/three" - << QDir::currentPath() + "/testdir/two" - << QDir::currentPath() + "/testdir/two/three"; - QTest::newRow("data0") << dirs.at(0) << true; - QTest::newRow("data1") << dirs.at(1) << false; - QTest::newRow("data2") << dirs.at(2) << false; // note: requires data1 to have been run! + dirs << "testdir/one" + << "testdir/two/three/four" + << "testdir/../testdir/three"; + QTest::newRow("plain") << QDir::currentPath() + "/" + dirs.at(0) << false; + QTest::newRow("recursive") << QDir::currentPath() + "/" + dirs.at(1) << true; + QTest::newRow("with-..") << QDir::currentPath() + "/" + dirs.at(2) << false; + + QTest::newRow("relative-plain") << dirs.at(0) << false; + QTest::newRow("relative-recursive") << dirs.at(1) << true; + QTest::newRow("relative-with-..") << dirs.at(2) << false; // Ensure that none of these directories already exist - QDir dir; for (int i = 0; i < dirs.count(); ++i) - dir.rmpath(dirs.at(i)); + QVERIFY(!QFile::exists(dirs.at(i))); } -void tst_QDir::mkdir() +void tst_QDir::mkdirRmdir() { QFETCH(QString, path); QFETCH(bool, recurse); @@ -376,6 +376,15 @@ void tst_QDir::mkdir() //make sure it really exists (ie that mkdir returns the right value) QFileInfo fi(path); QVERIFY2(fi.exists() && fi.isDir(), msgDoesNotExist(path).constData()); + + if (recurse) + QVERIFY(dir.rmpath(path)); + else + QVERIFY(dir.rmdir(path)); + + //make sure it really doesn't exist (ie that rmdir returns the right value) + fi.refresh(); + QVERIFY(!fi.exists()); } void tst_QDir::makedirReturnCode() @@ -405,32 +414,6 @@ void tst_QDir::makedirReturnCode() f.remove(); } -void tst_QDir::rmdir_data() -{ - QTest::addColumn("path"); - QTest::addColumn("recurse"); - - QTest::newRow("data0") << QDir::currentPath() + "/testdir/one/two/three" << true; - QTest::newRow("data1") << QDir::currentPath() + "/testdir/two/three" << false; - QTest::newRow("data2") << QDir::currentPath() + "/testdir/two" << false; -} - -void tst_QDir::rmdir() -{ - QFETCH(QString, path); - QFETCH(bool, recurse); - - QDir dir; - if (recurse) - QVERIFY(dir.rmpath(path)); - else - QVERIFY(dir.rmdir(path)); - - //make sure it really doesn't exist (ie that rmdir returns the right value) - QFileInfo fi(path); - QVERIFY(!fi.exists()); -} - void tst_QDir::removeRecursively_data() { QTest::addColumn("path"); diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp index a13ff0358a..d2f345feb5 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp @@ -34,6 +34,7 @@ #include #if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS) #include +#include #elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT) # include #endif @@ -59,6 +60,7 @@ private slots: void noPermissions(); void noPermissionsWindows(); void corruptedLockFile(); + void corruptedLockFileInTheFuture(); private: static bool overwritePidInLockFile(const QString &filePath, qint64 pid); @@ -521,6 +523,32 @@ void tst_QLockFile::corruptedLockFile() QCOMPARE(int(secondLock.error()), int(QLockFile::NoError)); } +void tst_QLockFile::corruptedLockFileInTheFuture() +{ +#if !defined(Q_OS_UNIX) + QSKIP("This tests needs utimes"); +#else + // This test is the same as the previous one, but the corruption was so there is a corrupted + // .rmlock whose timestamp is in the future + + const QString fileName = dir.path() + "/corruptedLockFile.rmlock"; + + { + QFile file(fileName); + QVERIFY(file.open(QFile::WriteOnly)); + } + + struct timeval times[2]; + gettimeofday(times, 0); + times[1].tv_sec = (times[0].tv_sec += 600); + times[1].tv_usec = times[0].tv_usec; + utimes(fileName.toLocal8Bit(), times); + + QTest::ignoreMessage(QtInfoMsg, "QLockFile: Lock file '" + fileName.toUtf8() + "' has a modification time in the future"); + corruptedLockFile(); +#endif +} + bool tst_QLockFile::overwritePidInLockFile(const QString &filePath, qint64 pid) { QFile f(filePath); diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index e1a999abfb..1cbb7ad19c 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -3071,7 +3071,11 @@ void tst_QUrl::fromUserInputWithCwd_data() } // Existing files - for (const char *fileName : {"file.txt", "file#a.txt", "file .txt", "file.txt "}) { + for (const char *fileName : {"file.txt", "file#a.txt", "file .txt", "file.txt " +#ifndef Q_OS_WIN + , "file:colon.txt" +#endif + }) { const QString filePath = base + '/' + fileName; QFile file(filePath); QVERIFY2(file.open(QIODevice::WriteOnly), qPrintable(filePath)); diff --git a/tests/auto/corelib/itemmodels/itemmodels.pro b/tests/auto/corelib/itemmodels/itemmodels.pro index 3552f30632..a09f03a7b4 100644 --- a/tests/auto/corelib/itemmodels/itemmodels.pro +++ b/tests/auto/corelib/itemmodels/itemmodels.pro @@ -9,6 +9,10 @@ qtHaveModule(gui): SUBDIRS += \ qitemselectionmodel \ qsortfilterproxymodel_recursive \ -qtHaveModule(widgets): SUBDIRS += \ - qitemmodel \ - qsortfilterproxymodel \ +qtHaveModule(widgets) { + SUBDIRS += \ + qsortfilterproxymodel + + qtHaveModule(sql): SUBDIRS += \ + qitemmodel +} diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 2346ca6d30..54582ee4c3 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -4017,7 +4017,7 @@ public: } bool canDropMimeData(const QMimeData *, Qt::DropAction, - int row, int column, const QModelIndex &parent) const Q_DECL_OVERRIDE + int row, int column, const QModelIndex &parent) const override { Q_UNUSED(row); Q_UNUSED(column); diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index 6aa5165e24..b215364f0e 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -32,6 +32,7 @@ #include "qjsonobject.h" #include "qjsonvalue.h" #include "qjsondocument.h" +#include "qregularexpression.h" #include #define INVALID_UNICODE "\xCE\xBA\xE1" @@ -49,6 +50,7 @@ private Q_SLOTS: void testNumbers(); void testNumbers_2(); void testNumbers_3(); + void testNumbers_4(); void testObjectSimple(); void testObjectSmallKeys(); @@ -375,6 +377,33 @@ void tst_QtJson::testNumbers_3() QVERIFY(d1_1 != d2_1); } +void tst_QtJson::testNumbers_4() +{ + // no exponent notation used to print numbers between -2^64 and 2^64 + QJsonArray array; + array << QJsonValue(+1000000000000000.0); + array << QJsonValue(-1000000000000000.0); + array << QJsonValue(+9007199254740992.0); + array << QJsonValue(-9007199254740992.0); + array << QJsonValue(+9223372036854775808.0); + array << QJsonValue(-9223372036854775808.0); + array << QJsonValue(+18446744073709551616.0); + array << QJsonValue(-18446744073709551616.0); + const QByteArray json(QJsonDocument(array).toJson()); + const QByteArray expected = + "[\n" + " 1000000000000000,\n" + " -1000000000000000,\n" + " 9007199254740992,\n" + " -9007199254740992,\n" + " 9223372036854776000,\n" + " -9223372036854776000,\n" + " 18446744073709552000,\n" + " -18446744073709552000\n" + "]\n"; + QCOMPARE(json, expected); +} + void tst_QtJson::testObjectSimple() { QJsonObject object; diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 78833d08bd..28c5c53744 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -1566,7 +1566,6 @@ DECLARE_NONSTREAMABLE(QJsonArray) DECLARE_NONSTREAMABLE(QJsonDocument) DECLARE_NONSTREAMABLE(QObject*) DECLARE_NONSTREAMABLE(QWidget*) -DECLARE_NONSTREAMABLE(std::nullptr_t) #define DECLARE_GUI_CLASS_NONSTREAMABLE(MetaTypeName, MetaTypeId, RealType) \ DECLARE_NONSTREAMABLE(RealType) @@ -1605,7 +1604,10 @@ void tst_QMetaType::saveAndLoadBuiltin() if (isStreamable) { QVERIFY(QMetaType::load(stream, type, value)); // Hmmm, shouldn't it return false? - QCOMPARE(stream.status(), QDataStream::ReadPastEnd); + + // std::nullptr_t is nullary: it doesn't actually read anything + if (type != QMetaType::Nullptr) + QCOMPARE(stream.status(), QDataStream::ReadPastEnd); } stream.device()->seek(0); @@ -1615,7 +1617,10 @@ void tst_QMetaType::saveAndLoadBuiltin() if (isStreamable) { QVERIFY(QMetaType::load(stream, type, value)); // Hmmm, shouldn't it return false? - QCOMPARE(stream.status(), QDataStream::ReadPastEnd); + + // std::nullptr_t is nullary: it doesn't actually read anything + if (type != QMetaType::Nullptr) + QCOMPARE(stream.status(), QDataStream::ReadPastEnd); } QMetaType::destroy(type, value); diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase.pro b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase.pro index 536a6b64de..f821702564 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase.pro +++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase.pro @@ -1,3 +1,5 @@ TEMPLATE = subdirs -SUBDIRS = qmimedatabase-xml -unix:!mac:!qnx: SUBDIRS += qmimedatabase-cache +qtHaveModule(concurrent) { + SUBDIRS = qmimedatabase-xml + unix:!darwin:!qnx: SUBDIRS += qmimedatabase-cache +} diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp index 02ba987ccd..280e3f77a4 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp @@ -861,7 +861,7 @@ void tst_QMimeDatabase::fromThreads() #if QT_CONFIG(process) enum { - UpdateMimeDatabaseTimeout = 120 * 1000 // 2min + UpdateMimeDatabaseTimeout = 4 * 60 * 1000 // 4min }; static bool runUpdateMimeDatabase(const QString &path) // TODO make it a QMimeDatabase method? diff --git a/tests/auto/corelib/thread/thread.pro b/tests/auto/corelib/thread/thread.pro index f18dad6a4c..d3c669859b 100644 --- a/tests/auto/corelib/thread/thread.pro +++ b/tests/auto/corelib/thread/thread.pro @@ -6,7 +6,6 @@ SUBDIRS=\ qresultstore \ qfuture \ qfuturesynchronizer \ - qfuturewatcher \ qmutex \ qmutexlocker \ qreadlocker \ @@ -18,3 +17,8 @@ SUBDIRS=\ qthreadstorage \ qwaitcondition \ qwritelocker + +qtHaveModule(concurrent) { + SUBDIRS += \ + qfuturewatcher +} diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp index ba2adddca0..a00c962510 100644 --- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp +++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp @@ -750,7 +750,6 @@ void tst_QArrayData::reallocate() QFETCH(size_t, alignment); QFETCH(QArrayData::AllocationOptions, allocateOptions); QFETCH(bool, isCapacityReserved); - QFETCH(const QArrayData *, commonEmpty); // Maximum alignment that can be requested is that of QArrayData, // otherwise, we can't use reallocate(). diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index dede56b4bf..76309d914b 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -38,7 +38,7 @@ class tst_QChar : public QObject private slots: void fromChar16_t(); void fromWchar_t(); - void operator_eqeq_int(); + void operator_eqeq_null(); void operators_data(); void operators(); void toUpper(); @@ -101,32 +101,54 @@ void tst_QChar::fromWchar_t() #endif } -void tst_QChar::operator_eqeq_int() +void tst_QChar::operator_eqeq_null() { { const QChar ch = QLatin1Char(' '); - QVERIFY(ch != 0); - QVERIFY(!(ch == 0)); +#define CHECK(NUL) \ + do { \ + QVERIFY(!(ch == NUL)); \ + QVERIFY( ch != NUL ); \ + QVERIFY(!(ch < NUL)); \ + QVERIFY( ch > NUL ); \ + QVERIFY(!(ch <= NUL)); \ + QVERIFY( ch >= NUL ); \ + QVERIFY(!(NUL == ch )); \ + QVERIFY( NUL != ch ); \ + QVERIFY( NUL < ch ); \ + QVERIFY(!(NUL > ch )); \ + QVERIFY( NUL <= ch ); \ + QVERIFY(!(NUL >= ch )); \ + } while (0) - QVERIFY(ch == 0x20); - QVERIFY(!(ch != 0x20)); - QVERIFY(0x20 == ch); - QVERIFY(!(0x20 != ch)); + CHECK(0); + CHECK('\0'); +#undef CHECK } { const QChar ch = QLatin1Char('\0'); - QVERIFY(ch == 0); - QVERIFY(!(ch != 0)); +#define CHECK(NUL) \ + do { \ + QVERIFY( ch == NUL ); \ + QVERIFY(!(ch != NUL)); \ + QVERIFY(!(ch < NUL)); \ + QVERIFY(!(ch > NUL)); \ + QVERIFY( ch <= NUL ); \ + QVERIFY( ch >= NUL ); \ + QVERIFY( NUL == ch ); \ + QVERIFY(!(NUL != ch )); \ + QVERIFY(!(NUL < ch )); \ + QVERIFY(!(NUL > ch )); \ + QVERIFY( NUL <= ch ); \ + QVERIFY( NUL >= ch ); \ + } while (0) - QVERIFY(ch != 0x20); - QVERIFY(!(ch == 0x20)); - QVERIFY(0x20 != ch); - QVERIFY(!(0x20 == ch)); + CHECK(0); + CHECK('\0'); +#undef CHECK } } -QT_WARNING_POP - void tst_QChar::operators_data() { QTest::addColumn("lhs"); diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index 0b864e71d4..0c5f1a7afb 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -1053,6 +1053,10 @@ void tst_QHash::keyIterator() QCOMPARE(*(--key_it), (--it).key()); QCOMPARE(std::count(hash.keyBegin(), hash.keyEnd(), 99), 1); + + // DefaultConstructible test + typedef QHash::key_iterator keyIterator; + Q_STATIC_ASSERT(std::is_default_constructible::value); } void tst_QHash::rehash_isnt_quadratic() diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp index 8aa7a3e518..f42ffc0471 100644 --- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp +++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp @@ -857,6 +857,10 @@ void tst_QMap::keyIterator() QCOMPARE(*(--key_it), (--it).key()); QCOMPARE(std::count(map.keyBegin(), map.keyEnd(), 99), 1); + + // DefaultConstructible test + typedef QMap::key_iterator keyIterator; + Q_STATIC_ASSERT(std::is_default_constructible::value); } void tst_QMap::keys_values_uniqueKeys() diff --git a/tests/auto/corelib/xml/xml.pro b/tests/auto/corelib/xml/xml.pro index 20519edf1b..374e695aa7 100644 --- a/tests/auto/corelib/xml/xml.pro +++ b/tests/auto/corelib/xml/xml.pro @@ -1,3 +1,3 @@ TEMPLATE=subdirs -qtHaveModule(network): SUBDIRS= \ +qtHaveModule(network):qtHaveModule(xml): SUBDIRS= \ qxmlstream diff --git a/tests/auto/dbus/dbus.pro b/tests/auto/dbus/dbus.pro index 2c58d7e235..6878c9341d 100644 --- a/tests/auto/dbus/dbus.pro +++ b/tests/auto/dbus/dbus.pro @@ -34,3 +34,6 @@ SUBDIRS+=\ qdbusabstractinterface \ qdbusinterface \ qdbusmarshall + +!qtHaveModule(xml): SUBDIRS -= \ + qdbusxmlparser diff --git a/tests/auto/gui/text/text.pro b/tests/auto/gui/text/text.pro index d1a3eda4fc..6b033fb506 100644 --- a/tests/auto/gui/text/text.pro +++ b/tests/auto/gui/text/text.pro @@ -35,3 +35,7 @@ win32:SUBDIRS -= qtextpiecetable qtextpiecetable \ qzip \ qtextodfwriter + +!qtHaveModule(xml): SUBDIRS -= \ + qcssparser \ + qtextdocument diff --git a/tests/auto/network/ssl/qsslsocket/certs/xn--schufele-2za.crt b/tests/auto/network/ssl/qsslsocket/certs/xn--schufele-2za.crt new file mode 100644 index 0000000000..b34847b8d2 --- /dev/null +++ b/tests/auto/network/ssl/qsslsocket/certs/xn--schufele-2za.crt @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBfTCCASegAwIBAgIJANTX9XvqKXllMA0GCSqGSIb3DQEBCwUAMBoxGDAWBgNV +BAMMDyouU0NIw4RVRkVMRS5ERTAeFw0xNzAzMDcwOTIwMzZaFw0xNzA0MDYwOTIw +MzZaMBoxGDAWBgNVBAMMDyouU0NIw4RVRkVMRS5ERTBcMA0GCSqGSIb3DQEBAQUA +A0sAMEgCQQDZGJFl85dMxps7EryuNyP1apWrBqp7mlwgfbCN9wboyUZBLCWM58UK +6oJPg0X19IJUv3UTxD8GH7qQteCXPl4bAgMBAAGjUDBOMB0GA1UdDgQWBBSLuHtk +CfEpYnW5Rw7XcO53P/1+jDAfBgNVHSMEGDAWgBSLuHtkCfEpYnW5Rw7XcO53P/1+ +jDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA0EAXrGVzhGlekW5Zm78tASr +5lTF6wn3klqvd2zTqTKuAKWAuBNX46p79g8OGsfY76X9M+/RbUYa7h5BuTL9b45K +dw== +-----END CERTIFICATE----- diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index ba02af1d47..f44e5261dd 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -191,6 +191,7 @@ private slots: void supportedCiphers(); void systemCaCertificates(); void wildcardCertificateNames(); + void isMatchingHostname(); void wildcard(); void setEmptyKey(); void spontaneousWrite(); @@ -1687,10 +1688,15 @@ void tst_QSslSocket::wildcardCertificateNames() { // Passing CN matches QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("www.example.com"), QString("www.example.com")), true ); + QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("WWW.EXAMPLE.COM"), QString("www.example.com")), true ); QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("*.example.com"), QString("www.example.com")), true ); QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("xxx*.example.com"), QString("xxxwww.example.com")), true ); QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("f*.example.com"), QString("foo.example.com")), true ); QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("192.168.0.0"), QString("192.168.0.0")), true ); + QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("foo.éxample.com"), QString("foo.xn--xample-9ua.com")), true ); + QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("*.éxample.com"), QString("foo.xn--xample-9ua.com")), true ); + QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("xn--kcry6tjko.example.org"), QString("xn--kcry6tjko.example.org")), true); + QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("*.xn--kcry6tjko.example.org"), QString("xn--kcr.xn--kcry6tjko.example.org")), true); // Failing CN matches QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("xxx.example.com"), QString("www.example.com")), false ); @@ -1705,6 +1711,26 @@ void tst_QSslSocket::wildcardCertificateNames() QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString(""), QString("www")), false ); QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("*"), QString("www")), false ); QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("*.168.0.0"), QString("192.168.0.0")), false ); + QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("xn--kcry6tjko*.example.org"), QString("xn--kcry6tjkoanc.example.org")), false ); // RFC 6125 §7.2 + QCOMPARE( QSslSocketPrivate::isMatchingHostname(QString("å*.example.org"), QString("xn--la-xia.example.org")), false ); +} + +void tst_QSslSocket::isMatchingHostname() +{ + // with normalization: (the certificate has *.SCHÄUFELE.DE as a CN) + // openssl req -x509 -nodes -subj "/CN=*.SCHÄUFELE.DE" -newkey rsa:512 -keyout /dev/null -out xn--schufele-2za.crt + QList certs = QSslCertificate::fromPath(SRCDIR "certs/xn--schufele-2za.crt"); + QVERIFY(!certs.isEmpty()); + QSslCertificate cert = certs.first(); + + QCOMPARE(QSslSocketPrivate::isMatchingHostname(cert, QString::fromUtf8("WWW.SCHÄUFELE.DE")), true); + QCOMPARE(QSslSocketPrivate::isMatchingHostname(cert, QString::fromUtf8("www.xn--schufele-2za.de")), true); + QCOMPARE(QSslSocketPrivate::isMatchingHostname(cert, QString::fromUtf8("www.schäufele.de")), true); + QCOMPARE(QSslSocketPrivate::isMatchingHostname(cert, QString::fromUtf8("föo.schäufele.de")), true); + + QCOMPARE(QSslSocketPrivate::isMatchingHostname(cert, QString::fromUtf8("foo.foo.xn--schufele-2za.de")), false); + QCOMPARE(QSslSocketPrivate::isMatchingHostname(cert, QString::fromUtf8("www.schaufele.de")), false); + QCOMPARE(QSslSocketPrivate::isMatchingHostname(cert, QString::fromUtf8("www.schufele.de")), false); } void tst_QSslSocket::wildcard() diff --git a/tests/auto/other/qaccessibility/accessiblewidgets.h b/tests/auto/other/qaccessibility/accessiblewidgets.h index 62aa38ff6c..0c337a72f4 100644 --- a/tests/auto/other/qaccessibility/accessiblewidgets.h +++ b/tests/auto/other/qaccessibility/accessiblewidgets.h @@ -98,14 +98,15 @@ public: return 0; } CustomTextWidgetIface(CustomTextWidget *w): QAccessibleWidget(w) {} - void *interface_cast(QAccessible::InterfaceType t) override { + void *interface_cast(QAccessible::InterfaceType t) override + { if (t == QAccessible::TextInterface) return static_cast(this); return 0; } // this is mostly to test the base implementation for textBefore/At/After - QString text(QAccessible::Text t) const Q_DECL_OVERRIDE + QString text(QAccessible::Text t) const override { if (t == QAccessible::Value) return textWidget()->text; @@ -131,20 +132,20 @@ public: return QAccessibleTextInterface::textAfterOffset(offset, boundaryType, startOffset, endOffset); } - void selection(int, int *startOffset, int *endOffset) const Q_DECL_OVERRIDE + void selection(int, int *startOffset, int *endOffset) const override { *startOffset = *endOffset = -1; } - int selectionCount() const Q_DECL_OVERRIDE { return 0; } - void addSelection(int, int) Q_DECL_OVERRIDE {} - void removeSelection(int) Q_DECL_OVERRIDE {} - void setSelection(int, int, int) Q_DECL_OVERRIDE {} - int cursorPosition() const Q_DECL_OVERRIDE { return textWidget()->cursorPosition; } - void setCursorPosition(int position) Q_DECL_OVERRIDE { textWidget()->cursorPosition = position; } - QString text(int startOffset, int endOffset) const Q_DECL_OVERRIDE { return textWidget()->text.mid(startOffset, endOffset); } - int characterCount() const Q_DECL_OVERRIDE { return textWidget()->text.length(); } - QRect characterRect(int) const Q_DECL_OVERRIDE { return QRect(); } - int offsetAtPoint(const QPoint &) const Q_DECL_OVERRIDE { return 0; } - void scrollToSubstring(int, int) Q_DECL_OVERRIDE {} - QString attributes(int, int *, int *) const Q_DECL_OVERRIDE + int selectionCount() const override { return 0; } + void addSelection(int, int) override {} + void removeSelection(int) override {} + void setSelection(int, int, int) override {} + int cursorPosition() const override { return textWidget()->cursorPosition; } + void setCursorPosition(int position) override { textWidget()->cursorPosition = position; } + QString text(int startOffset, int endOffset) const override { return textWidget()->text.mid(startOffset, endOffset); } + int characterCount() const override { return textWidget()->text.length(); } + QRect characterRect(int) const override { return QRect(); } + int offsetAtPoint(const QPoint &) const override { return 0; } + void scrollToSubstring(int, int) override {} + QString attributes(int, int *, int *) const override { return QString(); } private: diff --git a/tests/auto/tools/moc/cxx17-namespaces.h b/tests/auto/tools/moc/cxx17-namespaces.h index 7c9f54d5f3..97f534c697 100644 --- a/tests/auto/tools/moc/cxx17-namespaces.h +++ b/tests/auto/tools/moc/cxx17-namespaces.h @@ -27,7 +27,7 @@ ****************************************************************************/ #ifndef CXX17_NAMESPACES_H -#define CXX11_NAMESPACES_H +#define CXX17_NAMESPACES_H #include #if defined(__cpp_nested_namespace_definitions) || defined(Q_MOC_RUN) diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index d241296a6b..f2cf78e8ac 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -151,6 +152,7 @@ private slots: void testSelectionModelInSyncWithView(); void testClickToSelect(); void testDialogAsEditor(); + void QTBUG46785_mouseout_hover_state(); }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -2213,5 +2215,56 @@ void tst_QAbstractItemView::testDialogAsEditor() QCOMPARE(delegate.result, QDialog::Accepted); } +class HoverItemDelegate : public QItemDelegate +{ +public: + HoverItemDelegate() + : QItemDelegate() + , m_paintedWithoutHover(false) + { } + + void paint(QPainter *painter, const QStyleOptionViewItem &opt, const QModelIndex &index) const override + { + Q_UNUSED(painter); + + if (!(opt.state & QStyle::State_MouseOver)) { + + // We don't want to set m_paintedWithoutHover for any item so check for the item at 0,0 + if (index.row() == 0 && index.column() == 0) { + m_paintedWithoutHover = true; + } + } + } + + mutable bool m_paintedWithoutHover; +}; + +void tst_QAbstractItemView::QTBUG46785_mouseout_hover_state() +{ + HoverItemDelegate delegate; + + QTableWidget table(5, 5); + table.verticalHeader()->hide(); + table.horizontalHeader()->hide(); + table.setMouseTracking(true); + table.setItemDelegate(&delegate); + centerOnScreen(&table); + table.show(); + QVERIFY(QTest::qWaitForWindowActive(&table)); + + QModelIndex item = table.model()->index(0, 0); + QRect itemRect = table.visualRect(item); + + // Move the mouse into the center of the item at 0,0 to cause a paint event to occur + QTest::mouseMove(table.viewport(), itemRect.center()); + QTest::mouseClick(table.viewport(), Qt::LeftButton, 0, itemRect.center()); + + delegate.m_paintedWithoutHover = false; + + QTest::mouseMove(table.viewport(), QPoint(-50, 0)); + + QTRY_VERIFY(delegate.m_paintedWithoutHover); +} + QTEST_MAIN(tst_QAbstractItemView) #include "tst_qabstractitemview.moc" diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index cd1df49f8c..5fe0232d90 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -277,6 +277,7 @@ private slots: #endif void setLocale(); + void propagateLocale(); void deleteStyle(); void multipleToplevelFocusCheck(); void setFocus(); @@ -1205,6 +1206,33 @@ void tst_QWidget::setLocale() QCOMPARE(child2.locale(), QLocale(QLocale::French)); } +void tst_QWidget::propagateLocale() +{ + QWidget parent; + parent.setLocale(QLocale::French); + // Non-window widget; propagates locale: + QWidget *child = new QWidget(&parent); + QVERIFY(!child->isWindow()); + QVERIFY(!child->testAttribute(Qt::WA_WindowPropagation)); + QCOMPARE(child->locale(), QLocale(QLocale::French)); + parent.setLocale(QLocale::Italian); + QCOMPARE(child->locale(), QLocale(QLocale::Italian)); + delete child; + // Window: doesn't propagate locale: + child = new QWidget(&parent, Qt::Window); + QVERIFY(child->isWindow()); + QVERIFY(!child->testAttribute(Qt::WA_WindowPropagation)); + QCOMPARE(child->locale(), QLocale()); + parent.setLocale(QLocale::French); + QCOMPARE(child->locale(), QLocale()); + // ... unless we tell it to: + child->setAttribute(Qt::WA_WindowPropagation, true); + QVERIFY(child->testAttribute(Qt::WA_WindowPropagation)); + QCOMPARE(child->locale(), QLocale(QLocale::French)); + parent.setLocale(QLocale::Italian); + QCOMPARE(child->locale(), QLocale(QLocale::Italian)); +} + void tst_QWidget::visible_setWindowOpacity() { QScopedPointer testWidget(new QWidget); diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index 52d7a39406..ceef88338a 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -106,7 +106,8 @@ static bool tabBetweenSubWindowsIn(QMdiArea *mdiArea, int tabCount = -1, bool re } QMdiSubWindow *subWindow = subWindows.at(reverse ? subWindows.size() -1 - i : i); if (rubberBand->geometry() != subWindow->geometry()) { - qWarning("Rubber band has different geometry"); + qWarning().nospace() << "Rubber band of tab " << i << " has different geometry: " + << rubberBand->geometry() << " (sub window: " << subWindow->geometry() << ")."; return false; } } diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index b9ea310d80..bc94e2a05b 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -60,6 +61,8 @@ typedef QPair keyPairType; typedef QList pairListType; Q_DECLARE_METATYPE(keyPairType); +Q_DECLARE_METATYPE(QList); + QT_FORWARD_DECLARE_CLASS(QTextEdit) class tst_QTextEdit : public QObject @@ -200,6 +203,9 @@ private slots: void wheelEvent(); #endif + void preeditCharFormat_data(); + void preeditCharFormat(); + private: void createSelection(); int blockCount() const; @@ -2594,5 +2600,235 @@ void tst_QTextEdit::wheelEvent() #endif +namespace { + class MyPaintEngine : public QPaintEngine + { + public: + bool begin(QPaintDevice *) + { + return true; + } + + bool end() + { + return true; + } + + void updateState(const QPaintEngineState &) + { + } + + void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) + { + } + + void drawTextItem(const QPointF &, const QTextItem &textItem) Q_DECL_OVERRIDE + { + itemFonts.append(qMakePair(textItem.text(), textItem.font())); + } + + Type type() const { return User; } + + + QList > itemFonts; + }; + + class MyPaintDevice : public QPaintDevice + { + public: + MyPaintDevice() : m_paintEngine(new MyPaintEngine) + { + } + + + QPaintEngine *paintEngine () const + { + return m_paintEngine; + } + + int metric (QPaintDevice::PaintDeviceMetric metric) const { + switch (metric) { + case QPaintDevice::PdmWidth: + case QPaintDevice::PdmHeight: + case QPaintDevice::PdmWidthMM: + case QPaintDevice::PdmHeightMM: + case QPaintDevice::PdmNumColors: + return INT_MAX; + case QPaintDevice::PdmDepth: + return 32; + case QPaintDevice::PdmDpiX: + case QPaintDevice::PdmDpiY: + case QPaintDevice::PdmPhysicalDpiX: + case QPaintDevice::PdmPhysicalDpiY: + return 72; + case QPaintDevice::PdmDevicePixelRatio: + case QPaintDevice::PdmDevicePixelRatioScaled: + ; // fall through + } + return 0; + } + + MyPaintEngine *m_paintEngine; + }; +} + +void tst_QTextEdit::preeditCharFormat_data() +{ + QTest::addColumn >("imeAttributes"); + QTest::addColumn("substrings"); + QTest::addColumn >("boldnessList"); + QTest::addColumn >("italicnessList"); + QTest::addColumn >("pointSizeList"); + + { + QList attributes; + { + QTextCharFormat tcf; + tcf.setFontPointSize(13); + tcf.setFontItalic(true); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 1, 1, tcf)); + } + + { + QTextCharFormat tcf; + tcf.setFontPointSize(8); + tcf.setFontWeight(QFont::Normal); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 4, 2, tcf)); + } + + QTest::newRow("Two formats, middle, in order") + << attributes + << (QStringList() << "P" << "r" << "eE" << "di" << "tText") + << (QList() << true << true << true << false << true) + << (QList() << false << true << false << false << false) + << (QList() << 20 << 13 << 20 << 8 << 20); + } + + { + QList attributes; + { + QTextCharFormat tcf; + tcf.setFontPointSize(8); + tcf.setFontWeight(QFont::Normal); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 4, 2, tcf)); + } + + { + QTextCharFormat tcf; + tcf.setFontPointSize(13); + tcf.setFontItalic(true); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 1, 1, tcf)); + } + + QTest::newRow("Two formats, middle, out of order") + << attributes + << (QStringList() << "P" << "r" << "eE" << "di" << "tText") + << (QList() << true << true << true << false << true) + << (QList() << false << true << false << false << false) + << (QList() << 20 << 13 << 20 << 8 << 20); + } + + { + QList attributes; + { + QTextCharFormat tcf; + tcf.setFontPointSize(13); + tcf.setFontItalic(true); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, 1, tcf)); + } + + { + QTextCharFormat tcf; + tcf.setFontPointSize(8); + tcf.setFontWeight(QFont::Normal); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 4, 2, tcf)); + } + + QTest::newRow("Two formats, front, in order") + << attributes + << (QStringList() << "P" << "reE" << "di" << "tText") + << (QList() << true << true << false << true) + << (QList() << true << false << false << false) + << (QList() << 13 << 20 << 8 << 20); + } + + { + QList attributes; + { + QTextCharFormat tcf; + tcf.setFontPointSize(8); + tcf.setFontWeight(QFont::Normal); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 4, 2, tcf)); + } + + { + QTextCharFormat tcf; + tcf.setFontPointSize(13); + tcf.setFontItalic(true); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, 1, tcf)); + } + + QTest::newRow("Two formats, front, out of order") + << attributes + << (QStringList() << "P" << "reE" << "di" << "tText") + << (QList() << true << true << false << true) + << (QList() << true << false << false << false) + << (QList() << 13 << 20 << 8 << 20); + } +} + +void tst_QTextEdit::preeditCharFormat() +{ + QFETCH(QList, imeAttributes); + QFETCH(QStringList, substrings); + QFETCH(QList, boldnessList); + QFETCH(QList, italicnessList); + QFETCH(QList, pointSizeList); + + QTextEdit *w = new QTextEdit; + w->show(); + QVERIFY(QTest::qWaitForWindowExposed(w)); + + // Set main char format + { + QTextCharFormat tcf; + tcf.setFontPointSize(20); + tcf.setFontWeight(QFont::Bold); + w->mergeCurrentCharFormat(tcf); + } + + QList attributes; + attributes.prepend(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, + w->textCursor().position(), + 0, + QVariant())); + + attributes += imeAttributes; + + QInputMethodEvent event("PreEditText", attributes); + QApplication::sendEvent(w, &event); + + MyPaintDevice device; + { + QPainter p(&device); + w->document()->drawContents(&p); + } + + QCOMPARE(device.m_paintEngine->itemFonts.size(), substrings.size()); + for (int i = 0; i < substrings.size(); ++i) + QCOMPARE(device.m_paintEngine->itemFonts.at(i).first, substrings.at(i)); + + for (int i = 0; i < substrings.size(); ++i) + QCOMPARE(device.m_paintEngine->itemFonts.at(i).second.bold(), boldnessList.at(i)); + + for (int i = 0; i < substrings.size(); ++i) + QCOMPARE(device.m_paintEngine->itemFonts.at(i).second.italic(), italicnessList.at(i)); + + for (int i = 0; i < substrings.size(); ++i) + QCOMPARE(device.m_paintEngine->itemFonts.at(i).second.pointSize(), pointSizeList.at(i)); + + delete w; +} + QTEST_MAIN(tst_QTextEdit) #include "tst_qtextedit.moc" diff --git a/tests/manual/diaglib/diaglib.pri b/tests/manual/diaglib/diaglib.pri index f240a73167..9f10167136 100644 --- a/tests/manual/diaglib/diaglib.pri +++ b/tests/manual/diaglib/diaglib.pri @@ -10,7 +10,7 @@ HEADERS += \ $$PWD/qwindowdump.h \ $$PWD/nativewindowdump.h -win32!winrt: { +win32:!winrt: { SOURCES += $$PWD/nativewindowdump_win.cpp LIBS *= -luser32 } else { diff --git a/tests/manual/diaglib/qwidgetdump.cpp b/tests/manual/diaglib/qwidgetdump.cpp index 10cfde510d..6c1e7d8f79 100644 --- a/tests/manual/diaglib/qwidgetdump.cpp +++ b/tests/manual/diaglib/qwidgetdump.cpp @@ -96,6 +96,12 @@ static void dumpWidgetRecursion(QTextStream &str, const QWidget *w, str << "windowState=" << hex << showbase << states << dec << noshowbase << ' '; formatRect(str, w->geometry()); if (w->isWindow()) { + str << ' ' << w->logicalDpiX() << "DPI"; +#if QT_VERSION > 0x050600 + const qreal dpr = w->devicePixelRatioF(); + if (!qFuzzyCompare(dpr, qreal(1))) + str << " dpr=" << dpr; +#endif // Qt 5.6 const QRect normalGeometry = w->normalGeometry(); if (normalGeometry.isValid() && !normalGeometry.isEmpty() && normalGeometry != w->geometry()) { str << " normal="; diff --git a/tests/manual/diaglib/qwindowdump.cpp b/tests/manual/diaglib/qwindowdump.cpp index 4adb1da5f1..0e613753ef 100644 --- a/tests/manual/diaglib/qwindowdump.cpp +++ b/tests/manual/diaglib/qwindowdump.cpp @@ -138,7 +138,7 @@ void formatWindow(QTextStream &str, const QWindow *w, FormatWindowOptions option str << " \"" << w->screen()->name() << "\" "; #if QT_VERSION >= 0x050600 if (QHighDpiScaling::isActive()) - str << "factor=" << QHighDpiScaling::factor(w) << ' '; + str << "factor=" << QHighDpiScaling::factor(w) << " dpr=" << w->devicePixelRatio(); #endif } if (!(options & DontPrintWindowFlags)) { @@ -161,7 +161,7 @@ static void dumpWindowRecursion(QTextStream &str, const QWindow *w, FormatWindowOptions options = 0, int depth = 0) { indentStream(str, 2 * depth); - formatWindow(str, w); + formatWindow(str, w, options); foreach (const QObject *co, w->children()) { if (co->isWindowType()) dumpWindowRecursion(str, static_cast(co), options, depth + 1); diff --git a/tests/tests.pro b/tests/tests.pro index 346102ab7b..a3ca94a94f 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -1,5 +1,7 @@ TEMPLATE = subdirs CONFIG += no_docs_target +requires(qtHaveModule(testlib)) + SUBDIRS = auto # benchmarks in debug mode is rarely sensible