Commit Graph

68217 Commits (dcacb0be973cfc17f495fef6d2da73471c3360ea)

Author SHA1 Message Date
Alexandru Croitor dcacb0be97 coin: Enable generation and linting of source SBOM
This will enable generation and linting of source SBOMs only if the
repository source root contains a REUSE.toml file. Otherwise the steps
will be skipped.

Task-number: QTBUG-122899
Task-number: QTBUG-125211
Change-Id: I87ea9aad7fb4f15ec7fa9d00072c81cddbe7ea2c
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 186d368f0d613d7d1b60a6d1dc197269ab4db8f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-24 12:38:21 +00:00
Alexandru Croitor 0da10e9b22 CMake: Allow generating and verifying a source SBOM using 'reuse' tool
Add code to generate and install a source SBOM SPDX file for every
repo. It relies on the python 'reuse' tool being installed and
available in PATH.

Also add code to allow running 'reuse lint', which checks compliance
with the reuse specification.

The features are only enabled when configuring with
 -DQT_GENERATE_SBOM=ON
 -DQT_GENERATE_SOURCE_SBOM=ON
 -DQT_LINT_SOURCE_SBOM=ON
which will be the case for our CI in a follow up patch.

Because most of our repos are not yet reuse compliant, the actual
generation of the source SBOM and the linting is skipped if the
project root directory does not contain a REUSE.toml file.

This allows incremental handling of each repository, while also
enforcing the compliance at installation time when the REUSE.toml file
is actually there.

The source SBOM generation and linting will run at installation time,
but they can also be manually triggered at build time using the
ninja 'sbom' and 'reuse_lint' custom targets.

Various opt outs are provided as a fail safe:
- QT_FORCE_SOURCE_SBOM_GENERATION to force source sbom generation
  even if a REUSE.toml file is not present in the root source dir
- QT_FORCE_REUSE_LINT_ERROR to force linting to error out, even if
  a REUSE.toml file is not present
- QT_FORCE_SKIP_REUSE_LINT_ON_INSTALL to skip linting at installation
  time, but allow running it at build time

These can be set either locally or conditionally passed to CMake
inside repo-specific Coin instructions.

Task-number: QTBUG-122899
Task-number: QTBUG-125211
Change-Id: I664e69830936c4427688143ee86b98782c1733ab
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 6d9b4291746907e30ea49ac0adf8608ad8a1129b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-24 12:38:15 +00:00
Alexey Edelev 1647193afa Make the android multi-ABI builds with Unix Makefiles pure sequential
Add the missing dependency between qt_internal_android_<abi>_configure
and the last target from previous ABI-specific step in the chain.

This slows the Unix Makefiles builds, but ensures that there is no race
condition when executing configuring step.

Also as a driven-by fix the _qt_android_abi_steps property list, by removing
the parazite -NOTFOUND entries.

Pick-to: 6.7 6.5
Fixes: QTBUG-127414
Change-Id: Ibb69dcdebd2052a7aa1d4bd0c3f657cdeb312f37
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 924dd10afc9f9137ce2da7643306d8df511c6ab9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-24 12:38:11 +00:00
Alexandru Croitor 82d9b18535 CMake: Introduce sbom 'output file path without extensions' variable
Some operations might want to install additional files next to the
repo sbom, with the same file base name as the repo sbom file name.
E.g install qtbase.source.spdx.json next to qtbase.spdx.json.

Make the output file path without the extension available in a new
QT_SBOM_OUTPUT_PATH_WITHOUT_EXT variable during installation.

Task-number: QTBUG-122899
Change-Id: I0b9442cffa3f3b0fd2387e77569a94e43ce387a5
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 35bd5df58932299221ad475ebaf25e2c0492e6a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-24 12:38:08 +00:00
Alexandru Croitor 551e01c124 CMake: Allow opting out of Intel CET hardening
Some Qt internal targets might not work correctly when built with
Intel CET hardening.

Add a per-target opt out to skip adding the Intel CET flags.

Task-number: QTBUG-127464
Change-Id: I1a28b228a82b3505d987649eec6db08281c15482
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit c5e42a9d2faef611e3a6d124d5b093670346fb87)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-24 11:48:45 +00:00
Mate Barany 873bacc549 Rename signal in QNetworkFile
Address the "Overloaded signals should be avoided" warning: there
is already a method named "error" in QFileDevice, rename the signal
"error" to "networkError".

