summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.cmake.conf2
-rw-r--r--cmake/QtBuildHelpers.cmake2
-rw-r--r--cmake/QtInitProject.cmake2
-rw-r--r--cmake/QtInternalTargets.cmake5
-rw-r--r--cmake/QtPrecompiledHeadersHelpers.cmake12
-rw-r--r--cmake/QtPublicAppleHelpers.cmake16
-rw-r--r--cmake/QtPublicSbomCycloneDXHelpers.cmake4
-rw-r--r--cmake/QtPublicSbomDocumentNamespaceHelpers.cmake456
-rw-r--r--cmake/QtPublicSbomHelpers.cmake105
-rw-r--r--cmake/QtTestHelpers.cmake2
-rw-r--r--cmake/QtToolchainHelpers.cmake4
-rw-r--r--coin/instructions/README.md6
-rw-r--r--coin/instructions/cmake_cross_compilation_module_build_instructions.yaml14
-rw-r--r--coin/instructions/cmake_module_build_instructions.yaml14
-rw-r--r--coin/instructions/cmake_run_ctest.yaml11
-rw-r--r--coin/instructions/coin_module_axivion_template_v2.yaml7
-rw-r--r--configure.cmake2
-rw-r--r--doc/global/externalsites/external-resources.qdoc217
-rw-r--r--doc/global/externalsites/qt-webpages.qdoc61
-rw-r--r--doc/global/externalsites/rfc.qdoc33
-rw-r--r--doc/global/macros.qdocconf8
-rw-r--r--examples/network/doc/src/http.qdoc9
-rw-r--r--examples/network/http/httpwindow.cpp11
-rw-r--r--mkspecs/common/clang.conf8
-rw-r--r--mkspecs/common/g++-base.conf8
-rw-r--r--mkspecs/common/msvc-based-version.conf6
-rw-r--r--mkspecs/common/msvc-version.conf6
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp2
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h3
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp8
-rw-r--r--src/3rdparty/libjpeg/COPYRIGHT.txt2
-rw-r--r--src/3rdparty/libjpeg/ChangeLog.md43
-rw-r--r--src/3rdparty/libjpeg/qt_attribution.json4
-rw-r--r--src/3rdparty/libjpeg/src/jconfig.h4
-rw-r--r--src/3rdparty/libjpeg/src/jconfigint.h2
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtWindow.java11
-rw-r--r--src/corelib/CMakeLists.txt17
-rw-r--r--src/corelib/Qt6CoreMacros.cmake15
-rw-r--r--src/corelib/animation/qabstractanimation.cpp1
-rw-r--r--src/corelib/configure.cmake11
-rw-r--r--src/corelib/doc/images/javaiterators1.svg60
-rw-r--r--src/corelib/doc/images/javaiterators2.svg57
-rw-r--r--src/corelib/doc/images/stliterators1.svg90
-rw-r--r--src/corelib/doc/src/cmake/cmake-configure-variables.qdoc6
-rw-r--r--src/corelib/doc/src/cmake/cmake-properties.qdoc2
-rw-r--r--src/corelib/doc/src/cmake/qt_deploy_translations.qdoc1
-rw-r--r--src/corelib/doc/src/cmake/qt_extract_metatypes.qdoc1
-rw-r--r--src/corelib/doc/src/cmake/qt_finalize_project.qdoc1
-rw-r--r--src/corelib/doc/src/containers.qdoc2
-rw-r--r--src/corelib/doc/src/external-resources.qdoc5
-rw-r--r--src/corelib/doc/src/java-style-iterators.qdoc2
-rw-r--r--src/corelib/global/qcompilerdetection.h2
-rw-r--r--src/corelib/io/qfsfileengine.cpp6
-rw-r--r--src/corelib/io/qiooperation_p.h20
-rw-r--r--src/corelib/io/qioring_p.h6
-rw-r--r--src/corelib/io/qioring_win.cpp104
-rw-r--r--src/corelib/io/qrandomaccessasyncfile.cpp25
-rw-r--r--src/corelib/io/qrandomaccessasyncfile_darwin.mm103
-rw-r--r--src/corelib/io/qrandomaccessasyncfile_p_p.h241
-rw-r--r--src/corelib/io/qrandomaccessasyncfile_qioring.cpp61
-rw-r--r--src/corelib/io/qrandomaccessasyncfile_threadpool.cpp79
-rw-r--r--src/corelib/io/qwindowspipereader.cpp5
-rw-r--r--src/corelib/itemmodels/qrangemodel_impl.h18
-rw-r--r--src/corelib/itemmodels/qrangemodeladapter.h28
-rw-r--r--src/corelib/itemmodels/qrangemodeladapter.qdoc30
-rw-r--r--src/corelib/kernel/qcore_mac.mm32
-rw-r--r--src/corelib/kernel/qcore_mac_p.h17
-rw-r--r--src/corelib/kernel/qeventdispatcher_cf.mm1
-rw-r--r--src/corelib/kernel/qmetacontainer.h9
-rw-r--r--src/corelib/kernel/qmetasequence.cpp40
-rw-r--r--src/corelib/kernel/qmetasequence.h21
-rw-r--r--src/corelib/kernel/qpermissions.cpp2
-rw-r--r--src/corelib/kernel/qproperty.cpp20
-rw-r--r--src/corelib/kernel/qtranslator.cpp4
-rw-r--r--src/corelib/platform/windows/qbstr_p.h3
-rw-r--r--src/corelib/platform/windows/qcomobject_p.h1
-rw-r--r--src/corelib/platform/windows/qcomptr_p.h1
-rw-r--r--src/corelib/platform/windows/qcomvariant_p.h1
-rw-r--r--src/corelib/platform/windows/qfactorycacheregistration.cpp1
-rw-r--r--src/corelib/platform/windows/qfactorycacheregistration_p.h1
-rw-r--r--src/corelib/platform/windows/qt_winrtbase_p.h1
-rw-r--r--src/corelib/serialization/qcborvalue.cpp1
-rw-r--r--src/corelib/serialization/qdatastream.cpp1
-rw-r--r--src/corelib/serialization/qdatastream.h5
-rw-r--r--src/corelib/serialization/qxmlstream.cpp6
-rw-r--r--src/corelib/text/qlocale.cpp1
-rw-r--r--src/corelib/text/qregularexpression.cpp2
-rw-r--r--src/corelib/text/qstringconverter.cpp4
-rw-r--r--src/corelib/thread/qfuture.qdoc2
-rw-r--r--src/corelib/thread/qfuture_impl.h9
-rw-r--r--src/corelib/thread/qfutureinterface.h4
-rw-r--r--src/corelib/thread/qreadwritelock.cpp8
-rw-r--r--src/corelib/time/qdatetimeparser.cpp1
-rw-r--r--src/corelib/tools/qeasingcurve.cpp14
-rw-r--r--src/gui/doc/qtgui.qdocconf3
-rw-r--r--src/gui/doc/src/external-resources.qdoc1
-rw-r--r--src/gui/itemmodels/qfileinfogatherer.cpp6
-rw-r--r--src/gui/kernel/qguiapplication.cpp6
-rw-r--r--src/gui/kernel/qplatformintegrationfactory.cpp1
-rw-r--r--src/gui/kernel/qplatformthemefactory.cpp1
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp6
-rw-r--r--src/gui/painting/qcolor.cpp30
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp1
-rw-r--r--src/gui/painting/qpainterpath.h2
-rw-r--r--src/gui/painting/qpdf.cpp1
-rw-r--r--src/gui/painting/qstroker.cpp6
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusplatformmenu.cpp1
-rw-r--r--src/gui/text/qfontengine.cpp7
-rw-r--r--src/gui/text/qtextdocument.cpp5
-rw-r--r--src/gui/text/qtextdocument_p.cpp1
-rw-r--r--src/gui/text/qtexttable.cpp4
-rw-r--r--src/gui/util/qlayoutpolicy.cpp5
-rw-r--r--src/network/access/qbytedatabuffer_p.h2
-rw-r--r--src/network/access/qhttp2connection.cpp77
-rw-r--r--src/network/access/qhttp2connection_p.h24
-rw-r--r--src/network/access/qnetworkaccesscache.cpp12
-rw-r--r--src/network/access/qnetworkaccesscache_p.h4
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp13
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm25
-rw-r--r--src/plugins/sqldrivers/.cmake.conf2
-rw-r--r--src/plugins/styles/modernwindows/qwindows11style.cpp26
-rw-r--r--src/plugins/styles/modernwindows/qwindows11style_p.h4
-rw-r--r--src/plugins/styles/modernwindows/qwindowsvistastyle.cpp5
-rw-r--r--src/plugins/tls/openssl/qtlsbackend_openssl.cpp9
-rw-r--r--src/testlib/doc/src/qt-webpages.qdoc4
-rw-r--r--src/testlib/qtestlog.cpp6
-rw-r--r--src/tools/androidtestrunner/main.cpp59
-rw-r--r--src/tools/configure.cmake2
-rw-r--r--src/tools/macdeployqt/shared/shared.cpp27
-rw-r--r--src/widgets/accessible/qaccessiblecolorwell.cpp5
-rw-r--r--src/widgets/dialogs/qwizard.cpp34
-rw-r--r--src/widgets/dialogs/qwizard.h10
-rw-r--r--src/widgets/doc/src/external-resources.qdoc6
-rw-r--r--src/widgets/kernel/qtooltip.cpp10
-rw-r--r--src/widgets/kernel/qwidget.cpp6
-rw-r--r--src/widgets/styles/qcommonstyle.cpp9
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp12
-rw-r--r--src/widgets/widgets/qtabbar.cpp66
-rw-r--r--src/widgets/widgets/qtabbar_p.h3
-rw-r--r--src/xml/doc/src/external-resources.qdoc11
-rw-r--r--tests/auto/CMakeLists.txt3
-rw-r--r--tests/auto/cmake/mockplugins/.cmake.conf2
-rw-r--r--tests/auto/cmake/test_generating_cpp_exports/.cmake.conf2
-rw-r--r--tests/auto/cmake/test_static_resources/.cmake.conf2
-rw-r--r--tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp4
-rw-r--r--tests/auto/corelib/itemmodels/qrangemodeladapter/tst_qrangemodeladapter.cpp8
-rw-r--r--tests/auto/corelib/thread/qfuture/tst_qfuture.cpp79
-rw-r--r--tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp106
-rw-r--r--tests/auto/network/access/qhttp2connection/tst_qhttp2connection.cpp55
-rw-r--r--tests/auto/tools/rcc/data/legal/rcc_legal.cpp2
-rw-r--r--tests/auto/util/testrunner/CMakeLists.txt14
-rw-r--r--tests/auto/util/testrunner/qt_mock_test-log.xml (renamed from util/testrunner/tests/qt_mock_test-log.xml)14
-rwxr-xr-xtests/auto/util/testrunner/qt_mock_test.py (renamed from util/testrunner/tests/qt_mock_test.py)57
-rwxr-xr-xtests/auto/util/testrunner/tst_qt_testrunner.py (renamed from util/testrunner/tests/tst_testrunner.py)300
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp6
-rw-r--r--tests/auto/widgets/kernel/qwidget/BLACKLIST5
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp33
-rw-r--r--util/testrunner/README8
-rwxr-xr-xutil/testrunner/qt-testrunner.py155
159 files changed, 2599 insertions, 1138 deletions
diff --git a/.cmake.conf b/.cmake.conf
index e1e19d2ed2a..09e591bd25b 100644
--- a/.cmake.conf
+++ b/.cmake.conf
@@ -7,7 +7,7 @@ if (NOT DEFINED QT_SUPERBUILD OR DEFINED QT_REPO_MODULE_VERSION)
set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_LEAN_HEADERS=1")
endif()
-set(QT_REPO_MODULE_VERSION "6.11.0")
+set(QT_REPO_MODULE_VERSION "6.12.0")
set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
set(QT_COPYRIGHT "Copyright (C) The Qt Company Ltd. and other contributors.")
diff --git a/cmake/QtBuildHelpers.cmake b/cmake/QtBuildHelpers.cmake
index 91983636712..6a1dc543145 100644
--- a/cmake/QtBuildHelpers.cmake
+++ b/cmake/QtBuildHelpers.cmake
@@ -6,6 +6,7 @@ function(qt_internal_validate_cmake_generator)
if(NOT warning_shown
AND NOT CMAKE_GENERATOR MATCHES "Ninja"
+ AND NOT (IOS AND QT_INTERNAL_IS_STANDALONE_TEST)
AND NOT QT_SILENCE_CMAKE_GENERATOR_WARNING
AND NOT DEFINED ENV{QT_SILENCE_CMAKE_GENERATOR_WARNING})
set_property(GLOBAL PROPERTY _qt_validate_cmake_generator_warning_shown TRUE)
@@ -300,6 +301,7 @@ function(qt_internal_get_qt_build_public_helpers out_var)
QtPublicSbomCommonGenerationHelpers
QtPublicSbomCpeHelpers
QtPublicSbomCycloneDXHelpers
+ QtPublicSbomDocumentNamespaceHelpers
QtPublicSbomDepHelpers
QtPublicSbomFileHelpers
QtPublicSbomGenerationHelpers
diff --git a/cmake/QtInitProject.cmake b/cmake/QtInitProject.cmake
index 8860b3578ed..c2a21202108 100644
--- a/cmake/QtInitProject.cmake
+++ b/cmake/QtInitProject.cmake
@@ -209,5 +209,5 @@ message("The project file is successfully generated. To build the project run:"
"\nmkdir build"
"\ncd build"
"\nqt-cmake ${project_abs_dir}"
- "\ncmake --build ${project_abs_dir}"
+ "\ncmake --build ."
)
diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake
index 45e75d4836f..f0d7d06fb84 100644
--- a/cmake/QtInternalTargets.cmake
+++ b/cmake/QtInternalTargets.cmake
@@ -385,7 +385,10 @@ if(QT_FEATURE_stdlib_libcpp)
target_compile_definitions(PlatformCommonInternal INTERFACE _LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
endif()
-if(QT_USE_CCACHE AND CLANG AND BUILD_WITH_PCH)
+if((QT_USE_CCACHE
+ OR (CMAKE_CXX_COMPILER_LAUNCHER MATCHES "^(.*[/\\])?sccache$"))
+ AND CLANG
+ AND BUILD_WITH_PCH)
# The ccache man page says we must compile with -fno-pch-timestamp when using clang and pch.
foreach(language IN ITEMS C CXX OBJC OBJCXX)
target_compile_options(PlatformCommonInternal INTERFACE
diff --git a/cmake/QtPrecompiledHeadersHelpers.cmake b/cmake/QtPrecompiledHeadersHelpers.cmake
index b47e4e74e33..7fe94664da3 100644
--- a/cmake/QtPrecompiledHeadersHelpers.cmake
+++ b/cmake/QtPrecompiledHeadersHelpers.cmake
@@ -14,6 +14,18 @@ function(qt_update_precompiled_header_with_library target library)
get_target_property(target_type "${library}" TYPE)
if(target_type STREQUAL "INTERFACE_LIBRARY")
+ # If target links against QtFooPrivate then QtFoo is transitively pulled
+ # in. We assume that headers from QtFoo will be used and add this
+ # library to the target's precompiled headers too.
+ get_target_property(is_private_module "${library}" _qt_is_private_module)
+ if(is_private_module)
+ get_target_property(public_module_target "${library}" _qt_public_module_target_name)
+ qt_update_precompiled_header_with_library("${target}"
+ "${QT_CMAKE_EXPORT_NAMESPACE}::${public_module_target}"
+ )
+ endif()
+
+ # Don't handle interface libraries any further.
return()
endif()
diff --git a/cmake/QtPublicAppleHelpers.cmake b/cmake/QtPublicAppleHelpers.cmake
index 3ffe53c6f34..b8f3fb4818e 100644
--- a/cmake/QtPublicAppleHelpers.cmake
+++ b/cmake/QtPublicAppleHelpers.cmake
@@ -1028,7 +1028,6 @@ function(_qt_internal_check_apple_sdk_and_xcode_versions)
endif()
_qt_internal_get_cached_apple_sdk_version(sdk_version)
- _qt_internal_get_cached_xcode_version(xcode_version)
if(NOT max_sdk_version MATCHES "^[0-9]+$")
message(FATAL_ERROR
@@ -1075,12 +1074,15 @@ function(_qt_internal_check_apple_sdk_and_xcode_versions)
)
endif()
- if(xcode_version VERSION_LESS min_xcode_version AND NOT QT_NO_XCODE_MIN_VERSION_CHECK)
- message(${message_type}
- "Qt requires at least version ${min_xcode_version} of Xcode, "
- "you're building against version ${xcode_version}. Please upgrade."
- ${extra_message}
- )
+ if(NOT QT_NO_XCODE_MIN_VERSION_CHECK)
+ _qt_internal_get_cached_xcode_version(xcode_version)
+ if(xcode_version VERSION_LESS min_xcode_version)
+ message(${message_type}
+ "Qt requires at least version ${min_xcode_version} of Xcode, "
+ "you're building against version ${xcode_version}. Please upgrade."
+ ${extra_message}
+ )
+ endif()
endif()
if(QT_NO_APPLE_SDK_MAX_VERSION_CHECK)
diff --git a/cmake/QtPublicSbomCycloneDXHelpers.cmake b/cmake/QtPublicSbomCycloneDXHelpers.cmake
index a3dc52d4e39..92b26bb0525 100644
--- a/cmake/QtPublicSbomCycloneDXHelpers.cmake
+++ b/cmake/QtPublicSbomCycloneDXHelpers.cmake
@@ -226,9 +226,7 @@ function(_qt_internal_sbom_get_cyclone_bom_serial_number)
_qt_internal_sbom_set_default_option_value_and_error_if_empty(SPDX_NAMESPACE "")
- # This is a randomly generated uuid v4 value. To be used for all eternity. Until we change the
- # implementation of the function.
- set(uuid_namespace "c024642f-9853-45b2-9bfd-ab3f061a05bb")
+ _qt_internal_sbom_get_document_namespace_uuid_namespace(uuid_namespace)
string(UUID uuid NAMESPACE "${uuid_namespace}" NAME "${arg_SPDX_NAMESPACE}" TYPE SHA1)
set(cyclone_dx_serial_number "urn:cdx:${uuid}")
diff --git a/cmake/QtPublicSbomDocumentNamespaceHelpers.cmake b/cmake/QtPublicSbomDocumentNamespaceHelpers.cmake
new file mode 100644
index 00000000000..0293c163dec
--- /dev/null
+++ b/cmake/QtPublicSbomDocumentNamespaceHelpers.cmake
@@ -0,0 +1,456 @@
+# Copyright (C) 2025 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Computes the SPDX document namespace field.
+# See https://spdx.github.io/spdx-spec/v2.3/document-creation-information/#65-spdx-document-namespace-field
+# The document namespace is used in SPDX external references and dependency relationships.
+function(_qt_internal_sbom_compute_project_namespace out_var)
+ set(opt_args "")
+ set(single_args
+ SUPPLIER_URL
+ PROJECT_NAME
+ VERSION_SUFFIX
+ DOCUMENT_NAMESPACE_INFIX
+ DOCUMENT_NAMESPACE_SUFFIX
+ DOCUMENT_NAMESPACE_URL_PREFIX
+ )
+ set(multi_args "")
+
+ cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
+ _qt_internal_validate_all_args_are_parsed(arg)
+
+ if(NOT arg_PROJECT_NAME)
+ message(FATAL_ERROR "PROJECT_NAME must be set")
+ endif()
+
+ if(NOT arg_SUPPLIER_URL)
+ message(FATAL_ERROR "SUPPLIER_URL must be set")
+ endif()
+
+ string(TOLOWER "${arg_PROJECT_NAME}" project_name_lowercase)
+
+ set(version_suffix "")
+
+ if(arg_VERSION_SUFFIX)
+ set(version_suffix "-${arg_VERSION_SUFFIX}")
+ else()
+ _qt_internal_sbom_get_git_version_vars()
+ if(QT_SBOM_GIT_VERSION)
+ set(version_suffix "-${QT_SBOM_GIT_VERSION}")
+ endif()
+ endif()
+
+ set(namespace "${project_name_lowercase}${version_suffix}")
+
+ if(arg_DOCUMENT_NAMESPACE_INFIX)
+ string(APPEND namespace "${arg_DOCUMENT_NAMESPACE_INFIX}")
+ endif()
+
+ if(arg_DOCUMENT_NAMESPACE_SUFFIX)
+ string(APPEND namespace "${arg_DOCUMENT_NAMESPACE_SUFFIX}")
+ endif()
+
+ if(arg_DOCUMENT_NAMESPACE_URL_PREFIX)
+ set(url_prefix "${arg_DOCUMENT_NAMESPACE_URL_PREFIX}")
+ else()
+ set(url_prefix "${arg_SUPPLIER_URL}/spdxdocs")
+ endif()
+
+ set(repo_spdx_namespace "${url_prefix}/${namespace}")
+
+ set(${out_var} "${repo_spdx_namespace}" PARENT_SCOPE)
+endfunction()
+
+# A document namespace is recommended to be either a URI + v4 random UUID or a URI + v5 UUID
+# generated from a sha1 checksum.
+# It needs to be unique per document.
+# Having randomness is bad for build reproducibility, so the v4 UUID is not a good idea.
+#
+# Collecting enough unique content as part of the build for a checksum is difficult
+# without outside input, and because the final document contents is only available at install time.
+#
+# We currently create a fake URI (that is not hosted on a web service) and a combination of the
+# following info:
+# - project name
+# - project version
+# - document namespace infix, which consists of:
+# - platform and arch info (host + target)
+# - a v5 UUID based on various inputs
+# - extra content provided as input
+# - document namespace suffix (as a last resort)
+#
+# The document namespace infix should make the namespace unique enough, so that different
+# builds don't usually map to the same value, and thus is conformant to the spec.
+function(_qt_internal_sbom_compute_uniqueish_document_namespace_infix)
+ set(opt_args "")
+ set(single_args
+ UUID_EXTRA_CONTENT
+ OUT_VAR_INFIX
+ OUT_VAR_UUID_INFIX
+ OUT_VAR_UUID_INFIX_MERGED
+ )
+ set(multi_args "")
+
+ cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
+ _qt_internal_validate_all_args_are_parsed(arg)
+
+ if(NOT arg_OUT_VAR_INFIX AND NOT arg_OUT_VAR_UUID_INFIX AND NOT arg_OUT_VAR_UUID_INFIX_MERGED)
+ message(FATAL_ERROR "One of OUT_VAR_INFIX, OUT_VAR_UUID_INFIX or "
+ "OUT_VAR_UUID_INFIX_MERGED must be set")
+ endif()
+
+ if(QT_SBOM_NO_UNIQUE_NAMESPACE_INFIX)
+ set(${arg_OUT_VAR_INFIX} "" PARENT_SCOPE)
+
+ if(arg_OUT_VAR_UUID_INFIX)
+ set(${arg_OUT_VAR_UUID_INFIX} "" PARENT_SCOPE)
+ endif()
+
+ if(arg_OUT_VAR_UUID_INFIX_MERGED)
+ set(${arg_OUT_VAR_UUID_INFIX_MERGED} "" PARENT_SCOPE)
+ endif()
+
+ return()
+ endif()
+
+ # Collect the various pieces of information to build the unique-ish infix.
+ set(main_value "")
+
+ _qt_internal_sbom_get_host_platform_name(host_platform_name)
+ if(host_platform_name)
+ string(APPEND main_value "host-${host_platform_name}")
+ endif()
+
+ _qt_internal_sbom_get_host_platform_architecture(host_arch)
+ if(host_arch)
+ string(APPEND main_value "-${host_arch}")
+ endif()
+
+ _qt_internal_sbom_get_target_platform_friendly_name(target_platform_name)
+ if(target_platform_name)
+ string(APPEND main_value "-target-${target_platform_name}")
+ endif()
+
+ _qt_internal_sbom_get_target_platform_architecture(target_arch)
+ if(target_arch)
+ string(APPEND main_value "-${target_arch}")
+ endif()
+
+
+ # Collect the pieces for the infix uuid part.
+ set(uuid_content "<main_value>:${main_value}\n")
+
+ _qt_internal_sbom_get_build_tools_info_for_namespace_infix_uuid(tools_info)
+ if(tools_info)
+ string(APPEND uuid_content "<build_tools_info>:${tools_info}\n")
+ endif()
+
+ if(arg_UUID_EXTRA_CONTENT)
+ string(APPEND uuid_content "<extra_content>:\n${arg_UUID_EXTRA_CONTENT}\n")
+ endif()
+
+ if(QT_SBOM_NAMESPACE_INFIX_UUID_EXTRA_CONTENT)
+ string(APPEND uuid_content
+ "<extra_content_var>:${QT_SBOM_NAMESPACE_INFIX_UUID_EXTRA_CONTENT}\n")
+ endif()
+
+ _qt_internal_sbom_compute_document_namespace_infix_uuid(
+ UUID_CONTENT "${uuid_content}"
+ OUT_VAR_UUID uuid_value
+ )
+
+ if(arg_OUT_VAR_INFIX)
+ set(${arg_OUT_VAR_INFIX} "${main_value}" PARENT_SCOPE)
+ endif()
+
+ if(arg_OUT_VAR_UUID_INFIX)
+ set(${arg_OUT_VAR_UUID_INFIX} "${uuid_value}" PARENT_SCOPE)
+ endif()
+
+ if(arg_OUT_VAR_UUID_INFIX_MERGED)
+ set(${arg_OUT_VAR_UUID_INFIX_MERGED} "${main_value}-${uuid_value}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+# Computes the uuid part of a SPDX document namespace, given the inputs.
+# UUID_CONTENT - should be given enough unique content to ensure the uniqueness of generated the
+# uuid based on the content.
+#
+# Allow various overrides like:
+# - override of the full uuid content via QT_SBOM_FORCE_DOCUMENT_NAMESPACE_INFIX_UUID_CONTENT
+# - allow using a random value via QT_SBOM_FORCE_RANDOM_DOCUMENT_NAMESPACE_INFIX_UUID_CONTENT
+# - allow setting a specific uuid via QT_SBOM_FORCE_DOCUMENT_NAMESPACE_INFIX_UUID
+# - fake deterministic uuid (only useful for development purposes of this code)
+function(_qt_internal_sbom_compute_document_namespace_infix_uuid)
+ set(opt_args "")
+ set(single_args
+ UUID_CONTENT
+ OUT_VAR_UUID
+ )
+ set(multi_args "")
+
+ cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
+ _qt_internal_validate_all_args_are_parsed(arg)
+
+ if(NOT arg_OUT_VAR_UUID)
+ message(FATAL_ERROR "OUT_VAR_UUID must be set")
+ endif()
+
+ set(content "${arg_UUID_CONTENT}")
+
+ _qt_internal_sbom_get_document_namespace_uuid_namespace(uuid_namespace)
+
+ # Allow various overrides.
+ if(QT_SBOM_FAKE_DETERMINISTIC_BUILD
+ # This is to allow developers test a fake build, without a fake uuid
+ AND NOT QT_SBOM_NO_FAKE_DETERMINISTIC_BUILD_DOCUMENT_NAMESPACE_INFIX_UUID
+ )
+ set(uuid_content "<fake_deterministic_build>")
+ elseif(QT_SBOM_FORCE_DOCUMENT_NAMESPACE_INFIX_UUID_CONTENT)
+ set(uuid_content "${QT_SBOM_FORCE_DOCUMENT_NAMESPACE_INFIX_UUID_CONTENT}")
+ elseif(QT_SBOM_FORCE_RANDOM_DOCUMENT_NAMESPACE_INFIX_UUID_CONTENT)
+ string(RANDOM LENGTH 256 uuid_content)
+ else()
+ set(uuid_content "${content}")
+ endif()
+
+ # Also allow direct override of uuid.
+ if(QT_SBOM_FORCE_DOCUMENT_NAMESPACE_INFIX_UUID)
+ set(namespace_infix_uuid "${QT_SBOM_FORCE_DOCUMENT_NAMESPACE_INFIX_UUID}")
+ else()
+ string(UUID namespace_infix_uuid
+ NAMESPACE "${uuid_namespace}" NAME "${uuid_content}" TYPE SHA1)
+ endif()
+
+ set(${arg_OUT_VAR_UUID} "${namespace_infix_uuid}" PARENT_SCOPE)
+endfunction()
+
+# A v4 uuid to be used as a namespace value for generating v5 uuids.
+function(_qt_internal_sbom_get_document_namespace_uuid_namespace out_var)
+ # This is a randomly generated uuid v4 value. To be used for all eternity. Until we change the
+ # implementation of the function.
+ set(uuid_namespace "c024642f-9853-45b2-9bfd-ab3f061a05bb")
+ set(${out_var} "${uuid_namespace}" PARENT_SCOPE)
+endfunction()
+
+# Collects extra uuid content for generating a more unique document namespace uuid for qt repos.
+function(_qt_internal_sbom_compute_qt_uniqueish_document_namespace_infix)
+ set(opt_args "")
+ set(single_args
+ OUT_VAR_INFIX
+ OUT_VAR_UUID_INFIX
+ OUT_VAR_UUID_INFIX_MERGED
+ )
+ set(multi_args "")
+
+ cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
+ _qt_internal_validate_all_args_are_parsed(arg)
+
+ if(NOT arg_OUT_VAR_INFIX AND NOT arg_OUT_VAR_UUID_INFIX AND NOT arg_OUT_VAR_UUID_INFIX_MERGED)
+ message(FATAL_ERROR "One of OUT_VAR_INFIX, OUT_VAR_UUID_INFIX or "
+ "OUT_VAR_UUID_INFIX_MERGED must be set")
+ endif()
+
+ if(QT_SBOM_NO_UNIQUE_QT_NAMESPACE_INFIX)
+ set(${arg_OUT_VAR_INFIX} "" PARENT_SCOPE)
+
+ if(arg_OUT_VAR_UUID_INFIX)
+ set(${arg_OUT_VAR_UUID_INFIX} "" PARENT_SCOPE)
+ endif()
+
+ if(arg_OUT_VAR_UUID_INFIX_MERGED)
+ set(${arg_OUT_VAR_UUID_INFIX_MERGED} "" PARENT_SCOPE)
+ endif()
+
+ return()
+ endif()
+
+ set(uuid_extra_content "")
+
+ if(APPLE AND (CMAKE_OSX_ARCHITECTURES MATCHES ";"))
+ string(CONCAT building_for
+ "${QT_QMAKE_TARGET_MKSPEC} (${CMAKE_OSX_ARCHITECTURES}), ${TEST_architecture_arch} "
+ "features: ${subarch_summary})")
+ else()
+ string(CONCAT building_for
+ "${QT_QMAKE_TARGET_MKSPEC} (${TEST_architecture_arch}, "
+ "CPU features: ${subarch_summary})")
+ endif()
+
+ string(APPEND uuid_extra_content "<building_for>:${building_for}\n")
+
+ _qt_internal_get_configure_line(configure_line)
+ if(configure_line)
+ string(APPEND uuid_extra_content "<configure_line>:${configure_line}\n")
+ endif()
+
+ _qt_internal_sbom_compute_uniqueish_document_namespace_infix(
+ UUID_EXTRA_CONTENT "${uuid_extra_content}"
+ OUT_VAR_INFIX infix
+ OUT_VAR_UUID_INFIX uuid_infix
+ OUT_VAR_UUID_INFIX_MERGED uuid_infix_merged
+ )
+
+ if(arg_OUT_VAR_INFIX)
+ set(${arg_OUT_VAR_INFIX} "${infix}" PARENT_SCOPE)
+ endif()
+
+ if(arg_OUT_VAR_UUID_INFIX)
+ set(${arg_OUT_VAR_UUID_INFIX} "${uuid_infix}" PARENT_SCOPE)
+ endif()
+
+ if(arg_OUT_VAR_UUID_INFIX_MERGED)
+ set(${arg_OUT_VAR_UUID_INFIX_MERGED} "${uuid_infix_merged}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+# Returns a lower case host platform name for sbom document namespace purposes.
+function(_qt_internal_sbom_get_host_platform_name out_var)
+ string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" main_value)
+ if(NOT main_value)
+ set(main_value "unknown-platform")
+ endif()
+
+ set(${out_var} "${main_value}" PARENT_SCOPE)
+endfunction()
+
+# Returns a lower case target platform name for sbom document namespace purposes.
+function(_qt_internal_sbom_get_target_platform_friendly_name out_var)
+ string(TOLOWER "${CMAKE_SYSTEM_NAME}" lower_system_name)
+ set(friendly_name "${lower_system_name}")
+
+ if(NOT friendly_name)
+ set(friendly_name "unknown-platform")
+ endif()
+
+ if(MSVC)
+ string(APPEND friendly_name "-msvc")
+ endif()
+
+ if(MINGW)
+ string(APPEND friendly_name "-mingw")
+ endif()
+
+ if(CYGWIN)
+ string(APPEND friendly_name "-cygwin")
+ endif()
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(friendly_name "linux")
+ endif()
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "HPUX")
+ set(friendly_name "hpux")
+ endif()
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "Android")
+ set(friendly_name "android")
+ endif()
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "Integrity")
+ set(friendly_name "integrity")
+ endif()
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "VxWorks")
+ set(friendly_name "vxworks")
+ endif()
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
+ set(friendly_name "qnx")
+ endif()
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+ set(friendly_name "openbsd")
+ endif()
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+ set(friendly_name "freebsd")
+ endif()
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
+ set(friendly_name "netbsd")
+ endif()
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR EMSCRIPTEN)
+ set(friendly_name "wasm")
+ endif()
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
+ set(friendly_name "sunos")
+ endif()
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "GNU")
+ set(friendly_name "hurd")
+ endif()
+
+ if(CMAKE_CXX_FLAGS MATCHES "-D__WEBOS__")
+ set(friendly_name "webos")
+ endif()
+
+ if(APPLE)
+ if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
+ set(friendly_name "ios")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS")
+ set(friendly_name "tvos")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "watchOS")
+ set(friendly_name "watchos")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "visionOS")
+ set(friendly_name "visionos")
+ else()
+ set(friendly_name "macos")
+ endif()
+ endif()
+
+ set(${out_var} "${friendly_name}" PARENT_SCOPE)
+endfunction()
+
+# Returns the host architecture for sbom document namespace purposes.
+function(_qt_internal_sbom_get_host_platform_architecture out_var)
+ set(main_value "${CMAKE_HOST_SYSTEM_PROCESSOR}")
+
+ if(QT_SBOM_HOST_PLATFORM_ARCHITECTURE)
+ set(main_value "${QT_SBOM_HOST_PLATFORM_ARCHITECTURE}")
+ endif()
+
+ string(TOLOWER "${main_value}" main_value)
+
+ set(${out_var} "${main_value}" PARENT_SCOPE)
+endfunction()
+
+# Returns the target architecture for sbom document namespace purposes.
+function(_qt_internal_sbom_get_target_platform_architecture out_var)
+ set(main_value "")
+ if(APPLE)
+ set(main_value "${CMALE_OSX_ARCHITECTURES}")
+ string(REPLACE ";" "_" main_value "${main_value}")
+ endif()
+
+ if(NOT main_value)
+ set(main_value "${CMAKE_SYSTEM_PROCESSOR}")
+ endif()
+
+ if(QT_SBOM_TARGET_PLATFORM_ARCHITECTURE)
+ set(main_value "${QT_SBOM_TARGET_PLATFORM_ARCHITECTURE}")
+ endif()
+
+ string(TOLOWER "${main_value}" main_value)
+
+ set(${out_var} "${main_value}" PARENT_SCOPE)
+endfunction()
+
+# Returns various build tool information ofr document namespace purposes.
+function(_qt_internal_sbom_get_build_tools_info_for_namespace_infix_uuid out_var)
+ set(content "")
+
+ string(APPEND content "<cmake_version>: ${CMAKE_VERSION}\n")
+ string(APPEND content "<cmake_generator>: ${CMAKE_GENERATOR}\n")
+ string(APPEND content "<compiler>: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}\n")
+
+ if(CMAKE_CXX_COMPILER_LINKER_ID)
+ string(APPEND content "<linker>: ${CMAKE_CXX_COMPILER_LINKER_ID} "
+ "${CMAKE_CXX_COMPILER_LINKER_VERSION} "
+ "${CMAKE_CXX_COMPILER_LINKER_FRONTEND_VARIANT}\n")
+ endif()
+
+ set(${out_var} "${content}" PARENT_SCOPE)
+endfunction()
diff --git a/cmake/QtPublicSbomHelpers.cmake b/cmake/QtPublicSbomHelpers.cmake
index 3d66e7ff783..45342c2efb6 100644
--- a/cmake/QtPublicSbomHelpers.cmake
+++ b/cmake/QtPublicSbomHelpers.cmake
@@ -30,6 +30,7 @@ function(_qt_internal_sbom_begin_project)
set(opt_args
USE_GIT_VERSION
__QT_INTERNAL_HANDLE_QT_REPO
+ NO_AUTO_DOCUMENT_NAMESPACE_INFIX
)
set(single_args
INSTALL_PREFIX
@@ -39,6 +40,9 @@ function(_qt_internal_sbom_begin_project)
SUPPLIER_URL
DOWNLOAD_LOCATION
DOCUMENT_NAMESPACE
+ DOCUMENT_NAMESPACE_INFIX
+ DOCUMENT_NAMESPACE_SUFFIX
+ DOCUMENT_NAMESPACE_URL_PREFIX
VERSION
SBOM_PROJECT_NAME
QT_REPO_PROJECT_NAME
@@ -110,13 +114,72 @@ function(_qt_internal_sbom_begin_project)
)
_qt_internal_handle_sbom_project_version(${sbom_project_version_args})
+ if(arg___QT_INTERNAL_HANDLE_QT_REPO)
+ _qt_internal_sbom_compute_qt_uniqueish_document_namespace_infix(
+ OUT_VAR_UUID_INFIX_MERGED document_namespace_infix
+ )
+ if(document_namespace_infix)
+ set(arg_DOCUMENT_NAMESPACE_INFIX "-${document_namespace_infix}")
+ endif()
+ endif()
+
if(arg_DOCUMENT_NAMESPACE)
set(repo_spdx_namespace "${arg_DOCUMENT_NAMESPACE}")
+
+ if(QT_SBOM_DOCUMENT_NAMESPACE_INFIX)
+ string(APPEND repo_spdx_namespace "${QT_SBOM_DOCUMENT_NAMESPACE_INFIX}")
+ elseif(arg_DOCUMENT_NAMESPACE_INFIX)
+ string(APPEND repo_spdx_namespace "${arg_DOCUMENT_NAMESPACE_INFIX}")
+ elseif(NOT arg_NO_AUTO_DOCUMENT_NAMESPACE_INFIX
+ AND NOT QT_SBOM_NO_AUTO_DOCUMENT_NAMESPACE_INFIX)
+ _qt_internal_sbom_compute_uniqueish_document_namespace_infix(
+ OUT_VAR_UUID_INFIX_MERGED document_namespace_infix
+ )
+ string(APPEND repo_spdx_namespace "-${document_namespace_infix}")
+ endif()
+
+ if(QT_SBOM_DOCUMENT_NAMESPACE_SUFFIX)
+ string(APPEND repo_spdx_namespace "${QT_SBOM_DOCUMENT_NAMESPACE_SUFFIX}")
+ elseif(arg_DOCUMENT_NAMESPACE_SUFFIX)
+ string(APPEND repo_spdx_namespace "${arg_DOCUMENT_NAMESPACE_SUFFIX}")
+ endif()
else()
set(compute_project_namespace_args "")
if(repo_supplier_url)
list(APPEND compute_project_namespace_args SUPPLIER_URL "${repo_supplier_url}")
endif()
+
+ if(QT_SBOM_DOCUMENT_NAMESPACE_INFIX)
+ list(APPEND compute_project_namespace_args
+ DOCUMENT_NAMESPACE_INFIX "${QT_SBOM_DOCUMENT_NAMESPACE_INFIX}")
+ elseif(arg_DOCUMENT_NAMESPACE_INFIX)
+ list(APPEND compute_project_namespace_args
+ DOCUMENT_NAMESPACE_INFIX "${arg_DOCUMENT_NAMESPACE_INFIX}")
+ elseif(NOT arg_NO_AUTO_DOCUMENT_NAMESPACE_INFIX
+ AND NOT QT_SBOM_NO_AUTO_DOCUMENT_NAMESPACE_INFIX)
+ _qt_internal_sbom_compute_uniqueish_document_namespace_infix(
+ OUT_VAR_UUID_INFIX_MERGED document_namespace_infix
+ )
+ list(APPEND compute_project_namespace_args
+ DOCUMENT_NAMESPACE_INFIX "-${document_namespace_infix}")
+ endif()
+
+ if(QT_SBOM_DOCUMENT_NAMESPACE_SUFFIX)
+ list(APPEND compute_project_namespace_args
+ DOCUMENT_NAMESPACE_SUFFIX "${QT_SBOM_DOCUMENT_NAMESPACE_SUFFIX}")
+ elseif(arg_DOCUMENT_NAMESPACE_SUFFIX)
+ list(APPEND compute_project_namespace_args
+ DOCUMENT_NAMESPACE_SUFFIX "${arg_DOCUMENT_NAMESPACE_SUFFIX}")
+ endif()
+
+ if(QT_SBOM_DOCUMENT_NAMESPACE_URL_PREFIX)
+ list(APPEND compute_project_namespace_args
+ DOCUMENT_NAMESPACE_URL_PREFIX "${QT_SBOM_DOCUMENT_NAMESPACE_URL_PREFIX}")
+ elseif(arg_DOCUMENT_NAMESPACE_URL_PREFIX)
+ list(APPEND compute_project_namespace_args
+ DOCUMENT_NAMESPACE_URL_PREFIX "${arg_DOCUMENT_NAMESPACE_URL_PREFIX}")
+ endif()
+
_qt_internal_sbom_compute_project_namespace(repo_spdx_namespace
PROJECT_NAME "${repo_project_name_lowercase}"
${compute_project_namespace_args}
@@ -2332,48 +2395,6 @@ function(_qt_internal_get_configure_line out_var)
set(${out_var} "${content}" PARENT_SCOPE)
endfunction()
-function(_qt_internal_sbom_compute_project_namespace out_var)
- set(opt_args "")
- set(single_args
- SUPPLIER_URL
- PROJECT_NAME
- VERSION_SUFFIX
- )
- set(multi_args "")
-
- cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
- _qt_internal_validate_all_args_are_parsed(arg)
-
- if(NOT arg_PROJECT_NAME)
- message(FATAL_ERROR "PROJECT_NAME must be set")
- endif()
-
- if(NOT arg_SUPPLIER_URL)
- message(FATAL_ERROR "SUPPLIER_URL must be set")
- endif()
-
- string(TOLOWER "${arg_PROJECT_NAME}" project_name_lowercase)
-
- set(version_suffix "")
-
- if(arg_VERSION_SUFFIX)
- set(version_suffix "-${arg_VERSION_SUFFIX}")
- else()
- _qt_internal_sbom_get_git_version_vars()
- if(QT_SBOM_GIT_VERSION)
- set(version_suffix "-${QT_SBOM_GIT_VERSION}")
- endif()
- endif()
-
- # Used in external refs, it should be either aa URI + UUID or a URI + checksum.
- # We currently use a URI + git version, which is probably not conformant to the spec.
- set(repo_name_and_version "${project_name_lowercase}${version_suffix}")
- set(repo_spdx_namespace
- "${arg_SUPPLIER_URL}/spdxdocs/${repo_name_and_version}")
-
- set(${out_var} "${repo_spdx_namespace}" PARENT_SCOPE)
-endfunction()
-
function(_qt_internal_sbom_compute_project_file_name out_var)
set(opt_args
SPDX_TAG_VALUE
diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake
index 06228ac41de..781bdf4143a 100644
--- a/cmake/QtTestHelpers.cmake
+++ b/cmake/QtTestHelpers.cmake
@@ -1240,7 +1240,7 @@ function(qt_internal_add_test_finalizers target)
# specific platforms.
# TODO: Remove once we confirm that the new way of running test finalizers for all platforms
# doesn't cause any issues.
- if(QT_INTERNAL_SKIP_TEST_FINALIZERS_V2)
+ if(NOT QT_INTERNAL_SKIP_TEST_FINALIZERS_V2)
return()
endif()
diff --git a/cmake/QtToolchainHelpers.cmake b/cmake/QtToolchainHelpers.cmake
index 348a3c25603..b2a5575f130 100644
--- a/cmake/QtToolchainHelpers.cmake
+++ b/cmake/QtToolchainHelpers.cmake
@@ -183,6 +183,7 @@ endif()")
list(LENGTH CMAKE_OSX_ARCHITECTURES _qt_osx_architectures_count)
if(cmake_sysroot_name AND (MACOS OR (UIKIT AND NOT _qt_osx_architectures_count GREATER 1)))
list(APPEND init_platform "
+set(__qt_initial_apple_sdk \"${QT_APPLE_SDK}\")
if(NOT DEFINED CMAKE_OSX_SYSROOT)
set(CMAKE_OSX_SYSROOT \"${cmake_sysroot_name}\" CACHE STRING \"\")
endif()")
@@ -254,7 +255,8 @@ endif()")
qt_internal_get_first_osx_arch(osx_first_arch)
list(APPEND init_platform
"if((NOT CMAKE_GENERATOR STREQUAL \"Xcode\" AND NOT __qt_toolchain_building_qt_repo)
- OR (CMAKE_GENERATOR STREQUAL \"Xcode\" AND __qt_apple_sdk AND NOT QT_NO_SET_OSX_ARCHITECTURES))")
+ OR (CMAKE_GENERATOR STREQUAL \"Xcode\" AND __qt_initial_apple_sdk
+ AND NOT QT_NO_SET_OSX_ARCHITECTURES))")
list(APPEND init_platform
" set(CMAKE_OSX_ARCHITECTURES \"${osx_first_arch}\" CACHE STRING \"\")")
list(APPEND init_platform "endif()")
diff --git a/coin/instructions/README.md b/coin/instructions/README.md
index f366642395d..86a46efe051 100644
--- a/coin/instructions/README.md
+++ b/coin/instructions/README.md
@@ -32,6 +32,10 @@ The following environment variables are used in Coin instructions when building
that will be passed to a non-qtbase qt-configure-module call
`NON_QTBASE_CMAKE_ARGS` - contains platform-specific ``CMake-style`` arguments
that will be passed to a non-qtbase qt-configure-module call
+`<MODULE>_CONFIGURE_ARGS` - contains platform-specific ``configure-style`` arguments
+ that will be passed to the specified module's qt-configure-module call
+`<MODULE>_CMAKE_ARGS` - contains platform-specific ``CMake-style`` arguments
+ that will be passed to the specified module's qt-configure-module call
`COMMON_CMAKE_ARGS` - platform-independent ``CMake-style`` args set in
`prepare_building_env.yaml` that apply to qtbase configurations
only.
@@ -51,6 +55,8 @@ mirror the ones above. They are:
`TARGET_CMAKE_ARGS`
`NON_QTBASE_TARGET_CONFIGURE_ARGS`
`NON_QTBASE_TARGET_CMAKE_ARGS`
+`<MODULE>_TARGET_CONFIGURE_ARGS`
+`<MODULE>_TARGET_CMAKE_ARGS`
`COMMON_TARGET_CMAKE_ARGS`
`COMMON_NON_QTBASE_TARGET_CMAKE_ARGS`
diff --git a/coin/instructions/cmake_cross_compilation_module_build_instructions.yaml b/coin/instructions/cmake_cross_compilation_module_build_instructions.yaml
index cf308fc7836..1d60af72831 100644
--- a/coin/instructions/cmake_cross_compilation_module_build_instructions.yaml
+++ b/coin/instructions/cmake_cross_compilation_module_build_instructions.yaml
@@ -36,6 +36,20 @@ instructions:
- type: EnvironmentVariable
variableName: COIN_CMAKE_ARGS
variableValue: "{{.Env.NON_QTBASE_TARGET_CMAKE_ARGS}} {{.Env.COMMON_NON_QTBASE_TARGET_CMAKE_ARGS}}"
+ - type: AppendToEnvironmentVariable
+ variableName: COIN_CONFIGURE_ARGS
+ variableValue: " ${{ToUpper .Env.TESTED_MODULE_COIN}}_TARGET_CONFIGURE_ARGS"
+ enable_if:
+ condition: runtime
+ env_var: "{{ToUpper .Env.TESTED_MODULE_COIN}}_TARGET_CONFIGURE_ARGS"
+ not_equals_value: null
+ - type: AppendToEnvironmentVariable
+ variableName: COIN_CMAKE_ARGS
+ variableValue: " ${{ToUpper .Env.TESTED_MODULE_COIN}}_TARGET_CMAKE_ARGS"
+ enable_if:
+ condition: runtime
+ env_var: "{{ToUpper .Env.TESTED_MODULE_COIN}}_TARGET_CMAKE_ARGS"
+ not_equals_value: null
- type: EnvironmentVariable
variableName: CONFIGURE_ENV_PREFIX
variableValue: "{{.Env.TARGET_ENV_PREFIX}}"
diff --git a/coin/instructions/cmake_module_build_instructions.yaml b/coin/instructions/cmake_module_build_instructions.yaml
index 788074a4bf6..3d83d4ac0dc 100644
--- a/coin/instructions/cmake_module_build_instructions.yaml
+++ b/coin/instructions/cmake_module_build_instructions.yaml
@@ -17,6 +17,20 @@ instructions:
- type: EnvironmentVariable
variableName: COIN_CMAKE_ARGS
variableValue: "{{.Env.NON_QTBASE_CMAKE_ARGS}} {{.Env.COMMON_NON_QTBASE_CMAKE_ARGS}}"
+ - type: AppendToEnvironmentVariable
+ variableName: CONFIGURE_ARGS
+ variableValue: " ${{ToUpper .Env.TESTED_MODULE_COIN}}_CONFIGURE_ARGS"
+ enable_if:
+ condition: runtime
+ env_var: "{{ToUpper .Env.TESTED_MODULE_COIN}}_CONFIGURE_ARGS"
+ not_equals_value: null
+ - type: AppendToEnvironmentVariable
+ variableName: COIN_CMAKE_ARGS
+ variableValue: " ${{ToUpper .Env.TESTED_MODULE_COIN}}_CMAKE_ARGS"
+ enable_if:
+ condition: runtime
+ env_var: "{{ToUpper .Env.TESTED_MODULE_COIN}}_CMAKE_ARGS"
+ not_equals_value: null
- type: EnvironmentVariable
variableName: CONFIGURE_ENV_PREFIX
variableValue: "{{.Env.ENV_PREFIX}}"
diff --git a/coin/instructions/cmake_run_ctest.yaml b/coin/instructions/cmake_run_ctest.yaml
index 43963fc172b..03312101117 100644
--- a/coin/instructions/cmake_run_ctest.yaml
+++ b/coin/instructions/cmake_run_ctest.yaml
@@ -92,19 +92,10 @@ instructions:
variableName: CTEST_ARGS
variableValue: " --no-label-summary"
- # Enable CTest's JUnit XML summary
+ # Enable CTest's JUnit XML summary, supported in CMake >= v3.21
- type: AppendToEnvironmentVariable
variableName: CTEST_ARGS
variableValue: " --output-junit {{.Env.COIN_CTEST_RESULTSDIR}}{{.Env.CI_PATH_SEP}}test_summary.ctest_junit_xml"
- disable_if: # CMake < v3.21 does not support it
- condition: and
- conditions:
- - condition: runtime
- env_var: CMAKE_MIN_SUPPORTED_BIN_PATH
- not_equals_value: null
- - condition: runtime
- env_var: PATH
- contains_value: "{{.Env.CMAKE_MIN_SUPPORTED_BIN_PATH}}"
- !include "{{qt/qtbase}}/coin_module_test_android_start_emulator.yaml"
diff --git a/coin/instructions/coin_module_axivion_template_v2.yaml b/coin/instructions/coin_module_axivion_template_v2.yaml
index 90d57de281c..9840d1138b6 100644
--- a/coin/instructions/coin_module_axivion_template_v2.yaml
+++ b/coin/instructions/coin_module_axivion_template_v2.yaml
@@ -16,6 +16,13 @@ analysis_instructions_axivion: &analysis_instructions_axivion
condition: runtime
env_var: TESTED_MODULE_COIN
not_equals_value: "qtbase"
+ - type: EnvironmentVariable
+ variableName: TESTED_MODULE_BRANCH_COIN
+ variableValue: "unknown"
+ enable_if:
+ condition: runtime
+ env_var: TESTED_MODULE_BRANCH_COIN
+ equals_value: null
- type: Group
instructions:
- type: Rename
diff --git a/configure.cmake b/configure.cmake
index e89922f76f8..0d4e5b04688 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -621,7 +621,7 @@ qt_feature("private_tests" PRIVATE
)
qt_feature("doc_snippets" PRIVATE
LABEL "Developer build: doc_snippets"
- AUTODETECT QT_FEATURE_developer_build
+ AUTODETECT QT_BUILD_DOC_SNIPPETS
CONDITION QT_FEATURE_shared
)
qt_feature_definition("developer-build" "QT_BUILD_INTERNAL")
diff --git a/doc/global/externalsites/external-resources.qdoc b/doc/global/externalsites/external-resources.qdoc
index 51756842ad0..8670305b00c 100644
--- a/doc/global/externalsites/external-resources.qdoc
+++ b/doc/global/externalsites/external-resources.qdoc
@@ -58,68 +58,27 @@
*/
/*!
- \externalpage https://www.freedesktop.org/wiki/Standards/xembed-spec/
- \title XEmbed Specification
-*/
-
-/*!
- \externalpage https://www.freedesktop.org/wiki/Standards/icon-theme-spec/
- \title Icon Themes Specification
-*/
-
-/*!
\externalpage https://www.cups.org/
\title Common Unix Printing System (CUPS)
\keyword CUPS
*/
/*!
- \externalpage https://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/
- \title Desktop Entry Specification
-*/
-
-/*!
- \externalpage https://kde.org/
- \title The K Desktop Environment
- \keyword KDE
-*/
-
-/*!
\externalpage https://cmake.org/cmake/help/latest/
\title CMake Documentation
*/
/*!
- \externalpage https://cmake.org/cmake/help/latest/command/find_package.html
- \title CMake find_package Documentation
-*/
-
-/*!
\externalpage https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html#automoc
\title CMake AUTOMOC Documentation
*/
/*!
- \externalpage https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html#autorcc
- \title CMake AUTORCC Documentation
-*/
-
-/*!
\externalpage https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html#autouic
\title CMake AUTOUIC Documentation
*/
/*!
- \externalpage https://cmake.org/cmake/help/latest/prop_tgt/LOCATION.html
- \title CMake LOCATION Documentation
-*/
-
-/*!
- \externalpage https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html
- \title CMake POSITION_INDEPENDENT_CODE Documentation
-*/
-
-/*!
\externalpage https://cmake.org/cmake/help/latest/command/target_link_libraries.html
\title CMake target_link_libraries Documentation
*/
@@ -130,50 +89,11 @@
*/
/*!
- \externalpage https://conan.io/
- \title Conan
-*/
-
-/*!
\externalpage https://www.gnome.org/
\title GNOME
*/
/*!
- \externalpage https://www.gnu.org/software/emacs/
- \title GNU Emacs
-*/
-
-/*!
- \externalpage https://gnuwin32.sourceforge.net/packages.html
- \title GnuWin32 Project
-*/
-
-/*!
- \externalpage https://www.w3.org/Graphics/SVG/About.html
- \title About SVG
- \keyword Scalable Vector Graphics
-*/
-
-/*!
- \externalpage https://www.w3.org/TR/SVG/types.html#ColorKeywords
- \title SVG color keyword names
-*/
-
-/*!
- \externalpage https://www.w3.org/Graphics/SVG/
- \title SVG Working Group
-*/
-
-/*!
- \externalpage https://www.w3.org/TR/SVGMobile/
- \title Mobile SVG Profiles
- \omit
- Mobile SVG Profiles: SVG Tiny and SVG Basic
- \endomit
-*/
-
-/*!
\externalpage https://www.w3.org/TR/SVGMobile12/
\title SVG 1.2 Tiny
*/
@@ -186,36 +106,16 @@
/*!
- \externalpage https://jmeubank.github.io/tdm-gcc/
- \title TDM-GCC
-*/
-
-/*!
\externalpage https://www.dependencywalker.com/
\title Dependency Walker
*/
/*!
- \externalpage https://webkit.org/
- \title WebKit Open Source Project
-*/
-
-/*!
- \externalpage https://www.informit.com/store/c-plus-plus-gui-programming-with-qt4-9780132354165
- \title C++ GUI Programming with Qt 4, 2nd Edition
-*/
-
-/*!
\externalpage https://www.openssl.org/
\title OpenSSL Toolkit
*/
/*!
- \externalpage https://www.activestate.com/platform/supported-languages/perl/
- \title ActivePerl
-*/
-
-/*!
\externalpage https://chromium.googlesource.com/angle/angle/+/master/README.md
\title ANGLE
*/
@@ -226,16 +126,6 @@
*/
/*!
- \externalpage https://www.w3.org/TR/html401/
- \title HTML 4
-*/
-
-/*!
- \externalpage https://html.spec.whatwg.org/multipage/
- \title HTML 5
-*/
-
-/*!
\externalpage https://icu.unicode.org/
\title ICU
*/
@@ -251,41 +141,16 @@
*/
/*!
- \externalpage https://pyxml.sourceforge.net/topics/xbel/
- \title XML Bookmark Exchange Language Resource Page
-*/
-
-/*!
- \externalpage https://www.w3.org/TR/xquery/#errors
- \title error handling in the XQuery language
-*/
-
-/*!
\externalpage https://xaos-project.github.io/
\title XaoS
*/
/*!
- \externalpage https://www.unixodbc.org
- \title https://www.unixodbc.org
-*/
-
-/*!
\externalpage https://www.postgresql.org
\title https://www.postgresql.org
*/
/*!
- \externalpage https://www.postgresql.org/docs/current/installation-platform-notes.html
- \title PostgreSQL MinGW/Native Windows
-*/
-
-/*!
- \externalpage https://www.freetds.org
- \title https://www.freetds.org
-*/
-
-/*!
\externalpage https://www.sqlite.org
\title https://www.sqlite.org
*/
@@ -301,11 +166,6 @@
*/
/*!
- \externalpage https://tldp.org/HOWTO/Framebuffer-HOWTO.html
- \title Framebuffer HOWTO
-*/
-
-/*!
\externalpage https://www.w3.org/TR/scxml/
\title State Chart XML: State Machine Notation for Control Abstraction
*/
@@ -321,71 +181,21 @@
*/
/*!
- \externalpage https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
- \title GNU Lesser General Public License, version 2.1
-*/
-
-/*!
- \externalpage https://www.qtcentre.org
- \title Qt Centre
-*/
-
-/*!
\externalpage https://kde.org
\title KDE
*/
/*!
- \externalpage https://cplusplus.com/reference/cstring/memcpy/
- \title C++ Reference - memcpy
-*/
-
-/*!
\externalpage https://en.cppreference.com/w/cpp/symbol_index/chrono_literals.html
\title chrono_literals Symbol Index
*/
/*!
- \externalpage https://www.w3.org/TR/CSS2/selector.html
- \title Standard CSS2 selector
-*/
-
-/*!
- \externalpage https://www.w3.org/XML/Core/#Publications
- \title W3C XML specifications
-*/
-
-/*!
- \externalpage https://www.w3.org/XML/Schema
- \title XML Schema
-*/
-
-/*!
- \externalpage https://opensource.org/license/bsd-3-clause
- \title New and Modified BSD Licenses
-*/
-
-/*!
- \externalpage https://ecma-international.org/publications-and-standards/standards/ecma-262/
- \title ECMAScript Language Specification
-*/
-
-/*!
\externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript
\title JavaScript Resources
*/
/*!
- \externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
- \title JavaScript Guide
-*/
-
-/*!
- \externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript
- \title About JavaScript
-*/
-
-/*!
\externalpage https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#keywords
\title JavaScript Reserved Words
*/
@@ -406,41 +216,16 @@
*/
/*!
- \externalpage https://registry.khronos.org/OpenGL/index_gl.php
- \title OpenGL Registry
-*/
-
-/*!
- \externalpage https://registry.khronos.org/OpenGL/index_es.php
- \title Khronos OpenGL ES API Registry
-*/
-
-/*!
\externalpage https://www.khronos.org/opengl/wiki/Array_Texture
\title Array Texture
*/
/*!
- \externalpage https://github.com/iksaif/qsslkey-p11
- \title qsslkey example
-*/
-
-/*!
\externalpage https://www.w3.org/TR/2009/WD-webdatabase-20091029/
\title HTML5 Web Database API
*/
/*!
- \externalpage https://lldb.llvm.org/
- \title The LLDB Debugger
-*/
-
-/*!
- \externalpage https://account.qt.io/s/
- \title Qt Account Sign-up
-*/
-
-/*!
\externalpage https://facebook.github.io/zstd/
\title Zstandard Site
*/
@@ -476,6 +261,6 @@
*/
/*!
- \externalpage https://specifications.freedesktop.org/trash-spec/1.0/
+ \externalpage https://specifications.freedesktop.org/trash/1.0/
\title FreeDesktop.org Trash specification version 1.0
*/
diff --git a/doc/global/externalsites/qt-webpages.qdoc b/doc/global/externalsites/qt-webpages.qdoc
index 7b659fa5295..6cbf5f377b6 100644
--- a/doc/global/externalsites/qt-webpages.qdoc
+++ b/doc/global/externalsites/qt-webpages.qdoc
@@ -17,76 +17,15 @@
\title The Qt Company
*/
/*!
- \externalpage http://qt.io/licensing/
- \title Qt Licensing Overview
-*/
-/*!
- \externalpage http://doc.qt.io/archives/qq/
- \title Qt Quarterly
-*/
-/*!
- \externalpage http://doc.qt.io/archives/qq/qq19-plurals.html
- \title Qt Quarterly: Plural Form in Translation
-*/
-/*!
\externalpage https://code.qt.io/
\title Public Qt Repository
*/
/*!
- \externalpage https://code.qt.io/cgit/%7bnon-gerrit%7d/qt-labs/qtestlib-tools.git/
- \title qtestlib-tools
-*/
-
-/*!
- \externalpage http://wiki.qt.io/Qt_Coding_Style
- \title Qt Coding Style
-*/
-/*!
- \externalpage http://doc.qt.io/archives/qt-eclipse-1.6/index.html
- \title Eclipse Plugin
-*/
-/*!
- \externalpage http://doc.qt.io/archives/qq/qq11-events.html
- \title Qt Quarterly: Another Look at Events
-*/
-/*!
- \externalpage https://www.youtube.com/watch?v=P4kv-AoAJ-Q
- \title Livecoding video effects with Qt5
-*/
-/*!
- \externalpage http://blog.qt.io/2012/02/29/pimp-my-video-shader-effects-and-multimedia/
- \title Pimp my video
-*/
-/*!
- \externalpage http://wiki.qt.io/QtMediaHub
- \title QtMediaHub
-*/
-/*!
- \externalpage http://wiki.qt.io/Qt_RaspberryPi
- \title QtonPi
-*/
-
-/*!
- \externalpage http://wiki.qt.io/jom
- \title jom
-*/
-
-/*!
- \externalpage http://doc.qt.io/qt-4.8
- \title Qt 4.8 Reference Documentation
-*/
-
-/*!
\externalpage http://wiki.qt.io/Qt_Localization
\title external: Translating Qt Into Other Languages
*/
/*!
- \externalpage http://wiki.qt.io/Qt_Multimedia_Backends
- \title Qt Multimedia Backends
-*/
-
-/*!
\externalpage https://doc.qt.io/qt3dstudio/index.html
\title Qt 3D Studio Manual
*/
diff --git a/doc/global/externalsites/rfc.qdoc b/doc/global/externalsites/rfc.qdoc
index d0c127fb41e..071977b9a0e 100644
--- a/doc/global/externalsites/rfc.qdoc
+++ b/doc/global/externalsites/rfc.qdoc
@@ -12,12 +12,6 @@
*/
/*!
- \externalpage https://datatracker.ietf.org/doc/html/rfc1179
- \title RFC 1179
- \keyword lpr
-*/
-
-/*!
\externalpage https://datatracker.ietf.org/doc/html/rfc1738
\title RFC 1738
*/
@@ -28,43 +22,16 @@
*/
/*!
- \externalpage https://datatracker.ietf.org/doc/html/rfc1928
- \title RFC 1928
-*/
-
-/*!
- \externalpage https://datatracker.ietf.org/doc/html/rfc1929
- \title RFC 1929
-*/
-
-/*!
\externalpage https://datatracker.ietf.org/doc/html/rfc2045
\title RFC 2045
*/
/*!
- \externalpage https://datatracker.ietf.org/doc/html/rfc2109
- \title RFC 2109
- HTTP State Management Mechanism
-*/
-
-/*!
\externalpage https://datatracker.ietf.org/doc/html/rfc2822
\title RFC 2822
*/
/*!
- \externalpage https://datatracker.ietf.org/doc/html/rfc2965
- \title RFC 2965
- HTTP State Management Mechanism
-*/
-
-/*!
- \externalpage https://datatracker.ietf.org/doc/html/rfc3174
- \title RFC 3174
-*/
-
-/*!
\externalpage https://datatracker.ietf.org/doc/html/rfc3491
\title RFC 3491
*/
diff --git a/doc/global/macros.qdocconf b/doc/global/macros.qdocconf
index ae08c76ad93..f414b3fed18 100644
--- a/doc/global/macros.qdocconf
+++ b/doc/global/macros.qdocconf
@@ -91,11 +91,11 @@ macro.NdkFullVer = "27.2.12479018"
macro.NdkCompilerVer = "Clang 17.0.2"
macro.JdkVer = "17"
macro.AndroidMinApiVer = "28"
-macro.AndroidMaxApiVer = "35"
+macro.AndroidMaxApiVer = "36"
macro.AndroidMinVer = "9"
-macro.AndroidMaxVer = "15"
-macro.AndroidPlatformVer = "35"
-macro.AndroidBuildToolsVer = "35.0.1"
+macro.AndroidMaxVer = "16"
+macro.AndroidPlatformVer = "36"
+macro.AndroidBuildToolsVer = "36.0.0"
macro.GradleVer = "8.14.3"
macro.AGPVer = "8.10.1"
macro.AAOSVer = "10 to 13"
diff --git a/examples/network/doc/src/http.qdoc b/examples/network/doc/src/http.qdoc
index a07d0fe73b0..e8ebc907e92 100644
--- a/examples/network/doc/src/http.qdoc
+++ b/examples/network/doc/src/http.qdoc
@@ -18,6 +18,15 @@
The main work of this example is done in the HttpWindow class.
Thus we will focus on that.
+ \snippet http/httpwindow.cpp qnam-tcpkeepalive
+
+ Since Qt 6.11, it is possible to explicitly specify the TCP keepalive
+ parameters for a QNetworkRequest. In the snippet above, we are overriding
+ the defaults used by QNetworkAccessManager to follow a more aggressive
+ strategy. This can be useful, for example, in early detection of network
+ hangs caused by network changes on Linux. In this particular example, the
+ connection will be closed after thirty seconds of inactivity.
+
\snippet http/httpwindow.cpp qnam-download
Using QNetworkAccessManager, we begin the download of a resource as
diff --git a/examples/network/http/httpwindow.cpp b/examples/network/http/httpwindow.cpp
index 3d1c2467d84..3a4ae098321 100644
--- a/examples/network/http/httpwindow.cpp
+++ b/examples/network/http/httpwindow.cpp
@@ -10,6 +10,8 @@
#include <QUrl>
#include <memory>
+#include <chrono>
+using namespace std::chrono_literals;
#if QT_CONFIG(ssl)
const char defaultUrl[] = "https://www.qt.io/";
@@ -95,8 +97,15 @@ void HttpWindow::startRequest(const QUrl &requestedUrl)
url = requestedUrl;
httpRequestAborted = false;
+ //! [qnam-tcpkeepalive]
+ QNetworkRequest networkRequest(url);
+ networkRequest.setTcpKeepAliveIdleTimeBeforeProbes(20s);
+ networkRequest.setTcpKeepAliveIntervalBetweenProbes(2s);
+ networkRequest.setTcpKeepAliveProbeCount(5);
+ //! [qnam-tcpkeepalive]
+
//! [qnam-download]
- reply.reset(qnam.get(QNetworkRequest(url)));
+ reply.reset(qnam.get(networkRequest));
//! [qnam-download]
//! [connecting-reply-to-slots]
connect(reply.get(), &QNetworkReply::finished, this, &HttpWindow::httpFinished);
diff --git a/mkspecs/common/clang.conf b/mkspecs/common/clang.conf
index 82c6173a037..83867e66f94 100644
--- a/mkspecs/common/clang.conf
+++ b/mkspecs/common/clang.conf
@@ -32,14 +32,14 @@ QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
QMAKE_CXXFLAGS_LTCG_FATOBJECTS = $$QMAKE_CFLAGS_LTCG_FATOBJECTS
QMAKE_CXXFLAGS_DISABLE_LTCG = $$QMAKE_CFLAGS_DISABLE_LTCG
QMAKE_CXXFLAGS_CXX11 = -std=c++11
-QMAKE_CXXFLAGS_CXX14 = -std=c++1y
-QMAKE_CXXFLAGS_CXX1Z = -std=c++1z
+QMAKE_CXXFLAGS_CXX14 = -std=c++14
+QMAKE_CXXFLAGS_CXX1Z = -std=c++17
QMAKE_CXXFLAGS_CXX2A = -std=c++2a
QMAKE_CXXFLAGS_CXX2B = -std=c++2b
QMAKE_CXXFLAGS_CXX2C = -std=c++2c
QMAKE_CXXFLAGS_GNUCXX11 = -std=gnu++11
-QMAKE_CXXFLAGS_GNUCXX14 = -std=gnu++1y
-QMAKE_CXXFLAGS_GNUCXX1Z = -std=gnu++1z
+QMAKE_CXXFLAGS_GNUCXX14 = -std=gnu++14
+QMAKE_CXXFLAGS_GNUCXX1Z = -std=gnu++17
QMAKE_CXXFLAGS_GNUCXX2A = -std=gnu++2a
QMAKE_CXXFLAGS_GNUCXX2B = -std=gnu++2b
QMAKE_CXXFLAGS_GNUCXX2C = -std=gnu++2c
diff --git a/mkspecs/common/g++-base.conf b/mkspecs/common/g++-base.conf
index e12e41506ae..66248fb7d01 100644
--- a/mkspecs/common/g++-base.conf
+++ b/mkspecs/common/g++-base.conf
@@ -30,14 +30,14 @@ QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
QMAKE_CFLAGS_GNUC99 = -std=gnu99
QMAKE_CFLAGS_GNUC11 = -std=gnu11
QMAKE_CXXFLAGS_CXX11 = -std=c++11
-QMAKE_CXXFLAGS_CXX14 = -std=c++1y
-QMAKE_CXXFLAGS_CXX1Z = -std=c++1z
+QMAKE_CXXFLAGS_CXX14 = -std=c++14
+QMAKE_CXXFLAGS_CXX1Z = -std=c++17
QMAKE_CXXFLAGS_CXX2A = -std=c++2a
QMAKE_CXXFLAGS_CXX2B = -std=c++2b
QMAKE_CXXFLAGS_CXX2C = -std=c++2c
QMAKE_CXXFLAGS_GNUCXX11 = -std=gnu++11
-QMAKE_CXXFLAGS_GNUCXX14 = -std=gnu++1y
-QMAKE_CXXFLAGS_GNUCXX1Z = -std=gnu++1z
+QMAKE_CXXFLAGS_GNUCXX14 = -std=gnu++14
+QMAKE_CXXFLAGS_GNUCXX1Z = -std=gnu++17
QMAKE_CXXFLAGS_GNUCXX2A = -std=gnu++2a
QMAKE_CXXFLAGS_GNUCXX2B = -std=gnu++2b
QMAKE_CXXFLAGS_GNUCXX2C = -std=gnu++2c
diff --git a/mkspecs/common/msvc-based-version.conf b/mkspecs/common/msvc-based-version.conf
index adc893836a9..a687fa5f449 100644
--- a/mkspecs/common/msvc-based-version.conf
+++ b/mkspecs/common/msvc-based-version.conf
@@ -42,4 +42,10 @@ greaterThan(QMAKE_MSC_VER, 1929) {
MSVC_TOOLSET_VER = 143
}
+greaterThan(QMAKE_MSC_VER, 1949) {
+ # Visual Studio 2026 (18.0) / Visual C++ 19.50 and up
+ MSVC_VER = 18.0
+ MSVC_TOOLSET_VER = 145
+}
+
!isEmpty(COMPAT_MKSPEC):!$$COMPAT_MKSPEC: CONFIG += $$COMPAT_MKSPEC
diff --git a/mkspecs/common/msvc-version.conf b/mkspecs/common/msvc-version.conf
index 0130542ddb9..8270f02e890 100644
--- a/mkspecs/common/msvc-version.conf
+++ b/mkspecs/common/msvc-version.conf
@@ -147,4 +147,10 @@ greaterThan(QMAKE_MSC_VER, 1929) {
MSVC_TOOLSET_VER = 143
}
+greaterThan(QMAKE_MSC_VER, 1949) {
+ # Visual Studio 2026 (18.0) / Visual C++ 19.50 and up
+ MSVC_VER = 18.0
+ MSVC_TOOLSET_VER = 145
+}
+
!isEmpty(COMPAT_MKSPEC):!$$COMPAT_MKSPEC: CONFIG += $$COMPAT_MKSPEC
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 6517e5c4516..0776a4a5267 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -25,6 +25,8 @@ DotNET vsVersionFromString(const ProString &versionString)
int versionMajor = versionView.left(idx).toInt();
int versionMinor = versionView.mid(idx + 1).toInt();
+ if (versionMajor == 18)
+ return NET2026;
if (versionMajor == 17)
return NET2022;
if (versionMajor == 16)
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h
index 190d6c727fa..58f818a3bc5 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -29,7 +29,8 @@ enum DotNET {
NET2015 = 0xd0,
NET2017 = 0xe0,
NET2019,
- NET2022
+ NET2022,
+ NET2026
};
DotNET vsVersionFromString(const ProString &versionString);
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 1566f72ba66..7c2e0562aa7 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -56,6 +56,8 @@ const char _slnHeader142[] = "Microsoft Visual Studio Solution File, Format
"\n# Visual Studio Version 16";
const char _slnHeader143[] = "Microsoft Visual Studio Solution File, Format Version 12.00"
"\n# Visual Studio Version 17";
+const char _slnHeader145[] = "Microsoft Visual Studio Solution File, Format Version 12.00"
+ "\n# Visual Studio Version 18";
// The following UUID _may_ change for later servicepacks...
// If so we need to search through the registry at
// HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects
@@ -502,6 +504,9 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
}
switch (vcProject.Configuration.CompilerVersion) {
+ case NET2026:
+ t << _slnHeader145;
+ break;
case NET2022:
t << _slnHeader143;
break;
@@ -882,6 +887,9 @@ void VcprojGenerator::initProject()
// Own elements -----------------------------
vcProject.Name = project->first("QMAKE_ORIG_TARGET").toQString();
switch (vcProject.Configuration.CompilerVersion) {
+ case NET2026:
+ vcProject.Version = "18.00";
+ break;
case NET2022:
vcProject.Version = "17.00";
break;
diff --git a/src/3rdparty/libjpeg/COPYRIGHT.txt b/src/3rdparty/libjpeg/COPYRIGHT.txt
index f5eae868466..ce9d95bfebc 100644
--- a/src/3rdparty/libjpeg/COPYRIGHT.txt
+++ b/src/3rdparty/libjpeg/COPYRIGHT.txt
@@ -1,4 +1,4 @@
-Copyright (C) 2009-2025 D. R. Commander
+Copyright (C) 2009-2024 D. R. Commander
Copyright (C) 2015, 2020 Google, Inc.
Copyright (C) 2019-2020 Arm Limited
Copyright (C) 2015-2016, 2018 Matthieu Darbois
diff --git a/src/3rdparty/libjpeg/ChangeLog.md b/src/3rdparty/libjpeg/ChangeLog.md
index 4bdbf53dd34..17390d80bd0 100644
--- a/src/3rdparty/libjpeg/ChangeLog.md
+++ b/src/3rdparty/libjpeg/ChangeLog.md
@@ -1,3 +1,34 @@
+3.1.3
+=====
+
+### Significant changes relative to 3.1.2:
+
+1. Hardened the TurboJPEG API against hypothetical applications that may
+erroneously call `tj*Compress*()` or `tj*Transform()` with a reused JPEG
+destination buffer pointer while specifying a destination buffer size of 0.
+
+2. Hardened the TurboJPEG API against hypothetical applications that may
+erroneously set `TJPARAM_LOSSLESS` or `TJPARAM_COLORSPACE` prior to calling
+`tj3EncodeYUV*8()` or `tj3CompressFromYUV*8()`. `tj3EncodeYUV*8()` and
+`tj3CompressFromYUV*8()` now ignore `TJPARAM_LOSSLESS` and
+`TJPARAM_COLORSPACE`.
+
+3. Hardened the TurboJPEG Java API against hypothetical applications that may
+erroneously pass huge X or Y offsets to one of the compression, YUV encoding,
+decompression, or YUV decoding methods, leading to signed integer overflow in
+the JNI wrapper's buffer size checks that rendered those checks ineffective.
+
+4. Fixed an issue in the TurboJPEG Java API whereby
+`TJCompressor.getSourceBuf()` sometimes returned the buffer from a previous
+invocation of `TJCompressor.loadSourceImage()` if the target data precision was
+changed before the most recent invocation.
+
+5. Fixed an issue in the PPM reader that caused incorrect pixels to be
+generated when using `tj3LoadImage*()` or `TJCompressor.loadSourceImage()` to
+load a PBMPLUS (PPM/PGM) file into a CMYK buffer with a different data
+precision than that of the file.
+
+
3.1.2
=====
@@ -962,9 +993,9 @@ storage.
64-bit libjpeg-turbo SDK for Visual C++ were installed on the same system, only
one of them could be uninstalled.
-2. Fixed a signed integer overflow and subsequent segfault that occurred when
-attempting to decompress images with more than 715827882 pixels using the
-64-bit C version of TJBench.
+2. Fixed a signed integer overflow and subsequent segfault (CVE-2019-2201) that
+occurred when attempting to decompress images with more than 715827882 pixels
+using the 64-bit C version of TJBench.
3. Fixed out-of-bounds write in `tjDecompressToYUV2()` and
`tjDecompressToYUVPlanes()` (sometimes manifesting as a double free) that
@@ -1016,9 +1047,9 @@ regardless of whether a 4:2:2 JPEG image is rotated or transposed prior to
decompression (in the frequency domain) or after decompression (in the spatial
domain), the final image will be similar.
-4. Fixed an integer overflow and subsequent segfault that occurred when
-attempting to compress or decompress images with more than 1 billion pixels
-using the TurboJPEG API.
+4. Fixed an integer overflow and subsequent segfault (CVE-2019-2201) that
+occurred when attempting to compress or decompress images with more than 1
+billion pixels using the TurboJPEG API.
5. Fixed a regression introduced by 2.0 beta1[15] whereby attempting to
generate a progressive JPEG image on an SSE2-capable CPU using a scan script
diff --git a/src/3rdparty/libjpeg/qt_attribution.json b/src/3rdparty/libjpeg/qt_attribution.json
index fe38aec1f68..5ac811a12b4 100644
--- a/src/3rdparty/libjpeg/qt_attribution.json
+++ b/src/3rdparty/libjpeg/qt_attribution.json
@@ -7,8 +7,8 @@
"Description": "The Independent JPEG Group's JPEG software",
"Homepage": "http://libjpeg-turbo.virtualgl.org/",
- "Version": "3.1.2",
- "DownloadLocation": "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.1.2/libjpeg-turbo-3.1.2.tar.gz",
+ "Version": "3.1.3",
+ "DownloadLocation": "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.1.3/libjpeg-turbo-3.1.3.tar.gz",
"PURL": "pkg:github/libjpeg-turbo/libjpeg-turbo@$<VERSION>",
"CPE": "cpe:2.3:a:libjpeg-turbo:libjpeg-turbo:$<VERSION>:*:*:*:*:*:*:*",
diff --git a/src/3rdparty/libjpeg/src/jconfig.h b/src/3rdparty/libjpeg/src/jconfig.h
index e81574b9a48..85a1509fb68 100644
--- a/src/3rdparty/libjpeg/src/jconfig.h
+++ b/src/3rdparty/libjpeg/src/jconfig.h
@@ -2,9 +2,9 @@
#define JPEG_LIB_VERSION 80
-#define LIBJPEG_TURBO_VERSION 3.0.3
+#define LIBJPEG_TURBO_VERSION 3.1.3
-#define LIBJPEG_TURBO_VERSION_NUMBER 3000003
+#define LIBJPEG_TURBO_VERSION_NUMBER 3001003
#define C_ARITH_CODING_SUPPORTED 1
diff --git a/src/3rdparty/libjpeg/src/jconfigint.h b/src/3rdparty/libjpeg/src/jconfigint.h
index 6e7dbd75a1e..6d5f9633928 100644
--- a/src/3rdparty/libjpeg/src/jconfigint.h
+++ b/src/3rdparty/libjpeg/src/jconfigint.h
@@ -10,7 +10,7 @@
#define PACKAGE_NAME "libjpeg-turbo"
-#define VERSION "3.0.3"
+#define VERSION "3.1.3"
#if SIZE_MAX == 0xffffffff
#define SIZEOF_SIZE_T 4
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtWindow.java b/src/android/jar/src/org/qtproject/qt/android/QtWindow.java
index f0d304f9e7f..c63cd1a77e3 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtWindow.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtWindow.java
@@ -32,6 +32,7 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
private QtWindow m_parentWindow;
private GestureDetector m_gestureDetector;
private final QtEditText m_editText;
+ private boolean m_editTextFocusInitialized = false;
private final QtInputConnection.QtInputConnectionListener m_inputConnectionListener;
private boolean m_firstSafeMarginsDelivered = false;
private int m_actionBarHeight = -1;
@@ -62,6 +63,8 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
if (!isForeignWindow && context instanceof Activity) {
// TODO QTBUG-122552 - Service keyboard input not implemented
m_editText = new QtEditText(context, listener);
+ m_editText.setFocusable(false);
+ m_editText.setFocusableInTouchMode(false);
m_editText.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
@@ -242,6 +245,14 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
@Override
public boolean onTouchEvent(MotionEvent event)
{
+ // Enable focus for the edit text on first touch event to avoid
+ // early QtInputConnection callbacks from blocking the UI thread.
+ if (!m_editTextFocusInitialized) {
+ m_editTextFocusInitialized = true;
+ m_editText.setFocusable(true);
+ m_editText.setFocusableInTouchMode(true);
+ }
+
windowFocusChanged(true, getId());
if (m_editText != null && m_inputConnectionListener != null)
m_inputConnectionListener.onEditTextChanged(m_editText);
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index ea8cf7b9c8e..539ad753ca6 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -590,17 +590,14 @@ if(QT_FEATURE_async_io)
DEFINES
QT_RANDOMACCESSASYNCFILE_QIORING
)
- elseif(QT_FEATURE_thread AND QT_FEATURE_future)
- # TODO: This should become the last (fallback) condition later.
- # We migth also want to rewrite it so that it does not depend on
- # QT_FEATURE_future.
- qt_internal_extend_target(Core
- SOURCES
- io/qrandomaccessasyncfile_threadpool.cpp
- DEFINES
- QT_RANDOMACCESSASYNCFILE_THREAD
- )
endif()
+ # This is the fallback condition that should be always available.
+ # TODO: try to rewrite it so that it does not depend on
+ # QT_FEATURE_future.
+ qt_internal_extend_target(Core
+ SOURCES
+ io/qrandomaccessasyncfile_threadpool.cpp
+ )
endif()
# This needs to be done before one below adds kernel32 because the symbols we use
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index b69d0285de2..c1f9aee0180 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -3677,21 +3677,6 @@ macro(qt6_standard_project_setup)
if(NOT DEFINED QT_I18N_SOURCE_LANGUAGE)
set(QT_I18N_SOURCE_LANGUAGE ${__qt_sps_arg_I18N_SOURCE_LANGUAGE})
endif()
-
- if(CMAKE_GENERATOR STREQUAL "Xcode")
- # Ensure we always use device SDK for Xcode for single-arch Qt builds
- set(qt_osx_arch_count 0)
- if(QT_OSX_ARCHITECTURES)
- list(LENGTH QT_OSX_ARCHITECTURES qt_osx_arch_count)
- endif()
- if(NOT qt_osx_arch_count GREATER 1 AND "${CMAKE_OSX_SYSROOT}" MATCHES "^[a-z]+simulator$")
- # Xcode expects the base SDK to be the device SDK
- set(simulator_sysroot "${CMAKE_OSX_SYSROOT}")
- string(REGEX REPLACE "simulator" "os" CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}")
- set(CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}" CACHE STRING "" FORCE)
- set(CMAKE_XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS "${simulator_sysroot}")
- endif()
- endif()
endif()
endmacro()
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index c3e1ba4010f..8a343b15eeb 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -858,6 +858,7 @@ qint64 QAnimationDriver::elapsed() const
*/
/*!
+ \internal
The default animation driver just spins the timer...
*/
QDefaultAnimationDriver::QDefaultAnimationDriver(QUnifiedTimer *timer)
diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake
index 4386b907c13..7274b51cc0a 100644
--- a/src/corelib/configure.cmake
+++ b/src/corelib/configure.cmake
@@ -620,6 +620,10 @@ int main(void)
HRESULT hr = CreateIoRing(IORING_VERSION_3, flags, 1, 1, &ioRingHandle);
if (hr == IORING_E_SUBMISSION_QUEUE_FULL) // not valid, but test that this #define exists
return 0;
+ IORING_HANDLE_REF ref(HANDLE(nullptr));
+ IORING_BUFFER_REF bufRef(nullptr);
+ // The newest API addition that we require:
+ BuildIoRingWriteFile(ioRingHandle, ref, bufRef, -1, 0, FILE_WRITE_FLAGS_NONE, 0, IOSQE_FLAGS_NONE);
/* END TEST: */
return 0;
}
@@ -806,7 +810,7 @@ qt_feature("winsdkicu" PRIVATE
CONDITION TEST_winsdkicu
DISABLE QT_FEATURE_icu
)
-qt_feature("windows_ioring" PRIVATE
+qt_feature("windows-ioring" PRIVATE
LABEL "Windows I/O Ring"
AUTODETECT WIN32 AND CMAKE_HOST_SYSTEM_VERSION VERSION_GREATER_EQUAL 10.0.22000
CONDITION TEST_windows_ioring
@@ -1278,14 +1282,13 @@ qt_feature("permissions" PUBLIC
)
qt_feature("openssl-hash" PRIVATE
LABEL "OpenSSL based cryptographic hash"
- AUTODETECT OFF
CONDITION QT_FEATURE_openssl_linked AND QT_FEATURE_opensslv30
PURPOSE "Uses OpenSSL based implementation of cryptographic hash algorithms."
)
qt_feature("async-io" PRIVATE
LABEL "Async File I/O"
PURPOSE "Provides support for asynchronous file I/O."
- CONDITION (QT_FEATURE_thread AND QT_FEATURE_future) OR APPLE OR (LINUX AND QT_FEATURE_liburing) OR (WIN32 AND QT_FEATURE_windows_ioring)
+ CONDITION QT_FEATURE_thread AND QT_FEATURE_future
)
qt_configure_add_summary_section(NAME "Qt Core")
@@ -1298,7 +1301,7 @@ qt_configure_add_summary_entry(ARGS "glib")
qt_configure_add_summary_entry(ARGS "icu")
qt_configure_add_summary_entry(ARGS "jemalloc")
qt_configure_add_summary_entry(ARGS "liburing")
-qt_configure_add_summary_entry(ARGS "windows_ioring")
+qt_configure_add_summary_entry(ARGS "windows-ioring")
qt_configure_add_summary_entry(ARGS "timezone_tzdb")
qt_configure_add_summary_entry(ARGS "system-libb2")
qt_configure_add_summary_entry(ARGS "mimetype-database")
diff --git a/src/corelib/doc/images/javaiterators1.svg b/src/corelib/doc/images/javaiterators1.svg
index 468dbe5371c..c10329ab480 100644
--- a/src/corelib/doc/images/javaiterators1.svg
+++ b/src/corelib/doc/images/javaiterators1.svg
@@ -12,6 +12,11 @@
svg .text-style { font: 20px arial; fill: black }
svg .fill-style { stroke: none; fill: red }
+ svg.dark .box-style { stroke: #f2f2f2; fill: black }
+ svg.dark .line-style { stroke: red; fill: none }
+ svg.dark .text-style { font: 20px arial; fill: #f2f2f2 }
+ svg.dark .fill-style { stroke: none; fill: red }
+
[data-theme="dark"] svg .box-style { stroke: #f2f2f2; fill: black }
[data-theme="dark"] svg .line-style { stroke: red; fill: none }
[data-theme="dark"] svg .text-style { font: 20px arial; fill: #f2f2f2 }
@@ -24,36 +29,53 @@
</style>
<g transform="translate(10.5, 10.5)">
-<path d="m 0,0 h 80 v 60 h -80 z" class="box-style" />
-<text x="35" y="36" class="text-style">A</text>
-<path d="M 0,60 v 30" class="line-style" />
-<path d="M 0,60 l -5,10 l 10,0 z" class="fill-style" />
+<path d="m 0,0 h 80 v 60 h -80 z" stroke="black" fill="white"
+ class="box-style" />
+<text x="35" y="36" font-family="arial" font-size="20px"
+ class="text-style">A</text>
+<path d="M 0,60 v 30" stroke="red"
+ class="line-style" />
+<path d="M 0,60 l -5,10 l 10,0 z" stroke="red" fill="red"
+ class="fill-style" />
</g>
<g transform="translate(90.5, 10.5)">
-<path d="m 0,0 h 80 v 60 h -80 z" class="box-style" />
-<text x="35" y="36" class="text-style">B</text>
-<path d="M 0,60 v 30" class="line-style" />
-<path d="M 0,60 l -5,10 l 10,0 z" class="fill-style" />
+<path d="m 0,0 h 80 v 60 h -80 z" stroke="black" fill="white"
+ class="box-style" />
+<text x="35" y="36" font-family="arial" font-size="20px"
+ class="text-style">B</text>
+<path d="M 0,60 v 30" stroke="red"
+ class="line-style" />
+<path d="M 0,60 l -5,10 l 10,0 z" stroke="red" fill="red"
+ class="fill-style" />
</g>
<g transform="translate(170.5, 10.5)">
-<path d="m 0,0 h 80 v 60 h -80 z" class="box-style" />
-<text x="35" y="36" class="text-style">C</text>
-<path d="M 0,60 v 30" class="line-style" />
-<path d="M 0,60 l -5,10 l 10,0 z" class="fill-style" />
+<path d="m 0,0 h 80 v 60 h -80 z" stroke="black" fill="white"
+ class="box-style" />
+<text x="35" y="36" font-family="arial" font-size="20px"
+ class="text-style">C</text>
+<path d="M 0,60 v 30" stroke="red"
+ class="line-style" />
+<path d="M 0,60 l -5,10 l 10,0 z" stroke="red" fill="red"
+ class="fill-style" />
</g>
<g transform="translate(250.5, 10.5)">
-<path d="m 0,0 h 80 v 60 h -80 z" class="box-style" />
-<text x="35" y="36" class="text-style">D</text>
-<path d="M 0,60 v 30" class="line-style" />
-<path d="M 0,60 l -5,10 l 10,0 z" class="fill-style" />
+<path d="m 0,0 h 80 v 60 h -80 z" stroke="black" fill="white"
+ class="box-style" />
+<text x="35" y="36" font-family="arial" font-size="20px"
+ class="text-style">D</text>
+<path d="M 0,60 v 30" stroke="red"
+ class="line-style" />
+<path d="M 0,60 l -5,10 l 10,0 z" stroke="red" fill="red"
+ class="fill-style" />
</g>
<g transform="translate(330.5, 10.5)">
-<path d="M 0,60 v 30" class="line-style" />
-<path d="M 0,60 l -5,10 l 10,0 z" class="fill-style" />
+<path d="M 0,60 v 30" stroke="red"
+ class="line-style" />
+<path d="M 0,60 l -5,10 l 10,0 z" stroke="red" fill="red"
+ class="fill-style" />
</g>
-
</svg>
diff --git a/src/corelib/doc/images/javaiterators2.svg b/src/corelib/doc/images/javaiterators2.svg
index df4c6b352a6..3b41b3f8730 100644
--- a/src/corelib/doc/images/javaiterators2.svg
+++ b/src/corelib/doc/images/javaiterators2.svg
@@ -15,6 +15,14 @@
svg .text-style { font: 20px arial; fill: black }
svg .small-text-style { font: 12px monospace; fill: black }
+ svg.dark .box-style { stroke: #f2f2f2; fill: black }
+ svg.dark .line-style { stroke: red; fill: none }
+ svg.dark .fill-style { stroke: none; fill: red }
+ svg.dark .np-line-style { stroke: #4080ff; fill: none; stroke-width: 1.5 }
+ svg.dark .np-fill-style { stroke: none; fill: #4080ff }
+ svg.dark .text-style { font: 20px arial; fill: #f2f2f2 }
+ svg.dark .small-text-style { font: 12px monospace; fill: #f2f2f2 }
+
[data-theme="dark"] svg .box-style { stroke: #f2f2f2; fill: black }
[data-theme="dark"] svg .line-style { stroke: red; fill: none }
[data-theme="dark"] svg .fill-style { stroke: none; fill: red }
@@ -33,31 +41,46 @@
</style>
<g transform="translate(10.5, 10.5)">
-<path d="m 0,0 h 80 v 60 h -80 z" class="box-style" />
-<text x="35" y="36" class="text-style">A</text>
+<path d="m 0,0 h 80 v 60 h -80 z" stroke="black" fill="white"
+ class="box-style" />
+<text x="35" y="36" font-family="arial" font-size="20px"
+ class="text-style">A</text>
</g>
<g transform="translate(90.5, 10.5)">
-<path d="m 0,0 h 80 v 60 h -80 z" class="box-style" />
-<text x="35" y="36" class="text-style">B</text>
-<path d="M 0,60 c 0,30 50,40 80,30" class="np-line-style" />
-<path d="M 0,60 l -2,14 l 11,-4 z" class="np-fill-style" />
-<text x="-15" y="110" class="small-text-style">previous()</text>
+<path d="m 0,0 h 80 v 60 h -80 z" stroke="black" fill="white"
+ class="box-style" />
+<text x="35" y="36" font-family="arial" font-size="20px"
+ class="text-style">B</text>
+<path d="M 0,60 c 0,30 50,40 80,30" stroke="blue" fill="none"
+ class="np-line-style" />
+<path d="M 0,60 l -2,14 l 11,-4 z" stroke="none" fill="blue"
+ class="np-fill-style" />
+<text x="-15" y="110"
+ class="small-text-style">previous()</text>
</g>
<g transform="translate(170.5, 10.5)">
-<path d="m 0,0 h 80 v 60 h -80 z" class="box-style" />
-<text x="35" y="36" class="text-style">C</text>
-<path d="M 0,60 v 50" class="line-style" />
-<path d="M 0,60 l -5,10 l 10,0 z" class="fill-style" />
-<text x="30" y="110" class="small-text-style">next()</text>
+<path d="m 0,0 h 80 v 60 h -80 z" stroke="black" fill="white"
+ class="box-style" />
+<text x="35" y="36" font-family="arial" font-size="20px"
+ class="text-style">C</text>
+<path d="M 0,60 v 50" stroke="red"
+ class="line-style" />
+<path d="M 0,60 l -5,10 l 10,0 z" stroke="none" fill="red"
+ class="fill-style" />
+<text x="30" y="110"
+ class="small-text-style">next()</text>
</g>
<g transform="translate(250.5, 10.5)">
-<path d="m 0,0 h 80 v 60 h -80 z" class="box-style" />
-<text x="35" y="36" class="text-style">D</text>
-<path d="M 0,60 c 0,30 -50,40 -80,30" class="np-line-style" />
-<path d="M 0,60 l 2,14 l -11,-4 z" class="np-fill-style" />
+<path d="m 0,0 h 80 v 60 h -80 z" stroke="black" fill="white"
+ class="box-style" />
+<text x="35" y="36" font-family="arial" font-size="20px"
+ class="text-style">D</text>
+<path d="M 0,60 c 0,30 -50,40 -80,30" stroke="blue" fill="none"
+ class="np-line-style" />
+<path d="M 0,60 l 2,14 l -11,-4 z" stroke="none" fill="blue"
+ class="np-fill-style" />
</g>
-
</svg>
diff --git a/src/corelib/doc/images/stliterators1.svg b/src/corelib/doc/images/stliterators1.svg
new file mode 100644
index 00000000000..478211c78d7
--- /dev/null
+++ b/src/corelib/doc/images/stliterators1.svg
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ version="1.1"
+ width="420"
+ height="110"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+
+<style>
+ svg .box-style { stroke: black; fill: white }
+ svg .line-style { stroke: red; fill: none }
+ svg .text-style { font: 20px arial; fill: black }
+ svg .fill-style { stroke: none; fill: red }
+ svg .fn-text-style { font: 14px monospace; fill: black }
+
+ svg.dark .box-style { stroke: #f2f2f2; fill: black }
+ svg.dark .line-style { stroke: red; fill: none }
+ svg.dark .text-style { font: 20px arial; fill: #f2f2f2 }
+ svg.dark .fill-style { stroke: none; fill: red }
+ svg.dark .fn-text-style { font: 14px monospace; fill: #f2f2f2 }
+
+ [data-theme="dark"] svg .box-style { stroke: #f2f2f2; fill: black }
+ [data-theme="dark"] svg .line-style { stroke: red; fill: none }
+ [data-theme="dark"] svg .text-style { font: 20px arial; fill: #f2f2f2 }
+ [data-theme="dark"] svg .fill-style { stroke: none; fill: red }
+ [data-theme="dark"] svg .fn-text-style { font: 14px monospace; fill: #f2f2f2 }
+
+ [data-theme="light"] svg .box-style { stroke: black; fill: white }
+ [data-theme="light"] svg .line-style { stroke: red; fill: none }
+ [data-theme="light"] svg .text-style { font: 20px arial; fill: black }
+ [data-theme="light"] svg .fill-style { stroke: none; fill: red }
+ [data-theme="light"] svg .fn-text-style { font: 14px monospace; fill: black }
+</style>
+
+<g transform="translate(10.5, 10.5)">
+<path d="m 0,0 h 80 v 60 h -80 z" stroke="black" fill="white"
+ class="box-style" />
+<text x="35" y="36" font-family="arial" font-size="20px"
+ class="text-style">A</text>
+<path d="M 40,60 v 30" stroke="red"
+ class="line-style" />
+<path d="M 40,60 l -5,10 l 10,0 z" stroke="none" fill="red"
+ class="fill-style" />
+</g>
+
+<g transform="translate(90.5, 10.5)">
+<path d="m 0,0 h 80 v 60 h -80 z" stroke="black" fill="white"
+ class="box-style" />
+<text x="35" y="36" font-family="arial" font-size="20px"
+ class="text-style">B</text>
+<path d="M 40,60 v 30" stroke="red"
+ class="line-style" />
+<path d="M 40,60 l -5,10 l 10,0 z" stroke="none" fill="red"
+ class="fill-style" />
+</g>
+
+<g transform="translate(170.5, 10.5)">
+<path d="m 0,0 h 80 v 60 h -80 z" stroke="black" fill="white"
+ class="box-style" />
+<text x="35" y="36" font-family="arial" font-size="20px"
+ class="text-style">C</text>
+<path d="M 40,60 v 30" stroke="red"
+ class="line-style" />
+<path d="M 40,60 l -5,10 l 10,0 z" stroke="none" fill="red"
+ class="fill-style" />
+</g>
+
+<g transform="translate(250.5, 10.5)">
+<path d="m 0,0 h 80 v 60 h -80 z" stroke="black" fill="white"
+ class="box-style" />
+<text x="35" y="36" font-family="arial" font-size="20px"
+ class="text-style">D</text>
+<path d="M 40,60 v 30" stroke="red"
+ class="line-style" />
+<path d="M 40,60 l -5,10 l 10,0 z" stroke="none" fill="red"
+ class="fill-style" />
+</g>
+
+<g transform="translate(330.5, 10.5)">
+<path d="m 0,0 h 80 v 60 h -80 z" stroke="black" fill="white"
+ stroke-dasharray="3,3"
+ class="box-style" />
+<text x="20" y="36" font-family="monospace" font-size="14px"
+ class="fn-text-style">end()</text>
+<path d="M 40,60 v 30" stroke="red"
+ class="line-style" />
+<path d="M 40,60 l -5,10 l 10,0 z" stroke="none" fill="red"
+ class="fill-style" />
+</g>
+</svg>
diff --git a/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc b/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc
index 42cb3ecb42b..7cd3f91b901 100644
--- a/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc
+++ b/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc
@@ -142,6 +142,10 @@ effectively disables release package signing even in Release or RelWithDebInfo
builds. When not set, the default behavior is to use release package signing in
build types other than Debug.
+This variable is not supposed to be set in CMake project files. Rather set it
+when configuring your project on the command line or in the CMake settings of
+your IDE.
+
\sa {androiddeployqt}
*/
@@ -521,7 +525,6 @@ To prevent this, set \c QT_NO_SET_XCODE_BUNDLE_IDENTIFIER to \c TRUE.
\summary {Enables verbose mode of deployment tools.}
\cmakevariablesince 6.3
-\preliminarycmakevariable
Enables verbose mode of the \l androiddeployqt deployment tool when it is called
internally at build time, usually during target finalization.
@@ -541,7 +544,6 @@ must be set before the first \c{find_package(Qt6)} call to have that effect.
\summary {Name of the file to include for setting up deployment support.}
\cmakevariablesince 6.3
-\preliminarycmakevariable
\note The value of this variable should never be modified by project code.
This configure-phase variable is set by the Core package. It is intended to be
diff --git a/src/corelib/doc/src/cmake/cmake-properties.qdoc b/src/corelib/doc/src/cmake/cmake-properties.qdoc
index 821862494a2..c7b1a27a4b4 100644
--- a/src/corelib/doc/src/cmake/cmake-properties.qdoc
+++ b/src/corelib/doc/src/cmake/cmake-properties.qdoc
@@ -665,7 +665,6 @@ UTF-8 input). Use the \l QT_NO_CAST_FROM_ASCII and
\summary {Specifies the default Qt resource prefix.}
\cmakepropertysince 6.0
-\preliminarycmakeproperty
When using \l{qt6_add_resources}{qt_add_resources} without a \c PREFIX
argument, then the value of this target property will be used as
@@ -773,7 +772,6 @@ CMake properties:
\brief Sets the FOLDER property for Qt-internal targets.
\cmakepropertysince 6.5
-\preliminarycmakeproperty
Name of the \l FOLDER for internal targets that are added by Qt's CMake
commands.
diff --git a/src/corelib/doc/src/cmake/qt_deploy_translations.qdoc b/src/corelib/doc/src/cmake/qt_deploy_translations.qdoc
index 43ff23a35a1..e6d3edbbdc4 100644
--- a/src/corelib/doc/src/cmake/qt_deploy_translations.qdoc
+++ b/src/corelib/doc/src/cmake/qt_deploy_translations.qdoc
@@ -17,7 +17,6 @@ can only be called from a deployment script. It cannot be called directly by the
project during the configure stage.
\cmakecommandsince 6.5
-\preliminarycmakecommand
\note This command does not usually need to be called directly. It is used
internally by other higher level commands, but projects wishing to
implement more customized deployment logic may find it useful.
diff --git a/src/corelib/doc/src/cmake/qt_extract_metatypes.qdoc b/src/corelib/doc/src/cmake/qt_extract_metatypes.qdoc
index 7ec8d90f9b1..24112b1cf87 100644
--- a/src/corelib/doc/src/cmake/qt_extract_metatypes.qdoc
+++ b/src/corelib/doc/src/cmake/qt_extract_metatypes.qdoc
@@ -11,7 +11,6 @@
\summary {Extracts metatypes from a Qt target and generates an associated metatypes.json file.}
\cmakecommandsince 6.0
-\preliminarycmakecommand
\section1 Synopsis
diff --git a/src/corelib/doc/src/cmake/qt_finalize_project.qdoc b/src/corelib/doc/src/cmake/qt_finalize_project.qdoc
index 5506712691e..f60b850fcdb 100644
--- a/src/corelib/doc/src/cmake/qt_finalize_project.qdoc
+++ b/src/corelib/doc/src/cmake/qt_finalize_project.qdoc
@@ -9,7 +9,6 @@
\keyword qt6_finalize_project
\summary {Handles various common platform-specific tasks associated with a Qt project.}
-\preliminarycmakecommand
\include cmake-find-package-core.qdocinc
diff --git a/src/corelib/doc/src/containers.qdoc b/src/corelib/doc/src/containers.qdoc
index 874ab807609..38ce2188e13 100644
--- a/src/corelib/doc/src/containers.qdoc
+++ b/src/corelib/doc/src/containers.qdoc
@@ -275,7 +275,7 @@
The diagram below shows the valid iterator positions as red
arrows for a list containing four items:
- \image stliterators1.png
+ \image stliterators1.svg STL-style iterators point to items
Iterating backward with an STL-style iterator is done with reverse iterators:
diff --git a/src/corelib/doc/src/external-resources.qdoc b/src/corelib/doc/src/external-resources.qdoc
index 2232b49bf23..5d357c65496 100644
--- a/src/corelib/doc/src/external-resources.qdoc
+++ b/src/corelib/doc/src/external-resources.qdoc
@@ -28,11 +28,6 @@
*/
/*!
- \externalpage https://marcmutz.wordpress.com/effective-qt/containers/#containers-qlist
- \title Pros and Cons of Using QList
-*/
-
-/*!
\externalpage https://marcmutz.wordpress.com/effective-qt/containers/
\title Understand the Qt Containers
*/
diff --git a/src/corelib/doc/src/java-style-iterators.qdoc b/src/corelib/doc/src/java-style-iterators.qdoc
index a0e5c53d633..fc1378bb718 100644
--- a/src/corelib/doc/src/java-style-iterators.qdoc
+++ b/src/corelib/doc/src/java-style-iterators.qdoc
@@ -70,7 +70,7 @@
\l{QListIterator::next()}{next()} and
\l{QListIterator::previous()}{previous()} on an iterator:
- \image javaiterators2.png Iterating to the next and previous items
+ \image javaiterators2.svg Iterating to the next and previous items
The following table summarizes the QListIterator API:
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 0b42af7686c..b2d79cca603 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1404,7 +1404,7 @@ static_assert(!std::is_convertible_v<std::nullptr_t, bool>,
#if defined(__cplusplus)
#ifdef __cpp_constinit
-# if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
+# if defined(Q_CC_MSVC) && _MSC_VER < 1940 && !defined(Q_CC_CLANG)
// https://developercommunity.visualstudio.com/t/C:-constinit-for-an-optional-fails-if-/1406069
# define Q_CONSTINIT
# else
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index 0771c15584b..d3c398f0860 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -249,6 +249,12 @@ bool QFSFileEngine::open(QIODevice::OpenMode openMode, FILE *fh, QFile::FileHand
}
/*!
+ \class QFSFileEnginePrivate
+ \inmodule QtCore
+ \internal
+*/
+
+/*!
Opens the file handle \a fh using the open mode \a flags.
*/
bool QFSFileEnginePrivate::openFh(QIODevice::OpenMode openMode, FILE *fh)
diff --git a/src/corelib/io/qiooperation_p.h b/src/corelib/io/qiooperation_p.h
index 56845167ede..1486719a7e8 100644
--- a/src/corelib/io/qiooperation_p.h
+++ b/src/corelib/io/qiooperation_p.h
@@ -72,6 +72,9 @@ protected:
Q_DECLARE_PRIVATE(QIOOperation)
friend class QRandomAccessAsyncFilePrivate;
+ friend class QRandomAccessAsyncFileBackend;
+ friend class QRandomAccessAsyncFileNativeBackend;
+ friend class QRandomAccessAsyncFileThreadPoolBackend;
};
class Q_CORE_EXPORT QIOReadWriteOperationBase : public QIOOperation
@@ -86,6 +89,11 @@ protected:
QIOReadWriteOperationBase() = delete;
Q_DISABLE_COPY_MOVE(QIOReadWriteOperationBase)
explicit QIOReadWriteOperationBase(QIOOperationPrivate &dd, QObject *parent = nullptr);
+
+ friend class QRandomAccessAsyncFilePrivate;
+ friend class QRandomAccessAsyncFileBackend;
+ friend class QRandomAccessAsyncFileNativeBackend;
+ friend class QRandomAccessAsyncFileThreadPoolBackend;
};
class Q_CORE_EXPORT QIOReadOperation : public QIOReadWriteOperationBase
@@ -101,6 +109,9 @@ protected:
explicit QIOReadOperation(QIOOperationPrivate &dd, QObject *parent = nullptr);
friend class QRandomAccessAsyncFilePrivate;
+ friend class QRandomAccessAsyncFileBackend;
+ friend class QRandomAccessAsyncFileNativeBackend;
+ friend class QRandomAccessAsyncFileThreadPoolBackend;
};
class Q_CORE_EXPORT QIOWriteOperation : public QIOReadWriteOperationBase
@@ -116,6 +127,9 @@ protected:
explicit QIOWriteOperation(QIOOperationPrivate &dd, QObject *parent = nullptr);
friend class QRandomAccessAsyncFilePrivate;
+ friend class QRandomAccessAsyncFileBackend;
+ friend class QRandomAccessAsyncFileNativeBackend;
+ friend class QRandomAccessAsyncFileThreadPoolBackend;
};
class Q_CORE_EXPORT QIOVectoredReadOperation : public QIOReadWriteOperationBase
@@ -131,6 +145,9 @@ protected:
explicit QIOVectoredReadOperation(QIOOperationPrivate &dd, QObject *parent = nullptr);
friend class QRandomAccessAsyncFilePrivate;
+ friend class QRandomAccessAsyncFileBackend;
+ friend class QRandomAccessAsyncFileNativeBackend;
+ friend class QRandomAccessAsyncFileThreadPoolBackend;
};
class Q_CORE_EXPORT QIOVectoredWriteOperation : public QIOReadWriteOperationBase
@@ -146,6 +163,9 @@ protected:
explicit QIOVectoredWriteOperation(QIOOperationPrivate &dd, QObject *parent = nullptr);
friend class QRandomAccessAsyncFilePrivate;
+ friend class QRandomAccessAsyncFileBackend;
+ friend class QRandomAccessAsyncFileNativeBackend;
+ friend class QRandomAccessAsyncFileThreadPoolBackend;
};
QT_END_NAMESPACE
diff --git a/src/corelib/io/qioring_p.h b/src/corelib/io/qioring_p.h
index 0db832bc6bf..8fdaf48f8f6 100644
--- a/src/corelib/io/qioring_p.h
+++ b/src/corelib/io/qioring_p.h
@@ -91,6 +91,10 @@ enum class Operation : quint8 {
// clang-format on
Q_ENUM_NS(Operation);
#undef DEFINE_ENTRY
+
+#ifdef Q_OS_WIN
+struct IORingApiTable;
+#endif
}; // namespace QtPrivate
template <QtPrivate::Operation Op>
@@ -221,9 +225,11 @@ private:
std::optional<QWinEventNotifier> notifier;
HIORING ioRingHandle = nullptr;
HANDLE eventHandle = INVALID_HANDLE_VALUE;
+ const QtPrivate::IORingApiTable *apiTable;
bool initialized = false;
bool queueWasFull = false;
+
[[nodiscard]]
RequestPrepResult prepareRequest(GenericRequestType &request);
QIORing::ReadWriteStatus handleReadCompletion(
diff --git a/src/corelib/io/qioring_win.cpp b/src/corelib/io/qioring_win.cpp
index 42c51f428d6..b2f188486d0 100644
--- a/src/corelib/io/qioring_win.cpp
+++ b/src/corelib/io/qioring_win.cpp
@@ -24,6 +24,59 @@ static_assert(sizeof(qsizetype) > sizeof(UINT32),
using namespace Qt::StringLiterals;
+namespace QtPrivate {
+#define FOREACH_WIN_IORING_FUNCTION(Fn) \
+ Fn(BuildIoRingReadFile) \
+ Fn(BuildIoRingWriteFile) \
+ Fn(BuildIoRingFlushFile) \
+ Fn(BuildIoRingCancelRequest) \
+ Fn(QueryIoRingCapabilities) \
+ Fn(CreateIoRing) \
+ Fn(GetIoRingInfo) \
+ Fn(SubmitIoRing) \
+ Fn(CloseIoRing) \
+ Fn(PopIoRingCompletion) \
+ Fn(SetIoRingCompletionEvent) \
+ /**/
+struct IORingApiTable
+{
+#define DefineIORingFunction(Name) \
+ using Name##Fn = decltype(&::Name); \
+ Name##Fn Name = nullptr;
+
+ FOREACH_WIN_IORING_FUNCTION(DefineIORingFunction)
+
+#undef DefineIORingFunction
+};
+
+static const IORingApiTable *getApiTable()
+{
+ static const IORingApiTable apiTable = []() {
+ IORingApiTable apiTable;
+ const HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
+ if (Q_UNLIKELY(!kernel32)) // how would this happen
+ return apiTable;
+
+#define ResolveFunction(Name) \
+ apiTable.Name = IORingApiTable::Name##Fn(QFunctionPointer(GetProcAddress(kernel32, #Name)));
+
+ FOREACH_WIN_IORING_FUNCTION(ResolveFunction)
+
+#undef ResolveFunction
+ return apiTable;
+ }();
+
+#define TEST_TABLE_OK(X) \
+ apiTable.X && /* chain */
+#define BOOL_CHAIN(...) (__VA_ARGS__ true)
+ const bool success = BOOL_CHAIN(FOREACH_WIN_IORING_FUNCTION(TEST_TABLE_OK));
+#undef BOOL_CHAIN
+#undef TEST_TABLE_OK
+
+ return success ? std::addressof(apiTable) : nullptr;
+}
+} // namespace QtPrivate
+
static HRESULT buildReadOperation(HIORING ioRingHandle, qintptr fd, QSpan<std::byte> destination,
quint64 offset, quintptr userData)
{
@@ -32,8 +85,10 @@ static HRESULT buildReadOperation(HIORING ioRingHandle, qintptr fd, QSpan<std::b
const IORING_BUFFER_REF bufferRef(destination.data());
const auto maxSize = q26::saturate_cast<UINT32>(destination.size());
Q_ASSERT(maxSize == destination.size());
- return BuildIoRingReadFile(ioRingHandle, fileRef, bufferRef, maxSize, offset, userData,
- IOSQE_FLAGS_NONE);
+ const auto *apiTable = QtPrivate::getApiTable();
+ Q_ASSERT(apiTable); // If we got this far it needs to be here
+ return apiTable->BuildIoRingReadFile(ioRingHandle, fileRef, bufferRef, maxSize, offset,
+ userData, IOSQE_FLAGS_NONE);
}
static HRESULT buildWriteOperation(HIORING ioRingHandle, qintptr fd, QSpan<const std::byte> source,
@@ -44,16 +99,18 @@ static HRESULT buildWriteOperation(HIORING ioRingHandle, qintptr fd, QSpan<const
const IORING_BUFFER_REF bufferRef(const_cast<std::byte *>(source.data()));
const auto maxSize = q26::saturate_cast<UINT32>(source.size());
Q_ASSERT(maxSize == source.size());
+ const auto *apiTable = QtPrivate::getApiTable();
+ Q_ASSERT(apiTable); // If we got this far it needs to be here
// @todo: FILE_WRITE_FLAGS can be set to write-through, could be used for Unbuffered mode.
- return BuildIoRingWriteFile(ioRingHandle, fileRef, bufferRef, maxSize, offset,
- FILE_WRITE_FLAGS_NONE, userData, IOSQE_FLAGS_NONE);
+ return apiTable->BuildIoRingWriteFile(ioRingHandle, fileRef, bufferRef, maxSize, offset,
+ FILE_WRITE_FLAGS_NONE, userData, IOSQE_FLAGS_NONE);
}
QIORing::~QIORing()
{
if (initialized) {
CloseHandle(eventHandle);
- CloseIoRing(ioRingHandle);
+ apiTable->CloseIoRing(ioRingHandle);
}
}
@@ -62,8 +119,13 @@ bool QIORing::initializeIORing()
if (initialized)
return true;
+ if (apiTable = QtPrivate::getApiTable(); !apiTable) {
+ qCWarning(lcQIORing, "Failed to retrieve API table");
+ return false;
+ }
+
IORING_CAPABILITIES capabilities;
- QueryIoRingCapabilities(&capabilities);
+ apiTable->QueryIoRingCapabilities(&capabilities);
if (capabilities.MaxVersion < IORING_VERSION_3) // 3 adds write, flush and drain
return false;
if ((capabilities.FeatureFlags & IORING_FEATURE_SET_COMPLETION_EVENT) == 0)
@@ -75,7 +137,8 @@ bool QIORing::initializeIORing()
IORING_CREATE_FLAGS flags;
memset(&flags, 0, sizeof(flags));
- HRESULT hr = CreateIoRing(IORING_VERSION_3, flags, sqEntries, cqEntries, &ioRingHandle);
+ HRESULT hr = apiTable->CreateIoRing(IORING_VERSION_3, flags, sqEntries, cqEntries,
+ &ioRingHandle);
if (FAILED(hr)) {
qErrnoWarning(hr, "failed to initialize QIORing");
return false;
@@ -83,7 +146,7 @@ bool QIORing::initializeIORing()
auto earlyExitCleanup = qScopeGuard([this]() {
if (eventHandle != INVALID_HANDLE_VALUE)
CloseHandle(eventHandle);
- CloseIoRing(ioRingHandle);
+ apiTable->CloseIoRing(ioRingHandle);
});
eventHandle = CreateEvent(nullptr, TRUE, FALSE, nullptr);
if (eventHandle == INVALID_HANDLE_VALUE) {
@@ -91,13 +154,13 @@ bool QIORing::initializeIORing()
return false;
}
notifier.emplace(eventHandle);
- hr = SetIoRingCompletionEvent(ioRingHandle, eventHandle);
+ hr = apiTable->SetIoRingCompletionEvent(ioRingHandle, eventHandle);
if (FAILED(hr)) {
qErrnoWarning(hr, "Failed to assign the event handle to QIORing");
return false;
}
IORING_INFO info;
- if (SUCCEEDED(GetIoRingInfo(ioRingHandle, &info))) {
+ if (SUCCEEDED(apiTable->GetIoRingInfo(ioRingHandle, &info))) {
sqEntries = info.SubmissionQueueSize;
cqEntries = info.CompletionQueueSize;
qCDebug(lcQIORing) << "QIORing configured with capacity for" << sqEntries
@@ -274,7 +337,7 @@ void QIORing::completionReady()
{
ResetEvent(eventHandle);
IORING_CQE entry;
- while (PopIoRingCompletion(ioRingHandle, &entry) == S_OK) {
+ while (apiTable->PopIoRingCompletion(ioRingHandle, &entry) == S_OK) {
// NOLINTNEXTLINE(performance-no-int-to-ptr)
auto *request = reinterpret_cast<GenericRequestType *>(entry.UserData);
if (!addrItMap.contains(request)) {
@@ -458,7 +521,8 @@ void QIORing::submitRequests()
const bool shouldTryWait = std::exchange(queueWasFull, false);
const auto submitToRing = [this, &shouldTryWait] {
quint32 submittedEntries = 0;
- HRESULT hr = SubmitIoRing(ioRingHandle, shouldTryWait ? 1 : 0, 1, &submittedEntries);
+ HRESULT hr = apiTable->SubmitIoRing(ioRingHandle, shouldTryWait ? 1 : 0, 1,
+ &submittedEntries);
qCDebug(lcQIORing) << "Submitted" << submittedEntries << "requests";
unstagedRequests -= submittedEntries;
if (FAILED(hr)) {
@@ -558,9 +622,9 @@ auto QIORing::prepareRequest(GenericRequestType &request) -> RequestPrepResult
auto *closeRequest = request.requestData<Operation::Close>();
// NOLINTNEXTLINE(performance-no-int-to-ptr)
const IORING_HANDLE_REF fileRef(HANDLE(closeRequest->fd));
- hr = BuildIoRingFlushFile(ioRingHandle, fileRef, FILE_FLUSH_MIN_METADATA,
- quintptr(std::addressof(request)),
- IOSQE_FLAGS_DRAIN_PRECEDING_OPS);
+ hr = apiTable->BuildIoRingFlushFile(ioRingHandle, fileRef, FILE_FLUSH_MIN_METADATA,
+ quintptr(std::addressof(request)),
+ IOSQE_FLAGS_DRAIN_PRECEDING_OPS);
break;
}
case Operation::Read: {
@@ -645,9 +709,9 @@ auto QIORing::prepareRequest(GenericRequestType &request) -> RequestPrepResult
auto *flushRequest = request.requestData<Operation::Flush>();
// NOLINTNEXTLINE(performance-no-int-to-ptr)
const IORING_HANDLE_REF fileRef(HANDLE(flushRequest->fd));
- hr = BuildIoRingFlushFile(ioRingHandle, fileRef, FILE_FLUSH_DEFAULT,
- quintptr(std::addressof(request)),
- IOSQE_FLAGS_DRAIN_PRECEDING_OPS);
+ hr = apiTable->BuildIoRingFlushFile(ioRingHandle, fileRef, FILE_FLUSH_DEFAULT,
+ quintptr(std::addressof(request)),
+ IOSQE_FLAGS_DRAIN_PRECEDING_OPS);
break;
}
case QtPrivate::Operation::Stat: {
@@ -703,8 +767,8 @@ auto QIORing::prepareRequest(GenericRequestType &request) -> RequestPrepResult
}
// NOLINTNEXTLINE(performance-no-int-to-ptr)
const IORING_HANDLE_REF fileRef((HANDLE(fd)));
- hr = BuildIoRingCancelRequest(ioRingHandle, fileRef, quintptr(otherOperation),
- quintptr(std::addressof(request)));
+ hr = apiTable->BuildIoRingCancelRequest(ioRingHandle, fileRef, quintptr(otherOperation),
+ quintptr(std::addressof(request)));
break;
}
case Operation::NumOperations:
diff --git a/src/corelib/io/qrandomaccessasyncfile.cpp b/src/corelib/io/qrandomaccessasyncfile.cpp
index c544585de9d..34e216efe27 100644
--- a/src/corelib/io/qrandomaccessasyncfile.cpp
+++ b/src/corelib/io/qrandomaccessasyncfile.cpp
@@ -7,6 +7,31 @@
QT_BEGIN_NAMESPACE
+QRandomAccessAsyncFileBackend::QRandomAccessAsyncFileBackend(QRandomAccessAsyncFile *owner)
+ : m_owner(owner)
+{
+}
+QRandomAccessAsyncFileBackend::~QRandomAccessAsyncFileBackend() = default;
+QRandomAccessAsyncFilePrivate::QRandomAccessAsyncFilePrivate() = default;
+QRandomAccessAsyncFilePrivate::~QRandomAccessAsyncFilePrivate() = default;
+
+void QRandomAccessAsyncFilePrivate::init()
+{
+ Q_Q(QRandomAccessAsyncFile);
+
+#if defined(QT_RANDOMACCESSASYNCFILE_QIORING) || defined(Q_OS_DARWIN)
+ m_backend = std::make_unique<QRandomAccessAsyncFileNativeBackend>(q);
+#endif
+ if (!m_backend || !m_backend->init()) {
+#if QT_CONFIG(thread) && QT_CONFIG(future)
+ m_backend = std::make_unique<QRandomAccessAsyncFileThreadPoolBackend>(q);
+ [[maybe_unused]]
+ bool result = m_backend->init();
+ Q_ASSERT(result); // it always succeeds
+#endif
+ }
+}
+
QRandomAccessAsyncFile::QRandomAccessAsyncFile(QObject *parent)
: QObject{*new QRandomAccessAsyncFilePrivate, parent}
{
diff --git a/src/corelib/io/qrandomaccessasyncfile_darwin.mm b/src/corelib/io/qrandomaccessasyncfile_darwin.mm
index 7231d12fe7d..80c1affa642 100644
--- a/src/corelib/io/qrandomaccessasyncfile_darwin.mm
+++ b/src/corelib/io/qrandomaccessasyncfile_darwin.mm
@@ -27,14 +27,14 @@ static bool isBarrierOperation(QIOOperation::Type type)
// only!
template <typename Operation, typename ...Args>
Operation *
-QRandomAccessAsyncFilePrivate::addOperation(QIOOperation::Type type, qint64 offset, Args &&...args)
+QRandomAccessAsyncFileNativeBackend::addOperation(QIOOperation::Type type, qint64 offset, Args &&...args)
{
auto dataStorage = new QtPrivate::QIOOperationDataStorage(std::forward<Args>(args)...);
auto *priv = new QIOOperationPrivate(dataStorage);
priv->offset = offset;
priv->type = type;
- Operation *op = new Operation(*priv, q_ptr);
+ Operation *op = new Operation(*priv, m_owner);
auto opId = getNextId();
m_operations.push_back(OperationInfo(opId, op));
startOperationsUntilBarrier();
@@ -42,19 +42,20 @@ QRandomAccessAsyncFilePrivate::addOperation(QIOOperation::Type type, qint64 offs
return op;
}
-QRandomAccessAsyncFilePrivate::QRandomAccessAsyncFilePrivate()
- : QObjectPrivate()
+QRandomAccessAsyncFileNativeBackend::QRandomAccessAsyncFileNativeBackend(QRandomAccessAsyncFile *owner)
+ : QRandomAccessAsyncFileBackend(owner)
{
}
-QRandomAccessAsyncFilePrivate::~QRandomAccessAsyncFilePrivate()
+QRandomAccessAsyncFileNativeBackend::~QRandomAccessAsyncFileNativeBackend()
= default;
-void QRandomAccessAsyncFilePrivate::init()
+bool QRandomAccessAsyncFileNativeBackend::init()
{
+ return true;
}
-void QRandomAccessAsyncFilePrivate::cancelAndWait(QIOOperation *op)
+void QRandomAccessAsyncFileNativeBackend::cancelAndWait(QIOOperation *op)
{
auto it = std::find_if(m_operations.cbegin(), m_operations.cend(),
[op](const auto &opInfo) {
@@ -87,7 +88,7 @@ void QRandomAccessAsyncFilePrivate::cancelAndWait(QIOOperation *op)
startOperationsUntilBarrier();
}
-void QRandomAccessAsyncFilePrivate::close()
+void QRandomAccessAsyncFileNativeBackend::close()
{
if (m_fileState == FileState::Closed)
return;
@@ -95,10 +96,8 @@ void QRandomAccessAsyncFilePrivate::close()
// cancel all operations
m_mutex.lock();
m_opToCancel = kAllOperationIds;
- m_numChannelsToClose = m_ioChannel ? 1 : 0;
for (const auto &op : m_operations) {
if (op.channel) {
- ++m_numChannelsToClose;
closeIoChannel(op.channel);
}
}
@@ -127,7 +126,7 @@ void QRandomAccessAsyncFilePrivate::close()
m_fileState = FileState::Closed;
}
-qint64 QRandomAccessAsyncFilePrivate::size() const
+qint64 QRandomAccessAsyncFileNativeBackend::size() const
{
if (m_fileState != FileState::Opened)
return -1;
@@ -140,7 +139,7 @@ qint64 QRandomAccessAsyncFilePrivate::size() const
}
QIOOperation *
-QRandomAccessAsyncFilePrivate::open(const QString &path, QIODeviceBase::OpenMode mode)
+QRandomAccessAsyncFileNativeBackend::open(const QString &path, QIODeviceBase::OpenMode mode)
{
if (m_fileState == FileState::Closed) {
m_filePath = path;
@@ -153,44 +152,44 @@ QRandomAccessAsyncFilePrivate::open(const QString &path, QIODeviceBase::OpenMode
return addOperation<QIOOperation>(QIOOperation::Type::Open, 0);
}
-QIOOperation *QRandomAccessAsyncFilePrivate::flush()
+QIOOperation *QRandomAccessAsyncFileNativeBackend::flush()
{
return addOperation<QIOOperation>(QIOOperation::Type::Flush, 0);
}
-QIOReadOperation *QRandomAccessAsyncFilePrivate::read(qint64 offset, qint64 maxSize)
+QIOReadOperation *QRandomAccessAsyncFileNativeBackend::read(qint64 offset, qint64 maxSize)
{
QByteArray array(maxSize, Qt::Uninitialized);
return addOperation<QIOReadOperation>(QIOOperation::Type::Read, offset, std::move(array));
}
-QIOWriteOperation *QRandomAccessAsyncFilePrivate::write(qint64 offset, const QByteArray &data)
+QIOWriteOperation *QRandomAccessAsyncFileNativeBackend::write(qint64 offset, const QByteArray &data)
{
QByteArray copy = data;
return write(offset, std::move(copy));
}
-QIOWriteOperation *QRandomAccessAsyncFilePrivate::write(qint64 offset, QByteArray &&data)
+QIOWriteOperation *QRandomAccessAsyncFileNativeBackend::write(qint64 offset, QByteArray &&data)
{
return addOperation<QIOWriteOperation>(QIOOperation::Type::Write, offset, std::move(data));
}
QIOVectoredReadOperation *
-QRandomAccessAsyncFilePrivate::readInto(qint64 offset, QSpan<std::byte> buffer)
+QRandomAccessAsyncFileNativeBackend::readInto(qint64 offset, QSpan<std::byte> buffer)
{
return addOperation<QIOVectoredReadOperation>(QIOOperation::Type::Read, offset,
QSpan<const QSpan<std::byte>>{buffer});
}
QIOVectoredWriteOperation *
-QRandomAccessAsyncFilePrivate::writeFrom(qint64 offset, QSpan<const std::byte> buffer)
+QRandomAccessAsyncFileNativeBackend::writeFrom(qint64 offset, QSpan<const std::byte> buffer)
{
return addOperation<QIOVectoredWriteOperation>(QIOOperation::Type::Write, offset,
QSpan<const QSpan<const std::byte>>{buffer});
}
QIOVectoredReadOperation *
-QRandomAccessAsyncFilePrivate::readInto(qint64 offset, QSpan<const QSpan<std::byte>> buffers)
+QRandomAccessAsyncFileNativeBackend::readInto(qint64 offset, QSpan<const QSpan<std::byte>> buffers)
{
// GCD implementation does not have vectored read. Spawning several read
// operations (each with an updated offset), is not ideal, because some
@@ -204,32 +203,40 @@ QRandomAccessAsyncFilePrivate::readInto(qint64 offset, QSpan<const QSpan<std::by
}
QIOVectoredWriteOperation *
-QRandomAccessAsyncFilePrivate::writeFrom(qint64 offset, QSpan<const QSpan<const std::byte>> buffers)
+QRandomAccessAsyncFileNativeBackend::writeFrom(qint64 offset, QSpan<const QSpan<const std::byte>> buffers)
{
return addOperation<QIOVectoredWriteOperation>(QIOOperation::Type::Write, offset, buffers);
}
-void QRandomAccessAsyncFilePrivate::notifyIfOperationsAreCompleted()
+void QRandomAccessAsyncFileNativeBackend::notifyIfOperationsAreCompleted()
{
QMutexLocker locker(&m_mutex);
+ --m_numChannelsToClose;
if (m_opToCancel == kAllOperationIds) {
- --m_numChannelsToClose;
if (m_numChannelsToClose == 0 && m_runningOps.isEmpty())
m_cancellationCondition.wakeOne();
}
}
-dispatch_io_t QRandomAccessAsyncFilePrivate::createMainChannel(int fd)
+dispatch_io_t QRandomAccessAsyncFileNativeBackend::createMainChannel(int fd)
{
auto sharedThis = this;
- return dispatch_io_create(DISPATCH_IO_RANDOM, fd,
- dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0),
- ^(int /*error*/) {
- sharedThis->notifyIfOperationsAreCompleted();
- });
+ auto channel =
+ dispatch_io_create(DISPATCH_IO_RANDOM, fd,
+ dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0),
+ ^(int /*error*/) {
+ // main I/O channel uses kInvalidOperationId
+ // as its identifier
+ sharedThis->notifyIfOperationsAreCompleted();
+ });
+ if (channel) {
+ QMutexLocker locker(&m_mutex);
+ ++m_numChannelsToClose;
+ }
+ return channel;
}
-dispatch_io_t QRandomAccessAsyncFilePrivate::duplicateIoChannel(OperationId opId)
+dispatch_io_t QRandomAccessAsyncFileNativeBackend::duplicateIoChannel(OperationId opId)
{
if (!m_ioChannel)
return nullptr;
@@ -247,17 +254,18 @@ dispatch_io_t QRandomAccessAsyncFilePrivate::duplicateIoChannel(OperationId opId
if (channel) {
QMutexLocker locker(&m_mutex);
m_runningOps.insert(opId);
+ ++m_numChannelsToClose;
}
return channel;
}
-void QRandomAccessAsyncFilePrivate::closeIoChannel(dispatch_io_t channel)
+void QRandomAccessAsyncFileNativeBackend::closeIoChannel(dispatch_io_t channel)
{
if (channel)
dispatch_io_close(channel, DISPATCH_IO_STOP);
}
-void QRandomAccessAsyncFilePrivate::releaseIoChannel(dispatch_io_t channel)
+void QRandomAccessAsyncFileNativeBackend::releaseIoChannel(dispatch_io_t channel)
{
if (channel) {
dispatch_release(channel);
@@ -265,7 +273,7 @@ void QRandomAccessAsyncFilePrivate::releaseIoChannel(dispatch_io_t channel)
}
}
-void QRandomAccessAsyncFilePrivate::handleOperationComplete(const OperationResult &opResult)
+void QRandomAccessAsyncFileNativeBackend::handleOperationComplete(const OperationResult &opResult)
{
// try to start next operations on return
auto onReturn = qScopeGuard([this] {
@@ -372,15 +380,15 @@ void QRandomAccessAsyncFilePrivate::handleOperationComplete(const OperationResul
}
}
-void QRandomAccessAsyncFilePrivate::queueCompletion(OperationId opId, int error)
+void QRandomAccessAsyncFileNativeBackend::queueCompletion(OperationId opId, int error)
{
const OperationResult res = { opId, 0LL, error };
- QMetaObject::invokeMethod(q_ptr, [this, res] {
+ QMetaObject::invokeMethod(m_owner, [this, res] {
handleOperationComplete(res);
}, Qt::QueuedConnection);
}
-void QRandomAccessAsyncFilePrivate::startOperationsUntilBarrier()
+void QRandomAccessAsyncFileNativeBackend::startOperationsUntilBarrier()
{
// starts all operations until barrier, or a barrier operation if it's the
// first one
@@ -414,7 +422,7 @@ void QRandomAccessAsyncFilePrivate::startOperationsUntilBarrier()
}
}
-void QRandomAccessAsyncFilePrivate::executeRead(OperationInfo &opInfo)
+void QRandomAccessAsyncFileNativeBackend::executeRead(OperationInfo &opInfo)
{
opInfo.channel = duplicateIoChannel(opInfo.opId);
if (!opInfo.channel) {
@@ -445,7 +453,7 @@ void QRandomAccessAsyncFilePrivate::executeRead(OperationInfo &opInfo)
}
}
-void QRandomAccessAsyncFilePrivate::executeWrite(OperationInfo &opInfo)
+void QRandomAccessAsyncFileNativeBackend::executeWrite(OperationInfo &opInfo)
{
opInfo.channel = duplicateIoChannel(opInfo.opId);
if (!opInfo.channel) {
@@ -494,7 +502,7 @@ void QRandomAccessAsyncFilePrivate::executeWrite(OperationInfo &opInfo)
}
}
-void QRandomAccessAsyncFilePrivate::executeFlush(OperationInfo &opInfo)
+void QRandomAccessAsyncFileNativeBackend::executeFlush(OperationInfo &opInfo)
{
opInfo.channel = duplicateIoChannel(opInfo.opId);
if (!opInfo.channel) {
@@ -523,7 +531,7 @@ void QRandomAccessAsyncFilePrivate::executeFlush(OperationInfo &opInfo)
}
}
} else {
- auto context = sharedThis->q_ptr;
+ auto context = sharedThis->m_owner;
const OperationResult res = { opId, 0LL, err };
QMetaObject::invokeMethod(context, [sharedThis](const OperationResult &r) {
sharedThis->handleOperationComplete(r);
@@ -555,7 +563,7 @@ static inline int openModeToOpenFlags(QIODevice::OpenMode mode)
return oflags;
}
-void QRandomAccessAsyncFilePrivate::executeOpen(OperationInfo &opInfo)
+void QRandomAccessAsyncFileNativeBackend::executeOpen(OperationInfo &opInfo)
{
if (m_fileState != FileState::OpenPending) {
queueCompletion(opInfo.opId, EINVAL);
@@ -593,9 +601,10 @@ void QRandomAccessAsyncFilePrivate::executeOpen(OperationInfo &opInfo)
// So we need to notify the condition variable in
// both cases.
Q_ASSERT(sharedThis->m_runningOps.isEmpty());
+ Q_ASSERT(sharedThis->m_numChannelsToClose == 0);
sharedThis->m_cancellationCondition.wakeOne();
} else {
- auto context = sharedThis->q_ptr;
+ auto context = sharedThis->m_owner;
const OperationResult res = { opId, qint64(fd), err };
QMetaObject::invokeMethod(context,
[sharedThis](const OperationResult &r) {
@@ -605,7 +614,7 @@ void QRandomAccessAsyncFilePrivate::executeOpen(OperationInfo &opInfo)
});
}
-void QRandomAccessAsyncFilePrivate::readOneBuffer(OperationId opId, qsizetype bufferIdx,
+void QRandomAccessAsyncFileNativeBackend::readOneBuffer(OperationId opId, qsizetype bufferIdx,
qint64 alreadyRead)
{
// we need to lookup the operation again, because it could have beed removed
@@ -642,7 +651,7 @@ void QRandomAccessAsyncFilePrivate::readOneBuffer(OperationId opId, qsizetype bu
readBuffers.size(), alreadyRead);
}
-void QRandomAccessAsyncFilePrivate::readOneBufferHelper(OperationId opId, dispatch_io_t channel,
+void QRandomAccessAsyncFileNativeBackend::readOneBufferHelper(OperationId opId, dispatch_io_t channel,
qint64 offset, void *bytesPtr,
qint64 maxSize, qsizetype currentBufferIdx,
qsizetype totalBuffers, qint64 alreadyRead)
@@ -690,7 +699,7 @@ void QRandomAccessAsyncFilePrivate::readOneBufferHelper(OperationId opId, dispat
}
} else {
sharedThis->m_runningOps.remove(opId);
- auto context = sharedThis->q_ptr;
+ auto context = sharedThis->m_owner;
// if error, or last buffer, or read less than expected,
// report operation completion
qint64 totalRead = qint64(readFromBuffer) + alreadyRead;
@@ -713,7 +722,7 @@ void QRandomAccessAsyncFilePrivate::readOneBufferHelper(OperationId opId, dispat
});
}
-void QRandomAccessAsyncFilePrivate::writeHelper(OperationId opId, dispatch_io_t channel,
+void QRandomAccessAsyncFileNativeBackend::writeHelper(OperationId opId, dispatch_io_t channel,
qint64 offset, dispatch_data_t dataToWrite,
qint64 dataSize)
{
@@ -752,7 +761,7 @@ void QRandomAccessAsyncFilePrivate::writeHelper(OperationId opId, dispatch_io_t
const size_t written = dataSize - toBeWritten;
[dataToWrite release];
- auto context = sharedThis->q_ptr;
+ auto context = sharedThis->m_owner;
const OperationResult res = { opId, qint64(written), error };
QMetaObject::invokeMethod(context,
[sharedThis](const OperationResult &r) {
@@ -762,7 +771,7 @@ void QRandomAccessAsyncFilePrivate::writeHelper(OperationId opId, dispatch_io_t
});
}
-QRandomAccessAsyncFilePrivate::OperationId QRandomAccessAsyncFilePrivate::getNextId()
+QRandomAccessAsyncFileNativeBackend::OperationId QRandomAccessAsyncFileNativeBackend::getNextId()
{
// never return reserved values
static OperationId opId = kInvalidOperationId;
diff --git a/src/corelib/io/qrandomaccessasyncfile_p_p.h b/src/corelib/io/qrandomaccessasyncfile_p_p.h
index 11ad788c884..2eb53058780 100644
--- a/src/corelib/io/qrandomaccessasyncfile_p_p.h
+++ b/src/corelib/io/qrandomaccessasyncfile_p_p.h
@@ -22,7 +22,7 @@
#include <QtCore/qstring.h>
-#ifdef QT_RANDOMACCESSASYNCFILE_THREAD
+#if QT_CONFIG(future) && QT_CONFIG(thread)
#include <QtCore/private/qfsfileengine_p.h>
@@ -30,7 +30,7 @@
#include <QtCore/qmutex.h>
#include <QtCore/qqueue.h>
-#endif // QT_RANDOMACCESSASYNCFILE_THREAD
+#endif // future && thread
#ifdef Q_OS_DARWIN
@@ -50,41 +50,36 @@
QT_BEGIN_NAMESPACE
-class QRandomAccessAsyncFilePrivate : public QObjectPrivate
+class QRandomAccessAsyncFileBackend
{
- Q_DECLARE_PUBLIC(QRandomAccessAsyncFile)
- Q_DISABLE_COPY_MOVE(QRandomAccessAsyncFilePrivate)
+ Q_DISABLE_COPY_MOVE(QRandomAccessAsyncFileBackend)
public:
- QRandomAccessAsyncFilePrivate();
- ~QRandomAccessAsyncFilePrivate() override;
-
- static QRandomAccessAsyncFilePrivate *get(QRandomAccessAsyncFile *file)
- { return file->d_func(); }
+ explicit QRandomAccessAsyncFileBackend(QRandomAccessAsyncFile *owner);
+ virtual ~QRandomAccessAsyncFileBackend();
- void init();
- void cancelAndWait(QIOOperation *op);
+ virtual bool init() = 0;
+ virtual void cancelAndWait(QIOOperation *op) = 0;
- void close();
- qint64 size() const;
+ virtual void close() = 0;
+ virtual qint64 size() const = 0;
- [[nodiscard]] QIOOperation *open(const QString &path, QIODeviceBase::OpenMode mode);
- [[nodiscard]] QIOOperation *flush();
+ [[nodiscard]] virtual QIOOperation *open(const QString &path, QIODeviceBase::OpenMode mode) = 0;
+ [[nodiscard]] virtual QIOOperation *flush() = 0;
- [[nodiscard]] QIOReadOperation *read(qint64 offset, qint64 maxSize);
- [[nodiscard]] QIOWriteOperation *write(qint64 offset, const QByteArray &data);
- [[nodiscard]] QIOWriteOperation *write(qint64 offset, QByteArray &&data);
+ [[nodiscard]] virtual QIOReadOperation *read(qint64 offset, qint64 maxSize) = 0;
+ [[nodiscard]] virtual QIOWriteOperation *write(qint64 offset, const QByteArray &data) = 0;
+ [[nodiscard]] virtual QIOWriteOperation *write(qint64 offset, QByteArray &&data) = 0;
- [[nodiscard]] QIOVectoredReadOperation *
- readInto(qint64 offset, QSpan<std::byte> buffer);
- [[nodiscard]] QIOVectoredWriteOperation *
- writeFrom(qint64 offset, QSpan<const std::byte> buffer);
-
- [[nodiscard]] QIOVectoredReadOperation *
- readInto(qint64 offset, QSpan<const QSpan<std::byte>> buffers);
- [[nodiscard]] QIOVectoredWriteOperation *
- writeFrom(qint64 offset, QSpan<const QSpan<const std::byte>> buffers);
+ [[nodiscard]] virtual QIOVectoredReadOperation *
+ readInto(qint64 offset, QSpan<std::byte> buffer) = 0;
+ [[nodiscard]] virtual QIOVectoredWriteOperation *
+ writeFrom(qint64 offset, QSpan<const std::byte> buffer) = 0;
-private:
+ [[nodiscard]] virtual QIOVectoredReadOperation *
+ readInto(qint64 offset, QSpan<const QSpan<std::byte>> buffers) = 0;
+ [[nodiscard]] virtual QIOVectoredWriteOperation *
+ writeFrom(qint64 offset, QSpan<const QSpan<const std::byte>> buffers) = 0;
+protected:
// common for all backends
enum class FileState : quint8
{
@@ -94,32 +89,131 @@ private:
};
QString m_filePath;
+ QRandomAccessAsyncFile *m_owner = nullptr;
QIODeviceBase::OpenMode m_openMode;
FileState m_fileState = FileState::Closed;
+};
-#ifdef QT_RANDOMACCESSASYNCFILE_THREAD
+class QRandomAccessAsyncFilePrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QRandomAccessAsyncFile)
+ Q_DISABLE_COPY_MOVE(QRandomAccessAsyncFilePrivate)
public:
- struct OperationResult
+ QRandomAccessAsyncFilePrivate();
+ ~QRandomAccessAsyncFilePrivate() override;
+
+ static QRandomAccessAsyncFilePrivate *get(QRandomAccessAsyncFile *file)
+ { return file->d_func(); }
+
+ void init();
+ void cancelAndWait(QIOOperation *op)
{
- qint64 bytesProcessed; // either read or written
- QIOOperation::Error error;
- };
+ checkValid();
+ m_backend->cancelAndWait(op);
+ }
+
+ void close()
+ {
+ checkValid();
+ m_backend->close();
+ }
+ qint64 size() const
+ {
+ checkValid();
+ return m_backend->size();
+ }
+
+ [[nodiscard]] QIOOperation *open(const QString &path, QIODeviceBase::OpenMode mode)
+ {
+ checkValid();
+ return m_backend->open(path, mode);
+ }
+ [[nodiscard]] QIOOperation *flush()
+ {
+ checkValid();
+ return m_backend->flush();
+ }
+
+ [[nodiscard]] QIOReadOperation *read(qint64 offset, qint64 maxSize)
+ {
+ checkValid();
+ return m_backend->read(offset, maxSize);
+ }
+ [[nodiscard]] QIOWriteOperation *write(qint64 offset, const QByteArray &data)
+ {
+ checkValid();
+ return m_backend->write(offset, data);
+ }
+ [[nodiscard]] QIOWriteOperation *write(qint64 offset, QByteArray &&data)
+ {
+ checkValid();
+ return m_backend->write(offset, std::move(data));
+ }
+
+ [[nodiscard]] QIOVectoredReadOperation *readInto(qint64 offset, QSpan<std::byte> buffer)
+ {
+ checkValid();
+ return m_backend->readInto(offset, buffer);
+ }
+ [[nodiscard]] QIOVectoredWriteOperation *writeFrom(qint64 offset, QSpan<const std::byte> buffer)
+ {
+ checkValid();
+ return m_backend->writeFrom(offset, buffer);
+ }
+
+ [[nodiscard]] QIOVectoredReadOperation *readInto(qint64 offset,
+ QSpan<const QSpan<std::byte>> buffers)
+ {
+ checkValid();
+ return m_backend->readInto(offset, buffers);
+ }
+ [[nodiscard]] QIOVectoredWriteOperation *writeFrom(qint64 offset,
+ QSpan<const QSpan<const std::byte>> buffers)
+ {
+ checkValid();
+ return m_backend->writeFrom(offset, buffers);
+ }
private:
- mutable QBasicMutex m_engineMutex;
- std::unique_ptr<QFSFileEngine> m_engine;
- QFutureWatcher<OperationResult> m_watcher;
+ void checkValid() const { Q_ASSERT(m_backend); }
+ std::unique_ptr<QRandomAccessAsyncFileBackend> m_backend;
- QQueue<QPointer<QIOOperation>> m_operations;
- QPointer<QIOOperation> m_currentOperation;
- qsizetype numProcessedBuffers = 0;
+};
- void executeNextOperation();
- void processBufferAt(qsizetype idx);
- void processFlush();
- void processOpen();
- void operationComplete();
-#elif defined(QT_RANDOMACCESSASYNCFILE_QIORING)
+
+#if defined(QT_RANDOMACCESSASYNCFILE_QIORING) || defined(Q_OS_DARWIN)
+class QRandomAccessAsyncFileNativeBackend final : public QRandomAccessAsyncFileBackend
+{
+ Q_DISABLE_COPY_MOVE(QRandomAccessAsyncFileNativeBackend)
+public:
+ explicit QRandomAccessAsyncFileNativeBackend(QRandomAccessAsyncFile *owner);
+ ~QRandomAccessAsyncFileNativeBackend();
+
+ bool init() override;
+ void cancelAndWait(QIOOperation *op) override;
+
+ void close() override;
+ qint64 size() const override;
+
+ [[nodiscard]] QIOOperation *open(const QString &path, QIODeviceBase::OpenMode mode) override;
+ [[nodiscard]] QIOOperation *flush() override;
+
+ [[nodiscard]] QIOReadOperation *read(qint64 offset, qint64 maxSize) override;
+ [[nodiscard]] QIOWriteOperation *write(qint64 offset, const QByteArray &data) override;
+ [[nodiscard]] QIOWriteOperation *write(qint64 offset, QByteArray &&data) override;
+
+ [[nodiscard]] QIOVectoredReadOperation *
+ readInto(qint64 offset, QSpan<std::byte> buffer) override;
+ [[nodiscard]] QIOVectoredWriteOperation *
+ writeFrom(qint64 offset, QSpan<const std::byte> buffer) override;
+
+ [[nodiscard]] QIOVectoredReadOperation *
+ readInto(qint64 offset, QSpan<const QSpan<std::byte>> buffers) override;
+ [[nodiscard]] QIOVectoredWriteOperation *
+ writeFrom(qint64 offset, QSpan<const QSpan<const std::byte>> buffers) override;
+
+private:
+#if defined(QT_RANDOMACCESSASYNCFILE_QIORING)
void queueCompletion(QIOOperationPrivate *priv, QIOOperation::Error error);
void startReadIntoSingle(QIOOperation *op, const QSpan<std::byte> &to);
void startWriteFromSingle(QIOOperation *op, const QSpan<const std::byte> &from);
@@ -210,6 +304,61 @@ private:
dispatch_data_t dataToWrite, qint64 dataSize);
#endif
};
+#endif // QIORing || macOS
+
+#if QT_CONFIG(future) && QT_CONFIG(thread)
+class QRandomAccessAsyncFileThreadPoolBackend : public QRandomAccessAsyncFileBackend
+{
+ Q_DISABLE_COPY_MOVE(QRandomAccessAsyncFileThreadPoolBackend)
+public:
+ explicit QRandomAccessAsyncFileThreadPoolBackend(QRandomAccessAsyncFile *owner);
+ ~QRandomAccessAsyncFileThreadPoolBackend();
+
+ bool init() override;
+ void cancelAndWait(QIOOperation *op) override;
+
+ void close() override;
+ qint64 size() const override;
+
+ [[nodiscard]] QIOOperation *open(const QString &path, QIODeviceBase::OpenMode mode) override;
+ [[nodiscard]] QIOOperation *flush() override;
+
+ [[nodiscard]] QIOReadOperation *read(qint64 offset, qint64 maxSize) override;
+ [[nodiscard]] QIOWriteOperation *write(qint64 offset, const QByteArray &data) override;
+ [[nodiscard]] QIOWriteOperation *write(qint64 offset, QByteArray &&data) override;
+
+ [[nodiscard]] QIOVectoredReadOperation *
+ readInto(qint64 offset, QSpan<std::byte> buffer) override;
+ [[nodiscard]] QIOVectoredWriteOperation *
+ writeFrom(qint64 offset, QSpan<const std::byte> buffer) override;
+
+ [[nodiscard]] QIOVectoredReadOperation *
+ readInto(qint64 offset, QSpan<const QSpan<std::byte>> buffers) override;
+ [[nodiscard]] QIOVectoredWriteOperation *
+ writeFrom(qint64 offset, QSpan<const QSpan<const std::byte>> buffers) override;
+
+ struct OperationResult
+ {
+ qint64 bytesProcessed; // either read or written
+ QIOOperation::Error error;
+ };
+private:
+
+ mutable QBasicMutex m_engineMutex;
+ std::unique_ptr<QFSFileEngine> m_engine;
+ QFutureWatcher<OperationResult> m_watcher;
+
+ QQueue<QPointer<QIOOperation>> m_operations;
+ QPointer<QIOOperation> m_currentOperation;
+ qsizetype numProcessedBuffers = 0;
+
+ void executeNextOperation();
+ void processBufferAt(qsizetype idx);
+ void processFlush();
+ void processOpen();
+ void operationComplete();
+};
+#endif // future && thread
QT_END_NAMESPACE
diff --git a/src/corelib/io/qrandomaccessasyncfile_qioring.cpp b/src/corelib/io/qrandomaccessasyncfile_qioring.cpp
index c9783ea2856..8e1145325d8 100644
--- a/src/corelib/io/qrandomaccessasyncfile_qioring.cpp
+++ b/src/corelib/io/qrandomaccessasyncfile_qioring.cpp
@@ -18,18 +18,21 @@ QT_BEGIN_NAMESPACE
Q_STATIC_LOGGING_CATEGORY(lcQRandomAccessIORing, "qt.core.qrandomaccessasyncfile.ioring",
QtCriticalMsg);
-QRandomAccessAsyncFilePrivate::QRandomAccessAsyncFilePrivate() = default;
+QRandomAccessAsyncFileNativeBackend::QRandomAccessAsyncFileNativeBackend(QRandomAccessAsyncFile *owner)
+ : QRandomAccessAsyncFileBackend(owner)
+{}
-QRandomAccessAsyncFilePrivate::~QRandomAccessAsyncFilePrivate() = default;
+QRandomAccessAsyncFileNativeBackend::~QRandomAccessAsyncFileNativeBackend() = default;
-void QRandomAccessAsyncFilePrivate::init()
+bool QRandomAccessAsyncFileNativeBackend::init()
{
m_ioring = QIORing::sharedInstance();
if (!m_ioring)
- qCCritical(lcQRandomAccessIORing, "QRandomAccessAsyncFile: ioring failed to initialize");
+ qCWarning(lcQRandomAccessIORing, "QRandomAccessAsyncFile: ioring failed to initialize");
+ return m_ioring != nullptr;
}
-QIORing::RequestHandle QRandomAccessAsyncFilePrivate::cancel(QIORing::RequestHandle handle)
+QIORing::RequestHandle QRandomAccessAsyncFileNativeBackend::cancel(QIORing::RequestHandle handle)
{
if (handle) {
QIORingRequest<QIORing::Operation::Cancel> cancelRequest;
@@ -39,7 +42,7 @@ QIORing::RequestHandle QRandomAccessAsyncFilePrivate::cancel(QIORing::RequestHan
return nullptr;
}
-void QRandomAccessAsyncFilePrivate::cancelAndWait(QIOOperation *op)
+void QRandomAccessAsyncFileNativeBackend::cancelAndWait(QIOOperation *op)
{
auto *opHandle = m_opHandleMap.value(op);
if (auto *handle = cancel(opHandle)) {
@@ -48,7 +51,7 @@ void QRandomAccessAsyncFilePrivate::cancelAndWait(QIOOperation *op)
}
}
-void QRandomAccessAsyncFilePrivate::queueCompletion(QIOOperationPrivate *priv, QIOOperation::Error error)
+void QRandomAccessAsyncFileNativeBackend::queueCompletion(QIOOperationPrivate *priv, QIOOperation::Error error)
{
// Remove the handle now in case the user cancels or deletes the io-operation
// before operationComplete is called - the null-handle will protect from
@@ -61,14 +64,14 @@ void QRandomAccessAsyncFilePrivate::queueCompletion(QIOOperationPrivate *priv, Q
}, Qt::QueuedConnection);
}
-QIOOperation *QRandomAccessAsyncFilePrivate::open(const QString &path, QIODeviceBase::OpenMode mode)
+QIOOperation *QRandomAccessAsyncFileNativeBackend::open(const QString &path, QIODeviceBase::OpenMode mode)
{
auto *dataStorage = new QtPrivate::QIOOperationDataStorage();
auto *priv = new QIOOperationPrivate(dataStorage);
priv->type = QIOOperation::Type::Open;
- auto *op = new QIOOperation(*priv, q_ptr);
+ auto *op = new QIOOperation(*priv, m_owner);
if (m_fileState != FileState::Closed) {
queueCompletion(priv, QIOOperation::Error::Open);
return op;
@@ -115,7 +118,7 @@ QIOOperation *QRandomAccessAsyncFilePrivate::open(const QString &path, QIODevice
return op;
}
-void QRandomAccessAsyncFilePrivate::close()
+void QRandomAccessAsyncFileNativeBackend::close()
{
// all the operations should be aborted
const auto ops = std::exchange(m_operations, {});
@@ -123,7 +126,7 @@ void QRandomAccessAsyncFilePrivate::close()
// Request to cancel all of the in-flight operations:
for (const auto &op : ops) {
if (op) {
- op->d_func()->error = QIOOperation::Error::Aborted;
+ QIOOperationPrivate::get(op)->error = QIOOperation::Error::Aborted;
if (auto *opHandle = m_opHandleMap.value(op)) {
tasksToAwait.append(cancel(opHandle));
tasksToAwait.append(opHandle);
@@ -142,7 +145,7 @@ void QRandomAccessAsyncFilePrivate::close()
m_fd = -1;
}
-qint64 QRandomAccessAsyncFilePrivate::size() const
+qint64 QRandomAccessAsyncFileNativeBackend::size() const
{
QIORingRequest<QIORing::Operation::Stat> statRequest;
statRequest.fd = m_fd;
@@ -161,14 +164,14 @@ qint64 QRandomAccessAsyncFilePrivate::size() const
return finalSize;
}
-QIOOperation *QRandomAccessAsyncFilePrivate::flush()
+QIOOperation *QRandomAccessAsyncFileNativeBackend::flush()
{
auto *dataStorage = new QtPrivate::QIOOperationDataStorage();
auto *priv = new QIOOperationPrivate(dataStorage);
priv->type = QIOOperation::Type::Flush;
- auto *op = new QIOOperation(*priv, q_ptr);
+ auto *op = new QIOOperation(*priv, m_owner);
m_operations.append(op);
QIORingRequest<QIORing::Operation::Flush> flushRequest;
@@ -192,7 +195,7 @@ QIOOperation *QRandomAccessAsyncFilePrivate::flush()
return op;
}
-void QRandomAccessAsyncFilePrivate::startReadIntoSingle(QIOOperation *op,
+void QRandomAccessAsyncFileNativeBackend::startReadIntoSingle(QIOOperation *op,
const QSpan<std::byte> &to)
{
QIORingRequest<QIORing::Operation::Read> readRequest;
@@ -231,7 +234,7 @@ void QRandomAccessAsyncFilePrivate::startReadIntoSingle(QIOOperation *op,
m_opHandleMap.insert(priv->q_func(), m_ioring->queueRequest(std::move(readRequest)));
}
-QIOReadOperation *QRandomAccessAsyncFilePrivate::read(qint64 offset, qint64 maxSize)
+QIOReadOperation *QRandomAccessAsyncFileNativeBackend::read(qint64 offset, qint64 maxSize)
{
QByteArray array;
array.resizeForOverwrite(maxSize);
@@ -241,7 +244,7 @@ QIOReadOperation *QRandomAccessAsyncFilePrivate::read(qint64 offset, qint64 maxS
priv->offset = offset;
priv->type = QIOOperation::Type::Read;
- auto *op = new QIOReadOperation(*priv, q_ptr);
+ auto *op = new QIOReadOperation(*priv, m_owner);
m_operations.append(op);
startReadIntoSingle(op, as_writable_bytes(QSpan(dataStorage->getByteArray())));
@@ -249,12 +252,12 @@ QIOReadOperation *QRandomAccessAsyncFilePrivate::read(qint64 offset, qint64 maxS
return op;
}
-QIOWriteOperation *QRandomAccessAsyncFilePrivate::write(qint64 offset, const QByteArray &data)
+QIOWriteOperation *QRandomAccessAsyncFileNativeBackend::write(qint64 offset, const QByteArray &data)
{
return write(offset, QByteArray(data));
}
-void QRandomAccessAsyncFilePrivate::startWriteFromSingle(QIOOperation *op,
+void QRandomAccessAsyncFileNativeBackend::startWriteFromSingle(QIOOperation *op,
const QSpan<const std::byte> &from)
{
QIORingRequest<QIORing::Operation::Write> writeRequest;
@@ -288,7 +291,7 @@ void QRandomAccessAsyncFilePrivate::startWriteFromSingle(QIOOperation *op,
m_opHandleMap.insert(priv->q_func(), m_ioring->queueRequest(std::move(writeRequest)));
}
-QIOWriteOperation *QRandomAccessAsyncFilePrivate::write(qint64 offset, QByteArray &&data)
+QIOWriteOperation *QRandomAccessAsyncFileNativeBackend::write(qint64 offset, QByteArray &&data)
{
auto *dataStorage = new QtPrivate::QIOOperationDataStorage(std::move(data));
@@ -296,7 +299,7 @@ QIOWriteOperation *QRandomAccessAsyncFilePrivate::write(qint64 offset, QByteArra
priv->offset = offset;
priv->type = QIOOperation::Type::Write;
- auto *op = new QIOWriteOperation(*priv, q_ptr);
+ auto *op = new QIOWriteOperation(*priv, m_owner);
m_operations.append(op);
startWriteFromSingle(op, as_bytes(QSpan(dataStorage->getByteArray())));
@@ -304,7 +307,7 @@ QIOWriteOperation *QRandomAccessAsyncFilePrivate::write(qint64 offset, QByteArra
return op;
}
-QIOVectoredReadOperation *QRandomAccessAsyncFilePrivate::readInto(qint64 offset,
+QIOVectoredReadOperation *QRandomAccessAsyncFileNativeBackend::readInto(qint64 offset,
QSpan<std::byte> buffer)
{
auto *dataStorage = new QtPrivate::QIOOperationDataStorage(
@@ -314,7 +317,7 @@ QIOVectoredReadOperation *QRandomAccessAsyncFilePrivate::readInto(qint64 offset,
priv->offset = offset;
priv->type = QIOOperation::Type::Read;
- auto *op = new QIOVectoredReadOperation(*priv, q_ptr);
+ auto *op = new QIOVectoredReadOperation(*priv, m_owner);
m_operations.append(op);
startReadIntoSingle(op, dataStorage->getReadSpans().first());
@@ -322,7 +325,7 @@ QIOVectoredReadOperation *QRandomAccessAsyncFilePrivate::readInto(qint64 offset,
return op;
}
-QIOVectoredWriteOperation *QRandomAccessAsyncFilePrivate::writeFrom(qint64 offset,
+QIOVectoredWriteOperation *QRandomAccessAsyncFileNativeBackend::writeFrom(qint64 offset,
QSpan<const std::byte> buffer)
{
auto *dataStorage = new QtPrivate::QIOOperationDataStorage(
@@ -332,7 +335,7 @@ QIOVectoredWriteOperation *QRandomAccessAsyncFilePrivate::writeFrom(qint64 offse
priv->offset = offset;
priv->type = QIOOperation::Type::Write;
- auto *op = new QIOVectoredWriteOperation(*priv, q_ptr);
+ auto *op = new QIOVectoredWriteOperation(*priv, m_owner);
m_operations.append(op);
startWriteFromSingle(op, dataStorage->getWriteSpans().first());
@@ -341,7 +344,7 @@ QIOVectoredWriteOperation *QRandomAccessAsyncFilePrivate::writeFrom(qint64 offse
}
QIOVectoredReadOperation *
-QRandomAccessAsyncFilePrivate::readInto(qint64 offset, QSpan<const QSpan<std::byte>> buffers)
+QRandomAccessAsyncFileNativeBackend::readInto(qint64 offset, QSpan<const QSpan<std::byte>> buffers)
{
if (!QIORing::supportsOperation(QtPrivate::Operation::VectoredRead))
return nullptr;
@@ -351,7 +354,7 @@ QRandomAccessAsyncFilePrivate::readInto(qint64 offset, QSpan<const QSpan<std::by
priv->offset = offset;
priv->type = QIOOperation::Type::Read;
- auto *op = new QIOVectoredReadOperation(*priv, q_ptr);
+ auto *op = new QIOVectoredReadOperation(*priv, m_owner);
if (priv->offset < 0) { // The QIORing offset is unsigned, so error out now
queueCompletion(priv, QIOOperation::Error::IncorrectOffset);
return op;
@@ -393,7 +396,7 @@ QRandomAccessAsyncFilePrivate::readInto(qint64 offset, QSpan<const QSpan<std::by
}
QIOVectoredWriteOperation *
-QRandomAccessAsyncFilePrivate::writeFrom(qint64 offset, QSpan<const QSpan<const std::byte>> buffers)
+QRandomAccessAsyncFileNativeBackend::writeFrom(qint64 offset, QSpan<const QSpan<const std::byte>> buffers)
{
if (!QIORing::supportsOperation(QtPrivate::Operation::VectoredWrite))
return nullptr;
@@ -403,7 +406,7 @@ QRandomAccessAsyncFilePrivate::writeFrom(qint64 offset, QSpan<const QSpan<const
priv->offset = offset;
priv->type = QIOOperation::Type::Write;
- auto *op = new QIOVectoredWriteOperation(*priv, q_ptr);
+ auto *op = new QIOVectoredWriteOperation(*priv, m_owner);
if (priv->offset < 0) { // The QIORing offset is unsigned, so error out now
queueCompletion(priv, QIOOperation::Error::IncorrectOffset);
return op;
diff --git a/src/corelib/io/qrandomaccessasyncfile_threadpool.cpp b/src/corelib/io/qrandomaccessasyncfile_threadpool.cpp
index 4ebcf554655..774fbadc5ad 100644
--- a/src/corelib/io/qrandomaccessasyncfile_threadpool.cpp
+++ b/src/corelib/io/qrandomaccessasyncfile_threadpool.cpp
@@ -64,28 +64,29 @@ static SharedThreadPool asyncFileThreadPool;
} // anonymous namespace
-QRandomAccessAsyncFilePrivate::QRandomAccessAsyncFilePrivate() :
- QObjectPrivate()
+QRandomAccessAsyncFileThreadPoolBackend::QRandomAccessAsyncFileThreadPoolBackend(QRandomAccessAsyncFile *owner) :
+ QRandomAccessAsyncFileBackend(owner)
{
asyncFileThreadPool.ref();
}
-QRandomAccessAsyncFilePrivate::~QRandomAccessAsyncFilePrivate()
+QRandomAccessAsyncFileThreadPoolBackend::~QRandomAccessAsyncFileThreadPoolBackend()
{
asyncFileThreadPool.deref();
}
-void QRandomAccessAsyncFilePrivate::init()
+bool QRandomAccessAsyncFileThreadPoolBackend::init()
{
- QObject::connect(&m_watcher, &QFutureWatcherBase::finished, q_ptr, [this]{
+ QObject::connect(&m_watcher, &QFutureWatcherBase::finished, m_owner, [this]{
operationComplete();
});
- QObject::connect(&m_watcher, &QFutureWatcherBase::canceled, q_ptr, [this]{
+ QObject::connect(&m_watcher, &QFutureWatcherBase::canceled, m_owner, [this]{
operationComplete();
});
+ return true;
}
-void QRandomAccessAsyncFilePrivate::cancelAndWait(QIOOperation *op)
+void QRandomAccessAsyncFileThreadPoolBackend::cancelAndWait(QIOOperation *op)
{
if (op == m_currentOperation) {
m_currentOperation = nullptr; // to discard the result
@@ -97,7 +98,7 @@ void QRandomAccessAsyncFilePrivate::cancelAndWait(QIOOperation *op)
}
QIOOperation *
-QRandomAccessAsyncFilePrivate::open(const QString &path, QIODeviceBase::OpenMode mode)
+QRandomAccessAsyncFileThreadPoolBackend::open(const QString &path, QIODeviceBase::OpenMode mode)
{
// We generate the command in any case. But if the file is already opened,
// it will finish with an error
@@ -112,14 +113,14 @@ QRandomAccessAsyncFilePrivate::open(const QString &path, QIODeviceBase::OpenMode
auto *priv = new QIOOperationPrivate(dataStorage);
priv->type = QIOOperation::Type::Open;
- auto *op = new QIOOperation(*priv, q_ptr);
+ auto *op = new QIOOperation(*priv, m_owner);
m_operations.append(op);
executeNextOperation();
return op;
}
-void QRandomAccessAsyncFilePrivate::close()
+void QRandomAccessAsyncFileThreadPoolBackend::close()
{
// all the operations should be aborted
for (const auto &op : std::as_const(m_operations)) {
@@ -148,7 +149,7 @@ void QRandomAccessAsyncFilePrivate::close()
m_fileState = FileState::Closed;
}
-qint64 QRandomAccessAsyncFilePrivate::size() const
+qint64 QRandomAccessAsyncFileThreadPoolBackend::size() const
{
QMutexLocker locker(&m_engineMutex);
if (m_engine)
@@ -156,20 +157,20 @@ qint64 QRandomAccessAsyncFilePrivate::size() const
return -1;
}
-QIOOperation *QRandomAccessAsyncFilePrivate::flush()
+QIOOperation *QRandomAccessAsyncFileThreadPoolBackend::flush()
{
auto *dataStorage = new QtPrivate::QIOOperationDataStorage();
auto *priv = new QIOOperationPrivate(dataStorage);
priv->type = QIOOperation::Type::Flush;
- auto *op = new QIOOperation(*priv, q_ptr);
+ auto *op = new QIOOperation(*priv, m_owner);
m_operations.append(op);
executeNextOperation();
return op;
}
-QIOReadOperation *QRandomAccessAsyncFilePrivate::read(qint64 offset, qint64 maxSize)
+QIOReadOperation *QRandomAccessAsyncFileThreadPoolBackend::read(qint64 offset, qint64 maxSize)
{
QByteArray array;
array.resizeForOverwrite(maxSize);
@@ -179,14 +180,14 @@ QIOReadOperation *QRandomAccessAsyncFilePrivate::read(qint64 offset, qint64 maxS
priv->offset = offset;
priv->type = QIOOperation::Type::Read;
- auto *op = new QIOReadOperation(*priv, q_ptr);
+ auto *op = new QIOReadOperation(*priv, m_owner);
m_operations.append(op);
executeNextOperation();
return op;
}
QIOWriteOperation *
-QRandomAccessAsyncFilePrivate::write(qint64 offset, const QByteArray &data)
+QRandomAccessAsyncFileThreadPoolBackend::write(qint64 offset, const QByteArray &data)
{
auto *dataStorage = new QtPrivate::QIOOperationDataStorage(data);
@@ -194,14 +195,14 @@ QRandomAccessAsyncFilePrivate::write(qint64 offset, const QByteArray &data)
priv->offset = offset;
priv->type = QIOOperation::Type::Write;
- auto *op = new QIOWriteOperation(*priv, q_ptr);
+ auto *op = new QIOWriteOperation(*priv, m_owner);
m_operations.append(op);
executeNextOperation();
return op;
}
QIOWriteOperation *
-QRandomAccessAsyncFilePrivate::write(qint64 offset, QByteArray &&data)
+QRandomAccessAsyncFileThreadPoolBackend::write(qint64 offset, QByteArray &&data)
{
auto *dataStorage = new QtPrivate::QIOOperationDataStorage(std::move(data));
@@ -209,14 +210,14 @@ QRandomAccessAsyncFilePrivate::write(qint64 offset, QByteArray &&data)
priv->offset = offset;
priv->type = QIOOperation::Type::Write;
- auto *op = new QIOWriteOperation(*priv, q_ptr);
+ auto *op = new QIOWriteOperation(*priv, m_owner);
m_operations.append(op);
executeNextOperation();
return op;
}
QIOVectoredReadOperation *
-QRandomAccessAsyncFilePrivate::readInto(qint64 offset, QSpan<std::byte> buffer)
+QRandomAccessAsyncFileThreadPoolBackend::readInto(qint64 offset, QSpan<std::byte> buffer)
{
auto *dataStorage =
new QtPrivate::QIOOperationDataStorage(QSpan<const QSpan<std::byte>>{buffer});
@@ -225,14 +226,14 @@ QRandomAccessAsyncFilePrivate::readInto(qint64 offset, QSpan<std::byte> buffer)
priv->offset = offset;
priv->type = QIOOperation::Type::Read;
- auto *op = new QIOVectoredReadOperation(*priv, q_ptr);
+ auto *op = new QIOVectoredReadOperation(*priv, m_owner);
m_operations.append(op);
executeNextOperation();
return op;
}
QIOVectoredWriteOperation *
-QRandomAccessAsyncFilePrivate::writeFrom(qint64 offset, QSpan<const std::byte> buffer)
+QRandomAccessAsyncFileThreadPoolBackend::writeFrom(qint64 offset, QSpan<const std::byte> buffer)
{
auto *dataStorage =
new QtPrivate::QIOOperationDataStorage(QSpan<const QSpan<const std::byte>>{buffer});
@@ -241,14 +242,14 @@ QRandomAccessAsyncFilePrivate::writeFrom(qint64 offset, QSpan<const std::byte> b
priv->offset = offset;
priv->type = QIOOperation::Type::Write;
- auto *op = new QIOVectoredWriteOperation(*priv, q_ptr);
+ auto *op = new QIOVectoredWriteOperation(*priv, m_owner);
m_operations.append(op);
executeNextOperation();
return op;
}
QIOVectoredReadOperation *
-QRandomAccessAsyncFilePrivate::readInto(qint64 offset, QSpan<const QSpan<std::byte>> buffers)
+QRandomAccessAsyncFileThreadPoolBackend::readInto(qint64 offset, QSpan<const QSpan<std::byte>> buffers)
{
auto *dataStorage = new QtPrivate::QIOOperationDataStorage(buffers);
@@ -256,14 +257,14 @@ QRandomAccessAsyncFilePrivate::readInto(qint64 offset, QSpan<const QSpan<std::by
priv->offset = offset;
priv->type = QIOOperation::Type::Read;
- auto *op = new QIOVectoredReadOperation(*priv, q_ptr);
+ auto *op = new QIOVectoredReadOperation(*priv, m_owner);
m_operations.append(op);
executeNextOperation();
return op;
}
QIOVectoredWriteOperation *
-QRandomAccessAsyncFilePrivate::writeFrom(qint64 offset, QSpan<const QSpan<const std::byte>> buffers)
+QRandomAccessAsyncFileThreadPoolBackend::writeFrom(qint64 offset, QSpan<const QSpan<const std::byte>> buffers)
{
auto *dataStorage = new QtPrivate::QIOOperationDataStorage(buffers);
@@ -271,16 +272,16 @@ QRandomAccessAsyncFilePrivate::writeFrom(qint64 offset, QSpan<const QSpan<const
priv->offset = offset;
priv->type = QIOOperation::Type::Write;
- auto *op = new QIOVectoredWriteOperation(*priv, q_ptr);
+ auto *op = new QIOVectoredWriteOperation(*priv, m_owner);
m_operations.append(op);
executeNextOperation();
return op;
}
-static QRandomAccessAsyncFilePrivate::OperationResult
+static QRandomAccessAsyncFileThreadPoolBackend::OperationResult
executeRead(QFSFileEngine *engine, QBasicMutex *mutex, qint64 offset, char *buffer, qint64 maxSize)
{
- QRandomAccessAsyncFilePrivate::OperationResult result{0, QIOOperation::Error::None};
+ QRandomAccessAsyncFileThreadPoolBackend::OperationResult result{0, QIOOperation::Error::None};
QMutexLocker locker(mutex);
if (engine) {
@@ -299,11 +300,11 @@ executeRead(QFSFileEngine *engine, QBasicMutex *mutex, qint64 offset, char *buff
return result;
}
-static QRandomAccessAsyncFilePrivate::OperationResult
+static QRandomAccessAsyncFileThreadPoolBackend::OperationResult
executeWrite(QFSFileEngine *engine, QBasicMutex *mutex, qint64 offset,
const char *buffer, qint64 size)
{
- QRandomAccessAsyncFilePrivate::OperationResult result{0, QIOOperation::Error::None};
+ QRandomAccessAsyncFileThreadPoolBackend::OperationResult result{0, QIOOperation::Error::None};
QMutexLocker locker(mutex);
if (engine) {
@@ -322,7 +323,7 @@ executeWrite(QFSFileEngine *engine, QBasicMutex *mutex, qint64 offset,
return result;
}
-void QRandomAccessAsyncFilePrivate::executeNextOperation()
+void QRandomAccessAsyncFileThreadPoolBackend::executeNextOperation()
{
if (m_currentOperation.isNull()) {
// start next
@@ -351,7 +352,7 @@ void QRandomAccessAsyncFilePrivate::executeNextOperation()
}
}
-void QRandomAccessAsyncFilePrivate::processBufferAt(qsizetype idx)
+void QRandomAccessAsyncFileThreadPoolBackend::processBufferAt(qsizetype idx)
{
Q_ASSERT(!m_currentOperation.isNull());
auto *priv = QIOOperationPrivate::get(m_currentOperation.get());
@@ -417,7 +418,7 @@ void QRandomAccessAsyncFilePrivate::processBufferAt(qsizetype idx)
}
}
-void QRandomAccessAsyncFilePrivate::processFlush()
+void QRandomAccessAsyncFileThreadPoolBackend::processFlush()
{
Q_ASSERT(!m_currentOperation.isNull());
auto *priv = QIOOperationPrivate::get(m_currentOperation.get());
@@ -427,7 +428,7 @@ void QRandomAccessAsyncFilePrivate::processFlush()
QBasicMutex *mutexPtr = &m_engineMutex;
auto op = [engine = m_engine.get(), mutexPtr] {
QMutexLocker locker(mutexPtr);
- QRandomAccessAsyncFilePrivate::OperationResult result{0, QIOOperation::Error::None};
+ QRandomAccessAsyncFileThreadPoolBackend::OperationResult result{0, QIOOperation::Error::None};
if (engine) {
if (!engine->flush())
result.error = QIOOperation::Error::Flush;
@@ -442,7 +443,7 @@ void QRandomAccessAsyncFilePrivate::processFlush()
m_watcher.setFuture(f);
}
-void QRandomAccessAsyncFilePrivate::processOpen()
+void QRandomAccessAsyncFileThreadPoolBackend::processOpen()
{
Q_ASSERT(!m_currentOperation.isNull());
auto *priv = QIOOperationPrivate::get(m_currentOperation.get());
@@ -457,7 +458,7 @@ void QRandomAccessAsyncFilePrivate::processOpen()
m_engineMutex.unlock();
QBasicMutex *mutexPtr = &m_engineMutex;
auto op = [engine = m_engine.get(), mutexPtr, mode = m_openMode] {
- QRandomAccessAsyncFilePrivate::OperationResult result{0, QIOOperation::Error::None};
+ QRandomAccessAsyncFileThreadPoolBackend::OperationResult result{0, QIOOperation::Error::None};
QMutexLocker locker(mutexPtr);
const bool res =
engine && engine->open(mode | QIODeviceBase::Unbuffered, std::nullopt);
@@ -468,13 +469,13 @@ void QRandomAccessAsyncFilePrivate::processOpen()
f = QtFuture::makeReadyVoidFuture().then(asyncFileThreadPool(), op);
} else {
f = QtFuture::makeReadyVoidFuture().then(asyncFileThreadPool(), [] {
- return QRandomAccessAsyncFilePrivate::OperationResult{0, QIOOperation::Error::Open};
+ return QRandomAccessAsyncFileThreadPoolBackend::OperationResult{0, QIOOperation::Error::Open};
});
}
m_watcher.setFuture(f);
}
-void QRandomAccessAsyncFilePrivate::operationComplete()
+void QRandomAccessAsyncFileThreadPoolBackend::operationComplete()
{
// TODO: if one of the buffers was read/written with an error,
// stop processing immediately
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp
index 456a209af37..6edf4395887 100644
--- a/src/corelib/io/qwindowspipereader.cpp
+++ b/src/corelib/io/qwindowspipereader.cpp
@@ -14,6 +14,11 @@ using namespace Qt::StringLiterals;
static const DWORD minReadBufferSize = 4096;
+/*!
+ \class QWindowsPipeReader
+ \inmodule QtCore
+ \internal
+*/
QWindowsPipeReader::QWindowsPipeReader(QObject *parent)
: QObject(parent),
handle(INVALID_HANDLE_VALUE),
diff --git a/src/corelib/itemmodels/qrangemodel_impl.h b/src/corelib/itemmodels/qrangemodel_impl.h
index f6b08099fe7..7eca3094a66 100644
--- a/src/corelib/itemmodels/qrangemodel_impl.h
+++ b/src/corelib/itemmodels/qrangemodel_impl.h
@@ -239,17 +239,15 @@ namespace QRangeModelDetails
: std::true_type
{};
- // we use std::rotate in moveRows/Columns, which requires std::swap and the
- // iterators to be at least a forward iterator
- template <typename It, typename = void>
- struct test_rotate : std::false_type {};
-
+ // we use std::rotate in moveRows/Columns, which requires the values (which
+ // might be const if we only get a const iterator) to be swappable, and the
+ // iterator type to be at least a forward iterator
template <typename It>
- struct test_rotate<It, std::void_t<decltype(std::swap(*std::declval<It>(),
- *std::declval<It>()))>>
- : std::is_base_of<std::forward_iterator_tag,
- typename std::iterator_traits<It>::iterator_category>
- {};
+ using test_rotate = std::conjunction<
+ std::is_swappable<decltype(*std::declval<It>())>,
+ std::is_base_of<std::forward_iterator_tag,
+ typename std::iterator_traits<It>::iterator_category>
+ >;
template <typename C, typename = void>
struct test_splice : std::false_type {};
diff --git a/src/corelib/itemmodels/qrangemodeladapter.h b/src/corelib/itemmodels/qrangemodeladapter.h
index 2a23e01eba2..0234c402248 100644
--- a/src/corelib/itemmodels/qrangemodeladapter.h
+++ b/src/corelib/itemmodels/qrangemodeladapter.h
@@ -19,13 +19,11 @@ class QT_TECH_PREVIEW_API QRangeModelAdapter
#ifdef Q_QDOC
using range_type = Range;
- using const_row_reference = typename std::iterator_traits<Range>::const_reference;
- using row_reference = typename std::iterator_traits<Range>::reference;
#else
using range_type = QRangeModelDetails::wrapped_t<Range>;
+#endif
using const_row_reference = typename Impl::const_row_reference;
using row_reference = typename Impl::row_reference;
-#endif
using range_features = typename QRangeModelDetails::range_traits<range_type>;
using row_type = std::remove_reference_t<row_reference>;
using row_features = QRangeModelDetails::range_traits<typename Impl::wrapped_row_type>;
@@ -78,16 +76,22 @@ class QT_TECH_PREVIEW_API QRangeModelAdapter
template <typename C>
using if_compatible_row_range = std::enable_if_t<is_compatible_row_range<C>, bool>;
template <typename Data>
- static constexpr bool is_compatible_data = true;
- // std::is_convertible_v<Data, decltype(*std::begin(std::declval<const_row_reference>()))>;
+ static constexpr bool is_compatible_data = std::is_convertible_v<Data, data_type>;
template <typename Data>
using if_compatible_data = std::enable_if_t<is_compatible_data<Data>, bool>;
template <typename C>
static constexpr bool is_compatible_data_range = is_compatible_data<
+ typename QRangeModelDetails::data_type<
+ typename QRangeModelDetails::row_traits<
decltype(*std::begin(std::declval<C&>()))
- >;
+ >::item_type
+ >::type
+ >;
+ template <typename C>
+ using if_compatible_column_data = std::enable_if_t<is_compatible_data<C>
+ || is_compatible_data_range<C>, bool>;
template <typename C>
- using if_compatible_data_range = std::enable_if_t<is_compatible_data_range<C>, bool>;
+ using if_compatible_column_range = std::enable_if_t<is_compatible_data_range<C>, bool>;
template <typename R>
using if_assignable_range = std::enable_if_t<std::is_assignable_v<range_type, R>, bool>;
@@ -1262,12 +1266,12 @@ public:
decltype(auto) operator[](int row) const { return at(row); }
template <typename I = Impl, if_table<I> = true, if_writable<I> = true>
- decltype(auto) at(int row)
+ auto at(int row)
{
return RowReference{index(row, 0), this};
}
template <typename I = Impl, if_table<I> = true, if_writable<I> = true>
- decltype(auto) operator[](int row) { return at(row); }
+ auto operator[](int row) { return at(row); }
// at/operator[int, int] for table: returns value at row/column
template <typename I = Impl, unless_list<I> = true>
@@ -1445,15 +1449,15 @@ public:
return storage.m_model->insertColumn(before);
}
- template <typename D = row_type, typename I = Impl,
- if_canInsertColumns<I> = true, if_compatible_data<D> = true>
+ template <typename D, typename I = Impl,
+ if_canInsertColumns<I> = true, if_compatible_column_data<D> = true>
bool insertColumn(int before, D &&data)
{
return insertColumnImpl(before, storage.root(), std::forward<D>(data));
}
template <typename C, typename I = Impl,
- if_canInsertColumns<I> = true, if_compatible_data_range<C> = true>
+ if_canInsertColumns<I> = true, if_compatible_column_range<C> = true>
bool insertColumns(int before, C &&data)
{
return insertColumnsImpl(before, storage.root(), std::forward<C>(data));
diff --git a/src/corelib/itemmodels/qrangemodeladapter.qdoc b/src/corelib/itemmodels/qrangemodeladapter.qdoc
index ff595529d34..88872589299 100644
--- a/src/corelib/itemmodels/qrangemodeladapter.qdoc
+++ b/src/corelib/itemmodels/qrangemodeladapter.qdoc
@@ -277,14 +277,6 @@
*/
/*!
- \typedef QRangeModelAdapter::const_row_reference
-*/
-
-/*!
- \typedef QRangeModelAdapter::row_reference
-*/
-
-/*!
\typedef QRangeModelAdapter::range_type
*/
@@ -531,8 +523,8 @@
*/
/*!
- \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::unless_list<I>> QRangeModelAdapter<Range, Protocol, Model>::const_row_reference QRangeModelAdapter<Range, Protocol, Model>::at(int row) const
- \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::unless_list<I>> QRangeModelAdapter<Range, Protocol, Model>::const_row_reference QRangeModelAdapter<Range, Protocol, Model>::operator[](int row) const
+ \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::unless_list<I>> decltype(auto) QRangeModelAdapter<Range, Protocol, Model>::at(int row) const
+ \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::unless_list<I>> decltype(auto) QRangeModelAdapter<Range, Protocol, Model>::operator[](int row) const
\return a constant reference to the row at \a row, as stored in \c Range.
@@ -540,8 +532,8 @@
*/
/*!
- \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_table<I>, QRangeModelAdapter<Range, Protocol, Model>::if_writable<I>> QRangeModelAdapter<Range, Protocol, Model>::row_reference QRangeModelAdapter<Range, Protocol, Model>::at(int row)
- \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_table<I>, QRangeModelAdapter<Range, Protocol, Model>::if_writable<I>> QRangeModelAdapter<Range, Protocol, Model>::row_reference QRangeModelAdapter<Range, Protocol, Model>::operator[](int row)
+ \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_table<I>, QRangeModelAdapter<Range, Protocol, Model>::if_writable<I>> auto QRangeModelAdapter<Range, Protocol, Model>::at(int row)
+ \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_table<I>, QRangeModelAdapter<Range, Protocol, Model>::if_writable<I>> auto QRangeModelAdapter<Range, Protocol, Model>::operator[](int row)
\return a mutable reference to the row at \a row, as stored in \c Range.
@@ -597,6 +589,16 @@
*/
/*!
+ \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_tree<I>> decltype(auto) QRangeModelAdapter<Range, Protocol, Model>::at(QSpan<const int> path) const
+ \fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_tree<I>> decltype(auto) QRangeModelAdapter<Range, Protocol, Model>::operator[](QSpan<const int> path) const
+
+ \return a constant reference to the row specified by \a path, as stored in
+ \c Range.
+
+ \constraints \c Range is a tree.
+*/
+
+/*!
\fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_tree<I>, QRangeModelAdapter<Range, Protocol, Model>::if_writable<I>> auto QRangeModelAdapter<Range, Protocol, Model>::at(QSpan<const int> path)
\fn template <typename Range, typename Protocol, typename Model> template <typename I, QRangeModelAdapter<Range, Protocol, Model>::if_tree<I>, QRangeModelAdapter<Range, Protocol, Model>::if_writable<I>> auto QRangeModelAdapter<Range, Protocol, Model>::operator[](QSpan<const int> path)
@@ -833,7 +835,7 @@
*/
/*!
- \fn template <typename Range, typename Protocol, typename Model> template <typename D, typename I, QRangeModelAdapter<Range, Protocol, Model>::if_canInsertColumns<I>, QRangeModelAdapter<Range, Protocol, Model>::if_compatible_data<D>> bool QRangeModelAdapter<Range, Protocol, Model>::insertColumn(int before, D &&data)
+ \fn template <typename Range, typename Protocol, typename Model> template <typename D, typename I, QRangeModelAdapter<Range, Protocol, Model>::if_canInsertColumns<I>, QRangeModelAdapter<Range, Protocol, Model>::if_compatible_column_data<D>> bool QRangeModelAdapter<Range, Protocol, Model>::insertColumn(int before, D &&data)
\overload
Inserts a single column constructed from \a data before the column specified
@@ -861,7 +863,7 @@
*/
/*!
- \fn template <typename Range, typename Protocol, typename Model> template <typename C, typename I, QRangeModelAdapter<Range, Protocol, Model>::if_canInsertColumns<I>, QRangeModelAdapter<Range, Protocol, Model>::if_compatible_data_range<C>> bool QRangeModelAdapter<Range, Protocol, Model>::insertColumns(int before, C &&data)
+ \fn template <typename Range, typename Protocol, typename Model> template <typename C, typename I, QRangeModelAdapter<Range, Protocol, Model>::if_canInsertColumns<I>, QRangeModelAdapter<Range, Protocol, Model>::if_compatible_column_range<C>> bool QRangeModelAdapter<Range, Protocol, Model>::insertColumns(int before, C &&data)
Inserts columns constructed from the elements in \a data before the column
specified by \a before into all rows, and returns whether the insertion was
diff --git a/src/corelib/kernel/qcore_mac.mm b/src/corelib/kernel/qcore_mac.mm
index 687fc7e85fa..f5f1f4a8cb8 100644
--- a/src/corelib/kernel/qcore_mac.mm
+++ b/src/corelib/kernel/qcore_mac.mm
@@ -22,6 +22,10 @@
#include <spawn.h>
#include <qdebug.h>
+#include <qpoint.h>
+#include <qsize.h>
+#include <qrect.h>
+#include <qmargins.h>
#include "qendian.h"
#include "qhash.h"
@@ -222,6 +226,34 @@ QDebug operator<<(QDebug dbg, CFStringRef stringRef)
return dbg;
}
+QDebug operator<<(QDebug dbg, CGPoint point)
+{
+ dbg << QPointF::fromCGPoint(point);
+ return dbg;
+}
+
+QDebug operator<<(QDebug dbg, CGSize size)
+{
+ dbg << QSizeF::fromCGSize(size);
+ return dbg;
+}
+
+QDebug operator<<(QDebug dbg, CGRect rect)
+{
+ dbg << QRectF::fromCGRect(rect);
+ return dbg;
+}
+
+#if defined(Q_OS_MACOS)
+QDebug operator<<(QDebug dbg, NSEdgeInsets insets)
+#else
+QDebug operator<<(QDebug dbg, UIEdgeInsets insets)
+#endif
+{
+ dbg << QMargins(insets.left, insets.top, insets.right, insets.bottom);
+ return dbg;
+}
+
// Prevents breaking the ODR in case we introduce support for more types
// later on, and lets the user override our default QDebug operators.
#define QT_DECLARE_WEAK_QDEBUG_OPERATOR_FOR_CF_TYPE(CFType) \
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index 2c4b4c02c55..1e57ee01e1d 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -78,6 +78,15 @@ kern_return_t IOObjectRelease(io_object_t object);
Q_FORWARD_DECLARE_OBJC_CLASS(NSObject);
Q_FORWARD_DECLARE_OBJC_CLASS(NSString);
+struct CGPoint;
+struct CGSize;
+struct CGRect;
+#if defined(Q_OS_MACOS)
+struct NSEdgeInsets;
+#else
+struct UIEdgeInsets;
+#endif
+
// @compatibility_alias doesn't work with categories or their methods
#define QtExtras QT_MANGLE_NAMESPACE(QtExtras)
@@ -225,6 +234,14 @@ Q_AUTOTEST_EXPORT void qt_mac_ensureResponsible();
#ifndef QT_NO_DEBUG_STREAM
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QMacAutoReleasePool *pool);
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QCFString &string);
+Q_CORE_EXPORT QDebug operator<<(QDebug, CGPoint);
+Q_CORE_EXPORT QDebug operator<<(QDebug, CGSize);
+Q_CORE_EXPORT QDebug operator<<(QDebug, CGRect);
+#if defined(Q_OS_MACOS)
+Q_CORE_EXPORT QDebug operator<<(QDebug, NSEdgeInsets);
+#else
+Q_CORE_EXPORT QDebug operator<<(QDebug, UIEdgeInsets);
+#endif
#endif
Q_CORE_EXPORT bool qt_apple_isApplicationExtension();
diff --git a/src/corelib/kernel/qeventdispatcher_cf.mm b/src/corelib/kernel/qeventdispatcher_cf.mm
index 2dddf147f85..d57c057a21a 100644
--- a/src/corelib/kernel/qeventdispatcher_cf.mm
+++ b/src/corelib/kernel/qeventdispatcher_cf.mm
@@ -207,6 +207,7 @@ QEventLoop *QEventDispatcherCoreFoundation::currentEventLoop() const
}
/*!
+ \internal
Processes all pending events that match \a flags until there are no
more events to process. Returns \c true if pending events were handled;
otherwise returns \c false.
diff --git a/src/corelib/kernel/qmetacontainer.h b/src/corelib/kernel/qmetacontainer.h
index c9d3a6bf9c6..66047afefd4 100644
--- a/src/corelib/kernel/qmetacontainer.h
+++ b/src/corelib/kernel/qmetacontainer.h
@@ -971,18 +971,11 @@ public:
Iterator mutableEnd();
QVariant at(qsizetype idx) const;
- void set(qsizetype idx, const QVariant &value);
+ void setAt(qsizetype idx, const QVariant &value);
void append(const QVariant &value);
void prepend(const QVariant &value);
void removeLast();
void removeFirst();
-
-#if QT_DEPRECATED_SINCE(6, 11)
- enum Position: quint8 { Unspecified, AtBegin, AtEnd };
- void addValue(const QVariant &value, Position position = Unspecified);
- void removeValue(Position position = Unspecified);
- QMetaType valueMetaType() const;
-#endif // QT_DEPRECATED_SINCE(6, 11)
};
#else
using Iterable = QtMetaContainerPrivate::Sequence;
diff --git a/src/corelib/kernel/qmetasequence.cpp b/src/corelib/kernel/qmetasequence.cpp
index 2a3a923d5ca..018dd610146 100644
--- a/src/corelib/kernel/qmetasequence.cpp
+++ b/src/corelib/kernel/qmetasequence.cpp
@@ -531,39 +531,6 @@ void QMetaSequence::valueAtConstIterator(const void *iterator, void *result) con
*/
/*!
- \enum QMetaSequence::Iterable::Position
- \deprecated [6.11] Use append(), prepend(), removeFirst(), or removeLast()
-
- Specifies the position at which an element shall be added to or removed from
- the iterable.
-
- \value AtBegin
- Add or remove at the beginning of the iterable.
- \value AtEnd
- Add or remove at the end of the iterable.
- \value Unspecified
- Add or remove at an unspecified position in the iterable.
- */
-
-/*!
- \fn void QMetaSequence::Iterable::addValue(const QVariant &value, Position position)
- \deprecated [6.11] Use append() or prepend()
- Adds \a value to the container, at \a position, if possible.
- */
-
-/*!
- \deprecated [6.11] Use removeFirst() or removeLast()
- \fn void QMetaSequence::Iterable::removeValue(Position position)
- Removes a value from the container, at \a position, if possible.
- */
-
-/*!
- \deprecated [6.11] Use QMetaSequence::valueMetaType()
- \fn QMetaType QMetaSequence::Iterable::valueMetaType() const
- Returns the meta type for values stored in the underlying container.
- */
-
-/*!
\fn QVariant QMetaSequence::Iterable::at(qsizetype idx) const
Returns the value at position \a idx in the container.
@@ -574,13 +541,8 @@ void QMetaSequence::valueAtConstIterator(const void *iterator, void *result) con
*/
/*!
- \fn void QMetaSequence::Iterable::set(qsizetype idx, const QVariant &value)
+ \fn void QMetaSequence::Iterable::setAt(qsizetype idx, const QVariant &value)
Sets the element at position \a idx in the container to \a value.
-
- \note If the underlying container does not provide a native way to assign
- an element at an index, this method will synthesize the assignment
- using iterators. This behavior is deprecated and will be removed in a
- future version of Qt.
*/
/*!
diff --git a/src/corelib/kernel/qmetasequence.h b/src/corelib/kernel/qmetasequence.h
index 26156e7924f..f8052476d79 100644
--- a/src/corelib/kernel/qmetasequence.h
+++ b/src/corelib/kernel/qmetasequence.h
@@ -196,25 +196,11 @@ public:
});
}
- void set(qsizetype idx, const QVariant &value)
+ void setAt(qsizetype idx, const QVariant &value)
{
const QMetaSequence meta = metaContainer();
QtPrivate::QVariantTypeCoercer coercer;
- const void *dataPtr = coercer.coerce(value, meta.valueMetaType());
- if (meta.canSetValueAtIndex()) {
- meta.setValueAtIndex(mutableIterable(), idx, dataPtr);
- return;
- }
-
-#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
- // We shouldn't second-guess the underlying container
- QtPrivate::warnSynthesizedAccess(
- "set() called on an iterable without native indexed accessors. This is slow");
- void *it = meta.begin(m_iterable.mutablePointer());
- meta.advanceIterator(it, idx);
- meta.setValueAtIterator(it, dataPtr);
- meta.destroyIterator(it);
-#endif
+ meta.setValueAtIndex(mutableIterable(), idx, coercer.coerce(value, meta.valueMetaType()));
}
void append(const QVariant &value)
@@ -261,6 +247,9 @@ public:
QMetaType valueMetaType() const
Q_DECL_EQ_DELETE_X("Use QMetaSequence::valueMetaType() instead.");
+ void set(qsizetype idx, const QVariant &value)
+ Q_DECL_EQ_DELETE_X("Use setAt() instead.");
+
QT_WARNING_POP
#endif // QT_DEPRECATED_SINCE(6, 11)
};
diff --git a/src/corelib/kernel/qpermissions.cpp b/src/corelib/kernel/qpermissions.cpp
index 6767917e176..69383dafdd9 100644
--- a/src/corelib/kernel/qpermissions.cpp
+++ b/src/corelib/kernel/qpermissions.cpp
@@ -119,7 +119,7 @@ Q_LOGGING_CATEGORY(lcPermissions, "qt.permissions", QtWarningMsg);
To ensure the relevant permission backend is included with your
application, please \l {QT_ANDROID_PACKAGE_SOURCE_DIR}
{point the build system to your custom \c AndroidManifest.xml}
- or use \l {qt_add_android_permission()}.
+ or use \l {qt_add_android_permission}().
The relevant permission names are described in the documentation
for each permission type.
diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp
index d538ed7b4e9..9141a8f8bad 100644
--- a/src/corelib/kernel/qproperty.cpp
+++ b/src/corelib/kernel/qproperty.cpp
@@ -402,6 +402,16 @@ QPropertyBindingPrivate::NotificationState QPropertyBindingPrivate::notifyNonRec
}
/*!
+ \class QUntypedPropertyBinding
+ \inmodule QtCore
+ \since 6.0
+ \ingroup tools
+ \brief Represents a type-erased property binding.
+
+ \sa QUntypedBindable
+*/
+
+/*!
Constructs a null QUntypedPropertyBinding.
\sa isNull()
@@ -409,8 +419,8 @@ QPropertyBindingPrivate::NotificationState QPropertyBindingPrivate::notifyNonRec
QUntypedPropertyBinding::QUntypedPropertyBinding() = default;
/*!
- \fn template<typename Functor>
- QUntypedPropertyBinding(QMetaType metaType, Functor &&f, const QPropertyBindingSourceLocation &location)
+ \fn template<typename Functor> QUntypedPropertyBinding(
+ QMetaType metaType, Functor &&f, const QPropertyBindingSourceLocation &location)
\internal
*/
@@ -448,7 +458,6 @@ QUntypedPropertyBinding::QUntypedPropertyBinding(const QUntypedPropertyBinding &
: d(other.d)
{
}
-
/*!
Copy-assigns \a other to this QUntypedPropertyBinding.
*/
@@ -1183,7 +1192,7 @@ QString QPropertyBindingError::description() const
\return \c true when the binding was successfully set.
- //! \sa QUntypedPropertyBinding::valueMetaType()
+ \sa QUntypedPropertyBinding::valueMetaType()
*/
/*!
@@ -1199,8 +1208,7 @@ QString QPropertyBindingError::description() const
Returns the metatype of the property from which the QUntypedBindable was created.
If the bindable is invalid, an invalid metatype will be returned.
- \sa isValid()
- //! \sa QUntypedPropertyBinding::valueMetaType()
+ \sa isValid(), QUntypedPropertyBinding::valueMetaType()
*/
/*!
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index 9fdac89f775..6000edaa177 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -392,8 +392,8 @@ public:
translation files may contain misleading or malicious translations.
\sa QCoreApplication::installTranslator(), QCoreApplication::removeTranslator(),
- QObject::tr(), QCoreApplication::translate(), {I18N Example},
- {Hello tr() Example}, {Arrow Pad Example}, {Troll Print Example}
+ QObject::tr(), QCoreApplication::translate(),
+ {Localized Clock Example}, {Arrow Pad Example}, {Troll Print Example}
*/
/*!
diff --git a/src/corelib/platform/windows/qbstr_p.h b/src/corelib/platform/windows/qbstr_p.h
index 21eecfe2df7..32b1aace76f 100644
--- a/src/corelib/platform/windows/qbstr_p.h
+++ b/src/corelib/platform/windows/qbstr_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
#ifndef QBSTR_P_H
#define QBSTR_P_H
@@ -141,4 +142,4 @@ QT_END_NAMESPACE
#endif // Q_OS_WIN
-#endif // QCOMPTR_P_H
+#endif // QBSTR_P_H
diff --git a/src/corelib/platform/windows/qcomobject_p.h b/src/corelib/platform/windows/qcomobject_p.h
index bd6f81d1c28..b7a9c56555d 100644
--- a/src/corelib/platform/windows/qcomobject_p.h
+++ b/src/corelib/platform/windows/qcomobject_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
#ifndef QCOMOBJECT_P_H
#define QCOMOBJECT_P_H
diff --git a/src/corelib/platform/windows/qcomptr_p.h b/src/corelib/platform/windows/qcomptr_p.h
index 2a69e7b6038..e640528d3c2 100644
--- a/src/corelib/platform/windows/qcomptr_p.h
+++ b/src/corelib/platform/windows/qcomptr_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
#ifndef QCOMPTR_P_H
#define QCOMPTR_P_H
diff --git a/src/corelib/platform/windows/qcomvariant_p.h b/src/corelib/platform/windows/qcomvariant_p.h
index 34ce5f179ce..cc4ad104106 100644
--- a/src/corelib/platform/windows/qcomvariant_p.h
+++ b/src/corelib/platform/windows/qcomvariant_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
#ifndef QCOMVARIANT_P_H
#define QCOMVARIANT_P_H
diff --git a/src/corelib/platform/windows/qfactorycacheregistration.cpp b/src/corelib/platform/windows/qfactorycacheregistration.cpp
index 6bd69c66d14..04c81b7b665 100644
--- a/src/corelib/platform/windows/qfactorycacheregistration.cpp
+++ b/src/corelib/platform/windows/qfactorycacheregistration.cpp
@@ -1,5 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
#include "qfactorycacheregistration_p.h"
diff --git a/src/corelib/platform/windows/qfactorycacheregistration_p.h b/src/corelib/platform/windows/qfactorycacheregistration_p.h
index d0b19b995b4..f6e7d9eb064 100644
--- a/src/corelib/platform/windows/qfactorycacheregistration_p.h
+++ b/src/corelib/platform/windows/qfactorycacheregistration_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
#ifndef QFACTORYCACHEREGISTRATION_P_H
#define QFACTORYCACHEREGISTRATION_P_H
diff --git a/src/corelib/platform/windows/qt_winrtbase_p.h b/src/corelib/platform/windows/qt_winrtbase_p.h
index 79c2bdf6b1c..69a602a59e0 100644
--- a/src/corelib/platform/windows/qt_winrtbase_p.h
+++ b/src/corelib/platform/windows/qt_winrtbase_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Qt-Security score:significant reason:default
#ifndef QT_WINRTBASE_P_H
#define QT_WINRTBASE_P_H
diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp
index 13d74e591d5..0aeb2b07f47 100644
--- a/src/corelib/serialization/qcborvalue.cpp
+++ b/src/corelib/serialization/qcborvalue.cpp
@@ -975,6 +975,7 @@ QCborContainerPrivate *QCborContainerPrivate::detach(QCborContainerPrivate *d, q
}
/*!
+ \internal
Prepare for an insertion at position \a index
Detaches and ensures there are at least index entries in the array, padding
diff --git a/src/corelib/serialization/qdatastream.cpp b/src/corelib/serialization/qdatastream.cpp
index ae3bed5b751..fd2f7faeee5 100644
--- a/src/corelib/serialization/qdatastream.cpp
+++ b/src/corelib/serialization/qdatastream.cpp
@@ -552,6 +552,7 @@ void QDataStream::setByteOrder(ByteOrder bo)
\value Qt_6_9
\value Qt_6_10
\value Qt_6_11
+ \value Qt_6_12
\omitvalue Qt_DefaultCompiledVersion
\sa setVersion(), version()
diff --git a/src/corelib/serialization/qdatastream.h b/src/corelib/serialization/qdatastream.h
index 04373fe9c8a..d6fcf17efcd 100644
--- a/src/corelib/serialization/qdatastream.h
+++ b/src/corelib/serialization/qdatastream.h
@@ -96,8 +96,9 @@ public:
Qt_6_9 = Qt_6_7,
Qt_6_10 = 23,
Qt_6_11 = 24,
- Qt_DefaultCompiledVersion = Qt_6_11
-#if QT_VERSION >= QT_VERSION_CHECK(6, 12, 0)
+ Qt_6_12 = Qt_6_11,
+ Qt_DefaultCompiledVersion = Qt_6_12
+#if QT_VERSION >= QT_VERSION_CHECK(6, 13, 0)
#error Add the datastream version for this Qt version and update Qt_DefaultCompiledVersion
#endif
};
diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp
index 9cd90fa9d65..ff70289013a 100644
--- a/src/corelib/serialization/qxmlstream.cpp
+++ b/src/corelib/serialization/qxmlstream.cpp
@@ -3678,7 +3678,7 @@ void QXmlStreamWriter::setStopWritingOnError(bool stop)
The error status is never reset. Writes happening after the error
occurred may be ignored, even if the error condition is cleared.
- \sa error(), errorString(), raiseError(const QString &message),
+ \sa error(), errorString(), raiseError()
*/
bool QXmlStreamWriter::hasError() const
{
@@ -3692,7 +3692,7 @@ bool QXmlStreamWriter::hasError() const
QXmlStreamWriter::Error::None.
\since 6.10
- \sa errorString(), raiseError(const QString &message), hasError()
+ \sa errorString(), raiseError(), hasError()
*/
QXmlStreamWriter::Error QXmlStreamWriter::error() const
{
@@ -3708,7 +3708,7 @@ QXmlStreamWriter::Error QXmlStreamWriter::error() const
a null string.
\since 6.10
- \sa error(), raiseError(const QString &message), hasError()
+ \sa error(), raiseError(), hasError()
*/
QString QXmlStreamWriter::errorString() const
{
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp
index fed09aee45e..18007cacae6 100644
--- a/src/corelib/text/qlocale.cpp
+++ b/src/corelib/text/qlocale.cpp
@@ -301,6 +301,7 @@ bool operator<(LikelyPair lhs, LikelyPair rhs)
} // anonymous namespace
/*!
+ \internal
Fill in blank fields of a locale ID.
An ID in which some fields are zero stands for any locale that agrees with
diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp
index 5cc8e8681bb..0c65e18ec10 100644
--- a/src/corelib/text/qregularexpression.cpp
+++ b/src/corelib/text/qregularexpression.cpp
@@ -952,7 +952,7 @@ void QRegularExpressionPrivate::getPatternInfo()
namespace {
struct PcreJitStackFree
{
- void operator()(pcre2_jit_stack_16 *stack)
+ void operator()(pcre2_jit_stack_16 *stack) const
{
if (stack)
pcre2_jit_stack_free_16(stack);
diff --git a/src/corelib/text/qstringconverter.cpp b/src/corelib/text/qstringconverter.cpp
index bf6e776ee0e..896142b4837 100644
--- a/src/corelib/text/qstringconverter.cpp
+++ b/src/corelib/text/qstringconverter.cpp
@@ -2739,7 +2739,7 @@ QStringList QStringConverter::availableCodecs()
May also provide data from residual content that was pending decoding.
When there is no residual data to account for, the return's \c error
- field will be set to \l {QCharConverter::FinalizeResult::Error::}
+ field will be set to \l {QStringConverter::FinalizeResultChar::error}
{NoError}.
If \a out is supplied and non-null, it must have space in which up to
@@ -2793,7 +2793,7 @@ auto QStringDecoder::finalize(char16_t *out, qsizetype maxlen) -> FinalizeResult
May also provide data from residual content that was pending decoding.
When there is no residual data to account for, the return's \c error
- field will be set to \l {QCharConverter::FinalizeResult::Error::}
+ field will be set to \l {QStringConverter::FinalizeResultChar::error}
{NoError}.
If \a out is supplied and non-null, it must have space in which up to
diff --git a/src/corelib/thread/qfuture.qdoc b/src/corelib/thread/qfuture.qdoc
index f3f32e20adc..5e97086694b 100644
--- a/src/corelib/thread/qfuture.qdoc
+++ b/src/corelib/thread/qfuture.qdoc
@@ -786,7 +786,7 @@
between the second and third result, and returns the second result; and
so on.
- \image javaiterators1.png
+ \image javaiterators1.svg
Here's how to iterate over the elements in reverse order:
diff --git a/src/corelib/thread/qfuture_impl.h b/src/corelib/thread/qfuture_impl.h
index 371ee524d72..d6c185cd704 100644
--- a/src/corelib/thread/qfuture_impl.h
+++ b/src/corelib/thread/qfuture_impl.h
@@ -845,7 +845,7 @@ struct UnwrapHandler
using NestedType = typename QtPrivate::Future<ResultType>::type;
QFutureInterface<NestedType> promise(QFutureInterfaceBase::State::Pending);
- outer->then([promise](const QFuture<ResultType> &outerFuture) mutable {
+ auto chain = outer->then([promise](const QFuture<ResultType> &outerFuture) mutable {
// We use the .then([](QFuture<ResultType> outerFuture) {...}) version
// (where outerFuture == *outer), to propagate the exception if the
// outer future has failed.
@@ -883,6 +883,13 @@ struct UnwrapHandler
promise.reportCanceled();
promise.reportFinished();
});
+
+ // Inject the promise into the chain.
+ // We use a fake function as a continuation, since the promise is
+ // managed by the outer future
+ chain.d.setContinuation(ContinuationWrapper(std::move([](const QFutureInterfaceBase &) {})),
+ promise.d, QFutureInterfaceBase::ContinuationType::Then);
+
return promise.future();
}
};
diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h
index 0b88013800e..ff17560d3a1 100644
--- a/src/corelib/thread/qfutureinterface.h
+++ b/src/corelib/thread/qfutureinterface.h
@@ -42,6 +42,8 @@ template<class Function, class ResultType>
class FailureHandler;
#endif
+struct UnwrapHandler;
+
#if QT_CORE_REMOVED_SINCE(6, 10)
void Q_CORE_EXPORT watchContinuationImpl(const QObject *context,
QtPrivate::QSlotObjectBase *slotObj,
@@ -187,6 +189,8 @@ private:
friend class QtPrivate::FailureHandler;
#endif
+ friend struct QtPrivate::UnwrapHandler;
+
#if QT_CORE_REMOVED_SINCE(6, 10)
friend Q_CORE_EXPORT void QtPrivate::watchContinuationImpl(
const QObject *context, QtPrivate::QSlotObjectBase *slotObj, QFutureInterfaceBase &fi);
diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp
index 96e35dcb965..2a1af2315ca 100644
--- a/src/corelib/thread/qreadwritelock.cpp
+++ b/src/corelib/thread/qreadwritelock.cpp
@@ -234,14 +234,14 @@ QBasicReadWriteLock::contendedTryLockForRead(QDeadlineTimer timeout, void *dd)
return d->recursiveLockForRead(timeout);
auto lock = qt_unique_lock(d->mutex);
- if (d != d_ptr.loadRelaxed()) {
+ if (QReadWriteLockPrivate *dd = d_ptr.loadAcquire(); d != dd) {
// d_ptr has changed: this QReadWriteLock was unlocked before we had
// time to lock d->mutex.
// We are holding a lock to a mutex within a QReadWriteLockPrivate
// that is already released (or even is already re-used). That's ok
// because the QFreeList never frees them.
// Just unlock d->mutex (at the end of the scope) and retry.
- d = d_ptr.loadAcquire();
+ d = dd;
continue;
}
return d->lockForRead(lock, timeout);
@@ -340,11 +340,11 @@ QBasicReadWriteLock::contendedTryLockForWrite(QDeadlineTimer timeout, void *dd)
return d->recursiveLockForWrite(timeout);
auto lock = qt_unique_lock(d->mutex);
- if (d != d_ptr.loadRelaxed()) {
+ if (QReadWriteLockPrivate *dd = d_ptr.loadAcquire(); d != dd) {
// The mutex was unlocked before we had time to lock the mutex.
// We are holding to a mutex within a QReadWriteLockPrivate that is already released
// (or even is already re-used) but that's ok because the QFreeList never frees them.
- d = d_ptr.loadAcquire();
+ d = dd;
continue;
}
return d->lockForWrite(lock, timeout);
diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp
index 10882738a39..05ba3d2beae 100644
--- a/src/corelib/time/qdatetimeparser.cpp
+++ b/src/corelib/time/qdatetimeparser.cpp
@@ -2389,6 +2389,7 @@ bool operator==(QDateTimeParser::SectionNode s1, QDateTimeParser::SectionNode s2
}
/*!
+ \internal
Sets \a cal as the calendar to use. The default is Gregorian.
*/
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index de68a0042ac..1e647a83dc0 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -332,15 +332,13 @@ struct TCBPoint
qreal _c;
qreal _b;
- TCBPoint() {}
- TCBPoint(QPointF point, qreal t, qreal c, qreal b) : _point(point), _t(t), _c(c), _b(b) {}
- bool operator==(const TCBPoint &other) const
+ friend bool operator==(const TCBPoint &lhs, const TCBPoint &rhs) noexcept
{
- return _point == other._point &&
- qFuzzyCompare(_t, other._t) &&
- qFuzzyCompare(_c, other._c) &&
- qFuzzyCompare(_b, other._b);
+ return qFuzzyCompare(lhs._point, rhs._point)
+ && QtPrivate::fuzzyCompare(lhs._t, rhs._t)
+ && QtPrivate::fuzzyCompare(lhs._c, rhs._c)
+ && QtPrivate::fuzzyCompare(lhs._b, rhs._b);
}
};
Q_DECLARE_TYPEINFO(TCBPoint, Q_PRIMITIVE_TYPE);
@@ -1381,7 +1379,7 @@ void QEasingCurve::addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qre
if (!d_ptr->config)
d_ptr->config = curveToFunctionObject(d_ptr->type);
- d_ptr->config->_tcbPoints.append(TCBPoint(nextPoint, t, c, b));
+ d_ptr->config->_tcbPoints.append(TCBPoint{nextPoint, t, c, b});
if (nextPoint == QPointF(1.0, 1.0)) {
d_ptr->config->_bezierCurves = tcbToBezier(d_ptr->config->_tcbPoints);
diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf
index 24d9d522735..8b7569c1296 100644
--- a/src/gui/doc/qtgui.qdocconf
+++ b/src/gui/doc/qtgui.qdocconf
@@ -50,7 +50,8 @@ depends += \
qtshadertools \
qttestlib \
qtplatformintegration \
- qthelp
+ qthelp \
+ qtquickcontrols
headerdirs += ..
diff --git a/src/gui/doc/src/external-resources.qdoc b/src/gui/doc/src/external-resources.qdoc
index 0f356dd5046..14ed0817e62 100644
--- a/src/gui/doc/src/external-resources.qdoc
+++ b/src/gui/doc/src/external-resources.qdoc
@@ -36,6 +36,7 @@
\externalpage https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
\title Freedesktop Icon Naming Specification
*/
+
/*!
\externalpage https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout
\title Icon Theme Specification - Directory Layout
diff --git a/src/gui/itemmodels/qfileinfogatherer.cpp b/src/gui/itemmodels/qfileinfogatherer.cpp
index b7ab3dbbc46..ea19db0d20f 100644
--- a/src/gui/itemmodels/qfileinfogatherer.cpp
+++ b/src/gui/itemmodels/qfileinfogatherer.cpp
@@ -46,6 +46,12 @@ static QString translateDriveName(const QFileInfo &drive)
}
/*!
+ \class QFileInfoGatherer
+ \inmodule QtGui
+ \internal
+*/
+
+/*!
Creates thread
*/
QFileInfoGatherer::QFileInfoGatherer(QObject *parent)
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 741b089306e..e8df40f21b2 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -490,6 +490,12 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME
*/
/*!
+ \class QGuiApplicationPrivate
+ \inmodule QtGui
+ \internal
+*/
+
+/*!
Initializes the window system and constructs an application object with
\a argc command line arguments in \a argv.
diff --git a/src/gui/kernel/qplatformintegrationfactory.cpp b/src/gui/kernel/qplatformintegrationfactory.cpp
index d0a5e8871f8..d113e86090d 100644
--- a/src/gui/kernel/qplatformintegrationfactory.cpp
+++ b/src/gui/kernel/qplatformintegrationfactory.cpp
@@ -24,6 +24,7 @@ QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platfor
}
/*!
+ \internal
Returns the list of valid keys, i.e. the keys this factory can
create styles for.
diff --git a/src/gui/kernel/qplatformthemefactory.cpp b/src/gui/kernel/qplatformthemefactory.cpp
index beefa1c2942..3ac462598fd 100644
--- a/src/gui/kernel/qplatformthemefactory.cpp
+++ b/src/gui/kernel/qplatformthemefactory.cpp
@@ -31,6 +31,7 @@ QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString
}
/*!
+ \internal
Returns the list of valid keys, i.e. the keys this factory can
create styles for.
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 6b45d26fb4c..cb927d7c296 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -192,6 +192,12 @@ QOpenGLFunctions::QOpenGLFunctions(QOpenGLContext *context)
qWarning("QOpenGLFunctions created with non-current context");
}
+/*!
+ \class QOpenGLExtensions
+ \inmodule QtGui
+ \internal
+*/
+
QOpenGLExtensions::QOpenGLExtensions()
{
}
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index fe79490f54b..d63da38b747 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -2196,29 +2196,27 @@ QColor QColor::toHsv() const noexcept
color.ct.ahsv.alpha = ct.argb.alpha;
color.ct.ahsv.pad = 0;
- const float r = ct.argb.red / float(USHRT_MAX);
- const float g = ct.argb.green / float(USHRT_MAX);
- const float b = ct.argb.blue / float(USHRT_MAX);
- const float max = Q_MAX_3(r, g, b);
- const float min = Q_MIN_3(r, g, b);
- const float delta = max - min;
- color.ct.ahsv.value = qRound(max * USHRT_MAX);
- if (qFuzzyIsNull(delta)) {
+ const ushort r = ct.argb.red;
+ const ushort g = ct.argb.green;
+ const ushort b = ct.argb.blue;
+ const auto [min, max] = std::minmax({r, g, b});
+ color.ct.ahsv.value = max;
+ if (max == min) {
// achromatic case, hue is undefined
color.ct.ahsv.hue = USHRT_MAX;
color.ct.ahsv.saturation = 0;
} else {
// chromatic case
- float hue = 0;
+ const float delta = max - min; // cannot overflow
+ float hue;
color.ct.ahsv.saturation = qRound((delta / max) * USHRT_MAX);
- if (qFuzzyCompare(r, max)) {
- hue = ((g - b) /delta);
- } else if (qFuzzyCompare(g, max)) {
- hue = (2.0f + (b - r) / delta);
- } else if (qFuzzyCompare(b, max)) {
- hue = (4.0f + (r - g) / delta);
+ if (max == r) {
+ hue = 0 + (g - b) / delta;
+ } else if (max == g) {
+ hue = 2 + (b - r) / delta;
} else {
- Q_ASSERT_X(false, "QColor::toHsv", "internal error");
+ Q_ASSERT(max == b); // max({r,g,b}) must be one of r, g, and b!
+ hue = 4 + (r - g) / delta;
}
hue *= 60.0f;
if (hue < 0.0f)
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 047be5f1c3d..8e815394849 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -2881,6 +2881,7 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
/*!
+ * \internal
* Returns \c true if the rectangle is completely within the current clip
* state of the paint engine.
*/
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index cc80641ded9..ab9e7fe312a 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -6,9 +6,11 @@
#include <QtGui/qtguiglobal.h>
#include <QtGui/qtransform.h>
+
#include <QtCore/qglobal.h>
#include <QtCore/qline.h>
#include <QtCore/qlist.h>
+#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 908051a477c..b1ea3f240f1 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -3192,6 +3192,7 @@ static inline bool is_monochrome(const QList<QRgb> &colorTable)
}
/*!
+ * \internal
* Adds an image to the pdf and return the pdf-object id. Returns -1 if adding the image failed.
*/
int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, bool lossless, qint64 serial_no)
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index 0d435c95048..08128c30a70 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -145,6 +145,11 @@ static inline qreal adapted_angle_on_x(const QLineF &line)
return QLineF(0, 0, 1, 0).angleTo(line);
}
+/*!
+ \class QStrokerOps
+ \inmodule QtGui
+ \internal
+*/
QStrokerOps::QStrokerOps()
: m_elements(0)
, m_curveThreshold(qt_real_to_fixed(0.25))
@@ -373,6 +378,7 @@ QStroker::LineJoinMode QStroker::joinModeForJoin(Qt::PenJoinStyle joinStyle)
/*!
+ \internal
This function is called to stroke the currently built up
subpath. The subpath is cleared when the function completes.
*/
diff --git a/src/gui/platform/unix/dbusmenu/qdbusplatformmenu.cpp b/src/gui/platform/unix/dbusmenu/qdbusplatformmenu.cpp
index fe050461260..00c3192e00a 100644
--- a/src/gui/platform/unix/dbusmenu/qdbusplatformmenu.cpp
+++ b/src/gui/platform/unix/dbusmenu/qdbusplatformmenu.cpp
@@ -48,6 +48,7 @@ void QDBusPlatformMenuItem::setIcon(const QIcon &icon)
}
/*!
+ \internal
Set a submenu under this menu item.
*/
void QDBusPlatformMenuItem::setMenu(QPlatformMenu *menu)
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index d41296291f6..4df55d5b89c 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -402,7 +402,7 @@ bool QFontEngine::processHheaTable() const
const qreal unitsPerEm = emSquareSize().toReal();
// Bail out if values are too large for QFixed
- const auto limitForQFixed = qreal(std::numeric_limits<int>::max() / 64) / fontDef.pixelSize;
+ const auto limitForQFixed = qreal(std::numeric_limits<int>::max() >> 6) / fontDef.pixelSize;
if (ascent > limitForQFixed || descent > limitForQFixed || leading > limitForQFixed)
return false;
m_ascent = QFixed::fromReal(ascent * fontDef.pixelSize / unitsPerEm);
@@ -470,7 +470,7 @@ bool QFontEngine::processOS2Table() const
if (typoAscent == 0 && typoDescent == 0)
return false;
// Bail out if values are too large for QFixed
- const auto limitForQFixed = qreal(std::numeric_limits<int>::max() / 64) / fontDef.pixelSize;
+ const auto limitForQFixed = qreal(std::numeric_limits<int>::max() >> 6) / fontDef.pixelSize;
if (typoAscent > limitForQFixed || typoDescent > limitForQFixed
|| typoLineGap > limitForQFixed)
return false;
@@ -481,7 +481,7 @@ bool QFontEngine::processOS2Table() const
// Some fonts may have invalid OS/2 data. We detect this and bail out.
if (winAscent == 0 && winDescent == 0)
return false;
- const auto limitForQFixed = qreal(std::numeric_limits<int>::max() / 64) / fontDef.pixelSize;
+ const auto limitForQFixed = qreal(std::numeric_limits<int>::max() >> 6) / fontDef.pixelSize;
if (winAscent > limitForQFixed || winDescent > limitForQFixed)
return false;
m_ascent = QFixed::fromReal(winAscent * fontDef.pixelSize / unitsPerEm);
@@ -1059,6 +1059,7 @@ void QFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metr
}
/*!
+ \internal
Returns \c true if the font table idetified by \a tag exists in the font;
returns \c false otherwise.
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 4f01d09fed1..d519cd5a5d3 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -2385,6 +2385,11 @@ static QString colorValue(QColor color)
return result;
}
+/*!
+ \class QTextHtmlExporter
+ \inmodule QtGui
+ \internal
+*/
QTextHtmlExporter::QTextHtmlExporter(const QTextDocument *_doc)
: doc(_doc), fragmentMarkers(false)
{
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index 227cbae2952..85a74d366ac 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -1006,6 +1006,7 @@ int QTextDocumentPrivate::undoRedo(bool undo)
}
/*!
+ \internal
Appends a custom undo \a item to the undo stack.
*/
void QTextDocumentPrivate::appendUndoItem(QAbstractUndoItem *item)
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index ff8644b5302..337228ff170 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -394,11 +394,9 @@ void QTextTablePrivate::fragmentRemoved(QChar type, uint fragment)
}
/*!
- /fn void QTextTablePrivate::update() const
-
+ \internal
This function is usually called when the table is "dirty".
It seems to update all kind of table information.
-
*/
void QTextTablePrivate::update() const
{
diff --git a/src/gui/util/qlayoutpolicy.cpp b/src/gui/util/qlayoutpolicy.cpp
index 4d81a426835..0c0651c1f39 100644
--- a/src/gui/util/qlayoutpolicy.cpp
+++ b/src/gui/util/qlayoutpolicy.cpp
@@ -8,6 +8,11 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QLayoutPolicy
+ \inmodule QtGui
+ \internal
+*/
void QLayoutPolicy::setControlType(ControlType type)
{
/*
diff --git a/src/network/access/qbytedatabuffer_p.h b/src/network/access/qbytedatabuffer_p.h
index a119093cf7e..036b562d06a 100644
--- a/src/network/access/qbytedatabuffer_p.h
+++ b/src/network/access/qbytedatabuffer_p.h
@@ -280,6 +280,8 @@ public:
}
return false;
}
+
+ const QByteArray &last() const { return buffers.last(); }
};
QT_END_NAMESPACE
diff --git a/src/network/access/qhttp2connection.cpp b/src/network/access/qhttp2connection.cpp
index 2895e8335d2..c0b07ddd652 100644
--- a/src/network/access/qhttp2connection.cpp
+++ b/src/network/access/qhttp2connection.cpp
@@ -34,8 +34,38 @@ using namespace Http2;
\sa QHttp2Connection
*/
-QHttp2Stream::QHttp2Stream(QHttp2Connection *connection, quint32 streamID) noexcept
- : QObject(connection), m_streamID(streamID)
+/*!
+ \struct QHttp2Stream::Configuration
+ \inmodule QtNetwork
+ \internal
+
+ \brief Configuration options for a QHttp2Stream.
+
+ The Configuration struct holds options that control stream behavior.
+
+ \sa QHttp2Connection::createStream()
+*/
+
+/*!
+ \variable QHttp2Stream::Configuration::useDownloadBuffer
+
+ Controls whether incoming DATA frames, from QHttp2Stream::dataReceived(),
+ are buffered. The default is \c true.
+
+ You may disable buffering for client-initiated streams when the
+ application processes DATA immediately.
+
+ Buffering must remain enabled for pushed streams. A pushed stream can
+ receive DATA before the application becomes aware of them and the buffered
+ DATA is required to deliver the pushed response.
+
+ \sa QHttp2Stream::downloadBuffer(), QHttp2Stream::takeDownloadBuffer(),
+ QHttp2Configuration::serverPushEnabled(), QHttp2Stream::dataReceived()
+*/
+
+QHttp2Stream::QHttp2Stream(QHttp2Connection *connection, quint32 streamID,
+ Configuration configuration) noexcept
+ : QObject(connection), m_streamID(streamID), m_configuration(configuration)
{
Q_ASSERT(connection);
Q_ASSERT(streamID); // stream id 0 is reserved for connection control messages
@@ -213,6 +243,12 @@ QHttp2Stream::~QHttp2Stream() noexcept {
Returns the buffer containing the data received from the remote peer.
*/
+/*!
+ \fn QHttp2Stream::Configuration QHttp2Stream::configuration() const
+
+ Returns the configuration of this stream.
+*/
+
void QHttp2Stream::finishWithError(Http2::Http2Error errorCode, const QString &message)
{
qCDebug(qHttp2ConnectionLog, "[%p] stream %u finished with error: %ls (error code: %u)",
@@ -697,8 +733,14 @@ void QHttp2Stream::handleDATA(const Frame &inboundFrame)
inboundFrame.dataSize());
if (endStream)
transitionState(StateTransition::CloseRemote);
- emit dataReceived(fragment, endStream);
- m_downloadBuffer.append(std::move(fragment));
+ const auto shouldBuffer = m_configuration.useDownloadBuffer && !fragment.isEmpty();
+ if (shouldBuffer) {
+ // Only non-empty fragments get appended!
+ m_downloadBuffer.append(std::move(fragment));
+ emit dataReceived(m_downloadBuffer.last(), endStream);
+ } else {
+ emit dataReceived(fragment, endStream);
+ }
}
if (!endStream && m_recvWindow < connection->streamInitialReceiveWindowSize / 2) {
@@ -885,23 +927,35 @@ QHttp2Connection *QHttp2Connection::createDirectServerConnection(QIODevice *sock
}
/*!
- Creates a stream on this connection.
+ \fn QH2Expected<QHttp2Stream *, QHttp2Connection::CreateStreamError> QHttp2Connection::createStream()
+ Creates a stream on this connection, using the default QHttp2Stream::Configuration.
+
+//! [createStream]
Automatically picks the next available stream ID and returns a pointer to
the new stream, if possible. Otherwise returns an error.
\sa QHttp2Connection::CreateStreamError, QHttp2Stream
+//! [createStream]
+ \sa createStream(QHttp2Stream::Configuration)
+*/
+
+/*!
+ Creates a stream with \a configuration on this connection.
+
+ \include qhttp2connection.cpp createStream
*/
-QH2Expected<QHttp2Stream *, QHttp2Connection::CreateStreamError> QHttp2Connection::createStream()
+QH2Expected<QHttp2Stream *, QHttp2Connection::CreateStreamError>
+QHttp2Connection::createStream(QHttp2Stream::Configuration configuration)
{
Q_ASSERT(m_connectionType == Type::Client); // This overload is just for clients
if (m_nextStreamID > lastValidStreamID)
return { QHttp2Connection::CreateStreamError::StreamIdsExhausted };
- return createLocalStreamInternal();
+ return createLocalStreamInternal(configuration);
}
QH2Expected<QHttp2Stream *, QHttp2Connection::CreateStreamError>
-QHttp2Connection::createLocalStreamInternal()
+QHttp2Connection::createLocalStreamInternal(QHttp2Stream::Configuration conf)
{
if (m_goingAway)
return { QHttp2Connection::CreateStreamError::ReceivedGOAWAY };
@@ -909,7 +963,7 @@ QHttp2Connection::createLocalStreamInternal()
if (size_t(m_peerMaxConcurrentStreams) <= size_t(numActiveLocalStreams()))
return { QHttp2Connection::CreateStreamError::MaxConcurrentStreamsReached };
- if (QHttp2Stream *ptr = createStreamInternal_impl(streamID)) {
+ if (QHttp2Stream *ptr = createStreamInternal_impl(streamID, conf)) {
m_nextStreamID += 2;
return {ptr};
}
@@ -917,7 +971,8 @@ QHttp2Connection::createLocalStreamInternal()
return { QHttp2Connection::CreateStreamError::UnknownError };
}
-QHttp2Stream *QHttp2Connection::createStreamInternal_impl(quint32 streamID)
+QHttp2Stream *QHttp2Connection::createStreamInternal_impl(quint32 streamID,
+ QHttp2Stream::Configuration conf)
{
Q_ASSERT(streamID > m_lastIncomingStreamID || streamID >= m_nextStreamID);
@@ -930,7 +985,7 @@ QHttp2Stream *QHttp2Connection::createStreamInternal_impl(quint32 streamID)
if (!result.inserted)
return nullptr;
QPointer<QHttp2Stream> &stream = result.iterator.value();
- stream = new QHttp2Stream(this, streamID);
+ stream = new QHttp2Stream(this, streamID, conf);
stream->m_recvWindow = streamInitialReceiveWindowSize;
stream->m_sendWindow = streamInitialSendWindowSize;
diff --git a/src/network/access/qhttp2connection_p.h b/src/network/access/qhttp2connection_p.h
index f3f14145278..e2af7d7ab33 100644
--- a/src/network/access/qhttp2connection_p.h
+++ b/src/network/access/qhttp2connection_p.h
@@ -101,6 +101,11 @@ public:
Q_ENUM(State)
constexpr static quint8 DefaultPriority = 127;
+ struct Configuration
+ {
+ bool useDownloadBuffer = true;
+ };
+
~QHttp2Stream() noexcept;
// HTTP2 things
@@ -124,6 +129,8 @@ public:
QByteDataBuffer takeDownloadBuffer() noexcept { return std::exchange(m_downloadBuffer, {}); }
void clearDownloadBuffer() { m_downloadBuffer.clear(); }
+ Configuration configuration() const { return m_configuration; }
+
Q_SIGNALS:
void headersReceived(const HPack::HttpHeader &headers, bool endStream);
void headersUpdated();
@@ -154,7 +161,8 @@ private Q_SLOTS:
private:
friend class QHttp2Connection;
- QHttp2Stream(QHttp2Connection *connection, quint32 streamID) noexcept;
+ QHttp2Stream(QHttp2Connection *connection, quint32 streamID,
+ Configuration configuration) noexcept;
[[nodiscard]] QHttp2Connection *getConnection() const
{
@@ -201,6 +209,8 @@ private:
bool m_isReserved = false;
bool m_owningByteDevice = false;
+ const Configuration m_configuration;
+
friend tst_QHttp2Connection;
};
@@ -235,7 +245,12 @@ public:
createDirectServerConnection(QIODevice *socket, const QHttp2Configuration &config);
~QHttp2Connection();
- [[nodiscard]] QH2Expected<QHttp2Stream *, CreateStreamError> createStream();
+ [[nodiscard]] QH2Expected<QHttp2Stream *, CreateStreamError> createStream()
+ {
+ return createStream(QHttp2Stream::Configuration{});
+ }
+ [[nodiscard]] QH2Expected<QHttp2Stream *, CreateStreamError>
+ createStream(QHttp2Stream::Configuration config);
QHttp2Stream *getStream(quint32 streamId) const;
QHttp2Stream *promisedStream(const QUrl &streamKey) const
@@ -278,8 +293,9 @@ private:
friend class QHttp2Stream;
[[nodiscard]] QIODevice *getSocket() const { return qobject_cast<QIODevice *>(parent()); }
- QH2Expected<QHttp2Stream *, QHttp2Connection::CreateStreamError> createLocalStreamInternal();
- QHttp2Stream *createStreamInternal_impl(quint32 streamID);
+ QH2Expected<QHttp2Stream *, QHttp2Connection::CreateStreamError>
+ createLocalStreamInternal(QHttp2Stream::Configuration = {});
+ QHttp2Stream *createStreamInternal_impl(quint32 streamID, QHttp2Stream::Configuration = {});
bool isInvalidStream(quint32 streamID) noexcept;
bool streamWasResetLocally(quint32 streamID) noexcept;
diff --git a/src/network/access/qnetworkaccesscache.cpp b/src/network/access/qnetworkaccesscache.cpp
index 6ff70cd546d..1f2bbd321cf 100644
--- a/src/network/access/qnetworkaccesscache.cpp
+++ b/src/network/access/qnetworkaccesscache.cpp
@@ -176,18 +176,6 @@ void QNetworkAccessCache::updateTimer()
timer.start(interval + 10, this);
}
-bool QNetworkAccessCache::emitEntryReady(Node *node, QObject *target, const char *member)
-{
- if (!connect(this, SIGNAL(entryReady(QNetworkAccessCache::CacheableObject*)),
- target, member, Qt::QueuedConnection))
- return false;
-
- emit entryReady(node->object);
- disconnect(SIGNAL(entryReady(QNetworkAccessCache::CacheableObject*)));
-
- return true;
-}
-
void QNetworkAccessCache::timerEvent(QTimerEvent *)
{
while (firstExpiringNode && firstExpiringNode->timer.hasExpired()) {
diff --git a/src/network/access/qnetworkaccesscache_p.h b/src/network/access/qnetworkaccesscache_p.h
index 4d4ff325f98..5d7dc819461 100644
--- a/src/network/access/qnetworkaccesscache_p.h
+++ b/src/network/access/qnetworkaccesscache_p.h
@@ -69,9 +69,6 @@ public:
void releaseEntry(const QByteArray &key);
void removeEntry(const QByteArray &key);
-signals:
- void entryReady(QNetworkAccessCache::CacheableObject *);
-
protected:
void timerEvent(QTimerEvent *) override;
@@ -86,7 +83,6 @@ private:
void linkEntry(const QByteArray &key);
bool unlinkEntry(const QByteArray &key);
void updateTimer();
- bool emitEntryReady(Node *node, QObject *target, const char *member);
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkAccessCache::CacheableObject::Options)
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 6428653de26..66bb65685fa 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -216,6 +216,19 @@ static void ensureInitialized()
can be:
\snippet code/src_network_access_qnetworkaccessmanager.cpp 1
+ Since Qt 6.11 the defaults of the TCP Keepalive parameters used by
+ QNetworkAccessManager have been changed. With the current settings
+ the connection will be terminated after 2 minutes of inactivity.
+
+ These settings can be changed the individual requests, to make
+ them more lenient, or even more aggressive via the QNetworkRequest API.
+ \snippet http/httpwindow.cpp qnam-tcpkeepalive
+
+ In the above snippet we are picking a more aggressive strategy, to
+ terminate the connection after thirty seconds of inactivity. This can
+ be useful, for example, in early detection of network hangs caused
+ by network changes on Linux.
+
\sa QNetworkRequest, QNetworkReply, QNetworkProxy
*/
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 0905ba3e644..1b34490e358 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -330,6 +330,13 @@ QMargins QCocoaWindow::safeAreaMargins() const
// merge them.
auto screenRect = m_view.window.screen.frame;
auto screenInsets = m_view.window.screen.safeAreaInsets;
+ auto screenSafeArea = QCocoaScreen::mapFromNative(NSMakeRect(
+ NSMinX(screenRect) + screenInsets.left,
+ NSMinY(screenRect) + screenInsets.bottom, // Non-flipped
+ NSWidth(screenRect) - screenInsets.left - screenInsets.right,
+ NSHeight(screenRect) - screenInsets.top - screenInsets.bottom
+ ));
+
auto screenRelativeViewBounds = QCocoaScreen::mapFromNative(
[m_view.window convertRectToScreen:
[m_view convertRect:m_view.bounds toView:nil]]
@@ -339,20 +346,10 @@ QMargins QCocoaWindow::safeAreaMargins() const
// Note that we do not want represent the area outside of the
// screen as being outside of the safe area.
QMarginsF screenSafeAreaMargins = {
- screenInsets.left ?
- qMax(0.0f, screenInsets.left - screenRelativeViewBounds.left())
- : 0.0f,
- screenInsets.top ?
- qMax(0.0f, screenInsets.top - screenRelativeViewBounds.top())
- : 0.0f,
- screenInsets.right ?
- qMax(0.0f, screenInsets.right
- - (screenRect.size.width - screenRelativeViewBounds.right()))
- : 0.0f,
- screenInsets.bottom ?
- qMax(0.0f, screenInsets.bottom
- - (screenRect.size.height - screenRelativeViewBounds.bottom()))
- : 0.0f
+ qMin(screenSafeArea.left() - screenRelativeViewBounds.left(), screenInsets.left),
+ qMin(screenSafeArea.top() - screenRelativeViewBounds.top(), screenInsets.top),
+ qMin(screenRelativeViewBounds.right() - screenSafeArea.right(), screenInsets.right),
+ qMin(screenRelativeViewBounds.bottom() - screenSafeArea.bottom(), screenInsets.bottom)
};
return (screenSafeAreaMargins | viewSafeAreaMargins).toMargins();
diff --git a/src/plugins/sqldrivers/.cmake.conf b/src/plugins/sqldrivers/.cmake.conf
index be788d10f8e..846c4f3b923 100644
--- a/src/plugins/sqldrivers/.cmake.conf
+++ b/src/plugins/sqldrivers/.cmake.conf
@@ -1 +1 @@
-set(QT_REPO_MODULE_VERSION "6.11.0")
+set(QT_REPO_MODULE_VERSION "6.12.0")
diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp
index ff2d4bd845f..98e51397c17 100644
--- a/src/plugins/styles/modernwindows/qwindows11style.cpp
+++ b/src/plugins/styles/modernwindows/qwindows11style.cpp
@@ -596,7 +596,7 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt
if (sub & SC_ComboBoxArrow) {
QRectF rect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget);
painter->setFont(d->assetFont);
- painter->setPen(controlTextColor(option));
+ painter->setPen(controlTextColor(option, true));
painter->drawText(rect, Qt::AlignCenter, fluentIcon(Icon::ChevronDownMed));
}
if (state & State_KeyboardFocusChange && hasFocus) {
@@ -887,7 +887,7 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
if (isOn) {
painter->setFont(d->assetFont);
- painter->setPen(controlTextColor(option, QPalette::Window));
+ painter->setPen(controlTextColor(option));
qreal clipWidth = 1.0;
const QString str = fluentIcon(Icon::AcceptMedium);
QFontMetrics fm(d->assetFont);
@@ -907,7 +907,7 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
QFont f(d->assetFont);
f.setPointSize(6);
painter->setFont(f);
- painter->setPen(controlTextColor(option, QPalette::Window));
+ painter->setPen(controlTextColor(option));
painter->drawText(rect, Qt::AlignCenter, fluentIcon(Icon::Dash12));
}
}
@@ -1214,7 +1214,7 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
case QStyle::CE_ComboBoxLabel:
#if QT_CONFIG(combobox)
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- painter->setPen(controlTextColor(option));
+ painter->setPen(controlTextColor(option, true));
QStyleOptionComboBox newOption = *cb;
newOption.rect.adjust(4,0,-4,0);
QCommonStyle::drawControl(element, &newOption, painter, widget);
@@ -2622,6 +2622,7 @@ void QWindows11Style::polish(QPalette& result)
d->m_titleBarNormalIcon = QIcon();
d->m_toolbarExtensionButton = QIcon();
d->m_lineEditClearButton = QIcon();
+ d->m_tabCloseButton = QIcon();
}
QPixmap QWindows11Style::standardPixmap(StandardPixmap standardPixmap,
@@ -2662,6 +2663,14 @@ QIcon QWindows11Style::standardIcon(StandardPixmap standardIcon,
}
return d->m_toolbarExtensionButton;
}
+ case SP_TabCloseButton: {
+ if (d->m_tabCloseButton.isNull()) {
+ auto e = new WinFontIconEngine(fluentIcon(Icon::ChromeClose), d->assetFont);
+ e->setScale(0.6);
+ d->m_tabCloseButton = QIcon(e);
+ }
+ return d->m_tabCloseButton;
+ }
default:
break;
}
@@ -2737,7 +2746,7 @@ QBrush QWindows11Style::inputFillBrush(const QStyleOption *option, const QWidget
return winUI3Color(fillControlDefault);
}
-QColor QWindows11Style::controlTextColor(const QStyleOption *option, QPalette::ColorRole role) const
+QColor QWindows11Style::controlTextColor(const QStyleOption *option, bool ignoreIsChecked) const
{
using namespace StyleOptionHelper;
static constexpr WINUI3Color colorEnums[2][4] = {
@@ -2750,12 +2759,9 @@ QColor QWindows11Style::controlTextColor(const QStyleOption *option, QPalette::C
if (option->palette.isBrushSet(QPalette::Current, QPalette::ButtonText))
return option->palette.buttonText().color();
- const int colorIndex = isChecked(option) ? 1 : 0;
+ const int colorIndex = !ignoreIsChecked && isChecked(option) ? 1 : 0;
const auto state = calcControlState(option);
- const auto alpha = winUI3Color(colorEnums[colorIndex][int(state)]);
- QColor col = option->palette.color(role);
- col.setAlpha(alpha.alpha());
- return col;
+ return winUI3Color(colorEnums[colorIndex][int(state)]);
}
void QWindows11Style::drawLineEditFrame(QPainter *p, const QRectF &rect, const QStyleOption *o, bool isEditable) const
diff --git a/src/plugins/styles/modernwindows/qwindows11style_p.h b/src/plugins/styles/modernwindows/qwindows11style_p.h
index 96c2c4136e0..43a344a6ac9 100644
--- a/src/plugins/styles/modernwindows/qwindows11style_p.h
+++ b/src/plugins/styles/modernwindows/qwindows11style_p.h
@@ -104,8 +104,7 @@ private:
QBrush controlFillBrush(const QStyleOption *option, ControlType controlType) const;
QBrush inputFillBrush(const QStyleOption *option, const QWidget *widget) const;
// ControlType::ControlAlt can be mapped to QPalette directly
- QColor controlTextColor(const QStyleOption *option,
- QPalette::ColorRole role = QPalette::ButtonText) const;
+ QColor controlTextColor(const QStyleOption *option, bool ignoreIsChecked = false) const;
void drawLineEditFrame(QPainter *p, const QRectF &rect, const QStyleOption *o, bool isEditable = true) const;
inline QColor winUI3Color(enum WINUI3Color col) const;
@@ -126,6 +125,7 @@ class QWindows11StylePrivate : public QWindowsVistaStylePrivate {
protected:
QIcon m_toolbarExtensionButton;
QIcon m_lineEditClearButton;
+ QIcon m_tabCloseButton;
};
QT_END_NAMESPACE
diff --git a/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp b/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp
index 64ffba2d6f8..36b5d0f0143 100644
--- a/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp
+++ b/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp
@@ -16,6 +16,9 @@
#include <private/qapplication_p.h>
#include <private/qsystemlibrary_p.h>
#include <private/qwindowsthemecache_p.h>
+#if QT_CONFIG(tooltip)
+#include "private/qtooltip_p.h"
+#endif
#include "qdrawutil.h" // for now
#include <qbackingstore.h>
@@ -4676,7 +4679,7 @@ void QWindowsVistaStyle::polish(QWidget *widget)
widget->setPalette(pal);
} else
#endif // QT_CONFIG(commandlinkbutton)
- if (widget->inherits("QTipLabel")) {
+ if (qobject_cast<const QTipLabel *>(widget)) {
//note that since tooltips are not reused
//we do not have to care about unpolishing
widget->setContentsMargins(3, 0, 4, 0);
diff --git a/src/plugins/tls/openssl/qtlsbackend_openssl.cpp b/src/plugins/tls/openssl/qtlsbackend_openssl.cpp
index deb257be01c..d3b7d669ec7 100644
--- a/src/plugins/tls/openssl/qtlsbackend_openssl.cpp
+++ b/src/plugins/tls/openssl/qtlsbackend_openssl.cpp
@@ -407,8 +407,13 @@ QList<QSslCertificate> systemCaCertificates()
for (const QByteArray &directory : directories) {
for (const auto &dirEntry : QDirListing(QFile::decodeName(directory), flags)) {
// use canonical path here to not load the same certificate twice if symlinked
- if (hasMatchingExtension(dirEntry.fileName()))
- certFiles.insert(dirEntry.canonicalFilePath());
+ if (hasMatchingExtension(dirEntry.fileName())) {
+ QString canonicalPath = dirEntry.canonicalFilePath();
+ // skip broken symlinks to not end up adding "" to the list which will then
+ // just be rejected by `QSslCertificate::fromFile`
+ if (!canonicalPath.isEmpty())
+ certFiles.insert(canonicalPath);
+ }
}
}
for (const QString& file : std::as_const(certFiles))
diff --git a/src/testlib/doc/src/qt-webpages.qdoc b/src/testlib/doc/src/qt-webpages.qdoc
index 611f3795ba9..b32fd4f750f 100644
--- a/src/testlib/doc/src/qt-webpages.qdoc
+++ b/src/testlib/doc/src/qt-webpages.qdoc
@@ -15,7 +15,3 @@
\title Googletest Mocking (gMock) Framework
*/
-/*!
- \externalpage https://www.itk.org/Wiki/CMake_Testing_With_CTest
- \title CMake/Testing With CTest
-*/
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index 29cafe9aea4..f3db4ece49e 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -305,9 +305,7 @@ namespace QTest {
{
static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(QTest::maxWarnings);
- auto loggerCapture = loggers->allLoggers();
-
- if (loggerCapture.isEmpty()) {
+ if (loggers.isDestroyed() || loggers->allLoggers().isEmpty()) {
// the message handler may be called from a worker thread, after the main thread stopped
// logging. Forwarding to original message handler to avoid swallowing the message
Q_ASSERT(oldMessageHandler);
@@ -326,6 +324,8 @@ namespace QTest {
return;
}
+ auto loggerCapture = loggers->allLoggers();
+
if (type != QtFatalMsg) {
if (counter.loadRelaxed() <= 0)
return;
diff --git a/src/tools/androidtestrunner/main.cpp b/src/tools/androidtestrunner/main.cpp
index b517d85c5fb..161d95db49c 100644
--- a/src/tools/androidtestrunner/main.cpp
+++ b/src/tools/androidtestrunner/main.cpp
@@ -28,7 +28,16 @@
using namespace Qt::StringLiterals;
-#define EXIT_ERROR -1
+
+// QTest-based test processes may exit with up to 127 for normal test failures
+static constexpr int HIGHEST_QTEST_EXITCODE = 127;
+// Something went wrong in androidtestrunner, in general
+static constexpr int EXIT_ERROR = 254;
+// More specific exit codes for failures in androidtestrunner:
+static constexpr int EXIT_NOEXITCODE = 253; // Failed to transfer exit code from device
+static constexpr int EXIT_ANR = 252; // Android ANR error (Application Not Responding)
+static constexpr int EXIT_NORESULTS = 251; // Failed to transfer result files from device
+
struct Options
{
@@ -71,6 +80,13 @@ struct TestInfo
static TestInfo g_testInfo;
+// QTest-based processes return 0 if all tests PASSed, or the number of FAILs up to 127.
+// Other exitcodes signify abnormal termination and are system-dependent.
+static bool isTestExitCodeNormal(const int ec)
+{
+ return (ec >= 0 && ec <= HIGHEST_QTEST_EXITCODE);
+}
+
static bool execCommand(const QString &program, const QStringList &args,
QByteArray *output = nullptr, bool verbose = false)
{
@@ -744,9 +760,9 @@ void printLogcatCrash(const QByteArray &logcat)
}
if (!crashLogcat.startsWith("********** Crash dump"))
- qDebug() << "********** Crash dump: **********";
+ qDebug() << "[androidtestrunner] ********** BEGIN crash dump **********";
qDebug().noquote() << crashLogcat.trimmed();
- qDebug() << "********** End crash dump **********";
+ qDebug() << "[androidtestrunner] ********** END crash dump **********";
}
void analyseLogcat(const QString &timeStamp, int *exitCode)
@@ -781,10 +797,13 @@ void analyseLogcat(const QString &timeStamp, int *exitCode)
// Check for ANRs
const bool anrOccurred = logcat.contains("ANR in %1"_L1.arg(g_options.package).toUtf8());
if (anrOccurred) {
- // Treat a found ANR as a test failure.
- *exitCode = *exitCode < 1 ? 1 : *exitCode;
- qCritical("An ANR has occurred while running the test %s. The logcat will include "
- "additional logs from the system_server process.",
+ // Rather improbable, but if the test managed to return a non-crash exitcode then overwrite
+ // it to signify that something blew up. Same if we didn't manage to collect an exit code.
+ // Preserve all other exitcodes, they might be useful crash information from the device.
+ if (isTestExitCodeNormal(*exitCode) || *exitCode == EXIT_NOEXITCODE)
+ *exitCode = EXIT_ANR;
+ qCritical("[androidtestrunner] An ANR has occurred while running the test '%s';"
+ " consult logcat for additional logs from the system_server process",
qPrintable(g_options.package));
}
@@ -818,13 +837,14 @@ void analyseLogcat(const QString &timeStamp, int *exitCode)
}
}
- // If we have a crash, attempt to print both logcat and the crash buffer which
- // includes the crash stacktrace that is not included in the default logcat.
- const bool testCrashed = *exitCode == EXIT_ERROR && !g_testInfo.isTestRunnerInterrupted.load();
+ // If we have an unpredictable exitcode, possibly a crash, attempt to print both logcat and the
+ // crash buffer which includes the crash stacktrace that is not included in the default logcat.
+ const bool testCrashed = ( !isTestExitCodeNormal(*exitCode)
+ && !g_testInfo.isTestRunnerInterrupted.load());
if (testCrashed) {
- qDebug() << "********** logcat dump **********";
+ qDebug() << "[androidtestrunner] ********** BEGIN logcat dump **********";
qDebug().noquote() << testLogcat.join(u'\n').trimmed();
- qDebug() << "********** End logcat dump **********";
+ qDebug() << "[androidtestrunner] ********** END logcat dump **********";
if (!crashLogcat.isEmpty())
printLogcatCrash(crashLogcat);
@@ -839,7 +859,7 @@ static QString getCurrentTimeString()
QStringList dateArgs = { "shell"_L1, "date"_L1, "+'%1'"_L1.arg(timeFormat) };
QByteArray output;
if (!execAdbCommand(dateArgs, &output, false)) {
- qWarning() << "Date/time adb command failed";
+ qWarning() << "[androidtestrunner] ERROR in command: adb shell date";
return {};
}
@@ -851,14 +871,15 @@ static int testExitCode()
QByteArray exitCodeOutput;
const QString exitCodeCmd = "cat files/qtest_last_exit_code 2> /dev/null"_L1;
if (!execAdbCommand({ "shell"_L1, runCommandAsUserArgs(exitCodeCmd) }, &exitCodeOutput, false)) {
- qCritical() << "Failed to retrieve the test exit code.";
- return EXIT_ERROR;
+ qCritical() << "[androidtestrunner] ERROR in command: adb shell cat files/qtest_last_exit_code";
+ return EXIT_NOEXITCODE;
}
+ qDebug() << "[androidtestrunner] Test exitcode: " << exitCodeOutput;
bool ok;
int exitCode = exitCodeOutput.toInt(&ok);
- return ok ? exitCode : EXIT_ERROR;
+ return ok ? exitCode : EXIT_NOEXITCODE;
}
static bool uninstallTestPackage()
@@ -899,7 +920,7 @@ void sigHandler(int signal)
// a main event loop. Since, there's no other alternative to do this,
// let's do the cleanup anyway.
if (!g_testInfo.isPackageInstalled.load())
- _exit(-1);
+ _exit(EXIT_ERROR);
g_testInfo.isTestRunnerInterrupted.store(true);
}
@@ -1031,7 +1052,9 @@ int main(int argc, char *argv[])
if (g_options.showLogcatOutput)
analyseLogcat(formattedStartTime, &exitCode);
- exitCode = pullResults() ? exitCode : EXIT_ERROR;
+ const bool pullRes = pullResults();
+ if (!pullRes && isTestExitCodeNormal(exitCode))
+ exitCode = EXIT_NORESULTS;
if (!uninstallTestPackage())
return EXIT_ERROR;
diff --git a/src/tools/configure.cmake b/src/tools/configure.cmake
index 27ea90b89ac..07e11dd935b 100644
--- a/src/tools/configure.cmake
+++ b/src/tools/configure.cmake
@@ -37,7 +37,7 @@ qt_feature("qmake" PRIVATE
QT_FEATURE_datestring AND QT_FEATURE_regularexpression AND QT_FEATURE_temporaryfile)
qt_feature("qtwaylandscanner" PRIVATE
- CONDITION TARGET Wayland::Scanner
+ CONDITION TARGET Wayland::Scanner AND NOT INTEGRITY AND NOT ANDROID AND NOT WASM AND NOT IOS AND NOT QNX AND NOT VXWORKS
)
qt_configure_add_summary_section(NAME "Core tools")
diff --git a/src/tools/macdeployqt/shared/shared.cpp b/src/tools/macdeployqt/shared/shared.cpp
index 0731fb616ed..7f8590ae894 100644
--- a/src/tools/macdeployqt/shared/shared.cpp
+++ b/src/tools/macdeployqt/shared/shared.cpp
@@ -1008,6 +1008,31 @@ DeploymentInfo deployQtFrameworks(QList<FrameworkInfo> frameworks,
rpathsUsed.append(framework.rpathUsed);
}
+ // To properly find all dependencies of the current framework / library further down in
+ // getQtFrameworks, we need to get its rpaths, resolve them in the context of its original
+ // location before it is copied, and add them as candidate rpaths.
+ //
+ // This is necessary to handle cases like
+ // (1) QtNetwork.framework -> (2) libbrotlidec.dylib -> (3) libbrotlicommon.1.dylib
+ // to correctly resolve the path to (3) when it is referenced as
+ // '@rpath/libbrotlicommon.1.dylib' and (2) has an LC_RPATH of '@loader_path/../lib', and
+ // no other absolute rpaths. So the '@loader_path/../lib' will be resolved relative
+ // to (2)'s original location and its LC_RPATH.
+ //
+ // Otherwise we'd only have the Qt prefix and the current bundle app dir as rpath
+ // candidates, and once (2) is copied into the app bundle, there's no way
+ // '@rpath/libbrotlicommon.1.dylib' could resolve to the real path on disk from the two
+ // candidates above.
+ if (!framework.sourceFilePath.isEmpty()) {
+ const QList<QString> sourceRPaths = getBinaryRPaths(framework.sourceFilePath, true);
+ for (const QString &sourceRPath : sourceRPaths) {
+ const QDir sourceRPathDir(sourceRPath);
+ if (sourceRPathDir.exists() && !rpathsUsed.contains(sourceRPath)) {
+ rpathsUsed.append(sourceRPath);
+ }
+ }
+ }
+
// Copy the framework/dylib to the app bundle.
const QString deployedBinaryPath = framework.isDylib ? copyDylib(framework, bundlePath)
: copyFramework(framework, bundlePath);
@@ -1032,7 +1057,7 @@ DeploymentInfo deployQtFrameworks(QList<FrameworkInfo> frameworks,
for (const FrameworkInfo &dependency : dependencies) {
if (dependency.rpathUsed.isEmpty()) {
changeInstallName(bundlePath, dependency, QStringList() << deployedBinaryPath, useLoaderPath);
- } else {
+ } else if (!rpathsUsed.contains(dependency.rpathUsed)) {
rpathsUsed.append(dependency.rpathUsed);
}
diff --git a/src/widgets/accessible/qaccessiblecolorwell.cpp b/src/widgets/accessible/qaccessiblecolorwell.cpp
index ca08e511e9a..64fcd2a7fd1 100644
--- a/src/widgets/accessible/qaccessiblecolorwell.cpp
+++ b/src/widgets/accessible/qaccessiblecolorwell.cpp
@@ -3,6 +3,8 @@
#include "private/qaccessiblecolorwell_p.h"
+#include <QtCore/qcoreapplication.h>
+
QT_REQUIRE_CONFIG(accessibility);
#if QT_CONFIG(colordialog)
@@ -14,6 +16,7 @@ class QAccessibleColorWellItem : public QAccessibleInterface
{
QAccessibleColorWell *m_parent;
+ Q_DECLARE_TR_FUNCTIONS(QAccessibleColorWellItem)
public:
QAccessibleColorWellItem(QAccessibleColorWell *parent);
@@ -79,7 +82,7 @@ QString QAccessibleColorWellItem::text(QAccessible::Text t) const
if (t == QAccessible::Name) {
QRgb color = m_parent->colorWell()->rgbValues()[m_parent->indexOfChild(this)];
//: Color specified via its 3 RGB components (red, green, blue)
- return QObject::tr("RGB %1, %2, %3")
+ return tr("RGB %1, %2, %3")
.arg(QString::number(qRed(color)), QString::number(qGreen(color)),
QString::number(qBlue(color)));
}
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index e23ed9f23ee..58a4115374e 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -259,7 +259,7 @@ public:
void setup(const QWizardLayoutInfo &info, const QString &title,
const QString &subTitle, const QPixmap &logo, const QPixmap &banner,
Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat,
- QWizard::BannerSizePolicy bannerSizePolicy);
+ QWizard::BannerStretchPolicy bannerStretchPolicy);
protected:
void paintEvent(QPaintEvent *event) override;
@@ -273,7 +273,7 @@ private:
QLabel *logoLabel;
QGridLayout *layout;
QPixmap bannerPixmap;
- QWizard::BannerSizePolicy wizardBannerSizePolicy = QWizard::BannerSizePolicy::NoStretch;
+ QWizard::BannerStretchPolicy wizardBannerStretchPolicy = QWizard::BannerStretchPolicy::NoStretch;
};
QWizardHeader::QWizardHeader(QWidget *parent)
@@ -329,7 +329,7 @@ bool QWizardHeader::vistaDisabled() const
void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
const QString &subTitle, const QPixmap &logo, const QPixmap &banner,
Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat,
- QWizard::BannerSizePolicy bannerSizePolicy)
+ QWizard::BannerStretchPolicy bannerStretchPolicy)
{
bool modern = ((info.wizStyle == QWizard::ModernStyle)
#if QT_CONFIG(style_windowsvista)
@@ -337,7 +337,7 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
#endif
);
- wizardBannerSizePolicy = bannerSizePolicy;
+ wizardBannerStretchPolicy = bannerStretchPolicy;
layout->setRowMinimumHeight(0, modern ? ModernHeaderTopMargin : 0);
layout->setRowMinimumHeight(1, modern ? info.topLevelMarginTop - ModernHeaderTopMargin - 1 : 0);
@@ -364,7 +364,7 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
bannerPixmap = QPixmap();
}
- if (bannerPixmap.isNull() || wizardBannerSizePolicy != QWizard::BannerSizePolicy::NoStretch) {
+ if (bannerPixmap.isNull() || wizardBannerStretchPolicy != QWizard::BannerStretchPolicy::NoStretch) {
/*
There is no widthForHeight() function, so we simulate it with a loop.
*/
@@ -392,12 +392,12 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
void QWizardHeader::paintEvent(QPaintEvent * /* event */)
{
QStylePainter painter(this);
- switch (wizardBannerSizePolicy) {
- case QWizard::BannerSizePolicy::Stretch:
+ switch (wizardBannerStretchPolicy) {
+ case QWizard::BannerStretchPolicy::Stretch:
painter.setRenderHint(QPainter::SmoothPixmapTransform);
painter.drawPixmap(0, 0, width(), height(), bannerPixmap);
break;
- case QWizard::BannerSizePolicy::NoStretch:
+ case QWizard::BannerStretchPolicy::NoStretch:
painter.drawPixmap(0, 0, bannerPixmap);
break;
}
@@ -582,7 +582,7 @@ public:
QList<QWizard::WizardButton> buttonsCustomLayout;
Qt::TextFormat titleFmt = Qt::AutoText;
Qt::TextFormat subTitleFmt = Qt::AutoText;
- QWizard::BannerSizePolicy bannerSizePolicy = QWizard::BannerSizePolicy::NoStretch;
+ QWizard::BannerStretchPolicy bannerStretchPolicy = QWizard::BannerStretchPolicy::NoStretch;
mutable QPixmap defaultPixmaps[QWizard::NPixmaps];
union {
@@ -1238,7 +1238,7 @@ void QWizardPrivate::updateLayout()
Q_ASSERT(page);
headerWidget->setup(info, page->title(), page->subTitle(),
page->pixmap(QWizard::LogoPixmap), page->pixmap(QWizard::BannerPixmap),
- titleFmt, subTitleFmt, bannerSizePolicy);
+ titleFmt, subTitleFmt, bannerStretchPolicy);
}
if (info.watermark || info.sideWidget) {
@@ -2097,7 +2097,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
*/
/*!
- \enum QWizard::BannerSizePolicy
+ \enum QWizard::BannerStretchPolicy
This enum specifies the banner size policy when there is a banner.
@@ -2800,25 +2800,25 @@ Qt::TextFormat QWizard::subTitleFormat() const
}
/*!
- \property QWizard::bannerSizePolicy
+ \property QWizard::bannerStretchPolicy
\brief the banner size policy
The default policy is \l{QWizard::}{NoStretch}
*/
-void QWizard::setBannerSizePolicy(QWizard::BannerSizePolicy bannerSizePolicy)
+void QWizard::setBannerStretchPolicy(QWizard::BannerStretchPolicy bannerStretchPolicy)
{
Q_D(QWizard);
- if (d->bannerSizePolicy == bannerSizePolicy)
+ if (d->bannerStretchPolicy == bannerStretchPolicy)
return;
- d->bannerSizePolicy = bannerSizePolicy;
+ d->bannerStretchPolicy = bannerStretchPolicy;
d->updateLayout();
}
-QWizard::BannerSizePolicy QWizard::bannerSizePolicy() const
+QWizard::BannerStretchPolicy QWizard::bannerStretchPolicy() const
{
Q_D(const QWizard);
- return d->bannerSizePolicy;
+ return d->bannerStretchPolicy;
}
/*!
diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h
index 801fd7f4ef4..a421b3ecb40 100644
--- a/src/widgets/dialogs/qwizard.h
+++ b/src/widgets/dialogs/qwizard.h
@@ -25,7 +25,7 @@ class Q_WIDGETS_EXPORT QWizard : public QDialog
Q_PROPERTY(Qt::TextFormat subTitleFormat READ subTitleFormat WRITE setSubTitleFormat)
Q_PROPERTY(int startId READ startId WRITE setStartId)
Q_PROPERTY(int currentId READ currentId WRITE setCurrentId NOTIFY currentIdChanged)
- Q_PROPERTY(BannerSizePolicy bannerSizePolicy READ bannerSizePolicy WRITE setBannerSizePolicy REVISION(6, 11))
+ Q_PROPERTY(BannerStretchPolicy bannerStretchPolicy READ bannerStretchPolicy WRITE setBannerStretchPolicy REVISION(6, 11))
public:
enum WizardButton {
@@ -62,11 +62,11 @@ public:
};
Q_ENUM(WizardStyle)
- enum class BannerSizePolicy {
+ enum class BannerStretchPolicy {
NoStretch,
Stretch,
};
- Q_ENUM(BannerSizePolicy)
+ Q_ENUM(BannerStretchPolicy)
enum WizardOption {
IndependentPages = 0x00000001,
@@ -131,8 +131,8 @@ public:
Qt::TextFormat titleFormat() const;
void setSubTitleFormat(Qt::TextFormat format);
Qt::TextFormat subTitleFormat() const;
- void setBannerSizePolicy(BannerSizePolicy bannerSizePolicy);
- QWizard::BannerSizePolicy bannerSizePolicy() const;
+ void setBannerStretchPolicy(BannerStretchPolicy bannerStretchPolicy);
+ QWizard::BannerStretchPolicy bannerStretchPolicy() const;
void setPixmap(WizardPixmap which, const QPixmap &pixmap);
QPixmap pixmap(WizardPixmap which) const;
diff --git a/src/widgets/doc/src/external-resources.qdoc b/src/widgets/doc/src/external-resources.qdoc
index 96117546a29..0eccc3b19d4 100644
--- a/src/widgets/doc/src/external-resources.qdoc
+++ b/src/widgets/doc/src/external-resources.qdoc
@@ -1,12 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \externalpage http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html
- \title Apple Human Interface Guidelines
-*/
-
/*!
\externalpage https://rk.nvg.ntnu.no/sinclair/computers/zxspectrum/zxspectrum.htm
\title Sinclair Spectrum
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index 3417d93d587..97332cd7d5d 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -6,15 +6,12 @@
#include <qapplication.h>
#include <qevent.h>
-#include <qpointer.h>
#include <qstyle.h>
#include <qstyleoption.h>
#include <qstylepainter.h>
#if QT_CONFIG(effects)
#include <private/qeffects_p.h>
#endif
-#include <qtextdocument.h>
-#include <qdebug.h>
#include <qpa/qplatformscreen.h>
#include <qpa/qplatformcursor.h>
#if QT_CONFIG(style_stylesheet)
@@ -23,12 +20,9 @@
#include <qpa/qplatformwindow.h>
#include <qpa/qplatformwindow_p.h>
-#include <qlabel.h>
#include <QtWidgets/private/qlabel_p.h>
#include <QtGui/private/qhighdpiscaling_p.h>
#include <qtooltip.h>
-
-#include <QtCore/qbasictimer.h>
#include <QtWidgets/private/qtooltip_p.h>
QT_BEGIN_NAMESPACE
@@ -190,10 +184,10 @@ void QTipLabel::resizeEvent(QResizeEvent *e)
void QTipLabel::mouseMoveEvent(QMouseEvent *e)
{
if (!rect.isNull()) {
- QPoint pos = e->globalPosition().toPoint();
+ QPointF pos = e->globalPosition();
if (widget)
pos = widget->mapFromGlobal(pos);
- if (!rect.contains(pos))
+ if (!rect.contains(pos.toPoint()))
hideTip();
}
QLabel::mouseMoveEvent(e);
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 9499c88af12..bd2b5be11aa 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -32,7 +32,7 @@
#include "private/qwidgetwindow_p.h"
#include "qpainter.h"
#if QT_CONFIG(tooltip)
-#include "qtooltip.h"
+#include "private/qtooltip_p.h"
#endif
#if QT_CONFIG(whatsthis)
#include "qwhatsthis.h"
@@ -1435,7 +1435,9 @@ void QWidgetPrivate::createTLSysExtra()
if (extra->topextra->opacity != 255 && q->isWindow())
extra->topextra->window->setOpacity(qreal(extra->topextra->opacity) / qreal(255));
- const bool isTipLabel = q->inherits("QTipLabel");
+#if QT_CONFIG(tooltip)
+ const bool isTipLabel = qobject_cast<const QTipLabel *>(q) != nullptr;
+#endif
const bool isAlphaWidget = !isTipLabel && q->inherits("QAlphaWidget");
#ifdef Q_OS_WIN
// Pass on native parent handle for Widget embedded into Active X.
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 90c1cfb4b86..592b70ef8ba 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -1994,12 +1994,9 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
tr = proxy()->subElementRect(SE_TabBarTabText, opt, widget);
if (!tab->icon.isNull()) {
- QPixmap tabIcon = tab->icon.pixmap(tab->iconSize, QStyleHelper::getDpr(p),
- (tab->state & State_Enabled) ? QIcon::Normal
- : QIcon::Disabled,
- (tab->state & State_Selected) ? QIcon::On
- : QIcon::Off);
- p->drawPixmap(iconRect.x(), iconRect.y(), tabIcon);
+ const auto mode = (tab->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled;
+ const auto state = (tab->state & State_Selected) ? QIcon::On : QIcon::Off;
+ tab->icon.paint(p, iconRect, Qt::AlignCenter, mode, state);
}
proxy()->drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text,
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 25b048db65e..e0fdd56e6d8 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -35,7 +35,7 @@
#include <qabstractscrollarea.h>
#include "private/qabstractscrollarea_p.h"
#if QT_CONFIG(tooltip)
-#include <qtooltip.h>
+#include "private/qtooltip_p.h"
#endif
#include <qshareddata.h>
#if QT_CONFIG(toolbutton)
@@ -950,7 +950,7 @@ QRenderRule::QRenderRule(const QList<Declaration> &declarations, const QObject *
hasFont = v.extractFont(&font, &adj);
#if QT_CONFIG(tooltip)
- if (object && qstrcmp(object->metaObject()->className(), "QTipLabel") == 0)
+ if (qobject_cast<const QTipLabel *>(object) != nullptr)
palette = QToolTip::palette();
#endif
@@ -1495,7 +1495,7 @@ bool QRenderRule::hasModification() const
static inline QObject *parentObject(const QObject *obj)
{
#if QT_CONFIG(tooltip)
- if (qobject_cast<const QLabel *>(obj) && qstrcmp(obj->metaObject()->className(), "QTipLabel") == 0) {
+ if (qobject_cast<const QTipLabel *>(obj) != nullptr) {
QObject *p = qvariant_cast<QObject *>(obj->property("_q_stylesheet_parent"));
if (p)
return p;
@@ -1515,7 +1515,7 @@ public:
return QStringList();
const QMetaObject *metaObject = OBJECT_PTR(node)->metaObject();
#if QT_CONFIG(tooltip)
- if (qstrcmp(metaObject->className(), "QTipLabel") == 0)
+ if (metaObject == &QTipLabel::staticMetaObject)
return QStringList("QToolTip"_L1);
#endif
QStringList result;
@@ -1581,7 +1581,7 @@ public:
return false;
const QMetaObject *metaObject = OBJECT_PTR(node)->metaObject();
#if QT_CONFIG(tooltip)
- if (qstrcmp(metaObject->className(), "QTipLabel") == 0)
+ if (metaObject == &QTipLabel::staticMetaObject)
return nodeName == "QToolTip"_L1;
#endif
do {
@@ -1747,7 +1747,7 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w)
}
#endif
- if (qstrcmp(w->metaObject()->className(), "QTipLabel") == 0)
+ if (w->metaObject() == &QTipLabel::staticMetaObject)
return base->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, nullptr, w);
return base->pixelMetric(QStyle::PM_DefaultFrameWidth, nullptr, w);
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index 0f0abb6e1d5..44218d41ded 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -52,6 +52,14 @@ public:
void enterEvent(QEnterEvent *event) override;
void leaveEvent(QEvent *event) override;
void paintEvent(QPaintEvent *event) override;
+
+ void setParentClipRect(const QRect &clipRect)
+ {
+ m_parentClipRect = clipRect;
+ }
+
+protected:
+ QRect m_parentClipRect;
};
}
@@ -598,10 +606,11 @@ QRect QTabBarPrivate::normalizedScrollRect(int index)
q->initStyleOption(&opt, currentIndex);
opt.rect = q->rect();
- QRect scrollButtonLeftRect = q->style()->subElementRect(QStyle::SE_TabBarScrollLeftButton, &opt, q);
- QRect scrollButtonRightRect = q->style()->subElementRect(QStyle::SE_TabBarScrollRightButton, &opt, q);
- QRect tearLeftRect = q->style()->subElementRect(QStyle::SE_TabBarTearIndicatorLeft, &opt, q);
- QRect tearRightRect = q->style()->subElementRect(QStyle::SE_TabBarTearIndicatorRight, &opt, q);
+ const auto style = q->style();
+ QRect scrollButtonLeftRect = style->subElementRect(QStyle::SE_TabBarScrollLeftButton, &opt, q);
+ QRect scrollButtonRightRect = style->subElementRect(QStyle::SE_TabBarScrollRightButton, &opt, q);
+ QRect tearLeftRect = style->subElementRect(QStyle::SE_TabBarTearIndicatorLeft, &opt, q);
+ QRect tearRightRect = style->subElementRect(QStyle::SE_TabBarTearIndicatorRight, &opt, q);
if (verticalTabs(shape)) {
int topEdge, bottomEdge;
@@ -739,7 +748,7 @@ void QTabBarPrivate::layoutTab(int index)
if (tab->leftWidget) {
QRect rect = q->style()->subElementRect(QStyle::SE_TabBarTabLeftButton, &opt, q);
QPoint p = rect.topLeft();
- if ((index == pressedIndex) || paintWithOffsets) {
+ if (index == pressedIndex) {
if (vertical)
p.setY(p.y() + tab->dragOffset);
else
@@ -750,7 +759,7 @@ void QTabBarPrivate::layoutTab(int index)
if (tab->rightWidget) {
QRect rect = q->style()->subElementRect(QStyle::SE_TabBarTabRightButton, &opt, q);
QPoint p = rect.topLeft();
- if ((index == pressedIndex) || paintWithOffsets) {
+ if (index == pressedIndex) {
if (vertical)
p.setY(p.y() + tab->dragOffset);
else
@@ -1004,8 +1013,13 @@ int QTabBar::insertTab(int index, const QIcon& icon, const QString &text)
}
if (isVisible() && tabAt(d->mousePosition) == index) {
- d->hoverIndex = index;
- d->hoverRect = tabRect(index);
+ if (d->normalizedScrollRect(index).contains(d->mousePosition)) {
+ d->hoverIndex = index;
+ d->hoverRect = tabRect(index);
+ } else {
+ d->hoverIndex = -1;
+ d->hoverRect = QRect();
+ }
}
tabInserted(index);
@@ -1096,11 +1110,13 @@ void QTabBar::removeTab(int index)
if (d->hoverRect.isValid()) {
update(d->hoverRect);
d->hoverIndex = tabAt(d->mousePosition);
- if (d->validIndex(d->hoverIndex)) {
+ if (d->validIndex(d->hoverIndex)
+ && d->normalizedScrollRect(d->hoverIndex).contains(d->mousePosition)) {
d->hoverRect = tabRect(d->hoverIndex);
update(d->hoverRect);
} else {
d->hoverRect = QRect();
+ d->hoverIndex = -1;
}
}
tabRemoved(index);
@@ -1692,15 +1708,18 @@ bool QTabBar::event(QEvent *event)
case QEvent::HoverEnter: {
QHoverEvent *he = static_cast<QHoverEvent *>(event);
d->mousePosition = he->position().toPoint();
- if (!d->hoverRect.contains(d->mousePosition)) {
+ const auto sr = d->normalizedScrollRect();
+ const auto oldHoverRect = d->hoverRect & sr;
+ if (!oldHoverRect.contains(d->mousePosition)) {
if (d->hoverRect.isValid())
update(d->hoverRect);
d->hoverIndex = tabAt(d->mousePosition);
- if (d->validIndex(d->hoverIndex)) {
+ if (d->validIndex(d->hoverIndex) && sr.contains(d->mousePosition)) {
d->hoverRect = tabRect(d->hoverIndex);
update(d->hoverRect);
} else {
d->hoverRect = QRect();
+ d->hoverIndex = -1;
}
}
return true;
@@ -1845,10 +1864,14 @@ void QTabBar::paintEvent(QPaintEvent *)
QStyleOption opt;
opt.initFrom(this);
QRegion buttonRegion;
- if (d->leftB->isVisible())
- buttonRegion |= style()->subElementRect(QStyle::SE_TabBarScrollLeftButton, &opt, this);
- if (d->rightB->isVisible())
- buttonRegion |= style()->subElementRect(QStyle::SE_TabBarScrollRightButton, &opt, this);
+ if (d->leftB->isVisible()) {
+ const auto r = style()->subElementRect(QStyle::SE_TabBarScrollLeftButton, &opt, this);
+ buttonRegion |= r;
+ }
+ if (d->rightB->isVisible()) {
+ const auto r = style()->subElementRect(QStyle::SE_TabBarScrollRightButton, &opt, this);
+ buttonRegion |= r;
+ }
if (!buttonRegion.isEmpty())
p.setClipRegion(QRegion(rect()) - buttonRegion);
}
@@ -1857,9 +1880,13 @@ void QTabBar::paintEvent(QPaintEvent *)
const auto tab = d->tabList.at(i);
if (!tab->visible)
continue;
+ for (const auto side : { QTabBar::LeftSide, QTabBar::RightSide }) {
+ if (auto closeButton = qobject_cast<CloseButton *>(tabButton(i, side)))
+ closeButton->setParentClipRect(scrollRect);
+ }
QStyleOptionTab tabOption;
initStyleOption(&tabOption, i);
- if (d->paintWithOffsets && tab->dragOffset != 0) {
+ if (tab->dragOffset != 0) {
if (vertical) {
tabOption.rect.moveTop(tabOption.rect.y() + tab->dragOffset);
} else {
@@ -1901,7 +1928,7 @@ void QTabBar::paintEvent(QPaintEvent *)
const auto tab = d->tabList.at(selected);
initStyleOption(&tabOption, selected);
- if (d->paintWithOffsets && tab->dragOffset != 0) {
+ if (tab->dragOffset != 0) {
// if the drag offset is != 0, a move is in progress (drag or animation)
// => set the tab position to Moving to preserve the rect
tabOption.position = QStyleOptionTab::TabPosition::Moving;
@@ -2934,6 +2961,11 @@ void CloseButton::paintEvent(QPaintEvent *)
opt.state |= QStyle::State_Selected;
}
+ if (m_parentClipRect.isValid()) {
+ auto tl = mapFromParent(m_parentClipRect.topLeft());
+ auto br = mapFromParent(m_parentClipRect.bottomRight());
+ p.setClipRect(QRect(tl, br));
+ }
style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &opt, &p, this);
}
diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h
index 38fbde76470..5b31926253f 100644
--- a/src/widgets/widgets/qtabbar_p.h
+++ b/src/widgets/widgets/qtabbar_p.h
@@ -56,7 +56,7 @@ public:
QTabBarPrivate()
: layoutDirty(false), drawBase(true), elideModeSetByUser(false), useScrollButtons(false),
useScrollButtonsSetByUser(false), expanding(true), closeButtonOnTabs(false),
- paintWithOffsets(true), movable(false), dragInProgress(false), documentMode(false),
+ movable(false), dragInProgress(false), documentMode(false),
autoHide(false), changeCurrentOnDrag(false)
{}
~QTabBarPrivate()
@@ -95,7 +95,6 @@ public:
bool useScrollButtonsSetByUser : 1;
bool expanding : 1;
bool closeButtonOnTabs : 1;
- bool paintWithOffsets : 1;
bool movable : 1;
bool dragInProgress : 1;
bool documentMode : 1;
diff --git a/src/xml/doc/src/external-resources.qdoc b/src/xml/doc/src/external-resources.qdoc
index 89c30a84c47..89552477ae8 100644
--- a/src/xml/doc/src/external-resources.qdoc
+++ b/src/xml/doc/src/external-resources.qdoc
@@ -1,17 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \externalpage http://www.w3.org/2000/xmlns/
- \title http://www.w3.org/2000/xmlns/
-*/
-
-/*!
- \externalpage http://www.saxproject.org/
- \title SAX2 Java interface
-*/
-
/*!
\externalpage http://www.w3.org/TR/DOM-Level-2-Core/
\title W3C DOM Level 2
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
index ac8aece707b..7dd9340f51b 100644
--- a/tests/auto/CMakeLists.txt
+++ b/tests/auto/CMakeLists.txt
@@ -4,6 +4,9 @@
# Order by dependency [*], then alphabetic. [*] If bugs in part A of
# our source would break tests of part B, then test A before B.
+
+add_subdirectory(util/testrunner)
+
set(run_dbus_tests OFF)
if (QT_FEATURE_dbus)
set(run_dbus_tests ON)
diff --git a/tests/auto/cmake/mockplugins/.cmake.conf b/tests/auto/cmake/mockplugins/.cmake.conf
index be788d10f8e..846c4f3b923 100644
--- a/tests/auto/cmake/mockplugins/.cmake.conf
+++ b/tests/auto/cmake/mockplugins/.cmake.conf
@@ -1 +1 @@
-set(QT_REPO_MODULE_VERSION "6.11.0")
+set(QT_REPO_MODULE_VERSION "6.12.0")
diff --git a/tests/auto/cmake/test_generating_cpp_exports/.cmake.conf b/tests/auto/cmake/test_generating_cpp_exports/.cmake.conf
index be788d10f8e..846c4f3b923 100644
--- a/tests/auto/cmake/test_generating_cpp_exports/.cmake.conf
+++ b/tests/auto/cmake/test_generating_cpp_exports/.cmake.conf
@@ -1 +1 @@
-set(QT_REPO_MODULE_VERSION "6.11.0")
+set(QT_REPO_MODULE_VERSION "6.12.0")
diff --git a/tests/auto/cmake/test_static_resources/.cmake.conf b/tests/auto/cmake/test_static_resources/.cmake.conf
index be788d10f8e..846c4f3b923 100644
--- a/tests/auto/cmake/test_static_resources/.cmake.conf
+++ b/tests/auto/cmake/test_static_resources/.cmake.conf
@@ -1 +1 @@
-set(QT_REPO_MODULE_VERSION "6.11.0")
+set(QT_REPO_MODULE_VERSION "6.12.0")
diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
index c2c09a234c8..d134afc4323 100644
--- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
+++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
@@ -463,9 +463,7 @@ void tst_QParallelAnimationGroup::deleteChildrenWithRunningGroup()
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(anim1->state(), QAnimationGroup::Running);
- QTest::qWaitFor([&]{
- return group.currentLoopTime() > 0;
- }, 200ms);
+ QVERIFY(QTest::qWaitFor([&] { return group.currentLoopTime() > 0; }, 200ms));
delete anim1;
QCOMPARE(group.animationCount(), 0);
diff --git a/tests/auto/corelib/itemmodels/qrangemodeladapter/tst_qrangemodeladapter.cpp b/tests/auto/corelib/itemmodels/qrangemodeladapter/tst_qrangemodeladapter.cpp
index ef4a535dcac..29e26f99bdd 100644
--- a/tests/auto/corelib/itemmodels/qrangemodeladapter/tst_qrangemodeladapter.cpp
+++ b/tests/auto/corelib/itemmodels/qrangemodeladapter/tst_qrangemodeladapter.cpp
@@ -220,8 +220,8 @@ API_TEST(moveRows, moveRows(0, 0, 0))
API_TEST(moveTreeRows, moveRows(QList<int>{0, 0}, 0, QList<int>{0, 0}))
API_TEST(insertColumn, insertColumn(0))
-API_TEST(insertColumnWithData, insertColumn(0, {}))
-API_TEST(insertColumns, insertColumns(0, std::declval<Range&>()))
+API_TEST(insertColumnWithData, insertColumn(0, QList<int>{0}))
+API_TEST(insertColumns, insertColumns(0, QList<int>{0}))
API_TEST(removeColumn, removeColumn(0))
API_TEST(removeColumns, removeColumns(0, 0))
API_TEST(moveColumn, moveColumn(0, 0))
@@ -849,7 +849,7 @@ void tst_QRangeModelAdapter::insertColumn_API()
static_assert(has_insertColumnWithData(d.tableOfNumbers));
static_assert(!has_insertColumnWithData(d.constTableOfNumbers));
- static_assert(has_insertColumnWithData(d.tableOfPointers));
+ static_assert(!has_insertColumnWithData(d.tableOfPointers));
}
void tst_QRangeModelAdapter::insertColumns_API()
@@ -863,7 +863,7 @@ void tst_QRangeModelAdapter::insertColumns_API()
static_assert(has_insertColumns(d.tableOfNumbers));
static_assert(!has_insertColumns(d.constTableOfNumbers));
- static_assert(has_insertColumns(d.tableOfPointers));
+ static_assert(!has_insertColumns(d.tableOfPointers));
static_assert(!has_insertColumns(d.tableOfRowPointers));
static_assert(!has_insertColumns(d.listOfNamedRoles));
static_assert(!has_insertColumns(d.m_tree));
diff --git a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
index 806b6b43161..f7d98eb15e2 100644
--- a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
+++ b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
@@ -5656,6 +5656,12 @@ void tst_QFuture::cancelChainWithContext()
int onCancelCnt = 0;
bool unexpectedThread = false;
+ // For in-other-thread case we need a semaphore to make sure that
+ // the needed continuation is executed.
+ // Fot the in-main-thread case it's guaranteed by the unwrap()
+ // implementation.
+ QSemaphore sem;
+
auto f = p1.future()
.then(context, [&]() {
if (QThread::currentThread() != thread)
@@ -5666,6 +5672,8 @@ void tst_QFuture::cancelChainWithContext()
if (QThread::currentThread() != thread)
unexpectedThread = true;
++thenCnt;
+ if (inOtherThread)
+ sem.release();
return f;
}).unwrap()
.then(context, [&]{
@@ -5685,6 +5693,8 @@ void tst_QFuture::cancelChainWithContext()
});
p1.finish();
+ if (inOtherThread)
+ sem.acquire();
f.cancelChain();
p2.finish();
f.waitForFinished();
@@ -5737,6 +5747,75 @@ void tst_QFuture::cancelChainWithContext()
QCOMPARE_EQ(thenCnt, 4);
QCOMPARE_EQ(onCancelCnt, 0);
}
+ // cancelling propagates through unwrap()
+ {
+ QPromise<void> p1, p2;
+ p1.start();
+ p2.start();
+
+ int thenCnt = 0;
+ int onCancelCnt = 0;
+ bool unexpectedThread = false;
+
+ // For in-other-thread case we need a semaphore to make sure that
+ // the first continuation is executed.
+ // Fot the in-main-thread case it's guaranteed by the unwrap()
+ // implementation.
+ QSemaphore sem;
+
+ auto f = p1.future()
+ .then(context, [&, f2 = p2.future()]() {
+ if (QThread::currentThread() != thread)
+ unexpectedThread = true;
+ ++thenCnt;
+ if (inOtherThread)
+ sem.release();
+ return f2;
+ }).unwrap()
+ .onCanceled(context, [&] {
+ if (QThread::currentThread() != thread)
+ unexpectedThread = true;
+ ++onCancelCnt;
+ })
+ .then([&]() {
+ if (QThread::currentThread() != thread)
+ unexpectedThread = true;
+ ++thenCnt;
+ return QtFuture::makeReadyVoidFuture();
+ }).unwrap()
+ .onCanceled([&] {
+ if (QThread::currentThread() != thread)
+ unexpectedThread = true;
+ ++onCancelCnt;
+ })
+ .then(context, [&]{
+ if (QThread::currentThread() != thread)
+ unexpectedThread = true;
+ ++thenCnt;
+ return QtFuture::makeReadyVoidFuture();
+ }).unwrap()
+ .onCanceled([&] {
+ if (QThread::currentThread() != thread)
+ unexpectedThread = true;
+ ++onCancelCnt;
+ })
+ .then(context, [&]{
+ if (QThread::currentThread() != thread)
+ unexpectedThread = true;
+ ++thenCnt;
+ });
+
+ p1.finish();
+ if (inOtherThread)
+ sem.acquire();
+ f.cancelChain();
+ p2.finish();
+ f.waitForFinished();
+
+ QVERIFY(!unexpectedThread);
+ QCOMPARE_EQ(thenCnt, 1);
+ QCOMPARE_EQ(onCancelCnt, 3);
+ }
}
void tst_QFuture::cancelChainOnAnOverwrittenFuture()
diff --git a/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp b/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
index 86dfa5faffc..4c089091f8d 100644
--- a/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
+++ b/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
@@ -57,6 +57,7 @@ private slots:
void multipleReadersLoop();
void multipleWritersLoop();
void multipleReadersWritersLoop();
+ void heavyLoadLocks();
void countingTest();
void limitedReaders();
void deleteOnUnlock();
@@ -603,6 +604,111 @@ public:
}
};
+class HeavyLoadLockThread : public QThread
+{
+public:
+ QReadWriteLock &testRwlock;
+ const qsizetype iterations;
+ const int numThreads;
+ inline HeavyLoadLockThread(QReadWriteLock &l, qsizetype iters, int numThreads, QVector<QAtomicInt *> &counters):
+ testRwlock(l),
+ iterations(iters),
+ numThreads(numThreads),
+ counters(counters)
+ { }
+
+private:
+ QVector<QAtomicInt *> &counters;
+ QAtomicInt *getCounter(qsizetype index)
+ {
+ QReadLocker locker(&testRwlock);
+ /*
+ The index is increased monotonically, so the index
+ being requested should be always within or at the end of the
+ counters vector.
+ */
+ Q_ASSERT(index <= counters.size());
+ if (counters.size() <= index || counters[index] == nullptr) {
+ locker.unlock();
+ QWriteLocker wlocker(&testRwlock);
+ if (counters.size() <= index)
+ counters.resize(index + 1, nullptr);
+ if (counters[index] == nullptr)
+ counters[index] = new QAtomicInt(0);
+ return counters[index];
+ }
+ return counters[index];
+ }
+ void releaseCounter(qsizetype index)
+ {
+ QWriteLocker locker(&testRwlock);
+ delete counters[index];
+ counters[index] = nullptr;
+ }
+
+public:
+ void run() override
+ {
+ for (qsizetype i = 0; i < iterations; ++i) {
+ QAtomicInt *counter = getCounter(i);
+ /*
+ Here each counter is accessed by each thread
+ and increaed only once. As a result, when the
+ counter reaches numThreads, i.e. the fetched
+ value before the increment is numThreads-1,
+ we know all threads have accessed this counter
+ and we can delete it safely.
+ */
+ int prev = counter->fetchAndAddRelaxed(1);
+ if (prev == numThreads - 1) {
+#ifdef QT_BUILDING_UNDER_TSAN
+ /*
+ Under TSAN, deleting and freeing an object
+ will trigger a write operation on the memory
+ of the object. Since we used fetchAndAddRelaxed
+ to update the counter, TSAN will report a data
+ race when deleting the counter here. To avoid
+ the false positive, we simply reset the counter
+ to 0 here, with ordered semantics to establish
+ the sequence to ensure the the free-ing option
+ happens after all fetchAndAddRelaxed operations
+ in other threads.
+
+ When not building under TSAN, deleting the counter
+ will not result in any data read or written to the
+ memory region of the counter, so no data race will
+ happen.
+ */
+ counter->fetchAndStoreOrdered(0);
+#endif
+ releaseCounter(i);
+ }
+ }
+ }
+};
+
+/*
+ Multiple threads racing acquiring and releasing
+ locks on the same indices.
+*/
+
+void tst_QReadWriteLock::heavyLoadLocks()
+{
+ constexpr qsizetype iterations = 65536 * 4;
+ constexpr int numThreads = 8;
+ QVector<QAtomicInt *> counters;
+ QReadWriteLock testLock;
+ std::array<std::unique_ptr<HeavyLoadLockThread>, numThreads> threads;
+ for (auto &thread : threads)
+ thread = std::make_unique<HeavyLoadLockThread>(testLock, iterations, numThreads, counters);
+ for (auto &thread : threads)
+ thread->start();
+ for (auto &thread : threads)
+ thread->wait();
+ QVERIFY(counters.size() == iterations);
+ for (qsizetype i = 0; i < iterations; ++i)
+ QVERIFY(counters[i] == nullptr);
+}
/*
A writer acquires a read-lock, a reader locks
diff --git a/tests/auto/network/access/qhttp2connection/tst_qhttp2connection.cpp b/tests/auto/network/access/qhttp2connection/tst_qhttp2connection.cpp
index 417655c31d9..22aa9d44262 100644
--- a/tests/auto/network/access/qhttp2connection/tst_qhttp2connection.cpp
+++ b/tests/auto/network/access/qhttp2connection/tst_qhttp2connection.cpp
@@ -21,6 +21,8 @@ class tst_QHttp2Connection : public QObject
private slots:
void construct();
void constructStream();
+ void streamConfiguration_data();
+ void streamConfiguration();
void testSETTINGSFrame();
void maxHeaderTableSize();
void testPING();
@@ -204,6 +206,59 @@ void tst_QHttp2Connection::constructStream()
QCOMPARE(stream->isUploadingDATA(), false);
}
+void tst_QHttp2Connection::streamConfiguration_data()
+{
+ QTest::addColumn<bool>("useDownloadBuffer");
+
+ QTest::addRow("useDownloadBuffer=true") << true;
+ QTest::addRow("useDownloadBuffer=false") << false;
+}
+
+void tst_QHttp2Connection::streamConfiguration()
+{
+ QFETCH(const bool, useDownloadBuffer);
+
+ auto [client, server] = makeFakeConnectedSockets();
+ auto *clientConnection = makeHttp2Connection(client.get(), {}, Client);
+ auto *serverConnection = makeHttp2Connection(server.get(), {}, Server);
+
+ QHttp2Stream::Configuration config;
+ config.useDownloadBuffer = useDownloadBuffer;
+
+ QHttp2Stream *clientStream = clientConnection->createStream(config).unwrap();
+ QVERIFY(clientStream);
+ QCOMPARE(clientStream->configuration().useDownloadBuffer, useDownloadBuffer);
+ QVERIFY(waitForSettingsExchange(clientConnection, serverConnection));
+
+ QSignalSpy newIncomingStreamSpy{ serverConnection, &QHttp2Connection::newIncomingStream };
+ QSignalSpy clientDataReceivedSpy{ clientStream, &QHttp2Stream::dataReceived };
+
+ HPack::HttpHeader headers = getRequiredHeaders();
+ clientStream->sendHEADERS(headers, false);
+
+ QVERIFY(newIncomingStreamSpy.wait());
+ auto *serverStream = newIncomingStreamSpy.front().front().value<QHttp2Stream *>();
+ QVERIFY(serverStream);
+
+ const HPack::HttpHeader responseHeaders{ { ":status", "200" } };
+ serverStream->sendHEADERS(responseHeaders, false);
+
+ const QByteArray testData = "Hello World"_ba.repeated(100);
+ serverStream->sendDATA(testData, true);
+
+ QVERIFY(clientDataReceivedSpy.wait());
+ QCOMPARE(clientDataReceivedSpy.count(), 1);
+
+ const QByteArray receivedData = clientDataReceivedSpy.front().front().value<QByteArray>();
+ QCOMPARE(receivedData, testData);
+
+ if (useDownloadBuffer) {
+ QCOMPARE(clientStream->downloadBuffer().byteAmount(), testData.size());
+ } else {
+ QVERIFY(clientStream->downloadBuffer().isEmpty());
+ }
+}
+
void tst_QHttp2Connection::testSETTINGSFrame()
{
constexpr qint32 PrefaceLength = 24;
diff --git a/tests/auto/tools/rcc/data/legal/rcc_legal.cpp b/tests/auto/tools/rcc/data/legal/rcc_legal.cpp
index 248ab2e3b48..96f87d192e7 100644
--- a/tests/auto/tools/rcc/data/legal/rcc_legal.cpp
+++ b/tests/auto/tools/rcc/data/legal/rcc_legal.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2024 Intel Corporation.
** SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
**
-** Created by: The Resource Compiler for Qt version 6.11.0
+** Created by: The Resource Compiler for Qt version 6.12.0
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
diff --git a/tests/auto/util/testrunner/CMakeLists.txt b/tests/auto/util/testrunner/CMakeLists.txt
new file mode 100644
index 00000000000..5ca8406f854
--- /dev/null
+++ b/tests/auto/util/testrunner/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Copyright (C) 2025 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+
+# Run the qt-testrunner test only inside the CI.
+if(DEFINED ENV{COIN_UNIQUE_JOB_ID} AND NOT IOS)
+ qt_internal_create_test_script(
+ NAME tst_qt_testrunner
+ COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tst_qt_testrunner.py" ARGS -v
+ WORKING_DIRECTORY "${test_working_dir}"
+ OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/tst_qt_testrunner_Wrapper$<CONFIG>.cmake"
+ ENVIRONMENT "TESTRUNNER" ""
+ )
+endif()
diff --git a/util/testrunner/tests/qt_mock_test-log.xml b/tests/auto/util/testrunner/qt_mock_test-log.xml
index 62e93bb8dcc..a164bec9f9c 100644
--- a/util/testrunner/tests/qt_mock_test-log.xml
+++ b/tests/auto/util/testrunner/qt_mock_test-log.xml
@@ -21,6 +21,16 @@
<Incident type="{{always_crash_result}}" file="" line="0" />
<Duration msecs="0.828272"/>
</TestFunction>
+
+ <!-- The strings like this one "{{fail_then_pass:2_result}}"
+ are just template strings that will be replaced by the test driver
+ before each test. The colon doesn't have a special meaning.
+ The datatags in the following tests are just "2", "5", "6".
+ We don't strictly need datatags because the tests don't include
+ specific testing for datatags. It's just that adding a couple
+ of datatags to this XML template, complicates it a bit and
+ tests somewhat that functionality as a side-effect.
+ -->
<TestFunction name="fail_then_pass">
<Incident type="{{fail_then_pass:2_result}}" file="" line="0">
<DataTag><![CDATA[2]]></DataTag>
@@ -32,5 +42,9 @@
<DataTag><![CDATA[6]]></DataTag>
</Incident>
</TestFunction>
+ <TestFunction name="fail_then_crash">
+ <Incident type="{{fail_then_crash_result}}" file="" line="0" />
+ <Duration msecs="0.828272"/>
+ </TestFunction>
<Duration msecs="1904.9"/>
</TestCase>
diff --git a/util/testrunner/tests/qt_mock_test.py b/tests/auto/util/testrunner/qt_mock_test.py
index a7adb8804af..af8fdf24509 100755
--- a/util/testrunner/tests/qt_mock_test.py
+++ b/tests/auto/util/testrunner/qt_mock_test.py
@@ -24,28 +24,36 @@
# Mode B:
#
# If invoked without any argument, it runs the tests listed in the
-# variable QT_MOCK_TEST_FAIL_LIST. If variable is empty it just runs
+# variable QT_MOCK_TEST_RUN_LIST. If variable is empty it just runs
# the always_pass test. It also understands qtestlib's `-o outfile.xml,xml`
# option for writing a mock testlog in a file. Requires environment variables:
# + QT_MOCK_TEST_STATE_FILE :: See above
# + QT_MOCK_TEST_XML_TEMPLATE_FILE :: may point to the template XML file
# located in the same source directory. Without this variable, the
# option `-o outfile.xml,xml` will be ignored.
-# + QT_MOCK_TEST_FAIL_LIST :: may contain a comma-separated list of test
+# + QT_MOCK_TEST_RUN_LIST :: may contain a comma-separated list of test
# that should run.
+# + QT_MOCK_TEST_CRASH_CLEANLY :: if set to 1, then the executable will
+# crash (exit with a high exit code)
+# after successfully running the given tests and writing the XML logfile.
+
import sys
import os
import traceback
-from tst_testrunner import write_xml_log
+from tst_qt_testrunner import write_xml_log
MY_NAME = os.path.basename(sys.argv[0])
STATE_FILE = None
XML_TEMPLATE = None
XML_OUTPUT_FILE = None
+CRASH_CLEANLY = False
+
+def crash():
+ sys.exit(131)
def put_failure(test_name):
with open(STATE_FILE, "a") as f:
@@ -98,6 +106,15 @@ def log_test(testcase, result,
testsuite=MY_NAME.rpartition(".")[0]):
print("%-7s: %s::%s()" % (result, testsuite, testcase))
+def log_xml(fail_list):
+ if XML_OUTPUT_FILE and XML_TEMPLATE is not None:
+ if XML_TEMPLATE == "":
+ # If the template is an empty file, then write an empty output file
+ with open(XML_OUTPUT_FILE, "w"):
+ pass
+ else:
+ write_xml_log(XML_OUTPUT_FILE, failure=fail_list)
+
# Return the exit code
def run_test(testname):
if testname == "initTestCase":
@@ -107,7 +124,14 @@ def run_test(testname):
elif testname == "always_fail":
exit_code = 1
elif testname == "always_crash":
- exit_code = 130
+ exit_code = 131
+ elif testname == "fail_then_crash":
+ previous_fails = get_failures(testname)
+ if previous_fails == 0:
+ put_failure(testname)
+ exit_code = 1
+ else:
+ exit_code = 131
elif testname.startswith("fail_then_pass"):
wanted_fails = int(testname.partition(":")[2])
previous_fails = get_failures(testname)
@@ -139,13 +163,16 @@ def no_args_run():
for test in run_list:
test_exit_code = run_test(test)
if test_exit_code not in (0, 1):
- sys.exit(130) # CRASH!
+ crash()
if test_exit_code != 0:
fail_list.append(test)
total_result = total_result and (test_exit_code == 0)
- if XML_TEMPLATE and XML_OUTPUT_FILE:
- write_xml_log(XML_OUTPUT_FILE, failure=fail_list)
+ log_xml(fail_list)
+
+ if CRASH_CLEANLY:
+ # Crash despite all going well and writing all output files cleanly.
+ crash()
if total_result:
sys.exit(0)
@@ -163,13 +190,25 @@ def main():
with open(os.environ["QT_MOCK_TEST_XML_TEMPLATE_FILE"]) as f:
XML_TEMPLATE = f.read()
+ global CRASH_CLEANLY
+ if ("QT_MOCK_TEST_CRASH_CLEANLY" in os.environ
+ and os.environ["QT_MOCK_TEST_CRASH_CLEANLY"] == "1"
+ ):
+ CRASH_CLEANLY = True
+
args = clean_cmdline()
if len(args) == 0:
no_args_run()
assert False, "Unreachable!"
- else:
- sys.exit(run_test(args[0]))
+ else: # run single test function
+ exit_code = run_test(args[0])
+ # Write "fail" in the XML log only if the specific run has failed.
+ if exit_code != 0:
+ log_xml([args[0]])
+ else:
+ log_xml([])
+ sys.exit(exit_code)
# TODO write XPASS test that does exit(1)
diff --git a/util/testrunner/tests/tst_testrunner.py b/tests/auto/util/testrunner/tst_qt_testrunner.py
index 4a3d92e167b..1134fa0427f 100755
--- a/util/testrunner/tests/tst_testrunner.py
+++ b/tests/auto/util/testrunner/tst_qt_testrunner.py
@@ -14,7 +14,8 @@ from tempfile import TemporaryDirectory, mkstemp
MY_NAME = os.path.basename(__file__)
my_dir = os.path.dirname(__file__)
-testrunner = os.path.join(my_dir, "..", "qt-testrunner.py")
+testrunner = os.path.join(my_dir, "..", "..", "..", "..",
+ "util", "testrunner", "qt-testrunner.py")
mock_test = os.path.join(my_dir, "qt_mock_test.py")
xml_log_template = os.path.join(my_dir, "qt_mock_test-log.xml")
@@ -26,7 +27,12 @@ import unittest
def setUpModule():
global TEMPDIR
- TEMPDIR = TemporaryDirectory(prefix="tst_testrunner-")
+ TEMPDIR = TemporaryDirectory(prefix="tst_qt_testrunner-")
+
+ global EMPTY_FILE
+ EMPTY_FILE = os.path.join(TEMPDIR.name, "EMPTY")
+ with open(EMPTY_FILE, "w") as f:
+ pass
filename = os.path.join(TEMPDIR.name, "file_1")
print("setUpModule(): setting up temporary directory and env var"
@@ -35,6 +41,7 @@ def setUpModule():
os.environ["QT_MOCK_TEST_STATE_FILE"] = filename
os.environ["QT_MOCK_TEST_XML_TEMPLATE_FILE"] = xml_log_template
+ os.environ["QT_TESTRUNNER_TESTING"] = "1"
def tearDownModule():
print("\ntearDownModule(): Cleaning up temporary directory:",
@@ -44,22 +51,32 @@ def tearDownModule():
# Helper to run a command and always capture output
-def run(*args, **kwargs):
+def run(args : list, **kwargs):
+ if args[0].endswith(".py"):
+ # Make sure we run python executables with the same python version.
+ # It also helps on Windows, that .py files are not directly executable.
+ args = [ sys.executable, *args ]
if DEBUG:
print("Running: ", args, flush=True)
- proc = subprocess.run(*args, stdout=PIPE, stderr=STDOUT, **kwargs)
+ proc = subprocess.run(args, stdout=PIPE, stderr=STDOUT, **kwargs)
if DEBUG and proc.stdout:
print(proc.stdout.decode(), flush=True)
return proc
# Helper to run qt-testrunner.py with proper testing arguments.
-def run_testrunner(xml_filename=None, testrunner_args=None,
+# Always append --log-dir=TEMPDIR unless specifically told not to.
+def run_testrunner(xml_filename=None, log_dir=None,
+ testrunner_args=None,
wrapper_script=None, wrapper_args=None,
qttest_args=None, env=None):
args = [ testrunner ]
if xml_filename:
args += [ "--parse-xml-testlog", xml_filename ]
+ if log_dir == None:
+ args += [ "--log-dir", TEMPDIR.name ]
+ elif log_dir != "":
+ args += [ "--log-dir", log_dir ]
if testrunner_args:
args += testrunner_args
@@ -75,16 +92,21 @@ def run_testrunner(xml_filename=None, testrunner_args=None,
return run(args, env=env)
# Write the XML_TEMPLATE to filename, replacing the templated results.
-def write_xml_log(filename, failure=None):
+def write_xml_log(filename, failure=None, inject_message=None):
data = XML_TEMPLATE
+ if failure is None:
+ failure = []
+ elif isinstance(failure, str):
+ failure = [ failure ]
# Replace what was asked to fail with "fail"
- if type(failure) in (list, tuple):
- for template in failure:
- data = data.replace("{{"+template+"_result}}", "fail")
- elif type(failure) is str:
- data = data.replace("{{"+failure+"_result}}", "fail")
+ for x in failure:
+ data = data.replace("{{" + x + "_result}}", "fail")
# Replace the rest with "pass"
data = re.sub(r"{{[^}]+}}", "pass", data)
+ # Inject possible <Message> tags inside the first <TestFunction>
+ if inject_message:
+ i = data.index("</TestFunction>")
+ data = data[:i] + inject_message + data[i:]
with open(filename, "w") as f:
f.write(data)
@@ -96,6 +118,12 @@ class Test_qt_mock_test(unittest.TestCase):
state_file = os.environ["QT_MOCK_TEST_STATE_FILE"]
if os.path.exists(state_file):
os.remove(state_file)
+ def assertProcessCrashed(self, proc):
+ if DEBUG:
+ print("process returncode is:", proc.returncode)
+ self.assertTrue(proc.returncode < 0 or
+ proc.returncode >= 128)
+
def test_always_pass(self):
proc = run([mock_test, "always_pass"])
self.assertEqual(proc.returncode, 0)
@@ -125,6 +153,11 @@ class Test_qt_mock_test(unittest.TestCase):
self.assertEqual(proc.returncode, 1)
proc = run([mock_test, "fail_then_pass:2"])
self.assertEqual(proc.returncode, 0)
+ def test_fail_then_crash(self):
+ proc = run([mock_test, "fail_then_crash"])
+ self.assertEqual(proc.returncode, 1)
+ proc = run([mock_test, "fail_then_crash"])
+ self.assertProcessCrashed(proc)
def test_xml_file_is_written(self):
filename = os.path.join(TEMPDIR.name, "testlog.xml")
proc = run([mock_test, "-o", filename+",xml"])
@@ -132,6 +165,39 @@ class Test_qt_mock_test(unittest.TestCase):
self.assertTrue(os.path.exists(filename))
self.assertGreater(os.path.getsize(filename), 0)
os.remove(filename)
+ # Test it will write an empty XML file if template is empty
+ def test_empty_xml_file_is_written(self):
+ my_env = {
+ **os.environ,
+ "QT_MOCK_TEST_XML_TEMPLATE_FILE": EMPTY_FILE
+ }
+ filename = os.path.join(TEMPDIR.name, "testlog.xml")
+ proc = run([mock_test, "-o", filename+",xml"],
+ env=my_env)
+ self.assertEqual(proc.returncode, 0)
+ self.assertTrue(os.path.exists(filename))
+ self.assertEqual(os.path.getsize(filename), 0)
+ os.remove(filename)
+ def test_crash_cleanly(self):
+ proc = run([mock_test],
+ env={ **os.environ, "QT_MOCK_TEST_CRASH_CLEANLY":"1" })
+ if DEBUG:
+ print("returncode:", proc.returncode)
+ self.assertProcessCrashed(proc)
+
+
+# Find in @path, files that start with @testname and end with @pattern,
+# where @pattern is a glob-like string.
+def find_test_logs(testname=None, path=None, pattern="-*[0-9].xml"):
+ if testname is None:
+ testname = os.path.basename(mock_test)
+ if path is None:
+ path = TEMPDIR.name
+ pattern = os.path.join(path, testname + pattern)
+ logfiles = glob.glob(pattern)
+ if DEBUG:
+ print(f"Test ({testname}) logfiles found: ", logfiles)
+ return logfiles
# Test regular invocations of qt-testrunner.
class Test_testrunner(unittest.TestCase):
@@ -140,19 +206,17 @@ class Test_testrunner(unittest.TestCase):
if os.path.exists(state_file):
os.remove(state_file)
# The mock_test honors only the XML output arguments, the rest are ignored.
- old_logfiles = glob.glob(os.path.basename(mock_test) + "*.xml",
- root_dir=TEMPDIR.name)
+ old_logfiles = find_test_logs(pattern="*.xml")
for fname in old_logfiles:
os.remove(os.path.join(TEMPDIR.name, fname))
- self.env = dict()
- self.env["QT_MOCK_TEST_XML_TEMPLATE_FILE"] = os.environ["QT_MOCK_TEST_XML_TEMPLATE_FILE"]
- self.env["QT_MOCK_TEST_STATE_FILE"] = state_file
- self.testrunner_args = [ "--log-dir", TEMPDIR.name ]
+ self.env = dict(os.environ)
+ self.testrunner_args = []
def prepare_env(self, run_list=None):
if run_list is not None:
self.env['QT_MOCK_TEST_RUN_LIST'] = ",".join(run_list)
def run2(self):
return run_testrunner(testrunner_args=self.testrunner_args, env=self.env)
+
def test_simple_invocation(self):
# All tests pass.
proc = self.run2()
@@ -163,11 +227,7 @@ class Test_testrunner(unittest.TestCase):
self.assertEqual(proc.returncode, 0)
def test_output_files_are_generated(self):
proc = self.run2()
- xml_output_files = glob.glob(os.path.basename(mock_test) + "-*[0-9].xml",
- root_dir=TEMPDIR.name)
- if DEBUG:
- print("Output files found: ",
- xml_output_files)
+ xml_output_files = find_test_logs()
self.assertEqual(len(xml_output_files), 1)
def test_always_fail(self):
self.prepare_env(run_list=["always_fail"])
@@ -195,10 +255,38 @@ class Test_testrunner(unittest.TestCase):
self.prepare_env(run_list=["initTestCase,always_pass"])
proc = self.run2()
self.assertEqual(proc.returncode, 3)
+ def test_fail_then_crash(self):
+ self.prepare_env(run_list=["fail_then_crash"])
+ proc = self.run2()
+ self.assertEqual(proc.returncode, 3)
+
+ # By testing --no-extra-args, we ensure qt-testrunner works for
+ # tst_selftests and the other NON_XML_GENERATING_TESTS.
+ def test_no_extra_args_pass(self):
+ self.testrunner_args += ["--no-extra-args"]
+ proc = self.run2()
+ self.assertEqual(proc.returncode, 0)
+ def test_no_extra_args_fail(self):
+ self.prepare_env(run_list=["always_fail"])
+ self.testrunner_args += ["--no-extra-args"]
+ proc = self.run2()
+ self.assertEqual(proc.returncode, 3)
+ def test_no_extra_args_reruns_only_once_1(self):
+ self.prepare_env(run_list=["fail_then_pass:1"])
+ self.testrunner_args += ["--no-extra-args"]
+ proc = self.run2()
+ # The 1st rerun PASSed.
+ self.assertEqual(proc.returncode, 0)
+ def test_no_extra_args_reruns_only_once_2(self):
+ self.prepare_env(run_list=["fail_then_pass:2"])
+ self.testrunner_args += ["--no-extra-args"]
+ proc = self.run2()
+ # We never re-run more than once, so the exit code shows FAIL.
+ self.assertEqual(proc.returncode, 3)
# If no XML file is found by qt-testrunner, it is usually considered a
# CRASH and the whole test is re-run. Even when the return code is zero.
- # It is a PASS only if the test is not capable of XML output (see no_extra_args, TODO test it).
+ # It is a PASS only if the test is not capable of XML output (see no_extra_args above).
def test_no_xml_log_written_pass_crash(self):
del self.env["QT_MOCK_TEST_XML_TEMPLATE_FILE"]
self.prepare_env(run_list=["always_pass"])
@@ -220,11 +308,86 @@ class Test_testrunner(unittest.TestCase):
proc = self.run2()
self.assertEqual(proc.returncode, 3)
+ def test_empty_xml_crash_1(self):
+ self.env["QT_MOCK_TEST_XML_TEMPLATE_FILE"] = EMPTY_FILE
+ self.prepare_env(run_list=["always_pass"])
+ proc = self.run2()
+ self.assertEqual(proc.returncode, 3)
+ def test_empty_xml_crash_2(self):
+ self.env["QT_MOCK_TEST_XML_TEMPLATE_FILE"] = EMPTY_FILE
+ self.prepare_env(run_list=["always_fail"])
+ proc = self.run2()
+ self.assertEqual(proc.returncode, 3)
+
+ # test qFatal should be a crash in all cases.
+ def test_qfatal_crash_1(self):
+ fatal_xml_message = """
+ <Message type="qfatal" file="" line="0">
+ <DataTag><![CDATA[modal]]></DataTag>
+ <Description><![CDATA[Failed to initialize graphics backend for OpenGL.]]></Description>
+ </Message>
+ """
+ logfile = os.path.join(TEMPDIR.name, os.path.basename(mock_test) + ".xml")
+ write_xml_log(logfile, failure=None, inject_message=fatal_xml_message)
+ del self.env["QT_MOCK_TEST_XML_TEMPLATE_FILE"]
+ self.env["QT_TESTRUNNER_DEBUG_NO_UNIQUE_OUTPUT_FILENAME"] = "1"
+ self.prepare_env(run_list=["always_pass"])
+ proc = self.run2()
+ self.assertEqual(proc.returncode, 3)
+ def test_qfatal_crash_2(self):
+ fatal_xml_message = """
+ <Message type="qfatal" file="" line="0">
+ <DataTag><![CDATA[modal]]></DataTag>
+ <Description><![CDATA[Failed to initialize graphics backend for OpenGL.]]></Description>
+ </Message>
+ """
+ logfile = os.path.join(TEMPDIR.name, os.path.basename(mock_test) + ".xml")
+ write_xml_log(logfile, failure="always_fail", inject_message=fatal_xml_message)
+ del self.env["QT_MOCK_TEST_XML_TEMPLATE_FILE"]
+ self.env["QT_TESTRUNNER_DEBUG_NO_UNIQUE_OUTPUT_FILENAME"] = "1"
+ self.prepare_env(run_list=["always_pass,always_fail"])
+ proc = self.run2()
+ self.assertEqual(proc.returncode, 3)
+
+ def test_qwarn_is_ignored_1(self):
+ qwarn_xml_message = """
+ <Message type="qwarn" file="" line="0">
+ <DataTag><![CDATA[modal]]></DataTag>
+ <Description><![CDATA[Failed to create RHI (backend 2)]]></Description>
+ </Message>
+ """
+ logfile = os.path.join(TEMPDIR.name, os.path.basename(mock_test) + ".xml")
+ write_xml_log(logfile, failure=None, inject_message=qwarn_xml_message)
+ del self.env["QT_MOCK_TEST_XML_TEMPLATE_FILE"]
+ self.env["QT_TESTRUNNER_DEBUG_NO_UNIQUE_OUTPUT_FILENAME"] = "1"
+ self.prepare_env(run_list=["always_pass"])
+ proc = self.run2()
+ self.assertEqual(proc.returncode, 0)
+ def test_qwarn_is_ignored_2(self):
+ fatal_xml_message = """
+ <Message type="qfatal" file="" line="0">
+ <DataTag><![CDATA[modal]]></DataTag>
+ <Description><![CDATA[Failed to initialize graphics backend for OpenGL.]]></Description>
+ </Message>
+ <Message type="qwarn" file="" line="0">
+ <DataTag><![CDATA[modal]]></DataTag>
+ <Description><![CDATA[Failed to create RHI (backend 2)]]></Description>
+ </Message>
+ """
+ logfile = os.path.join(TEMPDIR.name, os.path.basename(mock_test) + ".xml")
+ write_xml_log(logfile, failure=None, inject_message=fatal_xml_message)
+ del self.env["QT_MOCK_TEST_XML_TEMPLATE_FILE"]
+ self.env["QT_TESTRUNNER_DEBUG_NO_UNIQUE_OUTPUT_FILENAME"] = "1"
+ self.prepare_env(run_list=["always_pass"])
+ proc = self.run2()
+ self.assertEqual(proc.returncode, 3)
+
# If a test returns success but XML contains failures, it's a CRASH.
def test_wrong_xml_log_written_1_crash(self):
logfile = os.path.join(TEMPDIR.name, os.path.basename(mock_test) + ".xml")
write_xml_log(logfile, failure="always_fail")
del self.env["QT_MOCK_TEST_XML_TEMPLATE_FILE"]
+ self.env["QT_TESTRUNNER_DEBUG_NO_UNIQUE_OUTPUT_FILENAME"] = "1"
self.prepare_env(run_list=["always_pass"])
proc = self.run2()
self.assertEqual(proc.returncode, 3)
@@ -233,6 +396,7 @@ class Test_testrunner(unittest.TestCase):
logfile = os.path.join(TEMPDIR.name, os.path.basename(mock_test) + ".xml")
write_xml_log(logfile)
del self.env["QT_MOCK_TEST_XML_TEMPLATE_FILE"]
+ self.env["QT_TESTRUNNER_DEBUG_NO_UNIQUE_OUTPUT_FILENAME"] = "1"
self.prepare_env(run_list=["always_fail"])
proc = self.run2()
self.assertEqual(proc.returncode, 3)
@@ -241,25 +405,34 @@ class Test_testrunner(unittest.TestCase):
if not content:
content='exec "$@"'
filename = os.path.join(TEMPDIR.name, filename)
- # if os.path.exists(filename):
- # os.remove(filename)
with open(filename, "w") as f:
f.write(f'#!/bin/sh\n{content}\n')
self.wrapper_script = f.name
os.chmod(self.wrapper_script, 0o700)
+ # Test that it re-runs the full executable in case of crash, even if the
+ # XML file is valid and shows one specific test failing.
+ def test_crash_reruns_full_QTQAINFRA_5226(self):
+ self.env["QT_MOCK_TEST_RUN_LIST"] = "always_fail"
+ # Tell qt_mock_test to crash after writing a proper XML file.
+ self.env["QT_MOCK_TEST_CRASH_CLEANLY"] = "1"
+ proc = self.run2()
+ # Verify qt-testrunner exited with 3 which means CRASH.
+ self.assertEqual(proc.returncode, 3)
+ # Verify that a full executable re-run happened that re-runs 2 times,
+ # instead of individual functions that re-run 5 times.
+ xml_output_files = find_test_logs()
+ self.assertEqual(len(xml_output_files), 2)
+
# Test that qt-testrunner detects the correct executable name even if we
# use a special wrapper script, and that it uses that in the XML log filename.
+ @unittest.skipUnless(os.name == "posix", "Wrapper script needs POSIX shell")
def test_wrapper(self):
self.create_wrapper("coin_vxworks_qemu_runner.sh")
proc = run_testrunner(wrapper_script=self.wrapper_script,
- testrunner_args=["--log-dir",TEMPDIR.name],
env=self.env)
self.assertEqual(proc.returncode, 0)
- xml_output_files = glob.glob(os.path.basename(mock_test) + "-*[0-9].xml",
- root_dir=TEMPDIR.name)
- if DEBUG:
- print("XML output files found: ", xml_output_files)
+ xml_output_files = find_test_logs()
self.assertEqual(len(xml_output_files), 1)
# The "androidtestrunner" wrapper is special. It expects the QTest arguments after "--".
@@ -269,48 +442,50 @@ class Test_testrunner(unittest.TestCase):
self.create_wrapper("androidtestrunner", content=
'while [ "$1" != "--" ]; do shift; done; shift; exec {} "$@"'.format(mock_test))
+ @unittest.skipUnless(os.name == "posix", "Wrapper script needs POSIX shell")
def test_androidtestrunner_with_aab(self):
self.create_mock_anroidtestrunner_wrapper()
- # Copied verbatim from our CI logs. The only relevant option is --aab.
- androidtestrunner_args= ['--path', '/home/qt/work/qt/qtdeclarative_standalone_tests/tests/auto/quickcontrols/qquickpopup/android-build-tst_qquickpopup', '--adb', '/opt/android/sdk/platform-tools/adb', '--skip-install-root', '--ndk-stack', '/opt/android/android-ndk-r27c/ndk-stack', '--manifest', '/home/qt/work/qt/qtdeclarative_standalone_tests/tests/auto/quickcontrols/qquickpopup/android-build-tst_qquickpopup/app/AndroidManifest.xml', '--make', '"/opt/cmake-3.30.5/bin/cmake" --build /home/qt/work/qt/qtdeclarative_standalone_tests --target tst_qquickpopup_make_aab', '--aab', '/home/qt/work/qt/qtdeclarative_standalone_tests/tests/auto/quickcontrols/qquickpopup/android-build-tst_qquickpopup/tst_qquickpopup.aab', '--bundletool', '/opt/bundletool/bundletool', '--timeout', '1425']
+ # Copied from our CI logs. The only relevant option is --aab.
+ androidtestrunner_args= [
+ '--path', '/home/qt/work/qt/qtdeclarative_standalone_tests/tests/auto/quickcontrols/qquickpopup/android-build-tst_qquickpopup',
+ '--adb', '/opt/android/sdk/platform-tools/adb', '--skip-install-root',
+ '--ndk-stack', '/opt/android/android-ndk-r27c/ndk-stack',
+ '--manifest', '/home/qt/work/qt/qtdeclarative_standalone_tests/tests/auto/quickcontrols/qquickpopup/android-build-tst_qquickpopup/app/AndroidManifest.xml',
+ '--make', '"/opt/cmake-3.30.5/bin/cmake" --build /home/qt/work/qt/qtdeclarative_standalone_tests --target tst_qquickpopup_make_aab',
+ '--aab', '/home/qt/work/qt/qtdeclarative_standalone_tests/tests/auto/quickcontrols/qquickpopup/android-build-tst_qquickpopup/tst_qquickpopup.aab',
+ '--bundletool', '/opt/bundletool/bundletool', '--timeout', '1425'
+ ]
# In COIN CI, TESTRUNNER="qt-testrunner.py --". That's why we append "--".
- proc = run_testrunner(testrunner_args=["--log-dir", TEMPDIR.name, "--"],
+ proc = run_testrunner(testrunner_args=["--"],
wrapper_script=self.wrapper_script,
wrapper_args=androidtestrunner_args,
env=self.env)
self.assertEqual(proc.returncode, 0)
- xml_output_files = glob.glob("tst_qquickpopup-*[0-9].xml",
- root_dir=TEMPDIR.name)
- if DEBUG:
- print("XML output files found: ", xml_output_files)
+ xml_output_files = find_test_logs("tst_qquickpopup")
self.assertEqual(len(xml_output_files), 1)
# similar to above but with "--apk"
+ @unittest.skipUnless(os.name == "posix", "Wrapper script needs POSIX shell")
def test_androidtestrunner_with_apk(self):
self.create_mock_anroidtestrunner_wrapper()
androidtestrunner_args= ['--blah', '--apk', '/whatever/waza.apk', 'blue']
- proc = run_testrunner(testrunner_args=["--log-dir", TEMPDIR.name, "--"],
+ proc = run_testrunner(testrunner_args=["--"],
wrapper_script=self.wrapper_script,
wrapper_args=androidtestrunner_args,
env=self.env)
self.assertEqual(proc.returncode, 0)
- xml_output_files = glob.glob("waza-*[0-9].xml",
- root_dir=TEMPDIR.name)
- if DEBUG:
- print("XML output files found: ", xml_output_files)
+ xml_output_files = find_test_logs("waza")
self.assertEqual(len(xml_output_files), 1)
# similar to above but with neither "--apk" nor "--aab". qt-testrunner throws error.
+ @unittest.skipUnless(os.name == "posix", "Wrapper script needs POSIX shell")
def test_androidtestrunner_fail_to_detect_filename(self):
self.create_mock_anroidtestrunner_wrapper()
androidtestrunner_args= ['--blah', '--argh', '/whatever/waza.apk', 'waza.aab']
- proc = run_testrunner(testrunner_args=["--log-dir", TEMPDIR.name, "--"],
+ proc = run_testrunner(testrunner_args=["--"],
wrapper_script=self.wrapper_script,
wrapper_args=androidtestrunner_args,
env=self.env)
self.assertEqual(proc.returncode, 1)
- xml_output_files = glob.glob("waza-*[0-9].xml",
- root_dir=TEMPDIR.name)
- if DEBUG:
- print("XML output files found: ", xml_output_files)
+ xml_output_files = find_test_logs("waza")
self.assertEqual(len(xml_output_files), 0)
@@ -322,7 +497,8 @@ class Test_testrunner(unittest.TestCase):
# + No failure logged. qt-testrunner should exit(0)
# + The "always_pass" test has failed. qt-testrunner should exit(0).
# + The "always_fail" test has failed. qt-testrunner should exit(2).
-# + The "always_crash" test has failed. qt-testrunner should exit(2).
+# + The "always_crash" test has failed. qt-testrunner should exit(3)
+# since the re-run will crash.
# + The "fail_then_pass:2" test failed. qt-testrunner should exit(0).
# + The "fail_then_pass:5" test failed. qt-testrunner should exit(2).
# + The "initTestCase" failed which is listed as NO_RERUN thus
@@ -333,28 +509,32 @@ class Test_testrunner_with_xml_logfile(unittest.TestCase):
(_handle, self.xml_file) = mkstemp(
suffix=".xml", prefix="qt_mock_test-log-",
dir=TEMPDIR.name)
+ os.close(_handle)
if os.path.exists(os.environ["QT_MOCK_TEST_STATE_FILE"]):
os.remove(os.environ["QT_MOCK_TEST_STATE_FILE"])
def tearDown(self):
os.remove(self.xml_file)
del self.xml_file
+ # Run testrunner specifically for the tests here, with --parse-xml-testlog.
+ def run3(self, testrunner_args=None):
+ return run_testrunner(self.xml_file,
+ testrunner_args=testrunner_args)
def test_no_failure(self):
write_xml_log(self.xml_file, failure=None)
- proc = run_testrunner(self.xml_file)
+ proc = self.run3()
self.assertEqual(proc.returncode, 0)
def test_always_pass_failed(self):
write_xml_log(self.xml_file, failure="always_pass")
- proc = run_testrunner(self.xml_file)
+ proc = self.run3()
self.assertEqual(proc.returncode, 0)
def test_always_pass_failed_max_repeats_0(self):
write_xml_log(self.xml_file, failure="always_pass")
- proc = run_testrunner(self.xml_file,
- testrunner_args=["--max-repeats", "0"])
+ proc = self.run3(testrunner_args=["--max-repeats", "0"])
self.assertEqual(proc.returncode, 2)
def test_always_fail_failed(self):
write_xml_log(self.xml_file, failure="always_fail")
- proc = run_testrunner(self.xml_file)
+ proc = self.run3()
self.assertEqual(proc.returncode, 2)
# Assert that one of the re-runs was in verbose mode
matches = re.findall("VERBOSE RUN",
@@ -362,22 +542,22 @@ class Test_testrunner_with_xml_logfile(unittest.TestCase):
self.assertEqual(len(matches), 1)
# Assert that the environment was altered too
self.assertIn("QT_LOGGING_RULES", proc.stdout.decode())
- def test_always_crash_failed(self):
+ def test_always_crash_crashed(self):
write_xml_log(self.xml_file, failure="always_crash")
- proc = run_testrunner(self.xml_file)
- self.assertEqual(proc.returncode, 2)
+ proc = self.run3()
+ self.assertEqual(proc.returncode, 3)
def test_fail_then_pass_2_failed(self):
write_xml_log(self.xml_file, failure="fail_then_pass:2")
- proc = run_testrunner(self.xml_file)
+ proc = self.run3()
self.assertEqual(proc.returncode, 0)
def test_fail_then_pass_5_failed(self):
write_xml_log(self.xml_file, failure="fail_then_pass:5")
- proc = run_testrunner(self.xml_file)
+ proc = self.run3()
self.assertEqual(proc.returncode, 2)
def test_with_two_failures(self):
write_xml_log(self.xml_file,
failure=["always_pass", "fail_then_pass:2"])
- proc = run_testrunner(self.xml_file)
+ proc = self.run3()
self.assertEqual(proc.returncode, 0)
# Check that test output is properly interleaved with qt-testrunner's logging.
matches = re.findall(r"(PASS|FAIL!).*\n.*Test process exited with code",
@@ -385,7 +565,7 @@ class Test_testrunner_with_xml_logfile(unittest.TestCase):
self.assertEqual(len(matches), 4)
def test_initTestCase_fail_crash(self):
write_xml_log(self.xml_file, failure="initTestCase")
- proc = run_testrunner(self.xml_file)
+ proc = self.run3()
self.assertEqual(proc.returncode, 3)
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index 560c725fd3f..2c14a408804 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -449,12 +449,12 @@ void tst_QWizard::setPixmap()
int newWidth = 1240;
wizard.resize(newWidth, 720);
QCOMPARE(wizard.width(), oldWidth);
- wizard.setBannerSizePolicy(QWizard::BannerSizePolicy::Stretch);
+ wizard.setBannerStretchPolicy(QWizard::BannerStretchPolicy::Stretch);
wizard.resize(newWidth, 720);
QCOMPARE(wizard.width(), newWidth);
- wizard.setBannerSizePolicy(QWizard::BannerSizePolicy::NoStretch);
+ wizard.setBannerStretchPolicy(QWizard::BannerStretchPolicy::NoStretch);
QCOMPARE(wizard.width(), oldWidth);
- wizard.setBannerSizePolicy(QWizard::BannerSizePolicy::Stretch);
+ wizard.setBannerStretchPolicy(QWizard::BannerStretchPolicy::Stretch);
wizard.resize(newWidth, 720);
QCOMPARE(wizard.width(), newWidth);
}
diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST
index 9651c1480c8..12da5b423ab 100644
--- a/tests/auto/widgets/kernel/qwidget/BLACKLIST
+++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST
@@ -4,11 +4,6 @@ osx
macos arm
[render_systemClip]
osx
-[multipleToplevelFocusCheck]
-centos
-opensuse-leap
-ubuntu
-sles-15
# QTBUG-87668
[showMinimizedKeepsFocus]
android
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index e3d172c60c0..359a0946474 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -6931,9 +6931,13 @@ class TopLevelFocusCheck: public QWidget
Q_OBJECT
public:
QLineEdit* edit;
- explicit TopLevelFocusCheck(QWidget *parent = nullptr)
+ explicit TopLevelFocusCheck(const QString &name, QWidget *parent = nullptr)
: QWidget(parent), edit(new QLineEdit(this))
{
+ const QString title = QLatin1String(QTest::currentTestFunction()) + "_"_L1 + name;
+ setWindowTitle(title);
+ setObjectName(title);
+ edit->setObjectName(QString("%1_edit"_L1).arg(title));
edit->hide();
edit->installEventFilter(this);
}
@@ -6943,7 +6947,7 @@ public slots:
{
edit->show();
edit->setFocus(Qt::OtherFocusReason);
- QCoreApplication::processEvents();
+ QVERIFY(QTest::qWaitForWindowFocused(edit));
}
bool eventFilter(QObject *obj, QEvent *event) override
{
@@ -6963,49 +6967,42 @@ void tst_QWidget::multipleToplevelFocusCheck()
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
QSKIP("Window activation is not supported");
- TopLevelFocusCheck w1;
- TopLevelFocusCheck w2;
+ TopLevelFocusCheck w1("Widget-1"_L1);
+ TopLevelFocusCheck w2("Widget-2"_L1);
- const QString title = QLatin1String(QTest::currentTestFunction());
- w1.setWindowTitle(title + QLatin1String("_W1"));
w1.move(m_availableTopLeft + QPoint(20, 20));
w1.resize(200, 200);
w1.show();
QVERIFY(QTest::qWaitForWindowExposed(&w1));
- w2.setWindowTitle(title + QLatin1String("_W2"));
w2.move(w1.frameGeometry().topRight() + QPoint(20, 0));
w2.resize(200,200);
w2.show();
QVERIFY(QTest::qWaitForWindowExposed(&w2));
w1.activateWindow();
- QApplicationPrivate::setActiveWindow(&w1);
QVERIFY(QTest::qWaitForWindowActive(&w1));
- QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&w1));
+ QTRY_COMPARE(QApplication::activeWindow(), &w1);
QTest::mouseDClick(&w1, Qt::LeftButton);
- QTRY_COMPARE(QApplication::focusWidget(), static_cast<QWidget *>(w1.edit));
+ QTRY_COMPARE(QApplication::focusWidget(), w1.edit);
w2.activateWindow();
- QApplicationPrivate::setActiveWindow(&w2);
QVERIFY(QTest::qWaitForWindowActive(&w2));
- QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&w2));
+ QTRY_COMPARE(QApplication::activeWindow(), &w2);
QTest::mouseClick(&w2, Qt::LeftButton);
QTRY_COMPARE(QApplication::focusWidget(), nullptr);
QTest::mouseDClick(&w2, Qt::LeftButton);
- QTRY_COMPARE(QApplication::focusWidget(), static_cast<QWidget *>(w2.edit));
+ QTRY_COMPARE(QApplication::focusWidget(), w2.edit);
w1.activateWindow();
- QApplicationPrivate::setActiveWindow(&w1);
QVERIFY(QTest::qWaitForWindowActive(&w1));
- QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&w1));
+ QTRY_COMPARE(QApplication::activeWindow(), &w1);
QTest::mouseDClick(&w1, Qt::LeftButton);
- QTRY_COMPARE(QApplication::focusWidget(), static_cast<QWidget *>(w1.edit));
+ QTRY_COMPARE(QApplication::focusWidget(), w1.edit);
w2.activateWindow();
- QApplicationPrivate::setActiveWindow(&w2);
QVERIFY(QTest::qWaitForWindowActive(&w2));
- QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&w2));
+ QTRY_COMPARE(QApplication::activeWindow(), &w2);
QTest::mouseClick(&w2, Qt::LeftButton);
QTRY_COMPARE(QApplication::focusWidget(), nullptr);
}
diff --git a/util/testrunner/README b/util/testrunner/README
index 5758e325140..cb6722ac807 100644
--- a/util/testrunner/README
+++ b/util/testrunner/README
@@ -15,10 +15,4 @@ It offers the following functionality
The script itself has a testsuite that is simply run by invoking
-qtbase/util/testrunner/tests/tst_testrunner.py
-
-Please *run this manually* before submitting a change to qt-testrunner and
-make sure it's passing. The reason it does not run automatically during the
-usual qtbase test run, is because
-+ the test run should not depend on Python
-+ we don't want to wrap the testrunner tests with testrunner.
+qtbase/tests/auto/util/testrunner/tst_qt_testrunner.py
diff --git a/util/testrunner/qt-testrunner.py b/util/testrunner/qt-testrunner.py
index 41e81e83122..1573534cee9 100755
--- a/util/testrunner/qt-testrunner.py
+++ b/util/testrunner/qt-testrunner.py
@@ -4,10 +4,9 @@
# !!!IMPORTANT!!! If you change anything to this script, run the testsuite
-# manually and make sure it still passes, as it doesn't run automatically.
-# Just execute the command line as such:
+# and make sure it still passes:
#
-# ./util/testrunner/tests/tst_testrunner.py -v [--debug]
+# qtbase/tests/auto/util/testrunner/tst_qt_testrunner.py -v [--debug]
#
# ======== qt-testrunner ========
#
@@ -15,24 +14,44 @@
# tst_whatever, and tries to iron out unpredictable test failures.
# In particular:
#
-# + Appends output argument to it: "-o tst_whatever.xml,xml"
-# + Checks the exit code. If it is zero, the script exits with zero,
-# otherwise proceeds.
-# + Reads the XML test log and Understands exactly which function
-# of the test failed.
-# + If no XML file is found or was invalid, the test executable
-# probably CRASHed, so we *re-run the full test once again*.
-# + If some testcases failed it executes only those individually
-# until they pass, or until max-repeats times is reached.
+# + Append output argument to it: "-o tst_whatever.xml,xml" and
+# execute it.
+# + Save the exit code.
+# - If it is <0 or >=128 (see NOTE_2), mark the test run as CRASH.
+# + Read the XML test log and find exactly which functions
+# of the test FAILed.
+# + Mark the test run as CRASH, if:
+# - no XML file is found,
+# - or an invalid XML file is found,
+# - or the XML contains a QFatal message: <Message type="qfatal">
+# - or no test FAILures are listed in the XML but the saved
+# exit code is not 0.
+# + If, based on the rules above, the test run is marked as CRASH,
+# then *re-run the full test once again* and start this logic over.
+# If we are on the 2nd run and CRASH happens again, then exit(3).
+# + Examine the saved exit code:
+# if it is 0, then exit(0) (success, all tests have PASSed).
+# + Otherwise, some testcases failed, so execute only those individually
+# until they pass, or until max-repeats (default: 5) times is reached.
#
# The regular way to use is to set the environment variable TESTRUNNER to
-# point to this script before invoking ctest.
+# point to this script before invoking ctest. In COIN CI it is set as
+# TESTRUNNER="qt-testrunner.py --" to stop it from parsing further args.
#
# NOTE: this script is crafted specifically for use with Qt tests and for
# using it in Qt's CI. For example it detects and acts specially if test
# executable is "tst_selftests" or "androidtestrunner". It also detects
# env var "COIN_CTEST_RESULTSDIR" and uses it as log-dir.
#
+# NOTE_2: Why is qt-testrunner considering exit code outside [0,127] as CRASH?
+# On Linux, Python subprocess module returns positive `returncode`
+# (255 for example), even if the child does exit(-1 for example). It
+# returns negative `returncode` only if the child is killed by a signal.
+# Qt-testrunner wants to catch both of these cases as CRASH.
+# On Windows, a crash is usually accompanied by exitcode >= 0xC0000000.
+# Finally, QTest is limiting itself to exit codes in [0,127]
+# so anything outside that range is abnormal, thus treated as CRASH.
+#
# TODO implement --dry-run.
# Exit codes of this script:
@@ -63,9 +82,17 @@ from pprint import pprint
from typing import NamedTuple, Tuple, List, Optional
# Define a custom type for returning a fail incident
-class WhatFailed(NamedTuple):
+class TestResult(NamedTuple):
func: str
tag: Optional[str] = None
+class WhatFailed(NamedTuple):
+ qfatal_message: Optional[str] = None
+ failed_tests: List[TestResult] = []
+
+class ReRunCrash(Exception):
+ pass
+class BadXMLCrash(Exception):
+ pass
# In the last test re-run, we add special verbosity arguments, in an attempt
@@ -83,9 +110,11 @@ NO_RERUN_FUNCTIONS = {
# not try to append "-o" to their command-line or re-run failed testcases.
# Only add tests here if absolutely necessary!
NON_XML_GENERATING_TESTS = {
- "tst_selftests", # qtestlib's selftests are using an external test framework (Catch) that does not support -o argument
- "tst_QDoc", # Some of QDoc's tests are using an external test framework (Catch) that does not support -o argument
- "tst_QDoc_Catch_Generators", # Some of QDoc's tests are using an external test framework (Catch) that does not support -o argument
+ # These tests use an external test framework (Catch) that doesn't support
+ # QtTest's -o argument.
+ "tst_selftests",
+ "tst_QDoc",
+ "tst_QDoc_Catch_Generators",
}
# These are scripts that are used to wrap test execution for special platforms.
# They need special handling (most times just skipping the wrapper name in argv[]).
@@ -131,6 +160,9 @@ Default flags: --max-repeats 5 --passes-needed 1
" -o log_file.xml -v2 -vs. This will disable some functionality like the"
" failed test repetition and the verbose output on failure. This is"
" activated by default when TESTARGS is tst_selftests.")
+ # TODO parser.parse_args(args=sys.argv[0:cmd_index]).
+ # Where cmd_index is either the first positional argument, or the argument right after "--".
+ # This way it won't interpet arguments after the first positional arg.
args = parser.parse_args()
args.self_name = os.path.basename(sys.argv[0])
args.specific_extra_args = []
@@ -198,11 +230,13 @@ Default flags: --max-repeats 5 --passes-needed 1
return args
-def parse_log(results_file) -> List[WhatFailed]:
- """Parse the XML test log file. Return the failed testcases, if any.
+def parse_log(results_file) -> WhatFailed:
+ """
+ Parse the XML test log file. Return the failed testcases, if any,
+ and the first qfatal message possibly printed.
Failures are considered the "fail" and "xpass" incidents.
- A testcase is a function with an optional data tag."""
+ """
start_timer = timeit.default_timer()
try:
@@ -222,10 +256,12 @@ def parse_log(results_file) -> List[WhatFailed]:
root = tree.getroot()
if root.tag != "TestCase":
- raise AssertionError(
+ raise BadXMLCrash(
f"The XML test log must have <TestCase> as root tag, but has: <{root.tag}>")
failures = []
+ qfatal_message = None
+
n_passes = 0
for e1 in root:
if e1.tag == "TestFunction":
@@ -233,23 +269,43 @@ def parse_log(results_file) -> List[WhatFailed]:
if e2.tag == "Incident":
if e2.attrib["type"] in ("fail", "xpass"):
func = e1.attrib["name"]
+ datatag = None
e3 = e2.find("DataTag") # every <Incident> might have a <DataTag>
if e3 is not None:
- failures.append(WhatFailed(func, tag=e3.text))
- else:
- failures.append(WhatFailed(func))
+ datatag = e3.text
+ failures.append(TestResult(func, datatag))
else:
n_passes += 1
+ # Use iter() here to _recursively_ search root for <Message>,
+ # as we don't trust that messages are always at the same depth.
+ for message_tag in root.iter(tag="Message"):
+ messagetype = message_tag.get("type")
+ if messagetype == "qfatal":
+ message_desc = message_tag.find("Description")
+ if message_desc is not None:
+ qfatal_message = message_desc.text
+ else:
+ qfatal_message = "--EMPTY QFATAL--"
+ L.warning("qFatal message ('%s') found in the XML, treating this run as a CRASH!",
+ qfatal_message)
+ break
+
end_timer = timeit.default_timer()
t = end_timer - start_timer
L.info(f"Parsed XML file {results_file} in {t:.3f} seconds")
L.info(f"Found {n_passes} passes and {len(failures)} failures")
- return failures
+ return WhatFailed(qfatal_message, failures)
def run_test(arg_list: List[str], **kwargs):
+ if (os.environ.get("QT_TESTRUNNER_TESTING", "0") == "1"
+ and os.name == "nt"
+ and arg_list[0].endswith(".py")
+ ):
+ # For executing qt_mock_test.py under the same Python interpreter when testing.
+ arg_list = [ sys.executable ] + arg_list
L.debug("Running test command line: %s", arg_list)
proc = subprocess.run(arg_list, **kwargs)
L.info("Test process exited with code: %d", proc.returncode)
@@ -257,6 +313,11 @@ def run_test(arg_list: List[str], **kwargs):
return proc
def unique_filename(test_basename: str) -> str:
+
+ # Hidden env var for testing, enforcing a predictable, non-unique filename.
+ if os.environ.get("QT_TESTRUNNER_DEBUG_NO_UNIQUE_OUTPUT_FILENAME"):
+ return f"{test_basename}"
+
timestamp = round(time.time() * 1000)
return f"{test_basename}-{timestamp}"
@@ -291,18 +352,19 @@ def run_full_test(test_basename, testargs: List[str], output_dir: str,
def rerun_failed_testcase(test_basename, testargs: List[str], output_dir: str,
- what_failed: WhatFailed,
+ testcase: TestResult,
max_repeats, passes_needed,
dryrun=False, timeout=None) -> bool:
"""Run a specific function:tag of a test, until it passes enough times, or
until max_repeats is reached.
Return True if it passes eventually, False if it fails.
+ Raise ReRunCrash Exception if it crashes.
"""
assert passes_needed <= max_repeats
- failed_arg = what_failed.func
- if what_failed.tag:
- failed_arg += ":" + what_failed.tag
+ failed_arg = testcase.func
+ if testcase.tag:
+ failed_arg += ":" + testcase.tag
n_passes = 0
@@ -325,6 +387,19 @@ def rerun_failed_testcase(test_basename, testargs: List[str], output_dir: str,
proc = run_test(testargs + output_args + VERBOSE_ARGS + [failed_arg],
timeout=timeout,
env={**os.environ, **VERBOSE_ENV})
+ # There are platforms that run tests wrapped with some test-runner
+ # script, that can possibly fail to extract a process exit code.
+ # Because of these cases, we *also* parse the XML file and signify
+ # CRASH in case of QFATAL/empty/corrupt result.
+ what_failed = parse_log(f"{pathname_stem}.xml")
+ if what_failed.qfatal_message:
+ raise ReRunCrash(f"CRASH! returncode:{proc.returncode} "
+ f"QFATAL:'{what_failed.qfatal_message}'")
+ if proc.returncode < 0 or proc.returncode >= 128:
+ raise ReRunCrash(f"CRASH! returncode:{proc.returncode}")
+ if proc.returncode == 0 and len(what_failed.failed_tests) > 0:
+ raise ReRunCrash("CRASH! returncode:0 but failures were found: "
+ + what_failed.failed_tests)
if proc.returncode == 0:
n_passes += 1
if n_passes == passes_needed:
@@ -354,20 +429,22 @@ def main():
try:
results_file = None
- failed_functions = []
+ what_failed = WhatFailed()
if args.parse_xml_testlog: # do not run test, just parse file
- failed_functions = parse_log(args.parse_xml_testlog)
+ what_failed = parse_log(args.parse_xml_testlog)
# Pretend the test returned correct exit code
- retcode = len(failed_functions)
+ retcode = len(what_failed.failed_tests)
else: # normal invocation, run test
(retcode, results_file) = \
run_full_test(args.test_basename, args.testargs, args.log_dir,
args.no_extra_args, args.dry_run, args.timeout,
args.specific_extra_args)
if results_file:
- failed_functions = parse_log(results_file)
+ what_failed = parse_log(results_file)
+
+ failed_functions = what_failed.failed_tests
- if retcode < 0:
+ if retcode < 0 or retcode >= 128 or what_failed.qfatal_message:
L.warning("CRASH detected, re-running the whole executable")
continue
if retcode == 0:
@@ -392,6 +469,8 @@ def main():
assert len(failed_functions) > 0 and retcode != 0
break # all is fine, goto re-running individual failed testcases
+ except AssertionError:
+ raise
except Exception as e:
L.error("exception:%s %s", type(e).__name__, e)
L.error("The test executable probably crashed, see above for details")
@@ -402,13 +481,15 @@ def main():
L.info("Some tests failed, will re-run at most %d times.\n",
args.max_repeats)
- for what_failed in failed_functions:
+ for test_result in failed_functions:
try:
ret = rerun_failed_testcase(args.test_basename, args.testargs, args.log_dir,
- what_failed, args.max_repeats, args.passes_needed,
+ test_result, args.max_repeats, args.passes_needed,
dryrun=args.dry_run, timeout=args.timeout)
+ except AssertionError:
+ raise
except Exception as e:
- L.error("exception:%s %s", type(e).__name__, e)
+ L.error("exception:%s", e)
L.error("The testcase re-run probably crashed, giving up")
sys.exit(3) # Test re-run CRASH