Found by an Axivion scan.

Pick-to: 6.7 6.5
Task-number: QTBUG-125026
Change-Id: I2f1b5752238aca614af82a94e2918399c582f74d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 7f0450a47f2cab8c0482131475eba7162f4bdf8f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-24 09:19:02 +00:00
Kai Köhne 5cd80af50f Doc: Make it explicit what QJsonParseError::offset refers to
Pick-to: 6.7 6.5 6.2
Change-Id: I278929f89e9e6f9f4461558dc0dd949d0455dcb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e00a032eac1a234c0846571a0e8a6ac1e5c411b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-24 09:19:00 +00:00
Lorn Potter a065afa40b wasm: set status code before readyRead is sent
Pick-to: 6.7
Change-Id: I6f0360158cf6fe728eb49f61dc0ec819924e96e2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit cd213bb750cb6619defeb700aea270f016c6cd19)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-24 05:21:22 +00:00
Axel Spoerl 5413d4b460 Minor code cleanup QTestPrivate::parseBlackList()
Constify local variables, where possible.
Remove redundant include.
Bump (c) year to 2024.

Change-Id: If13fb87b306926cb94f75186071a1dff2969a945
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 6de2203fb75e034c1a02478daa13e8ddfcea5d75)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-23 22:52:53 +00:00
Ahmad Samir d04e4bac4f tst_QMimeDatabase: update shared-mime-info local testing instructions
Also store the version in one variable and reuse it, to make it easier
to update in the future.

Change-Id: Ib843a1cfa5c53233f9daa6c373d238f756eb4853
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 922e197bd3468d4c10b8fcd6377cd7b67f2541f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-23 22:52:53 +00:00
Alexandru Croitor 2d4f6ec8a1 CMake: Improve SBOM PURL handling
Tools that consume SBOMs expect that each SBOM package will contain a
unique purl: https://github.com/package-url/purl-spec

Each Qt target maps to an SBOM package, so generate a target-specific
PURL for each Qt target, by using the combination of the repo name
and target name as the purl name.
The purl external reference will then look something like:

ExternalRef: PACKAGE-MANAGER purl pkg:/TheQtCompany/qtbase-Gui@6.8.0

Also allow customizing the purl for each target by specifying one of
the following options to functions like qt_internal_add_module or
qt_internal_extend_sbom:
- PURL_TYPE
- PURL_NAMESPACE
- PURL_NAME
- PURL_VERSION
- PURL_SUBPATH
- PURL_QUALIFIERS
- NO_PURL
- NO_DEFAULT_QT_PURL

Task-number: QTBUG-122899
Change-Id: I6926dd773a0ef6fc688664bcac7b23483ecbabe6
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit f6fdc1fe5fde253d7e70a2d2bbef42e9c411956e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-23 14:29:39 +00:00
Gary Wang 44a17e9a36 QJpegPlugin: also recognize jfif suffix
Currently QJpegPlugin can load JFIF image without issue, but didn't
register jfif as recognized suffix. This add the support for jfif
suffix and will load the image as regular JPEG image.

Qt image formats plugins doesn't care about the extra metadata provided
by image itself, so it's fine to simply use the existing QJpegPlugin
to load JFIF image files.

Change-Id: I880d7603f356fbb01af7de8e4fb62fa010a0fd1f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 68f58ce198a794e7b2890f1127c99e0395d105a5)
2024-07-23 09:15:31 +00:00
Giuseppe D'Angelo e358eb3bab QCompare: add more relational operator overloads
libc++ has a "poisoned" set of relational operator overloads for
the standard category types. A call like

  std::strong_ordering::equivalent == Qt::partial_ordering::equivalent

fails to compile, despite the presence of

  operator==(std::partial_ordering, Qt::partial_ordering)

This is viable after converting strong_ordering. But strong_ordering
itself defines a

  operator==(std::strong_ordering, CmpZero)

where CmpZero is poisoned and accepts Qt::partial_ordering, making
the call ill-formed.

I'm not 100% sure if libc++ is right here (cf. the linked upstream
bug report for some ruminations). We can work around this issue by
adding sufficient additional overloads to Qt::partial_ordering and
be a perfect match. For some reason this was already the case for
the other Qt's comparison types.

Notes:

1) I didn't test this. Only libc++-trunk defined the necessary C++
   feature macros to trigger the problem; I made a synthetic testcase
   and it worked.

2) I'm not sure why these operators are defined symmetrically instead of
   relying on C++20's reversed operators, but I'll follow the
   pre-existing ones.

Change-Id: I0937f40b7e685026d4677e7918948d47d2b7cec6
Pick-to: 6.7
Fixes: QTBUG-126541
Task-number: QTQAINFRA-6203
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit b892b39a7a6c50eb5bbf03f0c9f01bdd07756f13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 23:51:33 +00:00
Mate Barany 0e9046f20d Include qnetworkglobal_p.h into qocsp_p.h
Addressing a "Q_OS_WIN should not be checked before qglobal.h is
included" Axivion warning.

Task-number: QTBUG-125026
Pick-to: 6.7 6.5
Change-Id: I78c3df04a92aab8753c2651502d7893822523ed0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit df3c9f365f9543ec6491354f11103280ded0f3a9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 22:10:24 +00:00
Mate Barany c7de578712 Initialize the expiryTimeoutSeconds variable in CacheableObject
The variable expiryTimeoutSeconds is set by the function
QNetworkAccessCache::addEntry and as a parameter is defaulted to -1
so initialize it to -1 with NSDMI.

Task-number: QTBUG-125026
Pick-to: 6.7 6.5
Change-Id: I8a96c2acbf94be409529200801d4d7169e852ac1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 9e75236a0dd157ca85e6f38870fac37214b683b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 22:10:18 +00:00
Christian Ehrlicher 28e8a377f1 QWindowsScreen: use correct return value of SetupDiDestroyDeviceInfoList
SetupDiDestroyDeviceInfoList() returns TRUE (1) and not ERROR_SUCCESS
(0) so an assertion is triggered falsely on destruction.
This amends 5183ca14344c04015b32ef407e4cdad1b370c841.

Pick-to: 6.7 6.5
Task-number: QTBUG-127168
Change-Id: I03ea601e35c0cbcf44080379853e33362568122c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fcaaebd5c8d5323f050fdcf07d16dc37bdba197b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 21:18:26 +00:00
Marc Mutz a0c9b5f020 tst_QList: port away from qsnprintf()
Change-Id: I9ad99a06b2d645108eae3bf9d74e08d95d31f8fc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit a90a1ebac8b07e6cb8e0b62eefb714a77bb3ed8f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 21:00:13 +00:00
Marc Mutz 57ad4caa7b tst_QDeadlineTimer: fix format-string in toString() implementation
The second value (like the first) has type qint64 (aka long long), so
%d is wrong; need to use %lld instead.

Found while porting to std::snprintf() (qsnprintf() never actually got
the __attribute__((printf)), so compilers didn't warn).

Drive-by replace qAbs() with std::abs().

Amends 13c3558fe9.

Pick-to: 6.7 6.5
Change-Id: I9082a1aceefe8a5b04ad0d5725ab666e23483b29
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 61e4be2b62f9b6556a145f226850bf5e62d53e9d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 21:00:13 +00:00
Marc Mutz c9b55d8b39 tst_QStorageInfo: port from qvsnprintf to std::vsnprintf()
Drive-by make a variable const.

Change-Id: I90231330d15edfdef8bc182ed917b80a4c413d2d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 829caad5e773245b7d712bce4b7e53e9377e3764)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 21:00:12 +00:00
Christian Ehrlicher f9d6c8b14c QSqlDriver/doc: Add a note about features depending on the db server
Some features are server-dependent and therefore an open db connection
is needed to make sure that the feature is available.

Pick-to: 6.7 6.5
Fixes: QTBUG-10016
Change-Id: Ia9a117a64ba5fe7cdd69bf95a41cfc301ab5fd94
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 139b8779469244dd1aa226dd3222e6e4aeb2c932)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 21:00:12 +00:00
Marc Mutz 205e3a8dc8 ipctestcommon.h: add #pragma once
The file had no protection against multiple inclusions. While current
code doesn't include it multiply, prevent it from becoming a problem
in the future.

Pragma once is sufficient, as this header is not installed.

Amends 32a06e9830.

Pick-to: 6.7
Change-Id: I97bbbb80f46c0e587288e8ebb4fa06ddd2e892be
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 235bb0926a94a73655a266c0ac038fa3a0a982cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 21:00:12 +00:00
Christian Ehrlicher 4ab6fc7215 SQL/QSqlRelationTableModel: don't crash with more than one relation
When more than one relation is used, an internal container might be
resized which can lead to a reallocation. Since the internal data
structure holds a pointer to an element of this container, this pointer
is invalidated after the reallocation. Therefore store a QSharedPointer
instead.

Pick-to: 6.7 6.5
Fixes: QTBUG-60674
Change-Id: I18c6157c7328be201f8b89a7ca12f423a86d9b71
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit c0aabbd8a0c5a01c2048bcaf36525570a8e0bb35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 21:00:12 +00:00
Marc Mutz c342496831 QPlainTextLogger: FixedBufString: simplify appendf()
qsnprintf() does not make a difference between lvalue and rvalue
arguments, so the wrapper doesn't need to perfectly forward.

Use decay-copy via by-value arguments to potentially reduce the number
of instantiations required for the existing calls.

Adjust indentation so the continuation line doesn't need to be
re-indented when we'll port qsnprintf() to std::snprintf().

Amends 0e8eb20af4.

Pick-to: 6.7 6.5
Change-Id: Idcaa441517fdbf00fefd952db7928731779123ab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fba67959acb7be39942aa3ce829f6764c46ad3ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 21:00:12 +00:00
Allan Sandfeld Jensen 5e94d455db Add rvalue versions to new convertedToColorSpace method
Change-Id: I484d8a4258c2a0597549b6bdc6b7e5c144d3cf10
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 20e81dbe29cd9964b1a536901eba7f2c192385ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 17:08:52 +00:00
Allan Sandfeld Jensen db78bba3f4 Avoid crashing with plasma-integration
Move the virtual to at least make us call the right methods still when
encountering a platformtheme compiled against an older version

Change-Id: Idb6e75b71889c04b2a11e94492d0906dc8ddc84f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2b66952b83f048ebaf896691178910ed4e466ede)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 14:47:55 +00:00
Ahmad Samir f5971dc78a QDirListing: add API docs for DirEntry
It's part of the public API.

Drive-by change: add `\ingroup io` to QDirListing too.

Fixes: QTBUG-127152
Change-Id: Ic327cbb8742dfd323cae9f7135a7590d14819869
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8fc89a4637214a0724a2abb5f47c16487d4fffea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 14:47:54 +00:00
Mårten Nordheim 78e167ab7b tst_http2: stabilize duplicateRequestsWithAborts for macos
The test relies on things ending up in the h2RequestsToSend container
internally. For h2c we would have to use the http1 upgrade mechanism,
and while I have not verified it, it seems to not reliably put
enough requests in the container, and so the test is flaky for macos,
which is the only platform where we use h2c. In CI at least.

Fix it by forcing it by using h2 direct, which will work even on macOS
without server-side ALPN.

Pick-to: 6.7 6.5 6.2
Change-Id: I55816d400baa831524100f075e1b50fd3d9781a6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 4e827e42e339a2774be26ba844bd5e87a14d83b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 14:47:51 +00:00
Alexandru Croitor 3f89719a4b CMake: Allow marking incomplete 3rd party deps for a target's SBOM
For some targets, it might not be possible to specify all 3rd party
dependencies information for SBOM generation.

qtwebengine is one of these cases, where the 3rd party targets are
only known to GN, and not CMake.

Add a new SBOM_INCOMPLETE_3RD_PARTY_DEPENDENCIES option which can be
passed to qt_internal_add_module and friends.
This will include an informational message into the SBOM package
comment field that the dependency information might be incomplete.

Also add an SBOM_PACKAGE_COMMENT option, which can be used to provide
further information if necessary.

Task-number: QTBUG-122899
Change-Id: I5e893e1e205aae4a5591a457be88d5db54fa8fc3
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 04ade5acc923ae04142004551ce8c7560517d192)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 13:16:24 +00:00
Alexandru Croitor 7dd7e5038c CMake: Fix invalid option passed to _qt_internal_generic_deployqt
EXECUTABLE is not a valid option name, EXECUTABLES is. The latter is
already passed.

Remove the EXECUTABLE option, and add a guard to show an error when
there are unparsed arguments.

Task-number: QTBUG-127404
Change-Id: I981f6e53925d9b4a9e7ee23f6e80c69dc41e42e8
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 869c6ee890ee740b9e99eca44730524d6a45d4b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 12:12:31 +00:00
Marc Mutz 853f7b661f QDebug: make toString() SCARY
Extract the non-template-dependent code into an out-of-line function
and pass the actual streaming operation as a callback.

Saves 4% (174811→167936) in executable size for tst_qdebug and 2.7%
(93639→91122) for tst_tostring on Linux GCC 9 AMD64 release builds.

Change-Id: If232e5b26c66981ffcb614f1bdb7007c71e879bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5cdd1f594d26e1d4f84b00741be1ab7231458512)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 23:06:54 +00:00
Marc Mutz fbef250c6c Fix (unlikely) truncation in write_xbm_image()
The usual qsizetype -> int problem. Fix by using auto.

Change-Id: Ie990dec39c8c33cdc055da6bfee451319825c934
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 0cef4ae6870fdd57fd908cdecde3c6c426b7321e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 23:06:53 +00:00
Igor Khanin d84105e71f Fixup QTextOption enum formatting
Add missing trailing space, and change to newer "since Qt version"
format for relevant enum values.

Pick-to: 6.7 6.5
Change-Id: Iffe959545d9d608a65c41c8d3ad56f16468cfa73
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit f7d1d5cb0110552c276ff7a4d8bfb79bf1129c87)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 23:06:49 +00:00
Marc Mutz 334a83e4a7 Fix potential truncation in write_xbm_image()
The old code sized the buffer according to the UTF-16 size of the
input, but in fact wrote UTF-8 output, which can be up to twice as
large as UTF-16, overflowing the buffer size. Not a buffer overflow,
because qs_n_printf(), but truncation would create an invalid XBM
file here.

Fix by converting to UTF-8 first (and only once), and taking the
buffer size from there.

Introduced by 2883a6de40, which replaced
toAscii() (whose result has the same size as the input) with toUtf8()
(which can be larger).

Pick-to: 6.7 6.5
Change-Id: I4acc0816a94060520695c3e6895ed982812fdee2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6d3bd0ebeacc76178fc3c4c368e04bd642881a96)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 15:01:31 +00:00
Marc Mutz c8771a3082 QDebug: make Stream ctors explicit
Their argument types are not faithful representations of a Stream
object, so ctors should not be implicit. Besides, the QDebug ctors
that delegate to these Stream ctors are explicit, too, with the same
arguments.

Change-Id: I8048e26e890009cc8f6bc3ce49e2c01af1e89514
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a9ab406a69f4edc4228cc2effbcde309fcdcf411)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 15:01:31 +00:00
Marc Mutz 0471e845e4 qtesttostring.h: don't write 32..256B of NULs
qsnprint() is unconditionally called to fill the buffer and is
guaranteed to NUL-terminate, so there's no point in filling the whole
stack buffer with NULs beforehand. Leave it uninitialized.

The code was moved in 4ae6f40b3a, so not
picking further than that.

Change-Id: I34d456ebd2990aa242ccc42693adbbf1f64148de
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4c5b437a3ce84354dfa3bf2c4706e05144ac03a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 15:01:31 +00:00
Marc Mutz ae515c3f2e Fix signature of QDebug::toString() (again)
There are zero QDebug operators that take an rvalue RHS, so there's no
need to make toString() perfectly forwarding. It just causes four¹
different versions of the identical function to be instantiated. Not
all compilers can merge the binary representations and those that try,
violate the standard (same address for different functions).

¹ {rvalue, lvalue} × {const, non-const}

Fix by taking by cref.

Amends 4097653215.

[ChangeLog][Potentially Source-Incompatible Changes][QtCore][QDebug]
The toString() static function no longer allows the called
operator<<() to modify the argument. No Qt-provided operator<<() does
that, and operators that do are probably buggy.

Change-Id: Iac1ee9d29f93fd4840b75ffe363d354a2d19a96e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 13244eef6c913bb7f27cd8fbf459f5dfe9a0ed21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 15:01:31 +00:00
David Faure f7eddcdcb1 QTextDocument: repair AlignBaseline for inline objects
The code from QTBUG-14414 (Qt4 commit
ee9455ed2a83084692d969c398ecb91bcd4fc33a) was removed in commit
199f9c5448, due to an oversight: that
commit was only about images, while there's also the case of inline
objects that contain actual text. Such objects are easy to overlook
because they are not provided by Qt itself. They are however common
in applications that implement word-processor-looking "variables",
like a place-holder for "page number", for instance).

Pick-to: 6.7
Change-Id: I2ff1476583bdfe24abcc523cffb65ce116b7faf9
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 99c1465215beac52fad4c6772c9bfef2209157e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 12:42:34 +00:00
Alexandru Croitor abb231a2f0 CMake: Only build QtLibraryInfo if we are building tools
It is a dependency for qmake and qtpaths. If neither of them are
built, because building tools might be disabled, skip building the
library as well.

Task-number: QTBUG-127334
Change-Id: I0f7d5bc9d9a4539a6d25f7c2d841e9b8978a83a3
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 82b2c51c3aec148c890d732978ca4a881e5c6f82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 12:42:33 +00:00
Alexandru Croitor f240a7a2bb CMake: Allow building qmake docs in a documentation-only build
We never added the qmake subdirectory if we didn't build tools. Thus
we never created a doc target to build qmake's documentation.

Make sure we add the qmake subdirectory regardless of whether we build
tools or not. qt_internal_add_tool can then make sure to skip building
the tool if necessary.

If the tool is not created though, create a fake qmake INTERFACE
library target, so that qt_internal_add_docs has a target to work
with.

Amends 5c352f47b9

Fixes: QTBUG-127334
Change-Id: I41cc96fb6ad21e32e17d312ea474835dfa38528e
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit aea0f89cfa4aca7e4c7b5056c425fb44ce394770)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 12:42:33 +00:00
Axel Spoerl b572a85b68 Remove GTK3 native menu
QGtk3Menu relied on gtk_menu_popup, which is deprecated and no longer
supported from GTK 3.22 onward. This renders GTK applications
inconsistent, if GTK >= 3.22 is used.

GTK native menus aren't special. They do not blend in with e.g. a main
window or QML ApplicationWindow drawn by Qt itself. There is neither a
performance, nor a visual disadvantage of drawing own menus by Qt.

Remove support for native windows in the GTK3 platform theme.

[ChangeLog][Platform Specific Changes][Linux] Due to deprecation of the gtk_menu_popup() function, we no longer use GTK menus on Gnome: they are now rendered by Qt.

Fixes: QTBUG-124561
Fixes: QTBUG-126598
Pick-to: 6.7 6.5
Change-Id: I031751fb6e070444e99ab2bcac4c622ac509b4c9
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7ffb4c16955a60ffc0f32d990c70476c49ed0b0b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 12:42:33 +00:00
Marc Mutz 6cda03c5d6 QPROPERTY_TEST_COMPARISON_HELPER: don't write 1KiB of NULs
qsnprint() is unconditionally called to fill the buffer and is
guaranteed to NUL-terminate, so there's no point in filling the whole
1KiB stack buffer with NULs beforehand. Leave it uninitialized.

Amends 930e59b798.

Pick-to: 6.7 6.5 6.2
Change-Id: I7da859d609ad4492c9038cb3e14f2a721b2acbe4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 47c2263e896408e733c9aa466aec388cc4b4a6ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 10:07:40 +00:00
Volker Hilsheimer 5797326b16 JNI: Constrain QJniArray::toContainer to compatible target containers
We can populate a container with the contents of the Java array as long
as the element types are convertible without narrowing (taking various
special cases into account, such as jstring to QString). The container
has to be either support emplace_back, or be a contiguous container
if a primitive element type.

The template helpers need to be in QJniArrayBase in order for qdoc to
accept the input.

Add test coverage, including static compile time tests.

Change-Id: Id9372deed5cf33446ee1969dc284a88991db2aee
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8f04defa1e3973faec19a9cb1ab9bbf1ea7fb031)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:40 +00:00
Volker Hilsheimer c21612d246 JNI: Improve the constraint on QJniArray::fromContainer
We can create a QJniArray from any container that has a forward
iterator. A contiguous container can be used to optimize the code path,
as long as the element type is primitive (i.e. not an object type).

Fixes: QTBUG-126151
Change-Id: I21915f944d226d6d4f1113a54e5602ddc9cd727e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 71be7834e67216010dc74ed855dc7b513e302f1a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:35 +00:00
Volker Hilsheimer c4bd8a5492 JNI: clean up move semantics for QJniArray
Explicitly define (compiler-implemented) copy and move SMF's for
QJniArrayBase; we need to, as the destructor is declared, so without
them the compiler will implicitly convert an array to a QJniObject
and call that constructor.

Constrain the constructors and assignment operator from a QJniArray of
another type so that no narrowing conversion is allowed. Due to the
implicit conversion to QJniObject, we have to explicitly delete the
overload for narrowing conversions. Use the detector we have in
qobjectdefs_impl.h for that.

Make the detection helpers private, and add test coverage.

Change-Id: I1b2bb4435d52223567d20bb55ceb0d516e3b0b15
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ebbf7b0fdf866190cd20e62d6b13c7c6808101da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:28 +00:00
Volker Hilsheimer 43f0b1fcee QJniObject: specialize the QtJniTypes::Traits to treat it like jobject
It doesn't make a lot of sense to pass QJniObject instances into APIs,
but to be able to consistently treat QJniObject as an object type we
have to register it with the java/lang/Object signature.

Change-Id: Ic40e2676186bf327fa92764da51404985f74b565
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 82254fa836a21b5ec450a4ec7635e72403dded18)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:11 +00:00
Volker Hilsheimer 6c3513f514 QJniArray: implement operator-> for the iterator
The QJniArray doesn't store values, so at() always returns a temporary.
As we cannot hand out a pointer to a temporary, use a wrapper reference
struct that stores the value and implements operator->. It's all inline,
so we can move it out in the future to return mutable references, if we
ever want to enable write access to QJniArray elements.

Change-Id: I3962df6160db8c5b573d47ebb7975864f8ea7a8b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3d5af4b912e60beb791f874c2dbfef5597b9aad7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:06 +00:00
Morten Sørvig 71f80cff34 wasm: make the "a11y enable" button cover window
Adjust the button geometry to match window geometry.
Screen readers may visualize the geometry, and this
makes it clearer that the button is relevant.

Setting the clip looks to be sufficient to keep the
button visually hidden, even if the canvas (which would
normally be ordered in front) is missing.

Change-Id: Iff268cd2d8f52eead9be88e8cb460b0b445781a9
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit e6c77a0b7eba75e8837dc7bcd98dbc1ba95318f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 13:42:24 +00:00
Tor Arne Vestbø de7a39866c tst_macdeployqt: Only pass -use-debug-libs for debug-and-release builds
When passing -use-debug-libs to macdeployqt it will only consider plugins
that end with _debug.dylib, which is not the case for single-configuration
framework builds as of d3be87ff1d558f05309b1f29f7e71f291498584f.

When not passing -use-debug-libs macdeployqt will use whatever library
it finds, both suffixed and not, so the only case where we need to
explicitly make it choose one is when we have a debug-and-release
build of Qt. Otherwise we can leave macdeployqt to choose the right
one.

Change-Id: Ic438da9f21c3090f0d57ce615bc0c0969b9a600d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 60550f8acc4f9d742f6ef7cb027f0ed3e2d5e42a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 13:42:22 +00:00
Even Oscar Andersen 52c9346f5b Move destruction logic to QOpenGLWindow from Private
QOpenGLWindow has been destroyed when QOpenGLWindowPrivate
destructor runs

Fixes: QTBUG-126845
Change-Id: I4f0208c4adf1a875cdcaca91fc239cf4e6200e4d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c337cdf39cc249560bf9a5380e308d09a4c13b95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 13:42:20 +00:00
Volker Hilsheimer fe284006b2 Doc: link from non-categorized logging API to QLoggingCategory
The <QtLogging> documentation page is easily found, and from there it's
not easy to see that categorized logging is a feature. Add more links.

Task-number: QTBUG-125589
Change-Id: I214b9a561d6fc6b4c8600bc1b1eca04d856678d6
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7c344176d21e00a648bb504da735f174f70f0ad2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 12:33:09 +00:00