Compare commits

...

1403 Commits
dev ... 6.9.1

Author SHA1 Message Date
Jani Heikkinen
2ad23cd72d Revert "CMake: Make generated pkgconfig files relocatable"
This reverts commit 5b6527c35a5d86fbaac02ed1881134a921e38323.

Reason for revert: ${pcfiledir} cannot be used, because this
leads to wrong prefix values if PKG_CONFIG_SYSROOT_DIR is set.

Change-Id: Ie22607b2c4195dc197f1058d6b0fc1407427e7ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-05-28 15:04:37 +00:00
Mårten Nordheim
1cd79cf429 Http2: remove any reference to HttpReply when deleted
Prior to switching the protocol handler to use QHttp2Connection this
particular issue (see bugreport) was not a problem because the handling
of the IO-device being destroyed was simply to drop any pointer to
it.
QHttp2Stream, however, also has to keep track of the lifetime of
the IO-device, because it needs to abort the stream if the data
it's uploading is destroyed earlier than expected.

Now, since QHttp2Stream might also have other errors come up, we
have to connect to the generic 'errorOccurred' signal from it and
handle whatever issues arise, notifying our users that the request
for some reason cannot be fulfilled.
It's thanks to this part that we were now, in certain cases,
grabbing a stale pointer to the HttpNetworkReply and trying to
call functions on it.

We fix this somewhat indirectly. Because, after a HttpReply is
destroyed, we shouldn't even have any references to it in the
first place. And while it would usually be done as part of
handling the deleted() signal, we actually disconnect from
HttpNetworkReply's signals when we have processed one of the
finished*() functions. But since we were still connected to the stream's
signals we would still try to handle it.
For the http1 protocol handler this was already handled in
QHttpNetworkConnection::removeReply, which the HttpNetworkReply itself
calls at start of destruction. The function will go through any place
that the reply can be referenced and removes it. For http/2 it would
remove it from the list of requests yet to be sent, but not from the
in-progress list. So, we now add a new virtual function to the
AbstractProtocolHandler and specialize it in Http2 to handle exactly
this.

Fixes: QTBUG-136549
Change-Id: Ie41863677a3b163f77d10bc3904ca515f6840be3
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit b0b9adf06675c5caa37105ceee157245e3dcca21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 6b4e11e63ead46dde5c1002c123ca964bb6aa342)
2025-05-20 04:16:41 +00:00
Eirik Aavitsland
55edaffa7c Update bundled libpng to version 1.6.48
[ChangeLog][Third-Party Code] libpng was updated to version 1.6.48

Change-Id: I31762d38fc15db5649623300c3e6ac8c5e79cf67
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2025-05-16 12:36:07 +00:00
Eskil Abrahamsen Blomfeldt
60cf2f867b Upgrade Harfbuzz to 11.2.1
[ChangeLog][Third-Party Code] Upgraded Harfbuzz to version
11.2.1.

Task-number: QTBUG-136745
Change-Id: Ie3f67e84447f30579933d92677908f3606e557a4
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit f17a8ac6fb9a194b984521fa9f0120540de8b8d2)
Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io>
2025-05-16 12:36:04 +00:00
Volker Hilsheimer
31f1c78b0b QDockWidget: don't emit visibilityChanged while in destructor
Amends 2c67d47ea15c6dc34cc20d8fbdb406efb19f11d7, after which we emitted
the signal, as the setParent(nullptr) call in the destructor would call
back into the QDockWidget::event override.

That change was correct, but we are now emitted signals while in the
destructor, after a potential subclass destructor was already completed.
This crashed applications that had slots connected to those signals.

While arguably an application problem (PMF connections need to be
disconnected explicitly), we can avoid this regression by blocking
the emission of that signal when already in the destructor.

Fixes: QTBUG-136485
Change-Id: I6d5e98136beedc94c22287ccfd1198dd80f4f95e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 7869593119ffaea6002e6668814af159a2077398)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit e30e358ce6766e231d2a5528b8f7d9dc86092e0c)
2025-05-16 07:36:31 +00:00
Even Oscar Andersen
f10a8dbf6c wasm: set focus to m_canvas instead of m_window
Setting focus and contentEditable on m_window causes
innerHTML to build up with characters.

This does not happen when using the m_canvas

The downside is that m_canvas is aria-hidden, but this
should, in principle, not be a problem since
m_canvas should not be focused when a11y is in
effect.

Later aria-hidden might be set only if a11y is in
effect.

It turns out this also fixes tabbing between textfields
and buttons bug.

This is a candidate for manual cherry-picking to
6.9 6.9.1

Task-number: QTBUG-136687
Task-number: QTBUG-136562
Change-Id: I08a9db2c39f9b0b0038c75fd06d3504b736ea031
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2025-05-16 09:36:27 +02:00
Jarkko Koivikko
a003aafd86 Android: Skip restoring bundle state on process restart
When the app process is restarted (e.g. after revoking a permission), Qt
isn't running yet, so we must not restore the saved bundle state.

Fixes: QTBUG-136497
Fixes: QTBUG-136077
Fixes: QTBUG-135961
Change-Id: I5ec594ec93dd3ba13b088d63ec77a3649e21d798
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 270d59f65be53a13263ba840b077b47026df4d0e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit da6c71569105eb09f17078614047957d104990ee)
2025-05-14 11:50:25 +00:00
Mårten Nordheim
1926f88b24 Http2: check if stream was RSTed w/ bespoke function
We have a function to check if a stream was locally reset - we should
realistically only process HEADERS on RSTed streams for a limited amount
of time. I forgot we had this mechanism in place already, let's update
to use it for the recent fix.

Amends 9224fdd3f4cccce7a8123ab398f6ff8745d759ce

Change-Id: I4826100704542f681341ceb84c4f85332f8ae03d
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit f95805670161b38da60602ada6128f03f7f9ceb2)
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 013ec80ea89113af7ed46b6f30dedcba3c63d3e8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-14 11:50:08 +00:00
Thorbjørn Lund Martsum
adda61e87b Fix QHeaderView auto section resize corner case
In some situations where the model is set sufficient late
an auto resize would never be applied. See bug report for
further details.

This is solved by moving to the normal memory model when
the global resize mode is changed to resizeToContents or stretch.

Fixes: QTBUG-136453
Pick-to: 6.9
Change-Id: Ie0448042a7d23b059eaf7464a662f0f551d89fd9
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 0d61e8ec5341b1642b63c34d5b2ce96ada54bd73)
Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
2025-05-14 04:46:20 +00:00
Christian Ehrlicher
63093b0410 SQLite: Update SQLite to v3.49.2
[ChangeLog][Third-Party Code] Updated SQLite to v3.49.2

Change-Id: I9f16deebdcfc223005a5b6731b71b7c885ad17f2
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 4599903eed34c87f446fc703ba3825b37b7867b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 80fdd12957b29bd4d8b74e61f247cc5b9ed033f1)
2025-05-13 11:46:32 +00:00
Mårten Nordheim
4a95b7fc60 Http2: process HEADERS on RSTed streams
If we RST a stream then we may still have to process HEADER frames for
those streams (at least for a while) that was likely already in-transit.
This is due to HPACK, which manages header compression state. Missing a
frame desynchronizes the server and client, eventually leading to an
error where one party is referring to a header the other party doesn't
have.

Fixes: QTBUG-135800
Pick-to: 6.9 6.8
Change-Id: I5b4b510225ce6737fec7128c4bad38219404b196
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 9224fdd3f4cccce7a8123ab398f6ff8745d759ce)
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-05-13 11:46:26 +00:00
Joerg Bornemann
5b6527c35a CMake: Make generated pkgconfig files relocatable
Don't write an absolute prefix into generated .pc files but one that's
relative to ${pcfiledir}. This makes the files relocatable, and we don't
have to patch them in the Qt online installer.

Fixes: QTBUG-136210
Change-Id: I5c2f9398917be03f6c63286e553c87ff52971285
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 731d9a13956ef40e3f563f5ff5ff5c250b8d6d94)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-05-13 11:46:21 +00:00
Tor Arne Vestbø
0b84ad4e49 Revert "iOS: Replace variable length array in event dispatcher with QVarLengthArray"
This reverts commit be93c06758260b1e0738ab17a2ecc4ee8f90e87e.

The assumption was that using a QVarLengthArray was equivalent to
the existing C-style VLA, as we initialized the QVarLengthArray
with defaultStackSize as the Prealloc template argument.

However we failed to take into account that we adjust the stack
size via Stack::computeSize(), by adding space for our memory
guard, so we would effectively always end up with the user-main
stack on the heap.

This caused problems for Qt Quick's V4 engine, because it checks
for C++ stack overflow by comparing the current stack pointer to
the base and limit given by pthread_get_stackaddr_np and RLIMIT_STACK,
resulting in "RangeError: Maximum call stack size exceeded." errors
and failure to load the QML.

We can't tweak what pthread_get_stackaddr_np reports for an already
started thread, so in practice we can not put the user-main stack
on the heap, so we revert back to the use of C-style variable length
arrays, which should be fine for this specific use-case.

Change-Id: I05a4bd32697abee71aa9e70f9f5a011cc338f915
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ccce91461a39adebde7ec7803b4cc0b97093f77f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 30e50a9a7c238372e93ae4cd42b44db6aac8e15b)
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2025-05-12 07:06:15 +00:00
Christian Ehrlicher
1da71e5e7d QHeaderView: fix logic in setOffset()
Fix the logic in setOffset() which was accidentally reversed during
fixing of UB during signed overflow.

Amends 49fcac99deea390901000a74deea1c0c690b6ae2.

Coverity-Id: 479557
Pick-to: 6.8 6.5
Fixes: QTBUG-136362
Fixes: QTBUG-136477
Change-Id: Ifc9c80346355b0a9e516effe2ff8b60b1966d67a
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
(cherry picked from commit e808b38d4bb894f42b7dfe52f1ef67a0d48c23ff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-07 17:53:39 +00:00
Michal Klocek
77a10188a5 Adjust webengine resources deployment
In case of debug build install debug resources.
The change reflects qtwebengine's deployment change:
qtwebengine/76d317c082b2492cc1fe1fcf2afad26be5369d3f

Task-number: QTBUG-131897
Pick-to: 6.8
Change-Id: I58fa8a36e88369dd29f03fb16060b88ba08abd86
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit d531d31e1db9a84a907c10f89b557c744100ab94)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-07 16:09:58 +00:00
Edward Welbourne
500246d988 Forward-port a test I've just added to 5.15
Ammends commit 61343b5a3f10f5b9166729176d4b95a4c538c278 (which was too
big a change to back-port to 5.15), checking narrow != short in
Chinese month names.

Pick-to: 6.8 6.5
Task-number: QTBUG-10506
Task-number: QTBUG-84877
Change-Id: Ib9c26df751c0add517bc94218db04d32d8d135eb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 591dccddbbd4bc3c6b1bc4e85319b866022213bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-07 15:43:39 +00:00
Tim Blechmann
40d4ea3dcf QSocks5SocketEngine: avoid interface as parameter name
`interface` is used by win32 headers. avoiding it fixes unity builds on
windows.

Pick-to: 6.8
Change-Id: I85c05e70f4986f2f384850458f7a460baacf6baf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7d9b930b6fbb56e9c4a848b54af2db6b58926440)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-07 11:28:57 +00:00
Edward Welbourne
9911f7c90d Add QTranslator test for script-incompatible language truncation
Amends commit 0278a80d6876f38bb37f1d504e6b24a3512efb7a - I developed
the new test as part of adapting the earlier change to 6.8.

Task-number: QTBUG-131894
Change-Id: I711e62db7e35fa26c396498354ffbb5aa23920a8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit dabc113cc89c9b15e76ba8448e8abba3c9722f47)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-06 17:38:03 +00:00
Martin Storsjö
d40e353821 Add static casts needed for initializer lists on 32 bit platforms
This fixes build errors like these:

    src/corelib/time/qtimezonelocale.cpp:836:34: error: non-constant-expression cannot be narrowed from type 'Index' (aka 'unsigned int') to 'qsizetype' (aka 'int') in initializer list [-Wc++11-narrowing]
      836 |                         best = { range.size, type, invalidIanaId, row.metaIdIndex };
          |                                  ^~~~~~~~~~
    src/corelib/time/qtimezonelocale.cpp:836:34: note: insert an explicit cast to silence this issue
      836 |                         best = { range.size, type, invalidIanaId, row.metaIdIndex };
          |                                  ^~~~~~~~~~
          |                                  static_cast<qsizetype>( )
    src/corelib/time/qtimezonelocale.cpp:856:34: error: non-constant-expression cannot be narrowed from type 'Index' (aka 'unsigned int') to 'qsizetype' (aka 'int') in initializer list [-Wc++11-narrowing]
      856 |                         best = { range.size, type, row.ianaIdIndex };
          |                                  ^~~~~~~~~~
    src/corelib/time/qtimezonelocale.cpp:856:34: note: insert an explicit cast to silence this issue
      856 |                         best = { range.size, type, row.ianaIdIndex };
          |                                  ^~~~~~~~~~
          |                                  static_cast<qsizetype>( )

Change-Id: Iacb130a8240c56a32d30486180c6900e2c2f526f
Pick-to: 6.8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 80c73dc38b4a32189c58f641bfad2d32bc9428c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-06 13:03:31 +00:00
Kai Köhne
f23fd8ddae Doc: Remove mentioning of 'stripped' translator files
The concept of stripped vs unstripped files in the API
stems from Qt 3, but got abandoned already in Qt 4.

Change-Id: I449ddfd7ff3b8b3d50ab0252fabcab974d83a5ed
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Masoud Jami <masoud.jami@qt.io>
(cherry picked from commit 6ff833c04a2e7b46acfad6e9dd4e168ed527b9b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-06 13:03:30 +00:00
Kai Köhne
a3c75cfc52 Doc: Warn about loading of untrusted .qm files
Pick-to: 6.8
Change-Id: I0cc99ef285335fc244ba33f08bf0e322c7597a75
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3ab63875e551c67b9c6b7a0a8883a01666a557d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-06 13:03:29 +00:00
Even Oscar Andersen
8bcc3f2ce5 wasm: Update input field geometry on window geometry change
The location of the input field was wrong leading to empty space
inserted in the user interface.

Fixes: QTBUG-136233
Pick-to: 6.8
Change-Id: Ic8c9faf5c4dbb8cec43a43c25c1cce8d7809f140
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit f016201b6d66408a4dd7427d2b9234909b8f1f92)
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2025-05-06 07:53:00 +02:00
Even Oscar Andersen
5adb974194 Revert "wasm: call "focus" on window, not canvas"
This reverts commit 845aa1e9d1c60ecff38cbb2d0e98414ac1d9cc68.

Reason for revert: This breaks cell phones and tablets on chrome

Change-Id: I832f5b0d4b690b45168d6a3368f82317e97829d2
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2025-05-04 09:12:48 +00:00
Even Oscar Andersen
1192a9d81a wasm: Make sure typing with window focus does not produce characters
contenteditable on the window caused characters to be inserted.
Instead create a div as a child element, and set  contenteditable
on that.

Fixes: QTBUG-136050
Change-Id: I4ccf3589ea19876f68bb9c7077c3a13ae5f989e6
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
2025-05-03 07:56:26 +02:00
Joerg Bornemann
6a3b653fe6 CMake: Don't unconditionally enable the ASM language
CMake MR #10626 doesn't consider the MSVC compiler as valid assembler
anymore, thus unconditionally requiring ASM breaks with CMake > 4.0.1 on
MSVC.

Enable ASM only on non-Android Unix.
Remove the ASM language where it's not needed.

Pick-to: 6.8 6.5
Change-Id: I5df71edfce0f4920e39262f722e4bf95a735f31b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 25b040acc1e93ba4dd36f307271994be0f0604af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-03 01:24:12 +00:00
Nicolas Fella
d8fdcea0d1 QCompleter: Set transient parent on popup
In order to properly show a popup the Wayland QPA needs a parent window.

Currently it has to guess the parent, which might not work in all
circumstances. To address that explicitly set the widget as transient
parent of the popup.

Fixes: QTBUG-130474
Pick-to: 6.8
Change-Id: I99ea14a1a9ec25ee8a929cf61a6744957a850374
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit 81f8eee6a1e1cfcf4bf1f2dac863e94e0f872559)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-03 01:23:47 +00:00
Volker Hilsheimer
9db5beae71 macOS: use correct icon pixmaps in native menus
When creating an NSImage from a QIcon to show the icon of the action in
native menus, then we so far didn't take the state (on/off) or mode
(normal/disabled) of the UI element into account. This resulted in a
menu item showing the Normal/Off icon of an action, even if the
underlying action was disabled or checked.

Icons in menus are not common on macOS, but since we have the
information we need in QCocoaMenuItem, we might just as well use it to
get the right pixmap from the QIcon (even if that pixmap is generated
from the Normal/Off pixmap).

Add an overload to our NSImage::imageFromQIcon helpers that takes a mode
and state, call that from the existing overload, and use it in
QCocoaMenuItem::sync.

Pick-to: 6.8
Fixes: QTBUG-135934
Change-Id: Ifce73daf49ce34c874fa5bf652d84b3102a06709
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 84da5450c342655a7e426c5bb07d9accf7a222a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-03 01:23:41 +00:00
Ahmad Samir
679dc18c43 qdataurl: extend the unittests
Check:
- data: urls with a host are treated as malformed
- if the mime type is omitted, it's set to
  "text/plain;charset=US-ASCII" as per the RFC[1]
- the mime type of urls with a `charset` attribute are
  normalized by adding "text/plain;" (Qt implementation detail) if it's
  missing

[1] https://www.rfc-editor.org/rfc/rfc2397.html

Pick-to: 6.8 6.5 5.15
Change-Id: Ifd9736b7808226c8462e3d39798abda7b245c6d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f8987b2d0a0835bdc2e6e4f2204e6e40db33da5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-02 20:54:45 +00:00
Even Oscar Andersen
845aa1e9d1 wasm: call "focus" on window, not canvas
This is necessary to have correct focus handling on webassembly/ubuntu
without this change tabbing from text input to f.ex a button would
not work.

Fixes: QTBUG-136562
Change-Id: I78eaa6202d8bdb87b1195d5c38a3f73570a49c90
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2025-05-02 14:09:47 +02:00
Christian Ehrlicher
304089b6da SQL/MySQL: adjust check for MariaDB client library
The correct define to check for MariaDB C Connector is
MARIADB_PACKAGE_VERSION_ID, not MARIADB_BASE_VERSION (which is a string
describing the server version the c connector relates to).

Pick-to: 6.8
Task-number: QTBUG-136550
Change-Id: I844900d9b6622fd3a72db63298e5c34de8a2f3dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit dbbe65fb262cce0379660e38ab71b27044015d27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 21:21:49 +00:00
Christian Ehrlicher
51b75d520f WindowsVistaStyle: misc cleanup of QWindowsVistaStyle::standardIcon()
Clean up QWindowsVistaStyle::standardIcon a little bit by using
separate icons for SP_TitleBarMaxButton and SP_TitleBarNormalButton

Change-Id: I876d41f0373268a0a8888f00392a8e32d0f413a1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit aed4307a1f3e0bea9aac6013e3ba6ef32a47a989)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 21:21:49 +00:00
Mitch Curtis
e4e88d9137 Revert "XCB: set devicePixelRatio on backing store QImages"
This reverts commit c70fd79a178a1e9a186cf8b2f78986e0a39845b4.

Reason for revert: causes a regression.

Fixes: QTBUG-135867
Change-Id: Ia9a9049da778749d657ab999edd777650e572b86
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 11c171553eece9742ea94196b1cabc85d07d0ffb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 12:03:32 +00:00
Kai Köhne
09f68238d4 configure: Bail out early if Xcode is not installed on macOS
Currently, configure fails late with

     Qt requires at least version 15 of Xcode, you're building against
     version . Please upgrade.

Change-Id: Ic4f44d37429ac9def785a50909a25b0bcb4b72a5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d1e030f6f53f630819c7ec0729f83ede1e37e3b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:34 +00:00
Edward Welbourne
1e486c14d4 Fix long-form zone parts in date-time strings
Recent changes to date-time formatting arranged for time-zone names to
be localized appropriately. Teach the datetime parser to recognize the
long names that now implies, as well as IANA IDs, and ensure these
last are also used as a fallback when no localized long name is
available. Discrepancies between the platform time-zone backend and
our CLDR-derived name L10n (where needed, due to the backend lacking
it) make the naive approach to this (find any zone that matches,
expect them all to have the same offset history) fail, so take care in
this case to select as canonical an IANA ID for the named zone as we
can find. Add a round-trip test and adapt an existing test to
round-trip when it can.

[ChangeLog][QtCore][QDateTime] The tttt format specifier now uses the
full long name of the zone, falling back to its IANA ID only if this
cannot be determined. Both forms are now recognized when reading a
datetime from a string.

[ChangeLog][QtCore][QLocale] When serializing a datetime, the tttt
specifier now uses the localized full long name of the zone, falling
back to its IANA ID only if this cannot be determined. Both forms are
now recognized when reading a datetime from a string.

Pick-to: 6.8
Fixes: QTBUG-130278
Change-Id: Ia28529790c0f600930d55c92a606adbcdfa852b9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 2edd9286cf386675be76032424248e60216f6331)
2025-05-01 10:53:32 +02:00
Juha Vuolle
a55c9dbabc Fix tst_dnslookup compilation when udpsocket is disabled
Guard the UDP socket includes and uses with feature flag.

Task-number: QTBUG-136101
Pick-to: 6.8
Change-Id: I1fe27244e6aa029407b07ebc06de137ec8b280af
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6816273f0ed620ef28b407eb24d53212ea08dd77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:31 +00:00
Juha Vuolle
b9d95d7982 Put tst_qnetworkproxyfactory behind networkproxy feature
..as it heavily relies on it and fails to build without.

Task-number: QTBUG-136101
Pick-to: 6.8
Change-Id: Ie2ba55e485cf96d568b0b22f27e19ffa72f48da9
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 01e253e77cacf7a4323078f6f92940bf2c3b505d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:30 +00:00
Juha Vuolle
bae42278a0 Skip UDP parts of tst_qnetworkinterface if UDP sockets not enabled
Task-number: QTBUG-136101
Pick-to: 6.8
Change-Id: Ib3be9ae7c3a261c606cf242a15279491304de6b6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit cdeb245340b2f148e888ee28c215f60c80d822e0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:29 +00:00
Juha Vuolle
42dd3bc013 Fix tst_noqteventloop compilation if localserver disabled
..by feature-guarding localsocket and localserver uses.

Task-number: QTBUG-136101
Pick-to: 6.8
Change-Id: Icc6327fa222edda31fe9e88ec38c916dcd359eb0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 2f91439d05e4442abfa69db109ef3ecb4c341048)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:28 +00:00
Shawn Rutledge
595647cb6c maybeSynthesizeContextMenuEvent: accept mouse event if CME accepted
Prior to 84a5f50c7766c99f62b22bb4388137e0aa8dd13d
QWidgetWindow::handleMouseEvent() did its own synthesis of
QContextMenuEvents. Then we moved it to
QWindowPrivate::maybeSynthesizeContextMenuEvent() and didn't preserve
the code to accept the QMouseEvent if the QContextMenuEvent was
accepted. It turns out that the WASM platform depends on checking
whether the QPA mouse press event was accepted: if not, it closes
all popups, including any context menu that was just opened by a
right mouse press.

Fixes: QTBUG-136241
Change-Id: Ibe01763a6af19d65629dc77eb61ffc1af581efbe
Pick-to: 6.8
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit b01fe1390cd22165104aba5eb49dae90c0b91618)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:26 +00:00
Mårten Nordheim
ee9ee08762 Http2: Fix 'Received' typo
Missing 'e'.

QHttp2Connection is private API so the API can be changed.
No known external users.

Pick-to: 6.8
Change-Id: I4f3daab9deff3250ff66066dc3e088edfbbfc5ef
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 70d3293d72a1a612d375447a6f46ea223be1f9cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:25 +00:00
Allan Sandfeld Jensen
a692c8a78d Fix qRound(inf) assert
In some extreme cases we can return a finite float, and then turn it
infinite when multiplying it to calculate the index positions.

Avoid the whole thing by clamping to a brightness of +-32768 times the
white point standard, which is well within current HDR standards.

Credit to OSS-Fuzz which detected the assert.

Pick-to: 6.8
Change-Id: If007732a8d59ea27514f17674d318a099a057281
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
(cherry picked from commit 2b7ecfab7d8cb149ffc02285906f95906f2f1343)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:23 +00:00
Christian Ehrlicher
093ab48adf Widgets/Stylesheets: Remove double negations for stylehseet feature
Replace ifndef QT_NO_STYLE_STYLESHEET antipattern by
if QT_CONFIG(style_stylesheet).

Task-number: QTBUG-136341
Change-Id: I8f5d5ff0b7b5cce010df167977214bc92a9443b7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit a1612886bade6192fecad33d0dacb1d24792e315)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:21 +00:00
Christian Ehrlicher
72153bf6ef Windows11/VistaStyle: use delegating ctor
Use delegating ctor for QWindows11Style and QWindowsVistaStyle to avoid
code duplication.

Change-Id: Ia5048d989a1d6556b64a3ffc95da5d05624cd634
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e19607611c996505c859b264122b8d44d8298b9c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:20 +00:00
Christian Ehrlicher
4630c92cea Widgets: compile without features tabwidget/tabbar/toolbutton
Move the usage of the corresponding QStyleOption classes into a
QT_CONFIG() guard to fix compilation when these options are disabled.

Change-Id: I68e791f20bbc8389974878e765b08a97eb347b92
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 0d4e04416554d9b2f03f325616052be06dd85a44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:18 +00:00
Christian Ehrlicher
749bb5240a Widgets: remove some unused includes
Remove some unused includes in source files.

Change-Id: I5c43fd10fa1a179664ad8cbf4988f9bdb96d8af8
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 69053eea3fa858e7885dbac5e5d0bcd6ed618174)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:17 +00:00
Christian Ehrlicher
29688402ce QLaoyut: remove check for QT_CONFIG(menubar)
Even though the member is named 'menuBar', it's a plain QWidget. Also
the setter are not guarded so the functionality should not be guarded
too.

Change-Id: I5fa19ab955d9794aa3d344ba0cfc8a0a3d22b61e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 33c2931429ea0557607627ec452b093d273a9f95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:15 +00:00
Christian Ehrlicher
179474de31 Tests/QTreeView: use QCOMPARE_foo instead QCOMPARE
Replace some QCOMPARE(value > x) with QCOMPARE_GE(value, x) to get
better output on failure.

Change-Id: I3f7fc80cf25776adab40cd61c08c58a49f6af0c5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 29238407af94fd651900d18031c8ae1392d96f12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:13 +00:00
Christian Ehrlicher
0f88982f08 Widgets/Stylesheets: compile without FEATURE_style_stylesheet
Make sure to not compile the stylesheet sources when
FEATURE_style_stylesheet is disabled, also don't include the relevant
headers in this case.

Fixes: QTBUG-136341
Change-Id: I4fc2de2fcba004b93140809ef79374401209f14a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e57fff63419867d59b6067fc1a5a3495678708dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-05-01 08:53:11 +00:00
Safiyyah Moosa
e7247e9acd Doc: Add alt-text for Qt Network examples
QDoc generates warnings for images that do not have an alternate-text
associated with it. Alt-text is required for to increase accessibilty
options.

This patch adds alt-text to images in the Qt Network

Fixes: QTBUG-135122
Pick-to: 6.8
Change-Id: I690f1d381ef5a9052e189dd1f3906243df557da0
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit ae6ba06e55dbdae98eb05069e007044bf70f45da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-30 00:23:09 +00:00
Juha Vuolle
2dbc92e4ac Compile calendarbackendplugin only if widgets are enabled
The example links against widgets unconditionally => add
proper build-time guard

Task-number: QTBUG-136101
Change-Id: I62ea42a04f7ff421753a0fc7a30cd969cfaff6e2
Reviewed-by: Magdalena Stojek <magdalena.stojek@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 5776865f7c6b234f66512eab41c871662449d80d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-29 14:00:26 +00:00
Juha Vuolle
26e385d881 Fix tst_qlocale compilation when jalalicalendar is disabled
The 'syslocaleapp' test helper application was built only when
jalalicalendar is enabled. The tst_qlocale on the other hand
depends on 'syslocaleapp' if process-support is enabled.

Thus if jalalicalendar was disabled and process-support
enabled, the CMake configure fails because tst_qlocale won't meet
its 'syslocaleapp' dependency.

Fix by building a more limited version of the syslocaleapp when
jalalicalendar isn't supported, and adjust the testcase accordingly.

Pick-to: 6.8
Task-number: QTBUG-136101
Change-Id: Ic809b0124d47754105ca09b69e2b3c12856ba63a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 3bbe9d8ec7ab49a44b1ba661b0930d5d3506bce6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-29 14:00:20 +00:00
Marc Mutz
21cd27b3b9 qDecodeDataUrl(): fix precondition violation in call to QByteArrayView::at()
It is a precondition violation to call QByteArrayView::at() with
size() as argument. The code used that, though, as an implicit
end-of-string check, assuming == ' ' and == '=' would both fail for
null bytes. Besides, QByteArrays (but most certainly QByteArrayViews)
need not be null-terminated, so this could read even past size().

To fix, use higher-level API (startsWith()), consuming parsed tokens
along the way.

Add a test that would crash in debug mode before the fix.

Amends the start of the public history.

[ChangeLog][QtCore] Fixed a bug in the handling of data: URLs that
could lead to a crash if Qt was built with assertions enabled. This
affects QNetworkManager and links in QTextDocument.

Pick-to: 6.8 6.5 6.5.9 6.2 5.15
Change-Id: I4331c88051dfbb0a18fe7da4f50858c707785d09
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 4d839093b480d30eef8a89c0f864ee3f340adaa1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-28 23:55:06 +00:00
Alexey Edelev
814587f3cc Fix typos in qt_internal_add_plugin in the TEST_PLUGIN related warning
Amends 40def717978f832027542dad507e7873ccc0e1f6

Change-Id: I807b1b7db8c2d473355759c1db12cc2a9ead802d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d60930be3896a400832d7b9daa99086b0660c5ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-28 17:36:34 +00:00
Tim Blechmann
e9216d9826 Network: avoid interface as parameter name
`interface` is used by win32 headers. avoiding it fixes unity builds on
windows.

Pick-to: 6.8
Change-Id: I1d3f89a201f44f6e4eed5977d1b80f675078d430
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 74916280616cca163c8a9fa81eabd40d0b5ba30b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-28 16:09:48 +00:00
Tor Arne Vestbø
8866613373 Quote CMAKE_OSX_SYSROOT when checking for simulator SDK
With CMake 4.0 the CMAKE_OSX_SYSROOT is no longer automatically set
based on the CMAKE_OSX_DEPLOYMENT_TARGET or host platform, so the
variable will be empty by default.

Pick-to: 6.8
Change-Id: Icad8e044a9d58e995882672b27340c83eb0ae0a8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 91ec68313ae8a90fcc97e669e1cf386c952aa41f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-28 14:32:32 +00:00
Ali Kianian
9842c84f36 AssetDownloader: Provide network errors and SSL errors
Network errors and SSL errors are provided as invokable methods.
The end user can collect the errors after download is finished.

Task-number: QTBUG-136035
Pick-to: 6.8
Change-Id: Ic8bd9b84d331752c096998683b44b85be3cd6b10
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 124f05bd10c1ce2a5104394712fae54c0659fccb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-27 18:04:35 +00:00
Juha Vuolle
fd608b6a6b Allow configuring Qt without highdpiscaling on Windows
When highdpiscaling feature is disabled, a default dummy
QHighDpiScaling class is compiled in. This dummy class missed
the roundScaleFactor() method used by qwindwswindow.cpp, causing
a compilation error.

Pick-to: 6.8
Fixes: QTBUG-135893
Change-Id: I754878b9bbd55f68f07a19618fc275f89f7f839f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 581e39b35f5a09640959112779514b3f11bc5c82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-27 21:04:32 +03:00
Juha Vuolle
cca73cecb0 Allow configuring Qt without clipboard on Windows
Most feature guards were already in place, this commit adds the
missing ones.

Pick-to: 6.8
Fixes: QTBUG-135890
Change-Id: I1fbfad6552b2896d867a29134a2add693dbd136f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 4790a06b1684244841c4be90369561df0a9f97c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-27 21:04:29 +03:00
Eskil Abrahamsen Blomfeldt
bb8acc8e0e Upgrade Harfbuzz to 11.1.0
[ChangeLog][Third-Party Code] Upgraded Harfbuzz to version
11.1.0.

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-136054
Change-Id: I388586c887a3ae30ecc7b07bb0b6a5c12d3b6caf
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 395451e15f7421ee7d3eb6469bb78cb80f1447df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-27 18:04:28 +00:00
Edward Welbourne
b069dda4da Tidy up some QTimeZone code and comments
Correct a member comment in LocaleMetaZoneLongNames.
Remove a superfluous else in QUtcTimeZonePrivate::displayName().
Add a TODO comment to QUtcTimeZonePrivate::isTimeZoneIdAvailable().

Pick-to: 6.8
Change-Id: Iddc144a267ca8fb33a6577e8d671ef3da53ca525
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7983b9bd9a56cdb6c8ec6c0ae907329eabde39fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-27 18:04:26 +00:00
Edward Welbourne
bccbf1be13 Fix spacing and indentation in QTimeZone code
Petty tidy-up, just to disentangle it from other work.

Pick-to: 6.8
Change-Id: Ifa7543585af35e494185be8faf637e3d48670c4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit bb8c1b85afec82240026bd85dcc52b0734ffc25f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-27 18:04:25 +00:00
Juha Vuolle
12de520677 Make autotests configurable without Widgets on Android
tst_android depends on widgets, and parts of the test
needs to be excluded if Qt is configured without them.

Pick-to: 6.8
Change-Id: Iaca5b4228c0a7bd7c3a2efe9da04f354ac7e7c1c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit bdacb87cef17ff9bab69d843b8c5c14e2a749715)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-27 18:04:24 +00:00
Edward Welbourne
bc039f3253 Modernise and refine details in tst_QTimeZone
Use constexpr and const where we can.
Use Qt-defined string literals in a few more places.
Include GenericTime in a displayName() test, and make overt that we
are simply discarding the returns, with no further testing.

Pick-to: 6.8
Change-Id: Id120fdfe66267b01ff019fe13ac80f37390c106f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4702868677b4d09edc65b869ffd11756a20e6671)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-27 18:04:21 +00:00
Juha Vuolle
233f2340bd Fix namespace build when networkproxy is disabled
The QT_BEGIN_NAMESPACE macro was inside the "#if networkproxy" code
block, whereas the QT_END_NAMESPACE was outside of it.

When networkproxy feature is then disabled, the file will only
effectively have the QT_END_NAMESPACE macro. This fails to compile
when the build is an actual namespace build.

Pick-to: 6.8
Change-Id: Ic0b0fd2d086811664a4f66e2c46424d370641355
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 8d659669b248908b28dd51d07054cbb1ce91a35a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-27 21:04:15 +03:00
Juha Vuolle
b2ad8f05ba Fix tst_qnetworkreply compilation when networkproxy is disabled
Add a feature guard for test function relying on networkproxy.

Pick-to: 6.8
Task-number: QTBUG-136101
Change-Id: I69d97c84fb7d68f33f4b74fc8fd6665b1b8d6717
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 11b54b85ce74d59173afd297b780d3170b331548)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-27 18:04:14 +00:00
Juha Vuolle
518507bcfa Add explicit QPalette include to tst_qtextdocumentfragment
Test case relies on transitive include and fails to compile if this
include chain is broken e.g. by disabling features.

Pick-to: 6.8
Task-number: QTBUG-136101
Change-Id: Id34c9f8ec86468aaf4dda116be8d46591ebd9185
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 2542d79281a2c7f7d065c234438b866299ec4b7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-27 18:04:12 +00:00
Jerome Pasion
d5e902751a Doc: Add link to Export Controls page in the OpenSSL overview
-A new Export Controls page has a larger overview
-Edited parts of the section

Fixes: QTBUG-134259
Change-Id: Iaceb2501eeb848544f8004bfae03a3cdf36908af
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 03efecf818374f95d1387649f35cd4da8c9636ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-27 18:04:10 +00:00
Edward Welbourne
7549a5c388 Isolate an "enough like C locale" test and use consistently
Various checks for whether a locale was suitable for use of ASCII
offset formats were expressed in terms of QLocale::C. One was wrongly
expressed in terms of isDataLocale(), which is meant to be true for
the locale the backend thinks its data is suitable for. Write a new
method of QTimeZonePrivate to check for this, accepting en-Latn-* as a
good enough match, and deploy where it's the right test.

Pick-to: 6.8
Change-Id: Ieab129eb5c252732b8916fce017ec0a22684eba8
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 023a8d48e28f27da9fab097ecbe9acfbb8323544)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-27 18:04:07 +00:00
Ahmad Samir
585cdfbd17 QMetaObject: remove commented out normalizeTypeInternal() declaration
It is out-of-sync with the actual implementation in qmetaobject_moc_p.
we could change the parameter types, but it will only go out-of-sync
again if the implementation is changed in the future. So just remove the
whole comment.

Amends 916460929d1de315262d4a9ee91280ecaf3f58f1 and
4dbac23e5354638224d8d99ba3342067c015a04b.

Change-Id: Id41d2818266cf22765f0ae7f11265c0e840d5af3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 637a2a29833e31635eb42841e235f24e3589972c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-27 18:04:03 +00:00
Shawn Rutledge
4ebb0413f1 QTextMarkdownImporter: spell CRLF literal correctly
Amends eced22d7250fc7ba4dbafa1694bf149c2259d9ea

tst_QTextMarkdownImporter::frontMatter(yaml + markdown with CRLFs)
now does explicit replacement of LF with CRLF: git may convert the file,
so we can't rely on the CI test system checking out a true copy of
yaml-crlf.md; but QFile::open(ReadOnly | Text) ensures that we will
have LF line endings, not CRLF.

Pick-to: 6.8
Task-number: QTBUG-135284
Change-Id: I7eee5f41e7aea902a59ac06238e591ece016d2d3
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 66595c3efe125cc92333d7a71317cce529c52e92)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-25 20:08:08 +00:00
Alexandru Croitor
c3eaa283c3 CMake: Skip walking empty targets in __qt_internal_walk_libs()
If one of the interface link libraries of a target is
  "$<LINK_ONLY:$<BUILD_LOCAL_INTERFACE:Foo>>"
this will be exported by cmake as
  "$<LINK_ONLY:>"
in the exported INTERFACE_LINK_LIBRARIES property.

When walking the dependent libraries of a target using
__qt_internal_walk_libs(), this value will become empty after
unwrapping the LINK_ONLY genex.

In such a case, we should skip further processing of the library.

Otherwise in some weird unknown conditions, CMake might consider the
empty name to be a valid target, and cause errors when trying to read
properties from it.

Amends ad7b94e163ac5c3959a7e38d7f48536be288a187

Fixes: QTBUG-136039
Change-Id: I143dec697e10530379486462697cd299940ee463
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 9bc8ce6608eff2bd07b0044be80db4e9b6d8f5cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-25 16:40:04 +00:00
Ivan Solovev
b7ad2f3a9f Cleanup tst_qdatastream
Make NColorRoles constexpr and use static_assert() to verify that it
has a proper size.

Pick-to: 6.8
Change-Id: I40351e4815e248fe8cc07e906099172d5be531d0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f12115e97ca8875a2577eebc67b8c8dc03441996)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-25 16:40:04 +00:00
Marc Mutz
0bd5917b8b Mark QtPrivate::StreamStateSaver's ctor as [[nodiscard]]
As a RAII class, QtPrivate::StreamStateSaver's ctors should be marked
as [[nodiscard]].

Amends 3c93286f08a80b6e1821d7d63d361742b25c6578, but not picking all
the way back since 959800f6de137f6a77c7d5a2741a5bae0638cbd9
(Q_NODISCARD_CTOR) was only added in 6.6.

QUIP: 19
Pick-to: 6.8
Change-Id: If39fd79d21c52d60481973a416ae5f7da1858f7a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6079d7cd9c6f27cf49c63895771cdb3f87bdaee6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-25 16:40:04 +00:00
Marc Mutz
2a62697645 Remove traces of QDataStreamPrivate
It's no longer used since 9b2835e464748f499758a7eef0d4c49452e7211a.

Pick-to: 6.8
Change-Id: I8a075e9d645290af3a7fe5b9b2fa7a5a7a7b4909
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2471115715de2a00d477b35de69fcdb5e1cdf65d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-25 16:40:04 +00:00
Edward Welbourne
b5b172e34f Correct initialization of justAfter in QLocale::uiLanguages()
It's used to determine whether a non-equivalent prefix of a locale
gets added at the end of the block of equivalent locales, or at the
very end of the list. Thus it should be initialized for each prefix as
it is processed, not before the name is trimmed to its first prefix.

Added the test-case that caught this.
Amends commit cbf49f735e3cca85922a85d6548666816686db78

This should work as-is in 6.9 but may be hard to back-port to 6.8.
None the less, I shall try for the latter, too.

Pick-to: 6.8
Task-number: QTBUG-131894
Change-Id: I75ab27153133d2608cf57f0bc998c1e3d0d1432c
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0278a80d6876f38bb37f1d504e6b24a3512efb7a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-25 16:40:04 +00:00
Alexey Edelev
9e1cfb6ad9 Fold set_property call for Android executables
Small QoL improvement. The folded set_target_properties call looks
nicer.

Pick-to: 6.8 6.5
Change-Id: Id60e8c346672733a805e09420c754a24bcae82dc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 44a43b0aba93921a82e82e6adc4a3f906f68bbba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-25 16:40:04 +00:00
Alexey Edelev
662670febd Add support for _qt_internal_configure_file(GENERATE ... INPUT
Allow generating files from template file. The signature first
expands the '@' wrapped variables in template file and then generates
the resulting file using file(GENERATE command.

Pick-to: 6.8
Change-Id: I0b4cf557da1d5161ffcde1c44aea98c440427980
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5c30ae2c9f57d58b52effa1460c4bc38da29952a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-25 16:40:04 +00:00
Alexandru Croitor
1dc962cbe0 CMake: Clean up leftover attribution values during SBOM generation
When processing multiple attribution files to collect all attribution
ids, the values of the previous iteration extracted keys were not
reset.

This caused the values to leak to the next processed attribution id
target if the specific id key was empty.

Make sure to clean up the values before parsing the next attribution
key.

Pick-to: 6.8
Change-Id: I386fc9c09276c49207382b06605efeb0d939b6da
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3c80dd518a3bdc5f2c4df64c5330678294e06eb7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-25 12:12:51 +00:00
Alexey Edelev
7537bfbadf CMake: Fix SBOM PROJECT_COMMENT CMP0174 related warning
We should only pass PROJECT_COMMENT if it has a value.
We also need to escape semicolons, because the project comment might
contain the qt configure line, and that might have passed arguments
like -qpa offscreen\;xcb

Pick-to: 6.8
Change-Id: I934cf75c376b3466ba91a433d009e6eaa77a60fa
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ea575585e7eaccb628cdb342c8dd49396a3c52a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-25 12:12:47 +00:00
Giuseppe D'Angelo
72e6a5fec0 Examples: fix a couple of nodiscard warnings from QFile::open
In one case, the code simply checked for isOpen afterwards; refactor
it to use QFile::open's result. In another case, a file was opened
from the resource system, so add a check.

Pick-to: 6.8
Change-Id: I5f4c22dd5ce678f15c9c1609c4228d50a2b32a1d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit eeead68995653ab38e43e9f1494feaaa679dfd07)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-24 11:11:24 +00:00
Eirik Aavitsland
005e2c7876 Doc: QPropertyAnimation does not update target property when stopped
When stopped, an animations's currentValue can change as a result of
changes to the the start- or end value. The target property will not
be updated, however.

Fixes: QTBUG-125586
Pick-to: 6.8 6.5
Change-Id: Ib03133db80e92b4d73a1140e9a94d6d7a6b68fc4
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
(cherry picked from commit 25fbbb56122d95a9dce004ee6e9de8d144a46032)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-24 11:11:24 +00:00
Juha Vuolle
942b23f922 Make Qt for Android configurable without 'clipboard' support
Fixes: QTBUG-135675
Pick-to: 6.8
Change-Id: I844cd96f977bd0b5536606cf0c2449a87502231a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 323f408be6bcf5bfa5e2d447be94381556e52a62)
2025-04-24 14:11:24 +03:00
Juha Vuolle
c9921d069a Make Qt for Android configurable without 'accessibility' support
The code was already partially behind the feature flag, but not fully.

Pick-to: 6.8
Fixes: QTBUG-135693
Change-Id: Iad76221837aa37b90b3be998afc41ce9bbc05c55
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit f5b5f16bfa0bf0889c1d77af3e9840e67a2e851c)
2025-04-24 14:11:23 +03:00
Marc Mutz
111549dca0 Mark QtPrivate::StreamStateSaver's ctor as explicit
A QDataStream* is not a faithful representation of a
QtPrivate::StreamStateSaver, so the ctor should be explicit.

Amends 3c93286f08a80b6e1821d7d63d361742b25c6578.

Pick-to: 6.8 6.5 5.15
Change-Id: I63f8fa19070960bf70c965ffbc270070d10eacd7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit bb38a2929dfc00b202fe169b69c80e7854f47ad1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-24 11:11:23 +00:00
Juha Vuolle
eccceef934 Suppress unused lcQtGuiDrawHelper warning
Put lcQtGuiDrawHelper logging category declaration behind the same
feature flags as its users, to suppress a warning when neither
feature is defined:
qdrawhelper.cpp:38:27: warning: unused function 'lcQtGuiDrawHelper'

Pick-to: 6.8
Change-Id: Id6eab4e9ab7313475eedfeb20d8d29f84a47f291
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 40595f8063ff18fd3b3e810ffc799fb081e33a1b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-24 11:11:23 +00:00
Juha Vuolle
8b1b3866ba Fix namespace build when cssparser is disabled
The QT_BEGIN_NAMESPACE was inside "#if TEXTHTMLPARSER" code block,
whereas the QT_END_NAMESPACE was inside a nested "#if CSSPARSER"
block.

Therefore if cssparser was disabled, the file will effectively
have just QT_BEGIN_NAMESPACE, and the build will fail (if it's an
actual namespace build).

Pick-to: 6.8
Change-Id: Ibd750a71c154cb9596a7227327b7d5b3ab307001
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 8f940ca197249d89a4a6ff1958c8d4c95ff88077)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-24 11:11:23 +00:00
Juha Vuolle
8e078d8fd2 Fix tst_qimage compilation when deprecations are removed
Put both declaration and definition of tst_qimage::mirrored() behind
the same deprecation flags.

Task-number: QTBUG-136101
Change-Id: Ib54ee21f7944f1e2b7f9fe35aea9fd8d9e908f95
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 262a92244be71f622b5fa3e6e7c4fb60295efc0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-24 11:11:23 +00:00
Juha Vuolle
103c1c3a4c Fix tst_qtextmarkdown compilation when textmarkdownwriter not available
Place the calls to QTextDocument::toMarkdown() behind the same feature
flag as toMarkDown() function itself.

Pick-to: 6.8
Task-number: QTBUG-136101
Change-Id: I7468f6172cab613695504d7c50075169b46c4bc9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 3f5023aada2cc2450592a5434b6d6534468429e8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-24 11:11:23 +00:00
Assam Boudjelthia
b3a550d976 Android: release deadlock protector from requestPermissions()
Note this would ideally use androiddeadlockprotector.h, but since
it's living under the plugins directory it won't be accessible for
this code without some refactoring.

Fixes: QTBUG-133841
Pick-to: 6.8 6.5
Change-Id: I9b62e7a9809ba5e0782a82b9c07d122de544aece
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit e8aa9ff63850a6ddcac739bc773463d61ec4567f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-24 11:11:23 +00:00
Juha Vuolle
d6865ad65d Make Qt for Android compile without permissions -feature
The permissions were partially behind 'future' feature flag.
Instead put permission code behind the actual 'permissions'
feature flag, and require 'future' feature if permissions
are enabled.

Fixes: QTBUG-135617
Pick-to: 6.8
Change-Id: I573cca6a56c19bfc32a3f1df72a009cbe05ad2fb
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 965af8548cb804a0edb13ce167bd9daae0da3ed0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-24 07:21:18 +00:00
Magdalena Stojek
f6591e6638 Refactor QXmlStreamWriterPrivate constructor to modernize initialization
Apply NSDMI and move initializations to the constructor initializer list

Fixes: QTBUG-135897
Pick-to: 6.8
Change-Id: I7adff41fa006669677df457704d20c02f1af7197
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 3265f409394e821605cfd1888a26f7fbdd4ba682)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-24 06:43:04 +00:00
Christian Ehrlicher
4a8350da23 SQL/OCI: do not shadow QSqlCachedResultPrivate::sql
Rename QOCIResultPrivate::sql to QOCIResultPrivate::stmtp to avoid
shadowing of the sql member from base class.
Remove some useless casts as a drive-by.

Task-number: QTBUG-136024
Change-Id: I2a5951991039c4de7aecc29f9161dede7b4f3473
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3208ad494c7c03b964487787e246aedc444397dc)
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2025-04-24 06:40:43 +00:00
Antti Määttä
54d6769456 Fix recursion in QLoggingRegistry
QLoggingRegistry relies on any Qt code it uses not having category
logging in it, because it causes a global variable to be recursively
initialized. This has been the case so far, but with CTF tracing
enabled, there is Qt code that uses category logging if the first
tracing event originates from a logging category, causing the tracing
library to be loaded.

It is undefined behavior to recurse into the initialization.

Here is the backtrace of the situation:

QGlobalStatic<QtGlobalStatic::Holder<()::Q_QGS_qtLoggingRegistry> >::instance
QGlobalStatic<QtGlobalStatic::Holder<()::Q_QGS_qtLoggingRegistry> >::operator()
QLoggingRegistry::instance
QLoggingCategoryWithEnvironmentOverride::registerOverride
QLoggingCategoryWithEnvironmentOverride::QLoggingCategoryWithEnvironmentOverride
QtPrivateLogging::qt_lcDebugPlugins
locatePlugin
QPluginLoader::setFileName
QPluginLoader::QPluginLoader
loadPlugin
initialize
_tracepoint_enabled
QtPrivate::trace_QObject_ctor
QObject::QObject
 ...
QFile::QFile
loadRulesFromFile
QLoggingRegistry::initializeRules
QLoggingRegistry::QLoggingRegistry
(anonymous namespace)::Q_QGS_qtLoggingRegistry::innerFunction
QtGlobalStatic::Holder<::Q_QGS_qtLoggingRegistry>::Holder
QGlobalStatic<QtGlobalStatic::Holder<::Q_QGS_qtLoggingRegistry> >::instance
QGlobalStatic<QtGlobalStatic::Holder<::Q_QGS_qtLoggingRegistry> >::operator()
QLoggingRegistry::instance
QLoggingCategory::setFilterRules
main

Add a recursion guard in the QLoggingRegistry that causes
QLoggingRegistry::instance to return null if recursion occurs.
The internal code appears to handle nullptr well, while external code
should always receive a non-null pointer.

Fixes: QTBUG-135326
Pick-to: 6.8
Change-Id: I91f1ff341b096031930004cca8421f2ee0bab9b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 07255301eaa288fde3d550e0119b4d3ed2c39d22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-24 06:38:17 +00:00
Christian Ehrlicher
a223eca4ae Windows11Style/WindowsVistaStyle: don't modify SE_ItemViewItemDecoration
The windowsvista style increased the width for SE_ItemViewItemDecoration
by 4 pixels which lead to a non-square area for the decoration item.
Since the item is painted centered on the given area, this did not
change anything for squared pixmap-based icons. But when using a svg,
the image is automatically stretched to fill the complete area.
Therefore a svg is not painted quadratic but stretched which is not what
a user expects. Looking for other usages of SE_ItemViewItemDecoration
did not reveal another usecase for this so it should be safe to remove
the handling within windowsvista style.

Fixes: QTBUG-131955
Change-Id: I65f8e2afd1c2fb310d6a23b1405a920adcbf42c3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 298e8119222174cfb253272699e7fd90c1abf255)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-23 15:15:37 +00:00
Christian Ehrlicher
4e94132fb0 SQL/OCI: Fix usage of QOCIResult::d_ptr
The refactoring in 82681fd8a2af1113da5bd13875ba71c1efd45afb added a
d_ptr of type QOCIResultPrivate. This shadowed the d_ptr from
QSqlCachedResult and an unitialized QOCIResult::d_ptr variable which in
the end made the whole plugin unusable.
Fix it by removing the unneeded d_ptr member.

Fixes: QTBUG-136024
Change-Id: I5ecacba8079eadbfae25a32720b43b4465c096d8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 87bbcddb1d68142b3b8a21d20ec19e38c55a5e93)
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2025-04-23 15:15:34 +00:00
Christian Ehrlicher
1e6d93e614 SQL/MySQL: Add milliseconds in formatValue()
MySQL does understand ISO 8601 formatted datetime strings with
milliseconds so use Qt::ISODateWithMs instead Qt::ISODate within
formatValue().

Pick-to: 6.8 6.5
Task-number: QTBUG-95071
Fixes: QTBUG-136042
Change-Id: I182475c706c8eda0e3f97e23d98d3f91e372244a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5b6cbb9c4e4b897a79962ddd52287259391b0b5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-23 15:15:30 +00:00
Tor Arne Vestbø
06cec0646c Don't stop QPlaformWindow updateRequest timer until after delivery
Delivery of the update request may be circumvented temporarily by the
platform window, or the user may request another update during the
delivery, so wait to stop the timer until we know we don't need it
anymore.

Pick-to: 6.8
Fixes: QTBUG-135950
Change-Id: Ie6d1f0f726b66ab6a8036f281b46e525084d90e8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 2e6032188fee4430afbea377350c55dde46bfb43)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-23 13:41:14 +00:00
Eskil Abrahamsen Blomfeldt
50ef11616d directwrite: Fix embedding fonts in PDF
For a reason still unclear to me, the PDF engine refuses to
embed fonts if the file name is empty (so fonts that are loaded
directly from byte arrays typically). It could be that this in
itself is outdated.

However, embedding fonts that are loaded from the file system has
worked so far, but in Qt 6.8 we moved to the DirectWrite engine on
Windows and this stopped working there.

The reason is that our custom file loader did not support tracking
the file name and thus it would always be empty. This is experienced
as a regression and can only be worked around by manually selecting
the GDI engine instead (with the limitations that implies).

We fix this by implementing the loader as a IDWriteLocalFontFileLoader
instead, which supports the API which we currently use to retrieve the
paths of system-wide fonts.

Pick-to: 6.8
Fixes: QTBUG-134695
Change-Id: I1411b0617fd1c113c7c28154968c234920f5289e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 09805f355c7eb2ece70bcc58e731433980e31126)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-23 09:32:48 +00:00
Alexey Edelev
dcd3dee1ac Add the explicit include of qpixmapcache.h to qlabel.cpp
The include is required since code now accesses the respective types.

Amends 7a238e1225f49b81772516ed5d0a5a4f4f2e9268

Fixes: QTBUG-136079
Change-Id: I3c8fb8cd5b46875613b866bcb9c6bf7cded926a3
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit bfdedb260e019244cf199ed76915811ff69c9582)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-23 08:55:10 +00:00
Christian Ehrlicher
bd288ab255 QDateTimeEdit: Unify height of QDateTimeEdit
After 0a1c1711453697a88eee7fdb6f4cf082bfd433e2 a QDateTimeEdit with and
without a popup has different heights in some styles. Fixing the styles
may break existing layouts so we only get the needed width when the
popup is enable from CT_ComboBox and let the height being calculated
by CT_SpinBox to make sure both variants have the same height.

Pick-to: 6.8
Fixes: QTBUG-135029
Task-number: QTBUG-11967
Change-Id: I01c6f598d34a0b73125e60650c61a84b27d79ac8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 105ddadffeecf2370785ccd9bffde42fdbe25d1c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-23 08:32:05 +00:00
Marc Mutz
ae61177c50 Mark QRegularExpression* classes as security-critical
These classes, too, are usually in the first line of defense, used to
check tainted data for validity before anything else gets to see the
result of validation. In fact, in Perl, retrieving regex matches is
the main way to untaint data.

Amends 8df072fc8006510c9b743e8ffedaaf51a876883a.

QUIP: 23
Task-number: QTBUG-135195
Pick-to: 6.8
Change-Id: I1716f3c95ef110d5e20f3cdb303d4e70db16a6f1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit 3651442e6b6641a7d7a167c5397a54ba2f068b34)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-22 23:14:55 +00:00
Marc Mutz
2667f57338 Mark QCryptographicHash and QMAC as security-critical
If these classes aren't security-criticial, what is?

Amends 8df072fc8006510c9b743e8ffedaaf51a876883a.

QUIP: 23
Task-number: QTBUG-135198
Pick-to: 6.8
Change-Id: I50f4ab8139948be57107d27eb2a0b7eb9f898e32
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit 25cc585a1321a632b4c2aa56b2ef33248c5fb5cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-22 23:14:55 +00:00
Marc Mutz
d7d2c95eca Mark QByteArray and QString as security-critical
These classes are usually the first line of defense, containing
tainted data before anything else had the chance the verify it.

Amends 8df072fc8006510c9b743e8ffedaaf51a876883a.

QUIP: 23
Task-number: QTBUG-135195
Pick-to: 6.8
Change-Id: I91413e022b9794e21b6816b80962f5169ce8cd78
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit ef8d3e91d88e886cb12ccee9604e561b7699072b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-22 23:14:55 +00:00
Tor Arne Vestbø
c4486be6bd macOS: Always override NSApp.appearance on requestColorScheme
We can't compare to the effective appearance, as we'll then fail to
set an explicit appearance if the requested appearance matches the
current appearance, which results in the requested appearance not
sticking when the system appearance changes.

Pick-to: 6.8 6.5
Change-Id: Ibd8f7825051f1a67bed25a0abb2f1a13356f32d8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 05e59e37c83a15997fa20c10566a7be693fa07bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-22 18:21:43 +00:00
Axel Spoerl
b2b48ff26e Blacklist tst_QDnsLookup::lookupRoot() on macOS and Linux
Blocking CI; Blacklist until solved.

Task-number: QTQAINFRA-7130
Change-Id: Id420bfd9afcbe23555052ca9c3c8f3703b937bca
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4748d4303b7b49a9187a353df5d8e7a7fe9ec2dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-22 13:53:34 +00:00
Thiago Macieira
22dd10e261 QSqlDatabase: make evident the name of the driver that failed to load
Tell me this isn't confusing:
 Got keys from plugin meta data ("QMYSQL3", "QMYSQL", "QMARIADB")
 QSqlDatabase:  driver not loaded
 QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QMYSQL3

This also merges the two messages into a single line, which is nicer for
rich logging environments.

Pick-to: 6.8
Change-Id: Ieb80c6571213dddc518bfffdb6c86632df8f932c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 4216ba7c37dbdf67bfb5dc793d01a232ce4ea762)
2025-04-18 13:22:31 -07:00
Marc Mutz
df8f7becfc QMainWindowLayout: de-pessimize ~QMainWindowToolBar
As the code comment says, ~QMainWindowTabBar will removeOne(this) from
QMainWindowLayout::unusedTabBars. It doesn't assert that it was
included in it, or something special like that.

So we can optimize the whole thing by making sure that
~QMainWindowTabBar doesn't find anything to remove here, avoiding a
detach from the copy 'bars' and potentially also avoiding quadratic
behavior, as we delete the items in order.

Found by Coverity, but it only saw this as an optimization opportunity
because it doesn't understand that the copy is needed.

Amends 23357e59bb4dc54e76a237b290aa64a620db2ea1.

Pick-to: 6.8 6.5
Coverity-Id: 479705
Change-Id: I6c31e028c0c39813768e8c71076471b39bd8ef5a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit fb7670f193712fae2d4c03d6ee2a6c30101b886f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-18 20:22:31 +00:00
Alexey Edelev
4ea5f55aed Avoid using the $<CONFIG> based directory in .rc paths
The use of '/$<CONFIG>/' component in .rc path leads to undefined
behavior caused by CMake internal conflicts. Replace the path component
with the filename suffix.

Fixes: QTBUG-136019
Pick-to: 6.8 6.5
Change-Id: I73ae7f89ac65d00661148fcf41c973945bd2cc4f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7ce4a8a8c977688144efb94d41e20ed2420aa74b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-18 11:22:16 +00:00
Marc Mutz
4b20e23ed7 QAbstractSlider: fix missing "emission" of SliderOrientationChange
QAbstractSlider::sliderChange() is not a signal, but a protected
function, carrying an enum (also protected) to inform subclasses about
changes in the base class.

A user reported (QTBUG-135597) that in 5.15 the function was not
called for SliderOrientationChange. A prior test addition confirmed
that this bug is in all active branches.

Add the missing call in setOrientation().

This _should_ replace the update() call, because the default
sliderChange() implementation already calls it (and setPageStep(),
e.g., relies on this behavior), but since SliderOrientationChange was
not emitted since Qt 5.0, I minimize regression risks and keep the
update() call, just in case a user wrote code where they forgot to
call Base::sliderChange() for SliderOrientationChange (and this never
showed because we never "emitted" that, up to now). The duplicate
update() calls will be merged by Qt's event loop, so are harmless.

A dev-only follow-up change will remove the update().

[ChangeLog][QtWidgets][QAbstractSlider] Fixed the missing "emission"
of protected sliderChange(SliderOrientationChange).

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Fixes: QTBUG-135597
Change-Id: I4545d47d315a98a9a51134901a00fa369f720754
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit c35f6851bfe8ba71c26d3896498c1510fcd4e42b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-17 11:31:23 +00:00
Marc Mutz
f98c49666a QHeaderView: fix more UB (signed integer overflow) in setOffset()
We fixed the first line of defense in
03d1e81516be9af37fa08900f9a2d88d34abc4df, but that commit didn't rule
out ndelta == INT_MIN, in which case -ndelta overflows a few lines
below.

Coverity pointed this out.

Add a check that exposes this problem to ubsan, and avoid the overflow
by using qMulOverflow<-1>()¹ and not scrolling when it overflows, but
emitting a qWarning().

¹ There's no qNegateOverflow()...

When state == QHeaderViewPrivate::ResizeSection, we assume that
everything happens on the actual screen, which has physical limits to
the setOffset() argument, and therefore these arithmetic operations
don't need to be protected.

I fully expect that this will just be a rat's tail, one we can only
hope to control by using Peppe's safe integers everywhere, at which
point we've probably blown our executable code size out of any
proportions. So leave it at this, for the time being.

Amends 03d1e81516be9af37fa08900f9a2d88d34abc4df.

Coverity-Id: 479557
Pick-to: 6.8 6.5
Change-Id: I2e31fc9be21e7d59563b67f3cd26c29dcea61b55
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 49fcac99deea390901000a74deea1c0c690b6ae2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-17 11:31:23 +00:00
Marc Mutz
da619f9e0b qcompare.h: standardize on Coverity-friendly ctors
Coverity complained that the Qt::strong_ordering(std::strong_ordering)
ctor may leave m_order uninitialized, which is true if you assume that
'stdorder' could be anything else but {less, greater, equal}, which,
however, should not happen™.

Standardize on the pattern that QPartialOrdering(Qt::partial_ordering)
was using: init m_order to equivalent, and then check for the other
possible states.

I would have preferred adding 'else Q_UNREACHABLE()', but these are
constexpr functions, so we'd need the GCC 8 protection, and then the
else would have a body longer than one line, and I don't know whether
violating the coding style and adding {} only on the else would fly
with reviewers, so that's done in a follow-up.

Amends several changes (this code has seen a lot of churn over time).

Pick-to: 6.8
Coverity-Id: 475148
Change-Id: I3d88cdaaffbdfb8720161470b5f89046a3a15088
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f6d878d5ce4d6e41c088698bd337cf7f4438433e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-17 11:31:23 +00:00
Karim Pinter
68fb365e82 Fix VxWorks POSIX access() behavior
On VxWorks POSIX access() returns always false if it is called on file
which is not on POSIX file system, like DOSFS for example. Qt for
VxWorks 5.15 had similar patch omitting all access() calls and returning
true. This fix takes it a step further and checks if the file is on
POSIX filesystem or if it is DOSFS with read-only setting or not,
in case omitting access() call and returning true. Failure became
visible using QTranslator::load() method on DOSFS mmc card.

Task-number: QTBUG-134627
Pick-to: 6.8
Change-Id: I9c257d3cba1a2b976f2775ad129aae0e09f68ffd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fd73b220897e5b6faf012f2812e7eb9eab6c3955)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-17 08:06:45 +00:00
Kai Uwe Broulik
9909c89677 gtk3theme: Honor gtk-cursor-blink for whether blinking is on
gtk-cursor-blink-time is in an interval 100..2500ms, GTK uses a
dedicated boolean to determine whether blinking is on in the first place.

Pick-to: 6.8
Change-Id: I8a5dff70b6b3fbeeab599cf50402532052afe8b7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e2035be13d4d834fb179b7228e176ff5d4aa1721)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-16 22:06:56 +00:00
Volker Hilsheimer
c78963023a QMenu: show when QWidget::childrenRect is not empty
Amends 353ce5344fbde5a6cecbdd2c131e1cf0f4b7f383 after which QMenu::popup
returned early and without showing the menu if none of the actions had a
valid geometry in the menu.

This broke use cases where QMenu was used as a regular container widget
with child widgets (possibly in a layout). To fix this, take the result
of QWidget::childrenRect() into account, and only return early if that
rect is also empty.

Task-number: QTBUG-129108
Fixes: QTBUG-135933
Pick-to: 6.8
Change-Id: I05977044411df236146bb81dc08a30c176dfb6cb
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 7ffa6f1dd5c47196ac05300bd990b673c7cca976)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-16 22:06:46 +00:00
Volker Hilsheimer
c9ba8760de Widget effects DRY: replace manual pointer handling with unique_ptr
Instead of repeatedly resetting of the static pointers after (or before)
calling deleteLater(), use a unique_ptr with a custom deleter.

Since we use deleteLater(), nothing will happen if one of those widgets
does leak to the point where static objects are destroyed; we'd at most
call deleteLater() at this point, which won't do anything (if we enqueue
a DeferredDelete event at all, then it will never be processed).

Pick-to: 6.8
Task-number: QTBUG-135976
Change-Id: I36a4780093eafd064dcb1a72696c1d9b21483b77
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b50a2761e735208eeb62042ecfaba7a76e580454)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-16 22:06:37 +00:00
Shawn Rutledge
4f89fbc9a9 Make F11 the fullscreen keyboard shortcut on Gnome (as on KDE & Windows)
This seems to agree with current Gnome documentation.

[ChangeLog][Platform Specific Changes][Linux] The fullscreen keyboard
shortcut is now F11 on Gnome, not Ctrl-F11.

Pick-to: 6.8 6.5
Fixes: QTBUG-135854
Change-Id: I8ee0bd34152ce8ef112fd3226d17adc89f2a408e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 30fd101b558112b8829d3ae63b58e8504bbe9297)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-16 21:13:04 +00:00
Volker Hilsheimer
bc2f4ace0e Silence code checker warning about unused std::unique_ptr::release
We don't need the pointer, as it's the same as "this", we just don't
want the event to own the object anymore.

Nevertheless, silence code checker warning about the unused return.

Amends 96ef0004111b47cec239846b169942bbc885c181.

Pick-to: 6.8
Change-Id: I6a3c73e971f1b9e10f5754018a1fa5941dca6172
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 920a490d659836785f03d51edc11da1711ade965)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-04-16 09:41:01 +02:00
Volker Hilsheimer
cb199ab2aa QTimer: delete pending single shot timers when receiver's thread dies
QSingleShotTimer instances are usually destroyed when they receive their
QTimerEvent, and otherwise are children of the creating thread's event
dispatcher so that they do get destroyed even if they never fired.

However, if the receiver object lives in a different thread than the
thread that started the timer, then we move the QSST instance to
that thread to make sure that it starts in the right thread. We then
reparented the QSST instance to nullptr (it can't continue to be a
child of the creating thread's event dispatcher), and connected to
QApp::aboutToQuit as a fall-back in case the timer never fires.

This has two problems: if the timer never fires (e.g. because the
receiver's thread stopped before the timeout), then we created a
soft leak (until aboutToQuit). And since the QSST instance was
moved to the receiver's thread, the connection to aboutToQuit()
is always queued, and also never got processed if the thread was
stopped before (especially since we connected to deleteLater(),
which would require another event processing cycle). So in
practice, we ended up with a hard leak.

To fix this, we have to reparent the QSST instance to the event
dispatcher of the receiver's thread. We can do that reliably
once the receiver thread processes events. Simplify the code to
replace a meta-call with a posted event to ourselves, receiving
which starts the timer (or immediately fires timeout if it has
taken long enough to get there). To avoid memory leaks in the
unlikely case that this posted event never gets delivered (e.g.
because the thread is shutting down already), give that event
ownership of the QSST instance until the timer is started.

This turns out to be leaking anyway on most platforms, which
requires further investigation.

To be able to reparent safely away from a parent in a different
thread, clear the sendChildEvents flag first.

Amends 87535e4e4337596066258e361143cb9906e89512.

Fixes: QTBUG-135636
Pick-to: 6.8
Change-Id: I8188160d54cfb63cb1765c5de8a6c0728dabb7e5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 96ef0004111b47cec239846b169942bbc885c181)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-16 09:41:01 +02:00
Frédéric Lefebvre
aa4511af9d Blacklist tst_QFileDialog::clearLineEdit() on vxworks
Blacklist tst_QFileDialog::clearnLineEdit() on vsworks as it is
preventing the integration of other patches by failing too often.

Task-number: QTBUG-135966
Pick-to: 6.8 6.5
Change-Id: I9a2b9596a9d4783bcc7307c31c5faf8353f49257
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b760967a938f409b36395c31b44f443136e5b6a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-16 04:25:56 +00:00
Marc Mutz
62f382f271 QStringConverter: widen nameForEncoding()'s contract
Coverity apparently mixes bootstrap and non-bootstrap builds: it
complains that Encoding::Latin1 indexes encodingInterfaces[]
out-of-range (apparently taking the size of the latter from a
bootstrapped and the value of the former from a non-bootstrap build).

That should somehow be fixed in the Coverity configuration, but it
highlighted the fact that we have a narrow-contract function in this
security-critical class that can trivially have a wide contract, so
widen the contract by returning nullptr for invalid Encoding values.

Consequently, mark the function as noexcept.

As a drive-by, mark it also as Q_DECL_PURE_FUNCTION.

[ChangeLog][QtCore][QStringConverter] The nameForEncoding() function
now returns nullptr for an invalid Encoding value. Before, such a call
resulted in undefined behavior.

Pick-to: 6.8 6.5
Coverity-Id: 480251
Change-Id: Ie1c5c9df6881147a1ff44fe549e50748b2f5b7da
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 48959f7e5b670396805d4d62a44dd4fefac91611)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-15 18:51:32 +00:00
David Faure
df454f51f8 QPointer: fix data race on ExternalRefCountData
The creation of the ExternalRefCountData was published with
testAndSetOrdered() but the loadRelaxed() would only load the pointer
value, not the effects of the constructor.

Pick-to: 6.8 6.5
Fixes: QTBUG-135640
Change-Id: I3acbc51e763e8a291be3f7036e0d9cd3965a2ce8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 253f34082f526ff1ffd9eaefac73cc9aa616ab2a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-15 18:51:32 +00:00
Michal Klocek
e1d088b1e8 Enable building tests on WoA cross compile
Note this change has no impact on it own on current integrations,
as it barely adds tests compilation.

It is required for qtwebengine on WoA story.

Do not run some tests:
(required for qt5 patch introducing woa test node)
 * cmake test as host tools are provided by mingw,
   but tests are run natively by WoA platform.
 * dbus as this does not run natively on Woa anyway
   due to missing dbus service.

Change-Id: Ifdb3e1b76a7feb906a9031815984c716618e3882
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 04d17b2e229cee5e63596832b021c2316d9e4a05)
2025-04-15 20:51:32 +02:00
Volker Hilsheimer
d8fc1a6fa2 Blacklist tst_Android::orientationChange
The test fails almost daily.

Task-number: QTBUG-119205
Pick-to: 6.8
Change-Id: Ice5d14701cc72cd6b0a0fb73bf85b5edddd019f6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 3a21b4bcaf99ee705ab8f8ed0fc413d117edd1e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-15 14:27:10 +00:00
Jani Heikkinen
aa2e61f325 Bump version to 6.9.1
Change-Id: I13b41c9f75834bf8984a2414aa3e2c99bf802ff3
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2025-04-15 06:57:06 +01:00
Oliver Wolff
95f659aeda windeployqt: Deploy Qt dependencies of local non Qt dependencies
Before this patch we ignored every non Qt dependency we encountered
while scannig the binaries. That led to missing Qt dependencies for more
complex setups.

With this patch we also take "local non Qt dependencies" into
consideration. One example would be:
- A developer has a project that consists of an executable and a dll,
  where both are built/copied into the same folder before deployment
- The dll has different/additional Qt dependencies

The old approach just ignored these additional Qt dependencies.

The new approach checks for these local dependencies and finds the dll
in the same folder as the executable. In this case windeployqt will
now also scan this dll (and other local dlls) for Qt dependencies and
deploy these as well as their plugins.

[ChangeLog][Tools][Windeployqt] windeployqt now takes local non Qt
dependencies into consideration during deployment.

Fixes: QTBUG-135079
Pick-to: 6.8
Change-Id: Ia916dea78c6a5707ccecb61d996a0b7490215798
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 5ce44934b3cf07f4bfbf006bb4666cd481577c2c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:32:55 +00:00
Alexandru Croitor
189d5ebbda CMake: Show the active Apple SDK path when configuring qtbase
Starting with CMake 4.0, CMake doesn't initialize the
CMAKE_OSX_SYSROOT variable with any value when running on a macOS
host and no explicit CMAKE_OSX_SYSROOT or CMAKE_SYSTEM_NAME is set.

CMake expects the platform compiler wrapper /usr/bin/c++ to pass an
appropriate -isysroot flag to the underlying compiler, without CMake
explicitly setting one.

This mostly works, but the configure output will not show anymore the
active sysroot path.

Query the active path from xcrun, and display it in the configure
output.

Pick-to: 6.8
Task-number: QTBUG-135621
Change-Id: Ic9b9a43e25bb88bb83165dce52356c77ea8fffe1
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ab7eb492cba64fe985ea80b2f0be22c1c18f3c5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 23:32:39 +02:00
Alexandru Croitor
3ce44b88e2 CMake: Refactor _qt_internal_get_apple_sdk_version
Introduce two new functions _qt_internal_get_apple_xcrun_output
and _qt_internal_get_apple_sdk_name, to allow reusing them in the
future.

Make sure to set the output variables to empty even
outside Apple platforms.

Show an error when xcrun is called when targeting a non-Apple
platform.

Pick-to: 6.8
Change-Id: Ic3895f74cfcac337bff069f8e6ec1517aec6c8d0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit c0f0a275b379b97f3ddccdaa9fd8aa8f10cf0adf)
2025-04-14 23:32:36 +02:00
Joni Poikelin
14bfa63b48 Call xcrun from PATH
The xcrun binary may be installed in a different location when cross
compiling to macOS using osxcross.

Pick-to: 6.8
Change-Id: I47398e8da19c42e5e9d1b595673048c56662ea2e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 80d680e82f545d3a0ae23aa65d07befbab57b71a)
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2025-04-14 23:32:33 +02:00
Giuseppe D'Angelo
cb84d80c8a Include <QTest>, not <QtTest>
Avoid module-wide inclusions for QtTest. The transitive inclusions
eat a considerable amount of compilation time.

Task-number: QTQAINFRA-7110
Pick-to: 6.8
Change-Id: Ic1c93b40b638ea5bff739be212f173457bae26aa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5e1a1787322ce20752fc5f5251364e4e3d211dca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:32:29 +00:00
Mårten Nordheim
55ea4ebe34 Re-enable some TextBoundaryFinder test data
As part of updating UCD for Unicode 16 there was a need to support this
data anyway.

Task-number: QTBUG-121907
Pick-to: 6.8
Change-Id: I1d58a856de9b2aaff28917bd067914227bcffd9d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 541ff8e15cfe34056671410122ad21975b9d000d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:32:27 +00:00
David Faure
120a987544 QTestLib: fix crashes when using qDebug()s from threads with -junitxml
Other test loggers just output things immediately, but the junit test
logger appends messages to a vector, so this needs to be
mutex-protected.

In case of qDebug()s from long-running threads, we also need
to protect creation/destruction of systemOutputElement and
systemErrorElement -- and in case of qFatal(), currentTestCase.

Pick-to: 6.8 6.5
Change-Id: If35055fc232276a778951ebbfeaccd185b04f46b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit b4d6892ba5a745c1836daf34c850d13ef61e7ae0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:32:24 +00:00
Edward Welbourne
d4f4cd2ef2 Clean up "Qt Standard Time" tests
These were using an offset of 123456 seconds = UTC+34:17:36, which is
outside our supported range. This wasn't actually causing a problem,
as it wasn't being checked, but we should stay within 16 hours of UTC.
In the process, modernize the use of strings involved in its tests and
change an initial value to something further from what shall overwrite
it, rather than a neutral value.

Pick-to: 6.8
Change-Id: Ife4e082f1f00665d3203641508f5d30b34aaae75
Reviewed-by: Magdalena Stojek <magdalena.stojek@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 53ad78a636e4ca4f840213125c99841b7817195a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:32:13 +00:00
Edward Welbourne
b50bbd4269 Include "is known to ICU" check in QTimeZonePrivate::localeName()
As long noted in the QIcuTimeZonePrivate constructor, we can't trust
ucal_open()'s non-null return to mean it actually recognised the ID we
passed it. So break out the "is available" check to a function in the
QtTimeZoneLocale namespace so the check can be shared with
localeName() when compiled with ICU but some other backend. We were
previously getting GMT as display name for zones unknown to ICU.

Pick-to: 6.8
Change-Id: I57d57f94d8db7df76f24193a8ef1b5c71b08b0fc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit fc9a26ea3a0b76de8a437d6417af334a7a9dfde5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:32:10 +00:00
David Faure
854ef306be QReadWriteLock: fix data race on the d_ptr members
Testcase: ./tst_qreadwritelock countingTest

WARNING: ThreadSanitizer: data race (pid=356186)
  Read of size 1 at 0x7294000000f8 by thread T12:
    #0 contendedTryLockForRead qtbase/src/corelib/thread/qreadwritelock.cpp:230 (libQt6Core_tsan.so.6+0x6c3743)
    #1 QReadWriteLock::tryLockForRead(QDeadlineTimer) qtbase/src/corelib/thread/qreadwritelock.cpp:190 (libQt6Core_tsan.so.6+0x6c347b)
    #2 QReadWriteLock::lockForRead() qtbase/src/corelib/thread/qreadwritelock.h:68 (tst_qreadwritelock+0xb0f0)
    #3 ReadLockCountThread::run() qtbase/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp:597 (tst_qreadwritelock+0xc506)

  Previous write of size 8 at 0x7294000000f8 by thread T2:
    #0 operator new[](unsigned long, std::align_val_t) <null> (libtsan.so.2+0xa78eb)
    #1 allocate qtbase/src/corelib/tools/qfreelist_p.h:135 (libQt6Core_tsan.so.6+0x6c6079)
    #2 next qtbase/src/corelib/tools/qfreelist_p.h:212 (libQt6Core_tsan.so.6+0x6c5915)
    #3 QReadWriteLockPrivate::allocate() qtbase/src/corelib/thread/qreadwritelock.cpp:564 (libQt6Core_tsan.so.6+0x6c5354)
    #4 contendedTryLockForRead qtbase/src/corelib/thread/qreadwritelock.cpp:218 (libQt6Core_tsan.so.6+0x6c364f)

The loadRelaxed() at the beginning of tryLockForRead/tryLockForWrite
isn't enough to bring us the non-atomic write of the recursive bool.
Same issue with the std::mutex itself.

Pick-to: 6.8 6.5
Change-Id: I6f5e371cf94292b643cb36041d1406b19d22cdbe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 80d01c4ccb697b9d390cc0da49c2f111b19b4c5b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:32:07 +00:00
Giuseppe D'Angelo
a101ffb700 Tests: include what you use (QElapsedTimer)
Pick-to: 6.8
Change-Id: Ia0809dcba4477da97b506b4a9651b00e4ed5ab2c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit c3762aa30abecbec3f1049650a34562234302031)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:32:04 +00:00
Alexey Edelev
78f4273b97 Introduce _qt_internal_configure_file
The function is the internal public counterpart of the
qt_configure_file command, but also supports two modes:
GENERATE and CONFIGURE. The CONFIGURE mode is plain replacement
of file(CONFIGURE or configure_file command depending of specified
arguments.

In the GENERATE mode the function allows using the generator
expressions when evaluating the CONTENT. The function doesn't support
INPUT argument as its counterpart(there are no limitations, author left
this unimplemented).

Pick-to: 6.8
Change-Id: I9bef2265210404113596db95085b6e0d5f03ae13
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 1c886724bcb70f706e2a729461e4f1ea88e27ae3)
2025-04-14 23:31:59 +02:00
Alexey Edelev
c971288a04 [androidtestrunner] Add early return if AndroidManifest.xml is missing
Helps to debug deployment issues.

Pick-to: 6.8
Change-Id: I15909b3ce9e680636e87ec8764bacbd75711e857
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 2c8872f3815853b3bdefde30f09acd4389933744)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:31:53 +00:00
Topi Reinio
9520dc55a9 Doc: Fix \fn signatures for QFlags equality operators
These are hidden members, and visible under the QFlags class in the
Clang AST - even though semantically they belong to the parent (global)
scope.

Adjust the \fn signatures accordingly and remove the \relates commands
as unnecessary; QDoc recognizes the `friend` qualifier and marks the
functions as related non-members of QFlags automatically.

Pick-to: 6.8 6.5
Fixes: QTBUG-133923
Change-Id: Iaca74971bde8b313c573e75688bf57d3ff42b59d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 39358791f0553b2efbe3ee181e54694c2b72a6b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:31:49 +00:00
Alexey Edelev
1f2f5ee08c Default initialize the statep pointer in the resolv compile check
Initialize the variable with the default value, to avoid the type
mismatch warnings.

Fixes: QTBUG-135648
Pick-to: 6.8
Change-Id: I3ae2c59fb42676b373bcbbe06d3e6636203e283b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 52e2a89c63a059935f438209242a0065d5ac3cf5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:31:43 +00:00
Lorn Potter
7cd587aff1 wasm: fix QTcpSocket error code when url doesn't exist
::connect on wasm seems to be returning 0 in the instance that the
server url does not exist.
So we ignore that and look at errno, which returns ENOENT
which makes no sense here.

Fixes: QTBUG-132191
Change-Id: I2ff6642dd836324e1af6c288c53880de028ce158
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 1a8c8ffb0c45644c05ea1474df48bfdeea563524)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
2025-04-14 21:31:40 +00:00
Giuseppe D'Angelo
304e4e5cc4 QProcessTask: include what you use
Pick-to: 6.8
Change-Id: I62d02bf914effa2d86e43ea178e5007acf9935c4
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 22e212b6855f0e351b3b6a5a22b108e0bb53b986)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:31:36 +00:00
Bartlomiej Moskal
95ea70197f Android tests: Fix for moving file in content URI test
In Android's manual URI content test, there is a test case for moving a
file to another directory. While the function works and the file is
moved correctly, the URI is no longer usable after this operation. The
file must be reopened with a new URI.

This commit updates fileOperations test case to use the new URL after
moving file to another directory

Pick-to: 6.8
Fixes: QTBUG-134881
Change-Id: I114d76d6851815e7ee3d94ddc28d677d7c1ccea9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 1a35a560ddcaf03d9e2f5f91cd6bcd006c6d0951)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:31:30 +00:00
Topi Reinio
f4c1d51cae Doc: Qt D-Bus: Add image alt texts
To increase accessibility for the documentation, provide altenative
descriptions for the images.

Pick-to: 6.8
Fixes: QTBUG-135116
Change-Id: Id2d97251af9af0d4222f0dc15aa5b8e266ca36f4
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 8e36dcf4c861033f4675e37383c847b2ae03d23d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:31:26 +00:00
Axel Spoerl
b7aae99247 QDockWidgetGroupWindow: Properly destroy gap items and separators
QDockWidgetGroupWindow::destroyIfSingleItemLeft() cleared the item list
without checking for gap or separator items. When a QDockWidget was
deleted during an active drag, these items were leaked.

Call deleteAllLayoutItems() before clearing the item list.

Amends e6d85cf28bc4f750b69c33b72c006b067ae1190f.

Task-number: QTBUG-135442
Pick-to: 6.8 6.5
Change-Id: I94dffe162023c12bda1f801236ae4462229601b5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 12dfc8d5ed4756f15a9ce5252af80d3daa9fa074)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:31:21 +00:00
Laszlo Agocs
7cd1dbce12 rhi: d3d12: Avoid 1 sec timeout when skipping present
Follow the d3d11 change.

Pick-to: 6.8
Change-Id: I06ef9e64f37fba72c2ab6adc84ad9058f22ae1e4
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit d8fb42bb790f468ad1b5304b743dbff297582ddd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:31:15 +00:00
Edward Welbourne
f07a3e07d1 Convert QTextStream internals to char16_t QChar::unicode()
Pick-to: 6.8
Change-Id: If11457fbc472b2bc2ff7b76f4456fc87dd0014e5
Reviewed-by: Rym Bouabid <rym.bouabid@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 908b814fcdf209d113951331cb274f9b0fc4a87a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:31:09 +00:00
Edward Welbourne
dc3659f70f Port QTEXTSTREAM_DEBUG to modern QFlags
Its code was just casting to int, which no longer compiles.
Call toInt() on the fiag first.

Pick-to: 6.8 6.5
Change-Id: I74971f37841b44879cffdb480a173561798f8fa7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a9e2f5d0dc93bbc171b9c0d014f7b00c9e87a8f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 21:31:02 +00:00
Robert Löhning
7a8baa2583 Return early if qt_mapFillRect will return empty QRect
Credit to OSS-Fuzz, this fixes issue 406541912. When rendering the svg
image from that report, an integer overflow happend while calculating a
QRect which is empty anyway. To avoid that, return an empty, default
constructed QRect instead of calculating further.

Picking back to 6.5 which is the oldest maintained version which
contains this function.

Pick-to: 6.8 6.5
Change-Id: I1a0d1310c55f7be613a6292f36481ac7c7e5b56f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit d1b88f8b73c16e1ee362fa4cc853bcaadae0df6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 19:01:53 +00:00
Axel Spoerl
5cafb9c760 QDockWidget: Fix memory leak when closing floating tabs
QDockWidgetGroupWindow (aka "floating tabs") can have a single
QDockWidget child only, when a second QDockWidget is hovering over it.
When the QDockWidgetGroupWindow detects the disappearance of its second
last child, it reparents the last child to the QMainWindow and makes it
floating. It removes its last dock widget child from its own
item_list and itself from its parent's (the main window's) item_list.
Then the QDockWidgetGroupWindow removes itself by calling its
deleteLater() slot.

A removal from an item_list calls the d'tor of QDockAreaLayoutItem,
which deletes the item's subinfo and placeholder item, if they exist.
It does not delete the item's widgetItem. In fact the layout accesses
the widgetItem member to draw placeholders and decorations.
As a consequence, both the QDockWidgetGroupWindowItem and the
QDockWidgetItem are leaked, when the corresponding record is removed.

Implement QDockAreaLayout::takeWidgetItem(), which transfers ownership
of QDockAreaLayoutItem::widgetItem to the caller by returning a
std::unique_ptr.
Call this method in QDockWidgetGroupWindow::destroyOrHideIfEmpty() and
QDockWidgetGroupWindow::reparentToMainWindow().

As a drive-by, use static_cast<QMainWindow *>() and assert a
qobject_cast in debug mode.

Fixes: QTBUG-135442
Pick-to: 6.8 6.5
Change-Id: I055c998f515f2bb461518b7516f56db4673687da
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 40766380224b3a38bbf92b72d8d9baa3762bc06a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 14:55:20 +00:00
Juha Vuolle
1ae9914a32 Make autotests compile without draganddrop feature
Disable tst_qdrag test itself, and put proper feature
guards in tst_event test.

Fixes: QTBUG-135806
Pick-to: 6.8
Change-Id: I80e41538488ba1df230551a97f18c8266c01bdb5
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit cb48788425b04338a60587b09c27bd5ed74b739f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 13:40:12 +00:00
Frédéric Lefebvre
a40fdae4e7 tst_QSizeGrip::hideAndShowOnWindowStateChange is flaky on Ubuntu
tst_QSizeGrip::hideAndShowOnWindowStateChange is flaky on Ubuntu where
the widget is not set to fullscreen when it should. Wait for the the
widget to be exposed when shown the first time.

Fix flakiness on Ubuntu 24.04

Pick-to: 6.8 6.5
Change-Id: I9f5ea9ebb58c7505f841e5420dd2c15e5f0f2799
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 5ced648febe51b8788bbc38d7a578d4f43b720aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 13:23:52 +00:00
Milla Pohjanheimo
c17f7aed2b Add binary compatibility file for 6.9.0
Change-Id: Ibc5eb17a045ff4840727ae4d37bbdfae5855e596
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
(cherry picked from commit bb69d80975c4874fb69be7a74545543dcbfea6c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 13:23:51 +00:00
Jarek Kobus
cabdf3f94a TaskTree: Sync sources
Source sync Creator -> AssetDownloader.

Pick-to: 6.8
Change-Id: Ic503ba04c272718611a4a266bef40e73517e32fd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 2ab472f6cbcb8505a84dac8acd8e6795b9af0b8d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 15:16:30 +02:00
Ivan Solovev
adbb269eb9 qdbusxml2cpp: initialize the return value for adapters
If the interface has a method with a specified return value, the
generated adapter will contain a code like:

  bool out;
  QMetaObject::invokeMethod(parent(), "Func", Q_RETURN_ARG(bool, out));
  return out;

In this case Q_RETURN_ARG macro makes sure that the variable `out` is
properly initialized before being returned from a function, but only
if invokeMethod() call is executed successfully.

Update the generator to zero-initialize (or value-initialize) the
return variable, so that it returns some reasonable value even if
invokeMethod() fails.

Extend the unit-tests to make sure that the generated adapters always
initialize the return variables.

Coverity-Id: 479703
Pick-to: 6.8 6.5
Change-Id: I4d15ccc6844b5ca454ab9f0cf72fd8e3f0c1b704
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit 92c2ebdbcca9cfae6e4048004b3bdb58af972209)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 13:16:19 +00:00
Ivan Solovev
b5582df317 Add a separate QT_FEATURE for std::format
We want tst_qfloat16 to be built in C++20 mode, even if Qt itself is
not built in C++20 mode, which means we can't use QT_FEATURE_cxx20 as
check in tst_qfloat16's CMakeLists.txt.

In addition, even if the compiler supports C++20, the standard library
may not support all features we need. Specifically, due to the
deployment target of macOS being 12 we can't rely on std::to_chars
being available, as is only available since macOS 13.4.

This patch introduces a separate QT_FEATURE_cxx20_format, and
adjusts the tst_qfloat16's CMakeLists.txt to use this feature.

Note that we intentionally do not add QT_FEATURE_cxx20 as a
hard condition to the new check, because it might be disabled
during the Qt configuration, but we still want the test to be
built in C++20 mode.

Note also, that we cannot use the QT_CONFIG(cxx20_format)
check in the qtformat_impl.h header, because the std::format
support is header-only, and user project might be compiled
for a different minimal macOS version, so we do not want to
rely on the Qt-specific config.

Pick-to: 6.8
Change-Id: Ibc43d243dbb24fcb922647fe2d90f61491144eb7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f0573e93dff25c74287b3083d2c525c2daaa317c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 13:16:06 +00:00
Ivan Solovev
f0dbb0906b QXmlStreamReader: test adding data in different encodings
Currently all the tests are expected to pass because we always
convert everything to UTF-8.
This is a pre-requisite for the follow-up patches that would try to
optimize the internal logic to minimize the number of encoding
conversions.

Task-number: QTBUG-124636
Pick-to: 6.8 6.5
Change-Id: I0ac9212aeb8ccc768393e80c9e0d704fdc227b56
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 900d1daaebb703f4478c7cfedcda30b532291264)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 13:15:56 +00:00
Ivan Solovev
ec8f043ec5 QXmlStreamReader: fix addData() unnecessary conversion to UTF-8
The addData(QASV) overload was unconditionally converting UTF-16 and
Latin1 data to UTF-8.
However, if we already started reading the XML document, and we know
that its encoding is UTF-16 or Latin1, then we know for sure that the
new data has to be added as-is.

Amends 6bc227a06a0d1392d220aa79ddb1cdc145d4f76e.

[ChangeLog][QtCore][QXmlStreamReader] Fixed a bug when
addData(QAnyStringView) was incorrectly recoding UTF-16 and Latin1
data to UTF-8, thus potentially mangling it.

Fixes: QTBUG-135129
Pick-to: 6.8 6.5
Change-Id: Ie1171a5e5596b72a6f160031a4c5a9df3baae4fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b6b725aef59390f403a1a39f49d1318c48f13c07)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 13:15:53 +00:00
Tuomas Vaarala
a65a730ebf Replace qFatal() statements with qWarning() in case of failed queries
In some cases the QNX events can be stale ie. referring to a window
object that is already destroyed. This is not necessarily a fatal
condition, but there are some qFatal() statements in this case which
could be removed.

Fixes: QTBUG-135076
Pick-to: 6.8 6.5 5.15
Change-Id: I885fa95c323590a814176b8a70ef5b7ee332012c
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
(cherry picked from commit 1e10ede244b70455201df1c459b9586f3c015552)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-14 05:26:20 +00:00
Thiago Macieira
31334da21e QLoggingRegistry: remove use of QDir and merge two strings
We don't need to apply QDir::absolutePath() on the diretory that
QLibraryInfo::path() returns, because that is already an absolute path
(and if it weren't, it wouldn't make a difference anyway). That means we
are only doing path concatenation here. For code this low-level, it's
better to stick to QString.

This commit also rejiggles the string variables so we avoid one of the
memory allocations when calling QStandardPaths.

Change-Id: Ic3405877155a15ac4ac6fffdc92463ae0bff0bd9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit e0cdcf66cad739af808ae952c125030e9ad52de4)
2025-04-13 14:03:37 -07:00
Thiago Macieira
79e3416bb0 QMetaType/QVariant: update docs that canConvert() operates on types
Not on values. That is, it indicates whether there is a conversion path
from origin type to the destination type, not that the conversion will
succeed when attempted. For example:

  QObject *o = new QAbstractItemModel;
  QVariant variant = QVariant::fromValue(o);
  qDebug() << variant.canConvert<QAbstractItemModel*>();

This conversion *will* succeed for this particular value of a QObject*,
so canConvert() must return true for conversions between QObject* and
QAbstractItemModel*, despite not all such conversions being possible.

This is also done in preparation of changes being done to the conversion
routines that may cause some FP->integer conversions to fail depending
on the value of the FP.

Fixes: QTBUG-135619
Task-number: QTBUG-135285
Pick-to: 6.8
Change-Id: I138e34fb61a8b8772c8bfffdf75787a2e007d847
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 7cf49085eb47ae660d05e8579c08a3ad3be75021)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 21:03:29 +00:00
Thiago Macieira
09747e064e tst_Q*Application: suppress warning about using read() with MSVC
MSVC is pedantic that read() (a POSIX function) is not an ISO C function
so insists that we use the underscored version. As if Microsoft followed
that rule for their own APIs...

Amends e6a6757c1485d09a4b7a124d67260f06d8022fef.

Pick-to: 6.8
Change-Id: If51fd8564a3c415e1f7efffd7fde18a830c97e3b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 9ffbeae50e768c37865ec08e7d8716b9fa75f575)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 21:03:23 +00:00
Marc Mutz
1f2565e96d QMetaObject: don't use QMetaType::fromName() in typeFromTypeInfo()
The former will try to normalize the type name, but everything stored
in a QMetaObject is already in normalized form. So, if the first
lookup fails, the normalized one won't succeed either.

Use qMetaTypeTypeInternal(), which doesn't normalize.

At a minimum, this will fail faster. If we're lucky, the missing
round-trip via QMetaType(int).id() will help the positive case, too.
But if it does, it's lost in the statistical noise of the benchmark.

IOW: no measurable performance impact.

Task-number: QTBUG-135572
Change-Id: I23834c201fbcd1780c50e85cf8a15ea5e4a94c74
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit a481a79a97c6e63a77cfae8a15e060e203afdc40)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:52:30 +00:00
Marc Mutz
95fd5fc0d2 Port qMetaTypeTypeInternal() from const char* to QByteArrayView
The only caller of the function, QArgumentType, passes
QByteArray::constData() to it, and the function then goes around and
performs a strlen() in order to feed it into qMetaTypeTypeInternal().

Pass the name as a QByteArrayView, to save the strlen() over a string
we already knew the length of.

No measurable performance impact.

Task-number: QTBUG-135572
Change-Id: Ifccea7644ce86308df5fb7063c0269a579785504
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit cac63042b1303511ef41642b3290e6d54d1a76b8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:52:27 +00:00
Marc Mutz
c4b7c7b097 QMetaObject: save a strlen() in typeFromTypeInfo()
QMetaType::fromName() takes a QBAV, so don't feed it rawStringData()
(a const char*, causing the QBAV ctor to run strlen() on it), but
stringDataView() (a QBAV already, whose length is determined by offset
difference in the string offset table and not by strlen()).

No measurable difference in runtime speed.

Pick-to: 6.8 6.5
Change-Id: I583bea9d818deeaac6f62803f7ac5ab4766cb8a5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1445a33b6fd4c7a401edf68e325e4527e18a667a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:52:25 +00:00
Marc Mutz
4a1de91066 QMetaObject: fix performance regression in methodMatch()
Amends 22ce92f8040183faf9e1ba53c59c6b0b9172fb26, which apparently
changed the method name stored in the moc data from unqualified to a
qualified name. The original commit message doesn't mention it, but
the change in QMetaMethodPrivate::name() suggests as much.

Unfortunately, the search for the colon causes the name() call to
increase to 25% of the total methodMatch() runtime, up from 6.85%
before the change.

Since name() now always strips a possible prefix, re-add the original
name() as qualifiedName() and use that in methodMatch().

This is faster because we don't need to perform an a-priori search for
colons; instead, we can first check for endsWith(), and only if we
have a match, can we a-posteriori check that the match was preceded by
an (optional) colon.

Results on my machine:

  ********* Start testing of tst_QObject *********
  Config: Using QtTest library 6.10.0, Qt 6.10.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 15.0.3 (github.com:llvm/llvm-project.git 48b23aa469b8cfdb6cde1c55bf3361cabcdef6bc)), ubuntu 20.04
  PASS   : tst_QObject::initTestCase()
  PASS   : tst_QObject::connect_disconnect_benchmark(normalized signature)
  RESULT : tst_QObject::connect_disconnect_benchmark():"normalized signature":
  -    923.542494 nsecs per iteration (total: 461,771,247, iterations: 500000)
  +    880.558792 nsecs per iteration (total: 440,279,396, iterations: 500000)
  -    4,340.832532 CPU cycles per iteration, 4,7 GHz (total: 2,170,416,266, iterations: 500000)
  +    4,093.487614 CPU cycles per iteration, 4,65 GHz (total: 2,046,743,807, iterations: 500000)
  -    13,706.07561 instructions per iteration, 3,157 instr/cycle (total: 6,853,037,807, iterations: 500000)
  +    12,779.02463 instructions per iteration, 3,122 instr/cycle (total: 6,389,512,318, iterations: 500000)
  -    2,201.185595 branch instructions per iteration, 2,38 G/sec (total: 1,100,592,798, iterations: 500000)
  +    2,208.176500 branch instructions per iteration, 2,51 G/sec (total: 1,104,088,250, iterations: 500000)

For a ~5% overall speedup in both ns/iter and instr/iter, keeping in
mind that this data contains the disconnect() call, too.

As a drive-by, remove a second call of QMetaObjectPrivate::get() on the
same object, and reuse the previous call's result.

Task-number: QTBUG-135572
Change-Id: Ide253b323e7b826f8fa09d2f5f57496861c12f75
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 8e98a3a82602016b2e9bfe2435031ae6ff8010e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:52:22 +00:00
Thiago Macieira
4cd8e96f5f QThreadStorage: ensure global static exists when finish() is called
For the thread that calls ::exit() (usually, the main thread).
Otherwise, depending on construction order, it is possible for the
QThreadStorage's destructor list to have been destroyed by the time
destroy_current_thread_data() → QThreadData::finish() calls our
finish().

Fixes: QTBUG-135044
Pick-to: 6.8
Change-Id: Ic5a10367ff31e7faa039fffdc2067eba9642fbf9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 81a7a4c2d94fca6fc595dcb147831b9585eaee5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:52:17 +00:00
Ahmad Samir
37ba1457f4 QInternalMimeData: avoid a QString redundant allocation
By using QStringView.

Drive-by, explicitly use QBA::constData() to fix the build with
QT_NO_CAST_FROM_BYTEARRAY.

Pick-to: 6.5
Change-Id: I57bcd877048f3b9889ab8d638979f893857af396
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit f7db58335b78c296624e65ea119ef4cec6334815)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:52:15 +00:00
Volker Hilsheimer
6ff7f71c31 qgraphicsitem_cast: replace runtime with compile-time check
Specialize the cast template for QGraphicsItem, where we can skip the
runtime comparisons of the type.

In addition, replace the runtime check for QGraphicsItem::Type with a
compile time check in the main template.

We need to do both so that we correctly cast up to QGraphicsItem for
custom item types that don't provide their own Type alias.

Pick-to: 6.8
Change-Id: Ic1bff3404fe890747865ce1349cddbcfebb3b77b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 7af5912e61160681be736ff07a1cd0a0f6b28944)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:51:55 +00:00
Mauro Persano
9b8655cf0d Determine screen with initialGeometry when not positioning automatically
Popups aren't automatically positioned, so use the screen at the initial
geometry for scaling. Otherwise we may end up with the wrong geometry on
systems that have multiple screens with different scales.

Pick-to: 6.8
Fixes: QTBUG-134139
Change-Id: I686b1c8ab6cf458d9b849b529ba247ac8c3be064
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7dc2532bed8977dd4166e9aa4be021b0ec39b5ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:51:53 +00:00
David Faure
ab628edbb0 QItemSelectionModel: document danger with setData from selectionChanged
Got two independent bug reports where people got hit by that and had
to do a long and difficult debugging session to find out what was
happening (and still thought it was a Qt bug).

Fixes: QTBUG-54484
Fixes: QTBUG-50821
Change-Id: I0041fccebbb7070fccf8014288c62d89f117ae7d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 687422abde1444031e507112b6e6c5b3c0fe6b63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:51:51 +00:00
Johannes Grunenberg
e044a1bf9a Ensure Qt builds with -no-feature-shortcut on Windows
Building without shortcuts would fail due to a missing QKeySequence.
This was already handled in the implementation but required an ifdef in
the header.

Change-Id: I12c92ca480d0abdb518aae00b5b7e259133ef9ca
Pick-to: 6.8 6.5
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 0a281beaa76a04665930b1e1cd5349c26ae7f0d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:51:50 +00:00
Marc Mutz
d6284de755 tst_QAbstractSlider: add a check for sliderChange() "emission"
QAbstractSlider::sliderChange() is not a signal, but a protected
function, carrying an enum (also protected) to inform subclasses about
changes in the base class.

A user reported (QTBUG-135597) that in 5.15 the function was not
called for SliderOrientationChange.

Add a test that verfies that the function is a) called for all other
enum values and b) add XFAILs for the (still) missing
SliderOrientationChange.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-135597
Change-Id: I959077f030976937dd279897748025afa06e74dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f4e892d79768a6c4da8acf42da954a8f2e611f4b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:50:54 +00:00
Marc Mutz
72dfe79098 QDockWidget: fix UB (invalid member calls) in QDockAreaLayout::takeAt()
The process by which the QDockAreaLayout changes a QDockAreaLayoutInfo
from representing a QWidget that's being deleted to representing a
QPlaceholderItem involves the construction of the latter from the
former. If a QDockWidget is being deleted, however, at the time the
QDockAreaLayout notices, the ex-QDockWidget has been demoted to a
QObject, causing the calls to QWidget member functions to be UB:

Says UBSan:

  qdockarealayout.cpp:46:25: runtime error: member call on address 0x7ffe74a429d0 which does not point to an object of type 'QWidget'
  0x7ffe74a429d0: note: object is of type 'QObject'
   33 7f 00 00  c0 ea 73 6e 33 7f 00 00  00 12 00 00 70 61 00 00  40 cd 41 83 33 7f 00 00  00 00 00 00
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QObject'
    #0 0x7f339546e251 in QPlaceHolderItem::QPlaceHolderItem(QWidget*) qdockarealayout.cpp:46
    #1 0x7f33955169a8 in QDockAreaLayoutInfo::takeAt(int*, int) qdockarealayout.cpp:1780
    #2 0x7f3395517175 in QDockAreaLayout::takeAt(int*, int) qdockarealayout.cpp:3432
    #3 0x7f33959e38a8 in QMainWindowLayoutState::takeAt(int, int*) qmainwindowlayout.cpp:927
    #4 0x7f33959e38a8 in QMainWindowLayoutState::takeAt(int, int*) qmainwindowlayout.cpp:919
    #5 0x7f3395a42cdd in QMainWindowLayout::takeAt(int) qmainwindowlayout.cpp:2238
    #6 0x7f3393fae246 in removeWidgetRecursively qlayout.cpp:485
    #7 0x7f3393fb8300 in QLayout::widgetEvent(QEvent*) qlayout.cpp:544
    #8 0x7f3393bde28a in QApplicationPrivate::notify_helper(QObject*, QEvent*) qapplication.cpp:3298
    #9 0x7f3393c5f74a in QApplication::notify(QObject*, QEvent*) qapplication.cpp:3259
    #10 0x7f336b784ada in QCoreApplication::notifyInternal2(QObject*, QEvent*) qcoreapplication.cpp:1111
    #11 0x7f336b7874e3 in QCoreApplication::sendEvent(QObject*, QEvent*) qcoreapplication.cpp:1551
    #12 0x7f336bcc624a in QObjectPrivate::setParent_helper(QObject*) qobject.cpp:2271
    #13 0x7f336bccd76c in QObject::~QObject() qobject.cpp:1146
    #14 0x7f339434e126 in QWidget::~QWidget() qwidget.cpp:1584
    #15 0x7f33955b5815 in QDockWidget::~QDockWidget() qdockwidget.cpp:1362
    [...]

  qwidget.h:816:25: runtime error: member call on address 0x7ffe74a429d0 which does not point to an object of type 'QWidget'
  0x7ffe74a429d0: note: object is of type 'QObject'
   33 7f 00 00  c0 ea 73 6e 33 7f 00 00  00 12 00 00 70 61 00 00  40 cd 41 83 33 7f 00 00  00 00 00 00
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QObject'
    #0 0x7f339546e0bb in QWidget::isWindow() const qwidget.h:816
    #1 0x7f339546e0bb in QPlaceHolderItem::QPlaceHolderItem(QWidget*) qdockarealayout.cpp:47
    [... rest as above...]

Fix by dragging the setParent(nullptr) up into ~QDockWidget().

Ordinarily, that call happens only in ~QObject(). But that's what
caused the layout to react to the ChildRemoved element too late. When
doing it here, the dock widget is still itself, and all the
QDockAreaLayout machinery can still access its QWidget-ness.

Amends the start of the public history.

After consulting with QtWidgets maintainer, not picking to 5.15,
since, even though slim, there's a non-zero chance this might break
something, somewhere.

Pick-to: 6.8 6.5
Change-Id: I5472bbb0fcab9fb74272a1da6c2a2896226e12bb
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 2c67d47ea15c6dc34cc20d8fbdb406efb19f11d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:50:50 +00:00
Marc Mutz
bb46df6a7a QTimer: restore BC with Qt 6.7 for MSVC
When I ported the QTimer::defaultTypeFor() helper from ms to ns
granularity, I failed to account for MSVC, in which inline functions
of exported classes are themselves exported.

As a consequence, the private QTimer::defaultTypeFor(milliseconds)
symbol went missing.

To fix, re-add it as REMOVED_SINCE API.

We don't need to play tricks with QT6_*_NEW_OVERLOAD here, since the
overloads have a different signature and the only callers¹ are either
passing an exact ms or ns argument² or are in dependent names in
templates³ which removed_api.cpp does not instantiate.

¹ this is a private function, so we don't need to look very far...
² the string-based singleShot() overloads
³ and so name lookup (and therefore overload resolution) happens only
  at instantiation time, not at template parse time (so Integrity and
  VxWorks compilers will, that is)

Amends a60e341145a3b8a106e556e17ae62d2f45ac5d74.

Pick-to: 6.8
Fixes: QTBUG-135578
Change-Id: I375e6f04a3af3824f980fe59775d3eea94250987
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 27ed0014b491f457469914847f0a41926af998f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:50:42 +00:00
Marc Mutz
c5beecbcc0 tst_QGraphicsItem: check that qgraphicsitem_cast casts correctly
GCC, with ubsan and optimization enabled, issues -Warray-bounds for
the cast from &polygonItem to QGraphicsTextItem*, because the latter
is-a QObject and the former is not, so the cast has to adjust the
pointer value to correct for the fact that QGraphicsItem is not the
first base class of QGraphicsTextItem:

  qgraphicsitem.h:973:56: warning: array subscript -1 is outside array bounds of ‘QGraphicsPolygonItem [1]’ [-Warray-bounds]
    973 |         || (item && int(Item::Type) == item->type()) ? static_cast<T>(item) : nullptr;
        |                                                        ^~~~~~~~~~~~~~~~~~~~
  tst_qgraphicsitem.cpp:3193:26: note: while referencing ‘polygonItem’

Check the implementation is correct in this respect by not just
checking for nullptr or non-nullptr, but checking that the result
matches what dynamic_cast produces.

We can assume dynamic_cast works on QGraphicsItems because QPA is
using dynamic_cast, so both QtGui and QtWidgets need to have been
compiled with RTTI enabled.

This doesn't eliminate the GCC warning, but confirms that it is a
False Positive.

Pick-to: 6.8 6.5
Change-Id: Ifc262cb6e715e8e68c180855adc2467960da89a1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 101427957b59b715d0865cbdba12590fe11d1d10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:50:38 +00:00
Marc Mutz
a50425de58 QMetaObjectPrivate: make decodeMethodSignature() return QByteArrayView
... instead of QByteArray.

This is part of a quest to improve string-based connect() performance.

Needed to port a few consumers of decodeMethodSignature()'s result
from QByteArray to QByteArrayView, too. All private API, so doesn't
affect users.

This doesn't change anything in tst_bench_qobject's
connect_disconnect_benchmark:normalized signature, yet.

Task-nunber: QTBUG-135572
Change-Id: I1cd5b410ee090ab9c6f3aa8095a4d9efae516ac0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit f2747c62d4732694e0d03638ba0ed7af7ebeaa7a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:50:35 +00:00
Marc Mutz
a589ec7129 QDockWidgetLayout: mark the ctor explicit
A QWidget* is not a faithful representation of a QDockWidgetLayout, so
the ctor should be explicit, even if this is but a private class.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: Ib69d72540f094542dbcfc0684e2eec5f90aa532a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 21c9aac20abd700cf9f4bcacbbbe7751eb0aa364)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:50:31 +00:00
Marc Mutz
0859415f7d QMdiSubwindow: fix UB (invalid member call) in ControlContainer::removeButtonsFromMenuBar()
The function can be called from ~QMdiSubwindow(), and we checked for
QWidgetPrivate::data.in_destructor before proceeding with the removal
of buttons from the menubar, but we called
QPointer<QMdiSubwindow>::data()->window(), which, at this point in
time, had already been demoted to a QWidget:

Says UBSan:

  qpointer.h:75:14: runtime error: downcast of address 0x6040000aca10 which does not point to an object of type 'QMdiSubWindow'
   0x6040000aca10: note: object is of type 'QWidget'
    00 00 00 00  28 01 99 bc ff 7e 00 00  80 dc 0f 00 90 61 00 00  d8 02 99 bc ff 7e 00 00  00 00 be be
                 ^~~~~~~~~~~~~~~~~~~~~~~
                 vptr for 'QWidget'
       #0 0x7effb955f95a in QPointer<QMdiSubWindow>::data() const qpointer.h:75
       #1 0x7effb955f95a in QPointer<QMdiSubWindow>::operator->() const qpointer.h:79
       #2 0x7effb955f95a in QMdi::ControlContainer::removeButtonsFromMenuBar(QMenuBar*) qmdisubwindow.cpp:795
       #3 0x7effb9563031 in QMdi::ControlContainer::~ControlContainer() qmdisubwindow.cpp:717
       #4 0x7effb9566595 in QMdi::ControlContainer::~ControlContainer() qmdisubwindow.cpp:723
       #5 0x7eff8f4f2b7a in QObjectPrivate::deleteChildren() qobject.cpp:2226
       #6 0x7effb7bf732d in QWidget::~QWidget() qwidget.cpp:1557
       #7 0x7effb95cc02c in QMdiSubWindow::~QMdiSubWindow() qmdisubwindow.cpp:2254
       #8 0x7effb95cc1d5 in QMdiSubWindow::~QMdiSubWindow() qmdisubwindow.cpp:2254
       #9 0x7eff8f4f2b7a in QObjectPrivate::deleteChildren() qobject.cpp:2226
       #10 0x7effb7bf732d in QWidget::~QWidget() qwidget.cpp:1557
       #11 0x7effb7bffba5 in QWidget::~QWidget() qwidget.cpp:1584
       #12 0x7eff8f4f2b7a in QObjectPrivate::deleteChildren() qobject.cpp:2226
       #13 0x7effb7bf732d in QWidget::~QWidget() qwidget.cpp:1557
       #14 0x7effb85f0dc5 in QFrame::~QFrame() qframe.cpp:235
       #15 0x7effb859c747 in QAbstractScrollArea::~QAbstractScrollArea() qabstractscrollarea.cpp:478
       #16 0x7effb93c08a6 in QMdiArea::~QMdiArea() qmdiarea.cpp:1703
       #17 0x7effb93c0e55 in QMdiArea::~QMdiArea() qmdiarea.cpp:1703
       #18 0x7eff8f4f2b7a in QObjectPrivate::deleteChildren() qobject.cpp:2226
       #19 0x7effb7bf732d in QWidget::~QWidget() qwidget.cpp:1557
       #20 0x7effb920a425 in QMainWindow::~QMainWindow() qmainwindow.cpp:338

Fix by deleting the ControlContainer already from ~QMdiSubwindow(),
ie. when we have not yet been demoted to QWidget.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: Ia43c857bc1842b2b4957cc79e00f790b045d8f94
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2e3d39130c318da54d77775e82c6c699f236ddf8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:50:27 +00:00
Marc Mutz
d4cd7bf5ff tst_QMetaObject: check a few functions with QVector instead of QList
QVector instead of QList is currently still treated specially, being
considered normalized even if a signature piped through
normalizeSignature() would have changed.

We'd like to get rid of this special treatment, so add some tests for
invokeMethod() + Q_ARG, which we should continue to support.

Pick-to: 6.8 6.5
Task-number: QTBUG-135572
Change-Id: Ie09c80d2a8603a268859f395797196013efd8c0f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 1fa31be7ce3a6899f1c1597311d7593648ecd1d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:50:19 +00:00
Marc Mutz
8e9ef8df5b syncqt.cpp: don't init static variables with non-static data
Static variables are only initialized once, when control passes over
their definition for the first time¹. If they are initialized with
non-static data, like the contents of a non-static data member, or the
address of one, then all following uses of the object will continue to
use the first control pass' data, even if the data members were from
an object that has since been deleted.

This whole construct appears to have worked merely because these
functions are only executed once, or at least not on different
objects. But better remove the dangerous construct while it hasn't
broken something, yet, and before we e.g. make syncqt a library² or
add a mode that makes it scan multiple modules at once.

Requires to capture more variables in the parseArgument() lambda; more
than fits into an explicit capture list, so use a [&] catch-all
instead.

As a drive-by, use CTAD to not have to mention the number of elements
in a std::array, but have the compiler deduce them, and add const,
where it's missing.

Amends b89d63515bb352cecfd87e709320a2db5b6a1906 (and maybe a few
in-between, we'll see when cherry-picking).

¹ Except corner-case like when initialization fails by throwing an
  exception.
² see similar ideas for moc, e.g.: QTBUG-132820

Pick-to: 6.8 6.5
Change-Id: I65a73059151e3d39341939f613080e6d833a4c30
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 01ced9d45ab87f5d3fd41525621c680965517ee7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:50:15 +00:00
Marc Mutz
3e7f2f2048 QEventStorage: fix comment about slicing
QEventStorage<E> will slice if you call store(e) where typeid(e) !=
typeid(E). But if they are the same, no slicing occurs.

So change the code comment from "always slices" to "may slice".

Amends dd264cc9c00e09eb995f1c6f9b1fd651f1d4b2f4.

Task-number: QTBUG-99563
Task-number: QTBUG-133321
Change-Id: Ic69d2d3e6b5491c2d3e61d8da131f4bda628fe95
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 5d2164382cfaa6458731714e335b56002f865a33)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-04-13 19:50:11 +02:00
Marc Mutz
6a8b3344c0 QPointer: don't cause UB when checking for nullptr
QPointer is used to track whether a QObject is still alive, and so
it's unsurprising that checking whether the pointer is null is
sometimes done in situations where the QObject is already in the
process of being destroyed and therefore already demoted from T, the
QPointer template argument, to some base class.

Because of the way we made QPointer SCARY¹, calling data() will cast
from QObject* to T*, which is UB if the T was already demoted.

It's hard to fix this in the general case, but the various ways to
spell isNull() should all be equivalent to isNull() (which does not
cause UB, because it doesn't cast).

This patch fixes the relational operators against nullptr and adds an
explicit operator bool() so that if (p) and if(!p) no longer have to
go through (implicit) operator T*(). This does not appear to cause
disambiguities, so it's SC.

Don't document the operator, it's an implementation detail (and not
documenting it lets us pick it back). A follow-up will add the
documentation for 6.10+.

Add tests, even for stuff that's currently still UB (but marked by an
early return). A follow-up patch will try to make as many of these
other operations non-UB as possible, too.

¹ Originally 3f7741fbe7ab4140f8f971c0cf88bb04e7feea6b, then changed in
  cc7239da8d1ab95e68e12a64df3ca3051419cb34 and
  351c738fc4586bf354c9363fb78e190bdfca4617.

Amends the commits mentioned in the footnote.

[ChangeLog][QtCore][QPointer] For `QPointer<Derived> p`, `!p` and
comparing `p` to nullptr no longer perform invalid downcasts when the
object held in `p` is in the process of being destroyed and has
already been demoted from Derived to one of its base classes. Before,
these expressions invoked data(), which casts from QObject* to
Derived*, a cast which is invalid.

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-135626
Change-Id: I1b59062345e1b6933958c7e030d9253d69e7591c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 51cd57116b7465f732253d3f38a2dd78fc704088)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:50:08 +00:00
Marc Mutz
d4a1448901 tst_QPointer: make DerivedParent delete all children
... not just 'derivedChild'.

This doesn't change anything for the test right now, but will enable
an extended test to be added on top.

Pick-to: 6.8 6.5 5.15
Change-Id: Id52f785168c97c43433fb15a6a71a9d1fb140036
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4c610300e34d0bbbd1dac912f34127ff08ea04be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 17:50:04 +00:00
Ahmad Samir
2c2135a343 Use QByteArray overloads of QString::from{Utf8,Latin1}
Fixes the build with QT_NO_CAST_FROM_BYTEARRAY.

Pick-to: 6.8 6.5
Change-Id: I7d26235cbb9d26dc4b6d12a68a5ae494574b82a2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit ce38df4461d09793de675b6161225fc86e5168f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 16:48:38 +00:00
Magdalena Stojek
0b08fad61f Clarify XML version support and improve documentation for QXmlStream
This updates the documentation for QXmlStreamReader and QXmlStreamWriter
to explicitly state that only XML 1.0 is supported. While the writer
allows specifying arbitrary version strings, it does not implement
XML 1.1 features. The reader strictly enforces XML 1.0 and rejects
unsupported versions.

Fixes: QTBUG-43029
Pick-to: 6.8 6.5
Change-Id: I771de29e7915d7a4daafe2fe14d600adfbbac4ac
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 6551bef9d978d195c8824110d8a4ef050a833107)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-13 11:42:21 +00:00
Joerg Bornemann
06a41125b4 CMake: Fix InputSupportPrivate build condition
Fix the condition that decides whether to build InputSupportPrivate. The
conflict resolution went wrong for
b3b836e70388edcf1d18b114cd128c7b89a79199. The point of the commit is to
disable InputSupportPrivate if QT_FEATURE_libinput is enabled but
QT_FEATURE_xkbcommon is not.

Change-Id: I58a924abcf9ab5469e14182d1fdbb3fd69c1e74f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-04-12 19:57:53 +02:00
Christian Ehrlicher
62c1f8da1e tst_qgraphicslinearlayout: avoid duplicate data tags in removeAt()
Avoid the duplicated data tags in removeAt() tests by adding the
orientation to the tag.

Pick-to: 6.8 6.5
Fixes: QTBUG-135294
Change-Id: If31d719e4a9b1c90e591cedc149848bbb9c99657
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0b668c2f55f0fc797a2366b3dc73395f79e1b585)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 17:36:27 +00:00
Marc Mutz
6d6ee8d6d6 tst_QGraphicsGridLayout: fix memleaks in setGeometry()
The test function created a parent-less QGraphicsWidget, and while it
added a bunch of child objects to it, that initial graphics-widgets
never got an owner so it and all the children were leaked.

Fix by holding it in a unique_ptr. That is the minimally-invasive fix.

Amends the start of the public history.

Pick-to: 6.6 6.5 5.15
Change-Id: I3ab9db721e1343f2bd8d9fdd0ee6e86733a66da2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 2e0988190febe65b6d12b7956bd22b04843e2e6d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:25 +00:00
Marc Mutz
4fe022c408 tst_QGraphicsGridLayout: fix memory leaks in columnCount()
The populateLayout() function adds parent-less QGraphicsWidgets
(RectItems) to the layout. If the layout had a graphics-widget parent,
it would reparent the items added to it onto the parent. But it
didn't, so it didn't.

Therefore, the last part of the test function (as denoted by the
re-creation of `layout`) leaked a lot of items, including `layout`.

To fix, give the layout the existing graphics-widget parent. Then the
layout itself isn't leaked anymore, either.

Amends the start of the public history.

Essentially the same commit for columnCount() that
b9836518a367a31a48027a5bf81c4973b847b442 was for rowCount().

Pick-to: 6.8 6.5 5.15
Change-Id: Ic38dfccfa41049d96eb0cf5811271ac17f2b1f91
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit d21434d1876fc778aa5dea6696b145bd6d86d03c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:25 +00:00
Marc Mutz
9a9530fd08 tst_QGraphicsGridLayout: fix memleaks in spanningItem2x3()
The test function creates a bunch of QGraphicsWidgets without parents,
and adding them to the QGraphicsGridLayout doesn't make them owned by
it. Besides, the layout was without a parent itself, so all these
objects were leaked.

To fix, give the layout a stack-allocated QGraphicsWidget parent. Now,
the layout will reparent the widgets added to it to its own parent
widget, which will delete layout and child widgets when it itself is
deleted on all exists from the test function.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I8d80713f4ff6b1055bc396d855f98bc1873aee3b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit fe0b29a45c19ad401ab5e4d17bec2e2d3e2c618c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:25 +00:00
Marc Mutz
389dab064e tst_QGraphicsGridLayout: fix memleak in spanAcrossEmptyRow()
The test function created a parent-less QGraphicsWidget on the heap,
and didn't otherwise transfer ownership of it to another object, so
the object was leaked.

The minimal fix is to hold the graphics-widget in a unique_ptr. This
requires to change the following line, too (as would the alternative,
allocation on the stack), but the rest of the function can stay as-is
(unlike with stack allocation, which would require further s/[.]/->/.

Amends 4f072e2d3d7e429359ff15a615d02712bff7ee51.

Pick-to: 6.8 6.5 5.15
Change-Id: Ide305dde7934747dbc3acdb49f5a75e98563828c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 45f317fba09e98c1fb5f0456ce6309d59d1161cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:24 +00:00
Marc Mutz
f6d8388455 tst_QGraphicsGridLayout: fix memleak in removeItem()
The test function contains a negative test where we're trying to
remove an item that isn't in the layout.

Unfortunately, the object we're passing is heap-allocated and has no
parent, so was leaked.

To fix, pass the existing `widget` as a parent. This doesn't change
the test's outcome: Like in QWidget, a graphics-widget is not
automatically added to its parent's layout.

Amends the start of the public history.

Pick-to: 6.6 6.5 5.15
Change-Id: Ic110ea7b93aa0023c0903c776a30dc5c377ce0c5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 4d0f979610b961e3dd4e86060fc05456c9d1447d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:24 +00:00
Marc Mutz
13b833cd1a tst_QGraphicsGridLayout: fix memleak in spanningItem2x2()
The `form` graphics-widget has no parent and is not otherwise added to another
object that would take ownership of it, so it was leaked, together with its children.

To fix, simply create it on the stack. This is the minimally-invasive fix.
Had I held it in unique_ptr instead, I would have had to touch the line
creating `layout`, too. Creating it on the stack is simpler than make_unique(), so do that.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I4027dcb0c0650eb7556de96e6d1d20b98c14dc9a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit cba8f19ff83674e7396ce4e5daa086d473be70bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:24 +00:00
Marc Mutz
a6f082df9b tst_QGraphicsGridLayout: fix memleaks in addItem()
Both `layout` and `wid` were created without parents, and not otherwise added to
objects that would take their ownership; only `layout` was explicitly deleted
at the end of the function, `wid` was leaked.

The usual solution, giving them a stack-allocated graphics-widget as
parent that will delete them, doesn't work here, because the layout
does refuse to add the widget in some test rows.

Since there are no checks in-between the allocation and de-allocation
(this test is only checking for expected warning messages), do the
minimal fix and explicitly delete `wid`, as it was already done for
`layout`.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I5c7356ac93c04d648eb31888105b480791fbe155
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b518a385ad03c3b199f4704088d688b9bf1f3cc6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:24 +00:00
Marc Mutz
adbbd47314 tst_QGraphicsGridLayout: remove unneeded delete in rowMaximumHeight()
The deleted 'widget' was added to a stack-allocated QGraphicsScene,
which owns it and will delete it as its child if it itself is deleted.

There's no check following the manual delete, and the test function's
name shows no indication that deleting graphics-widgets from a scene
in a show()n QGraphicsView is being tested here, so it serves no
purpose.

Remove it.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I4e5405cd6212d2a318a567d99ef42c99261d431a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit fc89096bcb28036cd12c0aaa690f3607e96f5e3b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:24 +00:00
Marc Mutz
3295e7d52b tst_QGraphicsGridLayout: fix memory leaks in rowCount()
The populateLayoutWithSpansAndHoles() function adds parent-less
QGraphicsWidgets (RectItems) to the layout. If the layout had a
graphics-widget parent, it would reparent the items added to it onto
the parent. But it didn't, so it didn't.

Therefore, the last part of the test function (as denoted by the
re-creation of `layout`) leaked a lot of items, including `layout`.

To fix, give the layout the existing graphics-widget parent. Then the
layout itself isn't leaked anymore, either.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I063c0e3336d943a35592fa62a5d16cbddb6b920e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b9836518a367a31a48027a5bf81c4973b847b442)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:23 +00:00
Marc Mutz
690243d333 tst_QGraphicsGridLayout: fix memleaks in columnSpacing()
The populateLayout() function adds parent-less QGraphicsWidgets
(RectWidgets) to the layout. If the layout had a graphics-widget
parent, it would reparent them onto the parent. But it didn't, so it
didn't.

Therefore, the 2nd and 3rd part of the test function (as denoted by
the top-level scopes in the function) leaked a lot of items.

The first part of the function already used a widget, itself without
parent, but added to a QGraphicsScene allocated on the stack, so was
not leaking.

To fix, give the layouts a graphics-widget parent. Then the layout
doesn't need to be deleted anymore, either.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I7e63c51cf037818fb1e519dab5394ad75c74d67d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 5a559758d18627c7adb9df81ac8e0eb43eb1e7c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:23 +00:00
Marc Mutz
6753ab4723 QDialogButtonBox: fix UB (invalid downcast) in Private::handleButtonShowAndHide()
The event filter was still active when the QDialogButtonBox in its
destruction process had already been demoted to QWidget. The
ignoreShowAndHide guard came too late, because by the time we check
it, in Private::handleButtonShowAndHide(), we had already cast q_ptr
to QDialogButtonBox.

Says UBSan:

  qdialogbuttonbox_p.h:26:5: runtime error: downcast of address 0x7fffefab47e0 which does not point to an object of type 'QDialogButtonBox'
  0x7fffefab47e0: note: object is of type 'QWidget'
   00 00 00 00  28 c1 5b 6e 6d 7f 00 00  80 22 10 00 90 61 00 00  d8 c2 5b 6e 6d 7f 00 00  00 00 00 00
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QWidget'
     #0 0x7f6d6b51141d in QDialogButtonBoxPrivate::q_func() qdialogbuttonbox_p.h:26
     #1 0x7f6d6b51141d in QDialogButtonBoxPrivate::handleButtonShowAndHide(QAbstractButton*, QEvent*) qdialogbuttonbox.cpp:913
     #2 0x7f6d6b51436c in eventFilter qdialogbuttonbox.cpp:127
     #3 0x7f6d40c1a8f1 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) qcoreapplication.cpp:1248
     #4 0x7f6d690b23d5 in QApplicationPrivate::notify_helper(QObject*, QEvent*) qapplication.cpp:3303
     #5 0x7f6d69132a3a in QApplication::notify(QObject*, QEvent*) qapplication.cpp:3259
     #6 0x7f6d40c1da6a in QCoreApplication::notifyInternal2(QObject*, QEvent*) qcoreapplication.cpp:1111
     #7 0x7f6d40c20473 in QCoreApplication::sendEvent(QObject*, QEvent*) qcoreapplication.cpp:1551
     #8 0x7f6d690fe76c in QApplicationPrivate::setActiveWindow(QWidget*) qapplication.cpp:1857
     #9 0x7f6d695ac796 in QWidgetPrivate::deactivateWidgetCleanup() qwidget.cpp:2326
     #10 0x7f6d6976f8ce in QWidgetPrivate::hide_sys() qwidget.cpp:8256
     #11 0x7f6d69814579 in QWidgetPrivate::hide_helper() qwidget.cpp:8199
     #12 0x7f6d69887c1f in QWidgetPrivate::setVisible(bool) qwidget.cpp:8406
     #13 0x7f6d69775d23 in QWidget::setVisible(bool) qwidget.cpp:8314
     #14 0x7f6d695fb018 in QWidget::hide() qwidget.cpp:8179
     #15 0x7f6d6981a183 in QWidgetPrivate::handleClose(QWidgetPrivate::CloseMode) qwidget.cpp:8580
     #16 0x7f6d699e6fc6 in QWidgetWindow::closeEvent(QCloseEvent*) qwidgetwindow.cpp:871
     #17 0x7f6d52ef9f5d in QWindow::event(QEvent*) qwindow.cpp:2721
     #18 0x7f6d69a575f8 in QWidgetWindow::event(QEvent*) qwidgetwindow.cpp:398
     #19 0x7f6d690b2491 in QApplicationPrivate::notify_helper(QObject*, QEvent*) qapplication.cpp:3309
     #20 0x7f6d69132a3a in QApplication::notify(QObject*, QEvent*) qapplication.cpp:3259
     #21 0x7f6d40c1da6a in QCoreApplication::notifyInternal2(QObject*, QEvent*) qcoreapplication.cpp:1111
     #22 0x7f6d40c205b3 in QCoreApplication::sendSpontaneousEvent(QObject*, QEvent*) qcoreapplication.cpp:1565
     #23 0x7f6d5287415b in QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent*) qguiapplication.cpp:2911
     #24 0x7f6d528b543f in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) qguiapplication.cpp:2259
     #25 0x7f6d52fb5b02 in QWindowSystemEventHandler::sendEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) qwindowsysteminterface.cpp:190
     #26 0x7f6d52fb5b02 in bool QWindowSystemHelper<QWindowSystemInterface::SynchronousDelivery>::handleEvent<QWindowSystemInterfacePrivate::CloseEvent, QWindow*>(QWindow*) qwindowsysteminterface.cpp:102
     #27 0x7f6d52fb5b02 in handleWindowSystemEvent<QWindowSystemInterfacePrivate::CloseEvent, QWindowSystemInterface::SynchronousDelivery, QWindow*> qwindowsysteminterface.cpp:138
     #28 0x7f6d52fb5b02 in bool QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::SynchronousDelivery>(QWindow*) qwindowsysteminterface.cpp:351
     #29 0x7f6d52cb6f1e in QPlatformWindow::close() qplatformwindow.cpp:348
     #30 0x7f6d52e7e158 in QWindow::close() qwindow.cpp:2449
     #31 0x7f6d6981b4d2 in QWidgetPrivate::close() qwidget.cpp:8632
     #32 0x7f6d698205c6 in QWidget::~QWidget() qwidget.cpp:1508
     #33 0x7f6d6b4f6bf0 in QDialogButtonBox::~QDialogButtonBox() qdialogbuttonbox.cpp:496

To fix, don't delay the Q_Q to until after the ignoreShowAndHide
check, since that woould be brittle. Instead, do as we for signal/slot
connections, which we disconnect explicitly in ~QDialogButtonBox(),
and delete the EventFilter explicitly there, too. This way, it's more
natural, and also prevents all those useless event filter invocations
from having to be processed later on.

Amends aff0915352dda0cfaa11a249b665fbe47be21d69. The original code,
using QDialogButtonBox::eventFilter(), was not affected, since by the
time QDialogButtonBox was demoted to QWidget, QWidget::eventFilter(),
not QDialogButtonBox::eventFilter() would been invoked. Which just
goes to show that one needs to be very careful with delegating too
much responsibilites to the Private class, as it lives, fully derived,
until ~QWidget() executes.

Pick-to: 6.8 6.5
Change-Id: I04f36fd6d7d160932bfe1494fdff464786b85047
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit dceff0ace4d16344eec3ad4a27dec92f8a55c63e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:23 +00:00
Marc Mutz
53692fc9c5 tst_QMainWindow: fix unit'ed value in AddDockWidget
The constructors didn't initialize all fields, leading the
compiler-generated move contructor to read invalid enum values:

Says UBSan:

  tst_qmainwindow.cpp:1645:8: runtime error: load of value 32675, which is not a valid value for type 'Orientation'
    #0 0x55b1bd283e2e in AddDockWidget::AddDockWidget(AddDockWidget&&) tst_qmainwindow.cpp:1645
    [...]

  tst_qmainwindow.cpp:1645:8: runtime error: load of value 72, which is not a valid value for type 'DockWidgetArea'
    #0 0x55b1bd284024 in AddDockWidget::AddDockWidget(AddDockWidget&&) tst_qmainwindow.cpp:1645
    [...]

(ubsan does not direct uninitialized memory accesses directly).

Fix by vale-initalizing the two members. This is the most natural
initialization for these members: Given that the test passed even with
random data before, 0 is surely good enough.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I6fc0b2f79679fd0f69024066c1e66b4434a5ebe6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit af71de2036728091b432d7b4284368188961b680)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:23 +00:00
Marc Mutz
35431fe6e3 tst_QDockWidget: split setFloating() test function
The test function contains two completely separate tests: The old
setFloating() method from a910daf52678469b7e595da5fe54aa09ba2373c3^,
and the additions of said commit, which don't reuse any objects of the
old function.

Turn the latter into a new test function, setFloatingReparenting(), to
help code readers understand that these two parts of the test function
have nothing in common.

Case in point: setFloating() is now ubsan+asan-clean while
setFloatingReparenting() inherits both asan and ubsan errors of the
old, combined function.

Amends a910daf52678469b7e595da5fe54aa09ba2373c3.

Pick-to: 6.8 6.5
Change-Id: Ib0d54d47e74d4c3b70637bef95fa81d4da83dd76
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b724c3708bfd94e2f3ec01ccec8de6779f0adb33)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:22 +00:00
Vlad Zahorodnii
a47b7c285d dbusmenu: Skip registration with the registrar on Wayland
The RegisterWindow request expects a window id. The QDBusMenuBar uses
the QWindow::winId() property for that. On X11, the winId() returns
the XID of the window. On Wayland, the winId() returns an integer that
has meaning only to the application, there are no global window ids on
Wayland. The menubar should be registered using other means, for
example using the kde-appmenu protocol, which QtWayland already does.

The QDBusMenuBar can skip synchronously calling the RegisterWindow
request on Wayland because the menu will be registered using a different
api.

Change-Id: I6b2968624c5c9ddbdc93807f65eac369dc7a993a
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit fa1fab994e76c19a08903e9b641732ce388a30bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:22 +00:00
Matthias Rauter
6276f26bda Rename QtPrivate::Tok::size to tokenSize
Using MSVC 19.43 in C++20 mode leads to a compile error in
tst_qstringview. MSVC interprets QStringTokenizer as
std::ranges::sized_range because it found size() in the namespace
QtPrivate::Tok. QStringTokenizer is derived from a class in that
namespace.

Naturally this leads to a compile error because QStringTokenizer has no
size member function as required in QtPrivate::Tok::size():

qstringtokenizer.h(118): error C2039: 'size': is not a member of
    'QStringTokenizer<QStringView,QStringView>'
qstringtokenizer.h(232): note: see declaration of
    'QStringTokenizer<QStringView,QStringView>'
qstringtokenizer.h(118): note: the template instantiation context
    (the oldest one first) is
tst_qstringview.cpp(680): note: see reference to function template
    instantiation ...

The problem can be avoided by renaming QtPrivate::Tok::size() to
tokenSize. MSVC 19.43 interprets QStringTokenizer as std::ranges::range
that do not need the size() member function.

Pick-to: 6.8
Change-Id: Ib94db8e4d840a143bbf693c89e3714e1528a0267
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit eabbc15a5b0cb1b1866778fa014bd599d38f1695)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 07:45:22 +00:00
Konsta Alajärvi
ebb4b0140b Remove Blacklist entry for tst_QApplication::applicationPalettePolish()
tst_QApplication::applicationPalettePolish() is blacklisted but does
not seem to fail anymore.

Unblacklisting the function.

Fixes: QTQAINFRA-6906
Pick-to: 6.8
Change-Id: I14b8c4e8e1e94c3ff077f7d91ee8f97c031d5b6d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
(cherry picked from commit 1e63707f961748a0bbdd8cbda897cf72f4b96905)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-12 04:25:19 +00:00
Joerg Bornemann
13871ee86b Fix linker errors when building bootstrap lib on macOS
The bootstrap lib doesn't build qfilesystemengine_mac.mm, and that's
where QFileSystemEngine::supportsMoveFileToTrash and
QFileSystemEngine::moveFileToTrash are implemented.

Make sure that the preprocessor picks up the QT_BOOTSTRAPPED condition
first to define implementations for the two methods.

Fixes: QTBUG-135650
Change-Id: Icf7995abfae368b9f5bd5c4ccfcf4c3c6664d519
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fc277e3ff655780622bcbc0b664efc69fbc33537)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-10 19:08:11 +00:00
Joerg Bornemann
b3b836e703 CMake: Prevent creation of empty InputSupportPrivate module
The combination of
    -no-feature-evdev
    -no-feature-tslib
    -no-feature-libinput
led to the creation of the InputSupportPrivate module without source
files.

This triggered CMake upstream issue 23464 when using CMake < 3.25.

Fix this by adjusting the inexact condition that decides whether to
build InputSupportPrivate.

Pick-to: 6.8
Fixes: QTBUG-99957
Change-Id: If23d029f21811b6ff7c92ac9ecd2882aedb309d6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit cf2efa90fa92898f71861fca8100d7ac72244dae)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-04-10 21:08:02 +02:00
Axel Spoerl
c33044f500 Blacklist tst_QGestureRecognizer::touchReplay() on Linux
Deeper research into recent failure necessary.
Blacklist to unblock CI.

Task-number: QTBUG-129754
Pick-to: 6.8 6.5
Change-Id: I1f543e35acdac7d91d48215a2130a03b77fd2ac5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 4392e5f4c5b4806051f5d4c70de423133dfd2d86)
2025-04-10 18:36:42 +00:00
Eskil Abrahamsen Blomfeldt
a1b4480c53 Upgrade Harfbuzz to 11.0.0
[ChangeLog][Third-Party Code] Upgraded Harfbuzz to version
11.0.0.

Pick-to: 6.8 6.5 5.15
Fixes: QTBUG-135373
Change-Id: If4a530ec43f5992141945d7ad86268e838cc0230
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 98e0a7e0a067c6aacf9d61295bd36d290b150d51)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-10 18:22:52 +00:00
Eskil Abrahamsen Blomfeldt
53a687e5c3 Make sure Harfbuzz build picks up Qt atomics
We have our own implementation of the atomics API in Harfbuzz
for broader platform support. This is done through the mechanism
in Harfbuzz where you make a file called config.h with the
implementation and then define HAVE_CONFIG_H.

In Qt, we have this in src/3rdparty/harfbuzz-ng/config.h,
next to the CMakeLists.txt.

However, on some platforms, a different config.h has been found
earlier in the include paths and included instead, causing us to
use the default atomic implementation instead on these platforms.

This causes problems with the upgrade to Harfbuzz 11, where the
atomics have been written to depend on some template syntax which
is not properly supported on the Integrity OS compilers yet.

This was also a random inconsistency, so rather than try to work
around the compile issue on Integrity, we add the CMakeLists.txt
directory as the first include path, to make sure the correct
config.h is picked up on all platforms.

Pick-to: 6.8 6.5
Change-Id: I5fc2d57e740ea0a59700ebe319213fe716f8490e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 66fae045cd289e2f1525c7c4e4ce7a3069ec97ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-10 18:22:46 +00:00
Thiago Macieira
0c3fa7cd30 QXcbWindow: fix build: getpid() is <unistd.h>
Change-Id: I3494ac2ce660faa49b72fffdc3b9fbb13df0372d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit ecfa7406f1de34bacca57be2068423206f9c3707)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-10 18:21:45 +00:00
Tor Arne Vestbø
227dc87ab1 Account for Qt::AA_MacDontSwapCtrlAndMeta when mapping Latin ⌘-shortcuts
To follow the system we map key events that include ⌘ as if they had
been made using a Latin/Roman keyboard layout. However when looking
for the ⌘-keymap, we were not taking Qt::AA_MacDontSwapCtrlAndMeta
into account, and since the keymap differs whether the attribute is
set or not we ended up pulling the Meta-keymap instead.

Fixes: QTBUG-133963
Pick-to: 6.8
Change-Id: I32dd06025e1e1d93f3792952e6ad842efc6245a6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 2e5a881d347b2b20cfe19f0a9d9cb89f2c441408)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-09 23:49:44 +00:00
Tor Arne Vestbø
8dac03db35 iOS: Replace variable length array in event dispatcher with QVarLengthArray
This does mean that if a custom stack size has been requested which
is larger than the default size, we'll end up with a custom stack
on the heap instead of on the existing stack.

I don't remember exactly why we opted for our custom stack to live
on the stack in the fist place. The commit message for the change
that introduced it (59601e06d96edb5661a3dd91341d74e16dc6b229) does
mention garbage collection as once use-case, but iOS hasn't used
GC itself, and a GC's mark-and-sweep would have to include the heap
in any case.

However, for compatibility we keep the custom stack on the stack
if we can, as we pass the default stack size to QVarLengthArray,
which covers 99,9999% of apps use anyways (GitHub shows no hits
for the QtRunLoopIntegrationStackSize override that would trigger
a heap-allocated custom stack).

In testing on both simulator and device a custom stack size that
results in a heap-allocated custom stack does work, so we should
be good in either case.

Fixes: QTBUG-135609
Pick-to: 6.8
Change-Id: I86251da005ebca8a1cad5cabd2835e83486b3f8e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit be93c06758260b1e0738ab17a2ecc4ee8f90e87e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-09 23:49:39 +00:00
Tor Arne Vestbø
d18756589a iOS: Replace variable length array in QIOScreen with QVarLengthArray
Fixes: QTBUG-135609
Pick-to: 6.8
Change-Id: I3db252a4893ef298f6878fe2f3fac7c93fcf6c3a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5dd41d5e3035bc2335ab12015a0d633d4b249874)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-09 23:49:32 +00:00
Christian Ehrlicher
c46fdbad79 Windows11Style: Fix size hint for RadioButton/Checkbox
When the radiobutton/checkbox has no text, the size is to small as the
check rect is enlarged by 2px due to the rounded borders. This is only
visible when they have no text as otherwise there is enough space
between the checkbox and the text.
Therefore add 2px in width when no text is available.

Pick-to: 6.8
Fixes: QTBUG-135628
Task-number: QTBUG-133117
Change-Id: I8e3342fdc980485ab1494ef7f6df044f42883619
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit 696f9adaa4b7a293ff1bfe3fa47dca62b4fdc710)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-09 19:58:17 +00:00
Safiyyah Moosa
f7ad71f39c Doc: Add Alt-text to the Qt SQL examples
QDoc generates warnings for images that do not have alt-text associated
with them. Alt-text is used to add context to images for users who use
screen-readers.

This patch applies alt-text to images in the Qt SQL module that do not
have any alt-text associated with them.

Fixes: QTBUG-135114
Pick-to: 6.8
Change-Id: Iead375852d30219db7dfed12bb1f383eb55713e6
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 7b66c906bf7a8c32650157fdd13221822ec1558e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-09 15:43:59 +00:00
Nodir Temirkhodjaev
541d53f28d QMainWindowLayout: Fix build with -no-feature-dockwidget
Make deletion of unused tab bars conditional to dockwidget and tabwidget
features.

Task-number: QTBUG-135468
Pick-to: 6.8 6.5
Change-Id: I0ecb55ab20737f401796cdd4ebbc6040e54b5afe
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b37f84ba414f36d941d42f7addb2f8ca1516d3d6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-08 06:53:25 +00:00
Eike Ziller
08a65966af CMake: Add .js files to Source Files source group
In addition to .qml files

Change-Id: I8df7fd9bc997b888213b14c9de8b8d29ea536c1e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 9302945ce35c836f97f50ac78bfb74b45824ca59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-08 05:39:28 +00:00
Eike Ziller
1432788a12 CMake: Do not limit source_group creation to Xcode and VS
source_group is used by various IDEs, including Qt Creator,
so it makes sense to do that for other generators too.

Amends 06ea3e3994b38e5fe9ac4f33044b0efa1f1be294

Change-Id: I32334d658ea5a74a9e5f2a7fab2c1f531c099901
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f302a312dcf1005e147193e12fbfc4677aa7af30)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-08 05:39:21 +00:00
Christian Ehrlicher
969fbfb89b Windows11Style: Disable shadow for QComboBox inside QGraphicsProxyWidget
A QGraphicsEffect is not rendered inside a QGraphicsView so we must not
set it on a QComboBoxPrivateContainer. We have to do some checks for it
when a stylesheet is set as polish() is then called before the proxy
widget is set on the QComboBoxPrivateContainer. But luckily QComboBox
has the proxy widget already set so do the check there.

Pick-to: 6.8
Fixes: QTBUG-135340
Task-number: QTBUG-128916
Task-number: QTBUG-128329
Change-Id: I2426701f3aa44a2eb14b66846628dbb9cd16dc9f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 847c0bf07695942271f9a0cf2b3eb63fa19c7d72)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-08 05:38:08 +00:00
Joerg Bornemann
40fa39ba83 Doc: Fix the example for qt_generate_deploy_script
The EXECUTABLE argument must point to the full path of the created
executable, not just the file name. Otherwise,
qt_deploy_runtime_dependencies won't file the file.

Pick-to: 6.8
Change-Id: I18b6214b9f46c0ad4b99ca57468fe272efb9d718
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit e07b4d4394be2885cb35ed2c08a3eaedb6fd26e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-07 17:05:51 +00:00
Alexandru Croitor
84841f3bb0 CMake: Fix DESTDIR handling for plugin rpath adjustment on Linux
_qt_internal_set_rpath was using CMAKE_INSTALL_PREFIX instead of
QT_DEPLOY_PREFIX for the destination path, which ends up trying to
adjust the rpath of plugins in the regular install destination, rather
than in DESTDIR.

Change the code to use QT_DEPLOY_PREFIX where appropriate.

Amends 5430fb22439db9fc1ad1df4cbf0319b63346b0a5

Pick-to: 6.8
Fixes: QTBUG-135620
Task-number: QTBUG-109553
Change-Id: Iea1c0b69ba93fa5e81c463df57f8c2e19703a66a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ae4f9fe0cf6acded39020b8fbefd35df20ffff7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-07 17:05:45 +00:00
Albert Astals Cid
1f354786f1 Improve macos tabs accessbility support
Map PageTabList controls (i.e. QTabBar) to the TabGroup role, and
report the list of PageTabs as the tabs. Add a predicate-argument
to the unignoredChildren() function so that we can re-use that
logic to return the list of tabs, while also ignoring otherwise
accessible children, such as the scroll buttons.

Change-Id: I57472e9213dd178e018449e542de276051097073
Fixes: QTBUG-134807
Pick-to: 6.8
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0475bc57d699ac3bc82e2970b97ff267922bd15e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-06 22:29:00 +00:00
Christian Ehrlicher
7d04246b95 Windows11Style: replace QObject::inherits() with qobject_cast<>
Use qobject_cast<QComboBoxPrivateContainer *> instead
QObject::inherits() as this should be slightly faster and we have access
to the type so no need to use error-prone string comparison.

Pick-to: 6.8
Task-number: QTBUG-135340
Change-Id: I90ebb2323f21c2f5f9dd65bd7b1beeb32f1a91cc
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit 7fdf7ad7e578675b32deb399b51ec6392c66cb2d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-06 22:29:00 +00:00
Volker Hilsheimer
56218773ce macOS a11y: clean up ignore-logic
Replace an if-chain with a switch statement, and remove the duplicate
test for QAccessible::Client - we already ignore all such elements,
no matter their special role name.

Compare an object's className as a QByteArrayView, no need to expand to
a UTF16 QString just to compare with a Latin1 literal.

Pick-to: 6.8
Change-Id: I79f52277e4177f2a688216b7f5ef7469cfe0534c
Reviewed-by: Albert Astals Cid <aacid@kde.org>
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit e88940941f8ffe8236d281d5e0e46205f5c405ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-06 22:29:00 +00:00
Thiago Macieira
65768082fe QUrl::adjusted: remove unnecessary temporary variable
We don't need to QUrlPrivate::appendPath() to a temporary variable under
QUrl::FullyEncoded mode and then setPath(). We can simply ask
appendPath() to write to the destination variable once and for all, so
long as we take care to ask it to use the encoding form that setPath()
uses (QUrl::PrettyDecoded, which is 0x0). That avoids the side trip
through FullyEncoded mode.

Pick-to: 6.8
Change-Id: I7908b9cf75742db07145fffd9499ce3b79492fdb
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 7ed94ef2b510a51d81dbe8aa4700dc8a283b21aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-06 19:49:26 +00:00
Thiago Macieira
01ff6e19f7 QUrl: expand the square brackets encoding to decoded setPath() calls
Amends (reverts) commit 5e936b60fc921e21b8153a83113886a1de333b57, which
forced the encoding of the square brackets ("[]") into their percent-
encoded forms only in QUrl::fromLocalFile(). This commit expands the
functionality to all uses of decoded paths by applying the change
directly to recodeFromUser().

[ChangeLog][QtCore][QUrl] Square brackets ("[]") are now transformed to
their percent-encoded forms ("%5B" and "%5D") when present as inputs to
setPath(), setQuery(), and setFragment() if the parsing mode is
QUrl::DecodedMode (the default).

Pick-to: 6.8
Fixes: QTBUG-135433
Task-number: QTBUG-134073
See: https://bugs.kde.org/show_bug.cgi?id=502280
Change-Id: Id2b41559af08b5f228e4fffdb9c6f23120f856b5
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit f3da9d3c858e8dc28a5dc91047b592ed5becbd62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-06 19:49:25 +00:00
Thiago Macieira
bbe0b18b38 Add support for C23 standard attributes using __has_c_attribute()
The __has_cpp_attribute() refers to the attributes supported by the C++
language. GCC returns its knowledge of the C++ attribute in C, even when
the C code doesn't support it.

N2335[1] added the C++ attribute syntax to the C language and N2553[2] added
the __has_c_attribute() query syntax.

Known attributes:
From https://en.cppreference.com/w/c/language/attributes#Standard_attributes:
* [[deprecated]] (from N2334)
* [[fallthrough]] (from N2408)
* [[nodiscard]] (from N2267, with message in N2448)
* [[maybe_unused]] (from N2662)
* [[noreturn]] (from N2764, which also deprecates _Noreturn)

Drive-by remove C++11 & 14 support from [[nodiscard]]

[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2335.pdf
[2] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2553.pdf

Change-Id: Ifd32b2557683218e0d26fffd5b58dedf7911f77a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 4cd66686e4fcf31ca1c8038c11125f90dc0b4782)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-06 00:46:16 +00:00
Alexey Edelev
61369b37e1 Dealias the target implicitly in _qt_internal_add_transitive_property
Ensure the target is not an ALIAS target when adding the
transitive properties.

Pick-to: 6.8
Change-Id: Ic9cb4f1a6e110596e430176cfa9b7f742d2c3446
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d9ce5184c28b7d00330939f9907be5d0a069e68d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-05 18:09:09 +00:00
Laszlo Agocs
93933c5761 rhi: d3d11: Avoid 1 sec timeout when skipping present
endFrame(SkipPresent) followed by beginFrame() would sometimes end
up waiting up to a second. We should not wait at all in this case.

D3D12 patch will follow separately.

Pick-to: 6.8
Change-Id: I3a5605c3fb672f9d68f2afb69645c5c47a5214b3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit f2437c9d8ca0d4b4af7e917ff18cd0bc6ca83bcc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-05 18:08:56 +00:00
Laszlo Agocs
8121b39921 rhi: d3d11: Add activeAdapter null check
...to match 6.8 that has this added as part of a backport.

The D3D12 backend has this already. Still, move the
resetting of the variable to the outer scope in that one
too, to cover both code paths.

Change-Id: Ie4ba22ff9f2a2f6882dd2d5e3063c4e6701fa95c
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 35dd681f2ba00e7196e59309d76f920ad8807205)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-05 18:08:30 +00:00
Axel Spoerl
e6a294a69b Rename QDockWidgetGroupWindow::reparent() to reparentToMainWindow()
Naming the private API "reparent()" was unfortunate. It is ambigous, as
it suggests that the QDockWidget argument may be parented to the group
window. In fact the opposite is the case: It is removed from the group
window and re-parented to the QMainWindow.

Rename the API into reparentToMainWindow(), which is what it does.

Amends e6d85cf28bc4f750b69c33b72c006b067ae1190f.

Task-number: QTBUG-135442
Pick-to: 6.8 6.5
Change-Id: I6f9f37c190f3550348b1e4e14a8612d8880170dd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a0e0425a107aebf8727673505ea2376400b54b07)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-05 10:29:08 +00:00
Sebastian Beckmann
c0cee227de QComboBox: Ignore wheel event when not reacting to it
With the SH_ComboBox_AllowWheelScrolling style hint introduced in [1],
it's possible for combo boxes to not react to wheel scrolling. However,
since the event isn't explicitly ignored, it gets "eaten" by the combo
box instead of propagating up. This leads to upper level scroll areas
not receiving the event (and thus not scrolling).
By ignoring the event, the scroll area now scrolls if the hint is set
to false instead of nothing happening. This feels more intuitive and
mimics system behavior on both macOS (where the hint is set to false by
default) and Windows 11.

[1]: 5e9e4ccdc363297f70d4ebfbbb3e279670eca553

Pick-to: 6.8
Change-Id: I2207af8aad81fb76f3b1bbe074c3c4fbf22e3eca
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 9c966d837fe33b1e32f5e95f29a380dd3063055b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-05 09:55:29 +00:00
Alexandru Croitor
fe1863228c CMake: Fix CMP0177 warnings by adjusting qt_join_path
INSTALL_DATADIR and INSTALL_ARCHDATADIR have the value "." by default.

CMP0177 in CMake 3.31 now warns when paths that have "." as a
component are passed to install().

To avoid the warning, change the implementation of qt_path_join, to
filter out "." components.

That way all install() calls that build up their paths via
qt_path_join() will avoid the warning.

Pick-to: 6.8
Change-Id: Ib82aa9fe6b5d32e374e8b1acf05402312b6dbe1a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit a20f28121264bfe18af13bfe14be7fd29d33a2fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-04 09:07:29 +00:00
Ivan Solovev
0d2fd73c29 QXmlStreamReader: check appending data with unexpected encoding
If we add the first part of the XML document using a QBA overload of
the constructor or addData() method, the encoding of the document will
be extracted from the "encoding" attribute of the XML prolog.

This way, if the encoding is different from UTF-8, appending the data
with the QASV overload of addData() will always result in reading the
data incorrectly, because the implementation converts the input data
to UTF-8.

This test explicitly highlights this behavior.
In some cases the current behavior is probably fine. However, cases
like appending Latin1 to Latin1-encoded document or appending UTF-16
to UTF-16-encoded document should just work instead of doing the
unwanted conversion to UTF-8 and failing.

Task-number: QTBUG-124636
Task-number: QTBUG-135129
Pick-to: 6.8 6.5
Change-Id: Idf0571083e56032145478631538f09d251cb1022
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 046b8523f20bdc86373eff7dfc2a1c0f7bb297d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-04 08:51:48 +00:00
Ivan Solovev
a0ed54cb0b QXmlStreamReader: fix parsing of non-wellformed inputs
The tst_QXmlStream::runTestSuite() had two issues which resulted
in non-wellformed files not being checked in the incremental
parsing mode.

The first issue is that the TestSuiteHandler::endElement()
function calls isWellformed() twice with two different modes,
passing a pointer to a previously opened QFile to both calls.
As a result, the first call uses ParseSinglePass mode, which reads
the entire file at once. After that, the second call with
ParseIncrementally mode already uses a file which has
atEnd() == true. So, the call to readAll() simply returns an empty
QByteArray. So, the ParseIncrementally test was effectively a no-op.

This commit fixes it by explicitly calling seek(0) at the beginning
of the isWellformed() function and also changing the type of the
input parameter to be a QFile pointer instead of QIODevice pointer,
to make sure that seek(0) actually makes sense.

After that issue was solved, I noticed that in the incremental mode
the algorithm that was feeding the data to QXmlStreamReader
byte-by-byte was always skipping the first character (and also
reading past the end of the buffer). As a result, all the XML files
parsed in this mode were malformed.

This was fixed by moving the increment of the index after the
addData() call.

Finally, after these two things were fixed, six test cases from the
XML test suite started to fail, because the non-wellformed files
were incorrectly reported as well-formed.

Fix it by using StreamEOF instead of 0 in
QXmlStreamReaderPrivate::fastScanContentCharList().

The test case fixes amend the beginning of the public history.

The parser fix amends 817800ad39df10ca78e2c965a61d4d2025df622b
which introduced StreamEOF instead of 0.

Fixes: QTBUG-135471
Pick-to: 6.8 6.5 5.15
Change-Id: I885166252d40819a4460ec246db10bf448e4a8e2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 633278fe1c9991237e02233b32f825b2506187c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-04 08:51:45 +00:00
Edward Welbourne
ecae579d03 Add a reproducer tests for an assertion failure
The fix [*] means this already passes on dev; and the belated pick to
6.8 should get there before this does (it landed before 6.9, so did
not need picked there).

[*] commit 5d656e5085303bd427a4e8564818c65ec1d0ac26

On 6.8, without the fix, the ISODate test passes (that's handled by a
sui generis parser) but all three of the fromStringFormat tests of
QDate, and the QDatetime exact reproducer from the bug report, provoke
assertion failures.

Task-number: QTBUG-135382
Pick-to: 6.8
Change-Id: I303df9215873e37a9f2cbf5a78aab8ffa48f67aa
Reviewed-by: Albert Astals Cid <aacid@kde.org>
(cherry picked from commit 79a1986e86243e94e8558ab5805a75b424916c89)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 15:25:26 +00:00
Axel Spoerl
ab6f1ad778 QMainWindowLayout: Fix leaking of unused tab bars
QMainWindowLayout::unusedTabBars contains unparented tab bars.
They are leaked when QMainWindow and its layout get destroyed.
They still are in QApplication::allWidgets(), which attempts to delete
them eventually. When that happens, they try to remove themselves from
an already deleted QMainWindowLayout::unusedTabBars.

Delete all unused tab bars in the d'tor of QMainWindowLayout.

Task-number: QTBUG-135468
Pick-to: 6.8 6.5
Change-Id: I5ac7748ef738955522567db585e9505e3ba435ad
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 23357e59bb4dc54e76a237b290aa64a620db2ea1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 12:47:02 +00:00
Volker Hilsheimer
19c4db4201 QDockWidget: don't access a QMainWindow that's under destruction
Amends b6b489db6968fbc3b4aab3755d0166ee09712ff0, which introduced UB
(invalid downcast):

By the time the
QMainWindowTabBars are destroyed, and they want to unregister
themselves from the QMainWindow, the ex-QMainWindow has already been
demoted to a QWidget. Says UBSan:

  qmainwindow.cpp:63:47: runtime error: member call on address 0x6040000267d0 which does not point to an object of type 'QMainWindow'
  0x6040000267d0: note: object is of type 'QWidget'
   00 00 00 00  28 c1 e6 f3 c7 7f 00 00  80 24 00 00 60 61 00 00  d8 c2 e6 f3 c7 7f 00 00  00 00 be be
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QWidget'
    #0 0x7fc7f06da8c5 in QMainWindowPrivate::mainWindowLayout(QMainWindow const*) qmainwindow.cpp:63
    #1 0x7fc7f06da8c5 in qt_mainwindow_layout(QMainWindow const*) qmainwindow.cpp:69
    #2 0x7fc7f07bb4ed in QMainWindowTabBar::~QMainWindowTabBar() qmainwindowlayout.cpp:2042
    #3 0x7fc7f07bf4e5 in QMainWindowTabBar::~QMainWindowTabBar() qmainwindowlayout.cpp:2047
    #4 0x7fc7c69f9c2a in QObjectPrivate::deleteChildren() qobject.cpp:2226
    #5 0x7fc7ef0b7f3d in QWidget::~QWidget() qwidget.cpp:1557
    #6 0x7fc7f082c7c7 in QDockWidgetGroupWindow::~QDockWidgetGroupWindow() qmainwindowlayout_p.h:343
    #7 0x7fc7f082c7c7 in QDockWidgetGroupWindow::~QDockWidgetGroupWindow() qmainwindowlayout_p.h:343
    #8 0x7fc7c69f9c2a in QObjectPrivate::deleteChildren() qobject.cpp:2226
    #9 0x7fc7ef0b7f3d in QWidget::~QWidget() qwidget.cpp:1557
    #10 0x7fc7f06ce495 in QMainWindow::~QMainWindow() qmainwindow.cpp:338
    #12 0x556a6180a84c in std::default_delete<QMainWindow>::operator()(QMainWindow*) const unique_ptr.h:85
    #13 0x556a6180a84c in std::unique_ptr<QMainWindow, std::default_delete<QMainWindow> >::~unique_ptr() unique_ptr.h:361
    #14 0x556a6180a84c in tst_QDockWidget::setFloatingReparenting() tst_qdockwidget.cpp:492

Use qobject_cast to verify that the mainWindow is not pointing to a
QMainWindow that is being destroyed (and has passed the ~QMainWindow
destructor). If the main window is destroyed, then removing the tab bar
from the list of unused tab bars is unnecessary.

Pick-to: 6.8 6.5
Change-Id: I25e12d79198137b75cd2576ff1440b6c94277eba
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 1bbbacbecb0bd03a58fea889215850dfffebeb3b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 12:46:56 +00:00
Tor Arne Vestbø
793a8d9d14 Replace variable length array in qt_mac_draw_pattern with QVarLengthArray
Pick-to: 6.8
Change-Id: I1869ba14cdddb23cd903013fb6d160e24ac72967
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 10851432080df38668a07ff22f1da1c3cbfbfe51)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 12:46:54 +00:00
Marc Mutz
435da40cc0 QGraphicsView: remove (last remaining?) user of QEvent::op=
Instead of aggregating a QMutableSinglePointEvent by value, which
depends on the QEvent copy assignment operator, and casting it to a
QMouseEvent that it isn't, introduce QEventStorage which is a bit like
std::optional, but, by each event subclass befriending it, can store
event copies by-value, unlike clone(), which is restricted to the
heap. We could have befriended std::optional<QMouseEvent>, too, but by
adding our own type in _p.h, we can better control which code uses
this dangerous construct.

Added a guard to avoid clobbering lastMouseEvent with a copy of itself
in storeMouseEvent(). Before, we'd self-assign to lastMouseEvent,
which didn't invalidate the reference. Now, a store() is the
equivalent of a dtor + copy constructor, so we need to be a bit more
careful.

Fixes UBSan reports when running tst_qgraphicsview:

  qgraphicsview/qgraphicsview.cpp:612:27: runtime error: downcast of address 0x61a000035e90 which does not point to an object of type 'QMouseEvent'
   0x61a000035e90: note: object is of type 'QMutableSinglePointEvent'
    00 00 00 00  30 47 ef 8b 99 7f 00 00  02 00 00 00 00 00 00 e0  d0 91 00 00 20 60 00 00  00 00 00 00
                 ^~~~~~~~~~~~~~~~~~~~~~~
                 vptr for 'QMutableSinglePointEvent'
       #0 0x7f99a27c7a47 in QGraphicsViewPrivate::replayLastMouseEvent() qgraphicsview.cpp:612

  qgraphicsview.cpp:653:39: runtime error: member call on address 0x61a0000fe290 which does not point to an object of type 'QMouseEvent'
   0x61a0000fe290: note: object is of type 'QMutableSinglePointEvent'
    00 00 00 00  30 47 ef 8b 99 7f 00 00  05 00 00 00 00 00 00 e0  d0 91 00 00 20 60 00 00  00 00 00 00
                 ^~~~~~~~~~~~~~~~~~~~~~~
                 vptr for 'QMutableSinglePointEvent'
       #0 0x7f99a27c3609 in QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent*) qgraphicsview.cpp:653
       #1 0x7f99a27c7832 in QGraphicsViewPrivate::replayLastMouseEvent() qgraphicsview.cpp:612

  qgraphicsview.cpp:654:37: runtime error: member call on address 0x61a0000fe290 which does not point to an object of type 'QMouseEvent'
   0x61a0000fe290: note: object is of type 'QMutableSinglePointEvent'
    00 00 00 00  30 47 ef 8b 99 7f 00 00  05 00 00 00 00 00 00 e0  d0 91 00 00 20 60 00 00  00 00 00 00
                 ^~~~~~~~~~~~~~~~~~~~~~~
                 vptr for 'QMutableSinglePointEvent'
       #0 0x7f99a27c358b in QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent*) qgraphicsview.cpp:654
       #1 0x7f99a27c7832 in QGraphicsViewPrivate::replayLastMouseEvent() qgraphicsview.cpp:612

Task-number: QTBUG-99563
Change-Id: Ib642d416b8aef98c7fd8b1fa164ec2449189992a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit dd264cc9c00e09eb995f1c6f9b1fd651f1d4b2f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 05:35:08 +00:00
Marc Mutz
34e7253d05 tst_QComboBox: fix popupPositionAfterStyleChange() FAIL on Kubuntu 20.04
On my machine, the window manager opened the QComboBox always at y = 0
(top edge of the screen), where the popup, being confined to the
screen geometry, had no chance of "open[ing] up centered on top of the
current index".

Fix by centering the widget on screen.

Amends 8393922e7071221a9c6c0811eb714f20bf4ed02b.

Pick-to: 6.8 6.5
Change-Id: I7b4d066aa1e555f3d5cc1d5e0c88b1d835bf2b26
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e2790a6758be18add2bcab42cc7dfebdd74daae1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 05:34:34 +00:00
Marc Mutz
09d266af99 QAbstractItemView: disconnect from the correct delegate
Purely from a symmetry argument, we should be disconnecting the old
item delegate, not the new one.

I didn't find a case where this actually causes test failures, nor did
I take the time to implement a test where it does.

Amends a126d3627cc347500c1a6bd82027efa6d451ccbd. That patch landed in
Qt 6.7, but that branch is "closed" at this point in time, so not
picking there now.

Pick-to: 6.8
Change-Id: I06b704e699616d61c65ad676ffe45dfbd9f8a870
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e5f11eebc89ec041995cbbbc9b3db9eb3c6968c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 05:34:25 +00:00
Marc Mutz
76918c1f28 tst_QComboBox: ignore two warnings from setCompleter() in getSetCheck()
Tidies up the test output by removing expected warnings from the log
(and alerting us if they're missing).

Amends 64f6169f61ce8c982a1b92b20f930518a5f0d477, which introduced the
warning.

Pick-to: 6.8 6.5 5.15
Change-Id: Idcef99d556b11035307e6e207cf31fc2f13ed291
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit e55479ea4a2dca266b73a2a17ff77ec44e1c2135)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 05:34:16 +00:00
Marc Mutz
2efeaab1c6 QComboBox: fix UB (signed overflow) in Private::recomputeSizeHint()
The minimumContentsLength() is user-settable, and tst_QComboBox
actually sets it to INT_MAX as some point. As such, the implementation
needs to defend itself from UB, either by limiting what values it
accepts as minimumContentsLength() or by making sure it doesn't cause
signed overflow in calculations involving this user-controlled
variable.

The former doesn't really work as long as the test checks that INT_MAX
is accepted as-is, so we need to do the latter.

Do the calculation in qint64, and use the result only when it doesn't
exceeed good old QWIDGETSIZE_MAX.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I8aac7bda593095638c9c09db3b70b4c84e698419
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 00fdf9e432c78e7d7f1a491f7bc1f375fcbde8da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 05:34:05 +00:00
Marc Mutz
f261357c1a tst_QComboBox: fix memleak in task_QTBUG_56693_itemFontFromModel()
QProxyStyle's ctor arguments are not QObject parents, but the proxied
style, which becomes the proxy's QObject ... get this ... _child_.

What a broken concept... It means that this test function took
ownership of QApplication::style(), and the only way it wasn't going
to wreak havoc on the rest of the test functions was to leak it after
use.

To fix, create the style on the stack, so it gets automatically freed
by the compiler on all exists from the function. As a drive-by, use {}
instead of () to call the ctor (not to prevent C++' Most Vexing Parse,
just because it's easier on the eye).

The meat of the change, however, is in making the helper proxy-style
defend against QProxyStyle's grabbing of the baseStyle() as its child,
and managing baseStyle()->d->proxyStyle so we properly dissociate from
qApp->style() after we're done. Needed to use ctor delegation to
extract original parent and proxy model from the incoming style before
QProxyStyle, our first subobject, gets first picking on the style,
destroying the very state we're trying to preserve.

This should be become some QTest::LocalProxyStyle, if we find more
users of this pattern.

Amends 5cff7d2b679d48a247b4630cb9e3d5b04fab0b55.

Pick-to: 6.8 6.5 5.15
Change-Id: I2abf4a0bf54158254fd8d526de55ad486ca4e296
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit d88459139119b898e81c1a104e6fd3e28c8f01cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 05:33:56 +00:00
Marc Mutz
fee3a39fdc tst_QComboBox: fix memleaks in task_QTBUG_52027_mapCompleterIndex()
Both the QCompleter and the QSortFilterProxy objects are not owned by
the QComboBox merely by setting them as completer and model. Having no
other QObject parents, and having being allocated on the heap, they
were leaked.

To fix, give them the combo-box as QObject parent.

Amends 8b6d6d4832ea8ed5f9857d5ddf06408ee9d0b4e0.

Pick-to: 6.8 6.5 5.15
Change-Id: I5c3594272a5283a3fbaeb9885d315047b04f30de
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 27279e01d2794bba8c69db4b987c3351a2daa619)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 05:33:45 +00:00
Marc Mutz
73d2a7d29b tst_QComboBox: fix memleak in task190205_setModelAdjustToContents()
A QComboBox does not own the model set on it, because models can be in
many views at once. So the QStringListModel, allocated on the heap
without a QObject parent was leaked.

Fix by giving the model the combo-box as QObject parent.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: Idd9057c8f796937d9d3c5c4ef99b329124d2192d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit c41592c900257177849758ef31212a83fc813be5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 05:33:32 +00:00
Marc Mutz
c818392a59 tst_QComboBox: fix memleaks in setItemDelegate()/task253944_itemDelegateIsReset()
QItemDelegates are owned by neither the QComboBox directly, nor the
QComboBox::view(), upon a mere setItemDelegate() (the docs of this
function is pretty clear about that). Since the objects didn't have a
QObject parent, either, they were leaked.

To fix, give it the comboBox as a parent.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: Ic8bc2603072070b458bd79a6129af6c76811f8ec
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit fda3526f9c6c34f509ebaba67a27e5c32235d7e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 05:33:22 +00:00
Marc Mutz
5e3db40ba3 tst_QComboBox: fix memleak in getSetCheck()
Contrary to what the code comment suggested, a QComboBox does not own
the object passed in by setItemDelegate(). After a nullptr check, the
function merely forwards to QComboBox::view()->setItemDelegate() and
QAbstractItemView::setItemDelegate() documents very clearly that the
item delegate ownership does not change. Consequently, the test
function leaked the object.

To fix, hold it in a unique_ptr and reset() at the end of the code
block.

I opted to not merely comment in the delete there, because that would
still leak in case one of the QCOMPARE()s in-between failed. While it
is not the purpose of the current work to make tests leak-free even on
failure, it likewise makes little sense to not reap this small benefit
now, albeit at the cost of a bit of git history mess-up, itself
mediated by the fact that we're picking this all the way back, since
this...

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I1e604b795f5a12dc8829bf5913b88bc7c7110352
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 0de7cafabc6d71cf3c129e7a67792d2a3ff1c864)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 05:33:15 +00:00
Marc Mutz
82cf1c0c16 QLineEdit: fix UB (invalid downcast) in Private::removeAction()
QLineEdit remembers whether a QWidget size-widget came from a
QWidgetAction or is just one of its own QLineEditIconButtons. On
removal of the action, if QWidgetAction, it will ask the action to
deal with its widget, calling QWidgetAction::releaseWidget(),
otherwise it just deletes the QLineEditIconButton itself.

This is fine if the action is being removed from the line edit, but
not immediately deleted. But if the action is being deleted while its
widget is still in a QLineEdit, then the QLineEdit is informed of this
only by ~QAction(), at which point the QWidgetAction has ceased to
exist and the cast, in QLineEditPrivate::removeAction(), to
QWidgetAction is UB.

Says UBSan:

  qlineedit_p.cpp:656:10: runtime error: downcast of address 0x6020000c3950 which does not point to an object of type 'QWidgetAction'
   0x6020000c3950: note: object is of type 'QAction'
    00 00 00 00  70 57 49 81 3d 7f 00 00  80 bc 0c 00 50 61 00 00  03 02 00 00 10 00 00 00  a6 01 00 71
                 ^~~~~~~~~~~~~~~~~~~~~~~
                 vptr for 'QAction'
    #0 0x7f3d93910686 in QLineEditPrivate::removeAction(QAction*) qlineedit_p.cpp:656
    #1 0x7f3d938b44bc in QLineEdit::event(QEvent*) qlineedit.cpp:1469
    #2 0x7f3d91c50211 in QApplicationPrivate::notify_helper(QObject*, QEvent*) qapplication.cpp:3309
    #3 0x7f3d91cd160a in QApplication::notify(QObject*, QEvent*) qapplication.cpp:3259
    #4 0x7f3d697f6ada in QCoreApplication::notifyInternal2(QObject*, QEvent*) qcoreapplication.cpp:1111
    #5 0x7f3d697f94e3 in QCoreApplication::sendEvent(QObject*, QEvent*) qcoreapplication.cpp:1551
    #6 0x7f3d92345199 in QWidget::removeAction(QAction*) qwidget.cpp:3215
    #7 0x7f3d92e47202 in QtWidgetsActionPrivate::destroy() qaction_widgets.cpp:35
    #8 0x7f3d7f75d5fb in QAction::~QAction() qaction.cpp:451
    #9 0x7f3d92e4cc76 in QWidgetAction::~QWidgetAction() qwidgetaction.cpp:94
    #10 0x7f3d92e4e965 in QWidgetAction::~QWidgetAction() qwidgetaction.cpp:94
    #11 0x558c993da3b0 in tst_QLineEdit::sideWidgets() tst_qlineedit.cpp:4693

To fix, check the dynamic type of the action (using qobject_cast)
before calling QWidgetAction::releaseWidget(). If the cast fails, the
QWidgetAction will have dealt with the widget itself, in its own dtor,
so QLineEdit needn't do anything.

Unfortunately, fixing this centrally by just dragging destroy() down
from ~QAction() to ~QWidgetAction() causes use-after-free in other
test functions of tst_QLineEdit, so I deciced to fix this at the
QLineEdit level only.

Amends 9ce12cc8de940cdd450a28f4bd079acfc3621aa3.

Pick-to: 6.8 6.5 5.15
Change-Id: I3c514dbd1f1a4e1510df3dd9ac67b4bab50e63e9
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit bf62a9762b04689094d1411168ad785b2152cba4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 05:33:06 +00:00
Marc Mutz
799237eaae tst_QTextEdit: fix UB (invalid downcast) in various functions
The test uses the old-but-invalid trick of inheriting from a class X
to gain access to its private or protected parts, but then just
casting an object of dynamic type X to the newly derived class. This
is invalid, because the object is not actually of the newly-derived
type.

Says UBSan (excerpt):

  tst_qtextedit.cpp:2273:5: runtime error: downcast of address 0x60400013c190 which does not point to an object of type 'PublicTextEdit'
  0x60400013c190: note: object is of type 'QTextEdit'
   00 00 00 00  70 bc 57 df b1 7f 00 00  80 66 30 00 90 61 00 00  70 be 57 df b1 7f 00 00  00 00 be be
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QTextEdit'

To fix, make QTextEdit befriend tst_QTextEdit. This is how we do it
elsewhere, too. Then remove the now-unused PublicTextEdit helper.

Amends the start of the public history, and, in one function,
56f0ebfe860e440dcbba8997f44836debc901119 (which is only in Qt 6.4+, so
the cherry-pick to 5.15 will have to drop the part in pasteFromMarkdown().

Pick-to: 6.8 6.5 5.15
Change-Id: I967238d84cae0f6dd8f05d0afb7a318292d96415
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 73fc32af1410b54fc38d7450fad04bb9dabec077)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 05:32:55 +00:00
Marc Mutz
a8f7a100ae tst_QTextEdit: fix memleak in the MyPaintDevice helper
The constructor new'ed up a MyPaintEngine, but there was no destructor
to delete the object again. Neither is ownership of the engine
transferred out of the class, so the object was leaked.

Fix by holding it in a unique_ptr.

Amends 391e3aeef45efc937979b44c32147206e389a60b.

Pick-to: 6.8 6.5 5.15
Change-Id: I0c4da10d5a1659eceac0deba32cac757579e46c5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit de2de7e12cb82064e32197f88c8772ceeeead8ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-03 05:32:46 +00:00
Marc Mutz
414ca19a3f tst_QMetaType: fix UB (nullptr passed to memcmp()) in selfCompare()
QMetaType::Void is not constructible, so create() will return nullptr,
and even though sizeOf() returns 0, calling memcmp() is still UB in
that case.

Fix by guarding the memcmp() from QMetaType::Void.

Amends a59e7361714d50687d82a2d9abae9e95825a23b6.

Pick-to: 6.8 6.5
Change-Id: I55896826e6c0cad5d77e9d0ab861efa9a32f780f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c6c2a0bf3799c9851551bc9e1bd0919dbc64924c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-02 14:48:23 +00:00
Tim Blechmann
21b219f6b7 QLinuxFbIntegration: silence -Wunused-private-field
when configured without `evdev`, clang emits -Wunused-private-field

Pick-to: 6.8
Change-Id: Ia4ff59c002c1a00ef1b445520c28db0d932ee564
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit eb6042f915c27a9988392eb3ea4bf4b5830cc7d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-02 02:21:05 +00:00
Ahmad Samir
5a73a80943 QCryptographicHash: use switch statements with the Algorithm enum
To benefit from -Wswitch compiler flag, requested by Marc in code
review.

Define supportsAlgorithm() twice, with/without USING_OPENSSL, amends
9248d0cfbee0805d670f4b6b07bd3bf4003d6263.

Change-Id: I236093532196689bc0828131360dfeeb24fac23f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 095e6fd0840ad4cd578a022ec361ebf716dfa843)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-02 01:12:09 +00:00
Christian Ehrlicher
1f5545e6f2 QSqlError: rename ctor parameter to 'nativeErrorCode'
Rename the parameter 'code' to 'nativeErrorCode' to match the getter
nativeErrorCode() with the ctor's parameters.

Pick-to: 6.8
Change-Id: Ic95b45c75a57796536d845249c719b5d0d0e7587
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 06ef995a7d348c9769091b07e4511c3c9511a104)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-01 10:17:07 +00:00
Christian Ehrlicher
3b175fbecc SQL/MySQL: use utc datetime in formatValue()
We store timestamps as utc in the database but QSqlDriver::formatValue()
does not format the datetime string as utc. Fix it by converting the
datetime object to utc first.
This amends 2781c3b6248fe4410a7afffd41bad72d8567fc95

Pick-to: 6.8
Fixes: QTBUG-135135
Change-Id: Id26b251e9ed9800d6caff7f43de25fd9e9b08f43
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 219e9fe7a2312538635aaf1c0bc79b98df21723e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-01 10:17:07 +00:00
Tor Arne Vestbø
e98a2b90b9 Use QLastCursorPosition to check for missing cursor position
After c5792dcfd631abb4f9e2b92cd6e88d7e5c373406 the last cursor position
is reflected as a QPoint(std::numeric_limits<int>::max(), ...), and
after 209a2145f94e99f99832c3a08cdf579d8f42ca55 as 1 << 23. Instead of
hard coding the sentinel value, let's use QLastCursorPosition directly.

Pick-to: 6.8 6.5
Change-Id: I24031f3cc800d2f0028eb95f4f8597019cc945c0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 4ae41c225be57492d5bf0e50c58bf18091414c47)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-01 10:17:06 +00:00
Christian Ehrlicher
424de984df Windows11Style: Honor sort indicator size in headerview
The windows11 style, in contrast to the windows vista style, draws the
indicator on the side. Therefore call QWindowsStyle::sizeHint() for
CT_HeaderSection as the base style has the correct implementation.

Pick-to: 6.8
Fixes: QTBUG-135338
Change-Id: If84f72f9f26e87617ecebb1a01f448219d8656ba
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit 75c896f9b104831e40dfa6ca9aedebaa272704b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-01 10:17:06 +00:00
Volker Hilsheimer
caa101c8e0 mac a11y: ignore expected debug output from test
Don't confuse the next person working on this code.

Pick-to: 6.8
Change-Id: I3f9ff59299a4150a96cc11d851d06539a5701a70
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 04fbdd25522f3a7a4b53cb553b1ac70e3f8af5e8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-01 10:17:06 +00:00
Volker Hilsheimer
f234dac1f9 Doc: remove stray 's'
Amends 4409edc14b8a593640c1eb22560a6ba249336163.

Pick-to: 6.8
Change-Id: I1502e0d63a845c5deb476af1c37cb89a6cc43c6c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 984074eea2781e0672010c5e3bff2273422ec190)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-01 10:17:06 +00:00
David Faure
8289d2e889 QTestLib: fix race on QElapsedTimers from WatchDog thread
The WatchDog thread calls printTestRunTime() which reads the two
timers, created and started in the main thread.

Pick-to: 6.8 6.5
Change-Id: I1a337648fddf87190075b7902311544d0ab21ac3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 9e32306daea5578ac5cff1424678da25e2a158af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-01 10:17:06 +00:00
Juha Vuolle
5ef7bf98a1 Yield a configuration error with -no-feature-desktopservices
Yield a configuration error with -no-feature-desktopservices
if the platform is either Apple or Android. This should be clearer
than a compiler error later on, and also occurs earlier in the
process.

Pick-to: 6.8
Fixes: QTBUG-135152
Change-Id: I5dfb9eda12472ed9359767f17423fda63d208d9c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit b145f23770a2f88fc54eaaa33eef579c308f4663)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-01 06:25:21 +00:00
Juha Vuolle
3e67c1241a Put qxmlstreamreader code behind its feature-flag
Missed feature guards from:
- QXmlStreamReaderPrivate class declaration
- QXmlStreamWriter::writeCurrentToken definition [*]

[*] Function takes in a qxmlstreamreader. The declaration
of the function already had the necessary feature guard.

Pick-to: 6.8
Fixes: QTBUG-135230
Change-Id: I78741bc75a6baa8bc86ec5ce7d34a4333d8bdad4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 90c90d50715b7e7501b0a2153122d576656b9e4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-01 06:25:17 +00:00
Juha Vuolle
2cafab999d Fix qprocess.h include guards to match QProcess usage
Fixes: QTBUG-135225
Pick-to: 6.8
Change-Id: I64077ffaccc4f3b864c08df02b489857ac82f34b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 33df53bf320253965fe5a36b04c0c40bf56fa3c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-01 06:25:14 +00:00
Eskil Abrahamsen Blomfeldt
3688d42011 Fix possible crash in FontConfig database
In the FontConfig font database, when we registered alternative
names for the same font, we would just copy the existing user
data (the FontFile struct) from the original font.

However, this did not account for the fact that registerFont()
may in some cases delete fonts from the database if they are
being overwritten, which will also delete the user data.
Therefore the existing FontFile struct is not guaranteed to
be valid once the font database has taken ownership.

This was pre-existing, but it started happening on some
systems after 1d6f71779f05df1af3daacd48f309cd92523152a because
this change will cause some fonts to be seen as identical
which were not before.

Pick-to: 6.8
Fixes: QTBUG-135264
Change-Id: I913bf13dc8069d952a4cdc5fa5544594be1cdba1
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 11620f97f6fb067aa0dce2ee0b1f8ca738c66695)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-01 05:36:35 +00:00
Ahmad Samir
03ac8f8349 QDirIterator: next() should return empty string after reaching the end
Amends c7691842f743f568a073582c8f0cacd6ee188f98, and actually fixes the
other half of QTBUG-130142.

Fix the unittest, it was wrong to begin with, iterating over an empty
string with NoDotAndDotDot, next() will always return an empty string
because `currentFileInfo` has never been initialized.

Pick-to: 6.8
Fixes: QTBUG-135287
Task-number: QTBUG-130142
Change-Id: I9966428c7a143803e6e934b5970ea6b6afc8a08f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4fd7d31e0966d52af4dc40c7e47576d40d8b00ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 19:32:12 +00:00
Thiago Macieira
f315104924 tst_QUuid: make big-endian runs not fail
As far as I can tell, QUuid is working correctly on big endian
platforms. But it stores the integers in such a weird fashion (I wish to
fix that for Qt 7) that this test is non-obvious.

I don't have a big-endian machine to test this with. Anyone interested
is welcome to submit patches.

Fixes: QTBUG-134634
Pick-to: 6.8
Change-Id: I2415be976d1d880d1525fffdf525dcf4f21aaa70
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit aa872148645351a346d34db60cd0b8b1235fed1c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 19:32:11 +00:00
Christian Ehrlicher
deebbbba60 Tests/QSqlDriver: move cleanup tables into own function
Move the cleanup of the temporary tables into an own function and call them during init and cleanup. this makes sure the tables are
 - deleted on clean exit
 - not there during init when cleanup was not run (e.g. due to debugging or a crash).

Pick-to: 6.8
Change-Id: I9013a26b0166d0756a37f0a5d50ed825adf63868
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c833ed5711b40465a77a2d43b79e041092e638cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 19:32:10 +00:00
Ivan Solovev
cfda487726 QXmlStreamReader::addData: lock encoding for QLatin1 case
This fixes a bug when addData() is used to add a full Latin1-encoded
XML document with a proper "encoding" attribute.

Once addData() is called, it immediately converts the data to UTF-8.
However, if the encoding is not locked, the parser will later see
the "encoding" attribute, and try to interpret the data according
to the specified encoding.

The QXSR(QASV) constructor is not affected, because it already locks
the encoding.

Add a unit-test for the issue.

Amends 6bc227a06a0d1392d220aa79ddb1cdc145d4f76e.

[ChangeLog][QtCore][QXmlStreamReader] Fixed a bug when calling
addData() with a Latin1-encoded string containing a full XML document
with an encoding attribute, could result in incorrect parsing of this
document.

Fixes: QTBUG-135033
Pick-to: 6.8 6.5
Change-Id: I9a35d16d743050ea4feccab3d1336747ce0abff4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4b8659ebf689b79ac88f5935ad662a604f0c8bea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 12:12:23 +00:00
Matthias Rauter
5405f6b575 Remove debug flag from benchmark
If debug symbols are needed, then pass the respective flag to the
configure script.

Pick-to: 6.8
Change-Id: I99db92bdd5b7eb896e0d592117a8f218467a4bd7
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 355e0d85eb4a05acd4d5c9d6b2f1cfce7ccdb144)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 12:12:23 +00:00
Frédéric Lefebvre
9b9bd00c2b Add QTestPrivate::ensurePositionTopLeft() for reliable positioning
Implement ensurePositionTopLeft() to set a window's position
to the available top-left corner and verify that it is correctly
positioned.

Incorrect updates to window.position and window.framePosition have
been identified as one of the main sources of flakiness on
Opensuse. This test function addresses this issue and improves test
reliablity.

Task-number: QTQAINFRA-7050
Change-Id: I946f74c7d2c1db9cfe4fec7db272e12876b3ed43
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 7929852c1d39e12b7c586b5c6d257c9df27c01df)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-03-31 05:31:46 +00:00
Marc Mutz
7bf07cc12c tst_QGraphicsWidget: fix memleak in qgraphicswidget()
The QGraphicsWidget `parent` didn't have a parent itself, and the test
function neglected to delete the object manually, leaking it.

To fix, allocate it on the stack.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: Ie9814655c1a52b6dc0d15076eca591fe710d51ae
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 76e76afb83b87664aeeaf61b400e4259ce80f49a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:39:29 +00:00
Marc Mutz
8d99d38785 tst_QGraphicsWidget: remove unused object from qgraphicswidget()
The QGraphicsScene object wasn't used, so can be removed.

Make it so.

Seems to amend the start of the public history (and if there was a
user that has since been removed, we'll get a compile error, so no
need to data-mine the git history further).

Pick-to: 6.8 6.5 5.15
Change-Id: I9eeacde057ee5681ea86c185b66dff618a6f364e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 235fe36de7d8789cf6f5a393df01337a59874901)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:38:48 +00:00
Marc Mutz
c57d487d9b tst_QGraphicsWidget: fix memleak in shortcutsDeletion()
The QGraphicsWidget didn't have a parent, and wasn't deleted by the
test function, so it leaked.

To fix, hold it in unique_ptr. While we're at it, and so that it
doesn't look too out of place, also hold the other parent-less
QGraphicsWidget in a unique_ptr.

The action, OTOH, has a parent, so we don't need to change something
there.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I0597b7ecd293ac54981df9e276c38c385ac811c7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 92c1413c087c5435858f10c0e0c878bc25211b8f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:38:35 +00:00
Marc Mutz
604a76c8b3 tst_QGraphicsWidget: fix memleak in setStyle()
The result of QStyleFactory::create() is owned by the caller, and this
test function neglected to delete it, leaking the object.

To fix, reset() it, once created, into a unique_ptr. This is the
minimally0-invasive fix.

Amends 9bc49b0bca361646aac90cd00706588d3dcd66c9.

Pick-to: 6.8 6.5 5.15
Change-Id: I17fae174b93bd27e2cac6e5e2d2c8a4ac2de703e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f0a9b5b6f11dc5deaabadce0ee672530683cf0a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:37:58 +00:00
Marc Mutz
08986f17f6 tst_QGraphicsWidget: remove unneeded casts in setStyle()
`fstyle` is already a QStyle*, so casting it to QStyle* is unneeded.

Amends 9bc49b0bca361646aac90cd00706588d3dcd66c9.

And 0 is a valid nullptr value, so we don't need to cast there,
either.

Amends the start of the public history.

Drive-by port to nullptr.

Pick-to: 6.8 6.5 5.15
Change-Id: If763b8bf42de9d8bbe988ac76773d02bb7a2b68b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit dbfcd541552b51f831521c77fd44e753a97f04db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:37:28 +00:00
Marc Mutz
4a9782f628 tst_QGraphicsWidget: fix memleak in implicitMouseGrabber()
If a QGraphicsItem is removed from a QGraphicsScene, it also gets
un-parent-ed, and the caller of removeItem() is responsible for
deleting the item henceforth. The test function neglected that,
leaking the object.

To fix, use a scope-guard to defer deletion of the object to the exit
from the test function. This is the minimally-invasive fix.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: Ie4f9be232674bba583f4a59908e42de096930136
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 156bd559231f06136bc368236675688b3c93d02a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:37:20 +00:00
Marc Mutz
6489fc1e52 tst_QGraphicsProxyWidget: fix memleak in forwardTouchEvent()
The result of QTest::createTouchDevice() needs to be deleted by the
caller. The test function didn't, so leaked the object.

Fix by holding it in unique_ptr.

Amends 982b70d37db337b2c57a3cfce0f24c3d00a598d6, even though the code
that this patch replaced looked leaky, too.

Pick-to: 6.8 6.5 5.15
Change-Id: I3c7dfab31dc6ab364195381352d98fbd9c730990
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit bfd852c5025e342af3960516df2f871aa08f5982)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:37:08 +00:00
Marc Mutz
02fb66f8a5 tst_QGraphicsProxyWidget: fix memleak in touchEventPropagation()
The result of QTest::createTouchDevice() needs to be deleted by the
caller. The test function didn't, so leaked the object.

Fix by holding it in unique_ptr.

Amends 1ecf2212fae176b78c9951a37df9e33eb24d4f2d.

Not picking to 5.15, because the cherry-pick of
1ecf2212fae176b78c9951a37df9e33eb24d4f2d to 5.15 was abandoned.

Pick-to: 6.8 6.5
Change-Id: I649357466a51e02d669b114bdfa0746bfa09fe34
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 01ee8fd7b5c93cffaeb8624ed87f5dee36e9e5e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:37:00 +00:00
Marc Mutz
c1adc5c3ed tst_QGraphicsLinearLayout: fix memory leaks in removeAt()/removeItem()
Like in other test functions in this class, the QGraphicsWidgets were
leaked. So the solution is the same: hold them in a QVLA.

Also like in other test functions, the child layouts _are_ owned by
the parent layout, so were not leaked.

There's a twist here, though: we're removing layout items, which may
be widgets _or_ layouts. The old code deleted the removed layout item,
but we can't do that anymore, since it may be one of the widgets that
are owned by the QVLA, and that would cause a double-delete. If we
don't delete the removed item at all anymore, though, we'd leak it
when it was a layout.

So hold the layouts in QVLA, too. _Then_ we don't need to delete the
removed item anymore.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I16c61eb18f2843ceb72a432db1bd9be29e258bfd
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 0665ae81fb33dc6f71f494ad6df92f85aad70ca4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:36:53 +00:00
Marc Mutz
97bacdaab3 tst_QGraphicsLinearLayout: remove remaining memleaks in insertItem()
After the QGraphicsWidgets have been dealt with in a previous commit,
the last leak in the function is that of 'item'.

Fix by holding it in a unique_ptr.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I56986139a2b7865cf367bdd25ccde90d5e1c50ca
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 59b18d07e78be0b57c8bb7c9078e89c686ddf0f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:36:45 +00:00
Marc Mutz
fcf12e50c9 tst_QGraphicsLinearLayout: remove dead code (dump())
This test function hasn't tested anything since the start of the
public history, and leaks memory (the QGraphicsWidgets).

The dump() function, while implemented, doesn't do anything by default
(#ifdef'ed out), so there's no point in adding actual dump() calls
here, either.

Remove this function as dead code.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I6d9d224945fab0f97db0c5ea7d13a7df6c8837b2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 891473270869a29a6efb09962cf4cb19cc4d8d9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:36:37 +00:00
Marc Mutz
ceefdd6044 tst_QGraphicsLinearLayout: fix memleaks in count()/insertIrem()
The tests added parent-less QGraphicsWidgets to a
QGraphicsLinearLayout, which doesn't reparent them (and cannot,
because it doesn't have an item as a parent itself onto which to
reparent them), so the test functions leaked them.

The layout items, OTOH, do get reparented, and are therefore deleted
by the stack-allocated layout as its children.

Since there's thus no object that could naturally be a parent for the
widget items, allocate them on the stack. Since their number is
variable, use QVLA, whose constructor is able to create a ... wait for
it ... VLA of non-copyable-non-movable elements on the stack (we test
for this, also in Qt 5, see e7c792ba7179c4c81fb2e26f66031ec81234b0d7).

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I9b0b65efbccd1fd7e708da4d12f746d942f602fe
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 374b9fd03145acac49a96abe81a253e9b482230a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:36:30 +00:00
Marc Mutz
a961848c16 tst_QGraphicsLinearLayout: fix memleaks in itemAt()
The old code used a data-driven test to check that itemAt(i), 0 ≤ i ≤
2, was returning non-nullptr. It re-created the widgets and the layout
for each data tag anew, leaking the widgets by the way.

Using data-driven test machinery here is overkill. Remove it and
create the widgets in a C array on the stack, so they're not leaked,
and iterate over them using range-for.

Also check not just for nullptr, but also that the pointer matches the
widgets we put into layout, at the position we put them in.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: Ib808aa6756c6550a61a4768edfc5021f2f6ae3b3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 159029b58753ad8a76eef9ea105275001a430ef2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:36:24 +00:00
Marc Mutz
c144326b2d tst_QGraphicsLinearLayout: fix memleaks in defaultSpacing()
QStyle objects aren't owned by widgets (or QGraphicsWidgets) they are
set on, so need to be deleted manually. The test function didn't do
that, so they style objects were leaked.

To fix, hold them in unique_ptrs. QStyle subclasses, even though being
QObjects, don't have the usual QObject *parent=nullptr constructor
parameter, so passing a QObject parent isn't an alternative, really.

Amends 66b7e7497c3b318dddeb91175d8f85f606c99eec.

Pick-to: 6.8 6.5 5.15
Change-Id: I6c43264760f7126610fe51f72e74ec341bd2e3d7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit dd9a94a3b32327b4e0f2aaca55cd987a71dd2878)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:36:17 +00:00
Marc Mutz
d25185fb0d tst_QGraphicsLinearLayout: fix memleaks in itemAt_visualOrder()
The test function leaked all the items it created.

Unless I renamed the object and kept the pointers to them by their old
names, any fix would touch every line, anyway. The former would be
pretty contrived in such a short function, so port the complete test
to stack-allocated objects, which is how this function would have been
written today.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: Ia8a67825d3a80be4574b7779c2105d53003b9e69
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 64060cbeae86b2bfeccc6fc18df56cd1e829b0e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:36:10 +00:00
Marc Mutz
25b71e1fee tst_QGraphicsLinearLayout: fix memleak in testStretch()
QGraphicsView, being a QWidget, needs to have a parent or be manually
deleted. The test function did neither, so leaked the view.

Fix by allocating it on the stack.

Amends 913ff732004c2c61c39bcdd82ff05ea1827f328b.

Pick-to: 6.8 6.5 5.15
Change-Id: If012d4b833849285b62e2a4b4089457c2aef1d88
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 9bab38b1330a4106e920b66538e4e14b795d33e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:36:02 +00:00
Marc Mutz
30fe30550f tst_QGraphicsLayout: fix memleaks in alternativeLayoutItems()
I honestly didn't bother to figure out the ownership relationships
between these items; the QGraphicsView docs don't help much:

> The layout takes ownership of the items. In some cases when the
> layout item also inherits from QGraphicsItem (such as
> QGraphicsWidget) there will be a ambiguity in ownership because the
> layout item belongs to two ownership hierarchies

but asan said that the AnimatedLayoutItem objects were leaked, so hold
them in unique_ptrs now.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: Icd0eabc4129b57251bbec7f8e3752f99ee584cf3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f3a02fe39d8d0bfea8fa0f087bb95c6e65d77b45)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:35:54 +00:00
Marc Mutz
b15d1ee499 tst_QSplitter: don't leak the QSplitter from initTestCase()
Several test functions use a centrally-allocated QSplitter for their
tests. This object was allocated in initTestCase(), but
cleanTestCase(), while present, was empty, so nothing deleted the
object again.

Fix by deleting the object in cleanupTestCase(). Initialize the member
variable to nullptr so that the delete is well-formed even if
initTestCase() for some reason didn't run (or didn't run to
completion).

Amends the start of the public history, where this function read

    #if defined(QT3_SUPPORT)
        delete qApp->mainWidget();
    #endif

which was already leaking if QT3_SUPPORT wasn't defined.

Pick-to: 6.8 6.5 5.15
Change-Id: I43e5d8921a9c097f252e11709f25bc622fc8fe15
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit fbaa37633580dcf6b8ec3cd4a0da8d85902de2ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:35:47 +00:00
Marc Mutz
b9fd0b1272 tst_QSplitter: fix memleak in replaceWidget()
Depending on whether QSplitter::replaceWidget() succeeds or not, we
need to delete either the return value (an unparented QWidget) or the
argument (another QWidget without parent). The test function only
deleted the return value.

Use a unique_ptr for delayed automatic deletion at the end of the test
function, which is the minimally-invasive fix. Use it for both
candidates, which ensures that either one of them is reliably deleted,
even if a QCOMPARE() fails in-between.

One check before we reset(newWidget) is special: if (!res) fails, then
the reaper contained something we also need to delete, and the reset()
will do that, but code checkers (e.g. Coverity) are known to complain
about using a pointer value after a delete, so split the check into
the check and the QVERIFY().

Amends 2c634a132696376a0a0d7641bf05ae875c50190e.

Pick-to: 6.8 6.5 5.15
Change-Id: I8571477d9e53b85b2db041d7c9bdf2bd7aa69906
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 4513d48490f39c805644ea01a5a8e9a16d51764b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-31 04:35:38 +00:00
Magdalena Stojek
64fd9edb2c Clarify QDomProcessingInstruction docs regarding XML declaration
The documentation now explicitly explains that the XML declaration is
not a processing instruction according to the XML 1.0 Specification and
the W3C DOM Level 1/2 Core specifications. It advises against using
createProcessingInstruction() to insert an XML declaration and
recommends QXmlStreamWriter.
This clarification aims to reduce confusion caused by the similar syntax
of processing instructions and the XML declaration.

Fixes: QTBUG-21166
Pick-to: 6.8 6.5
Change-Id: I630e0e73bc8e4b6f145cb1e771a0a6fec54543cf
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d2258328e39ab8695e8034fe85cec7a18884f6d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-30 16:07:30 +00:00
Thiago Macieira
013793a783 QThread/Doc: improve docs on running, finished, and the OS thread
And take the opportunity to explain that the finished() signal does not
indicate the end of the operating system thread. Indeed, on some OSes,
not even wait() can be sure of that: for Unix systems, see the docs at
the top of qthread_unix.cpp about timed pthread_joins.

Pick-to: 6.8
Fixes: QTBUG-135163
Change-Id: Ie00a742f0707f57c767bfffd44bdaec40df05e4a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit de90f2e064ffef2ed751b7805d81a93668dc67a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-30 13:01:41 +00:00
Thiago Macieira
f2b58861d2 QRhiD3D11: fix qHash() to use qHashMulti()
The old code used XOR to combine hash values, but XOR is a bad combiner,
since it's mixing the bits insufficiently (XORing the same value again
will e.g. undo the original change).

This is a private class, so there are no users outside of Qt that would
have inlined this qHash() function; therefore, we are free to change the
algorithm.

Change-Id: I7970e52ef4bd3b6a2248fffda0d4d75eb4afdf5a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7bf9beb300db40835464c5b82da83cd8d49573c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-30 13:01:39 +00:00
Thiago Macieira
db33112d4d forkfd: fix build with FreeBSD 14.2: convertForkfdWaitFlagsToWaitFlags()
The FreeBSD-specific pdfork() code in forkfd_freebsd.c code was failing
to build because convertForkfdWaitFlagsToWaitFlags() wasn't
defined. That function is behind a check for #ifdef HAVE_WAITID, which
is only defined if _POSIX_VERSION is 2008 or later. That macro has been
stuck at 2001 for the past 23 years. I can't explain how this code
compiled with FreeBSD 14.1 and earlier, because I am sure it was using
pdfork().

So just #define HAVE_WAITID for FreeBSD. It must have been there since
much earlier than 13.0, but that seems like a reasonable starting point
today.

We also need to #include <sys/param.h> to have the __FreeBSD_version__
macro, something that also wasn't needed in earlier versions. It was
probably indirectly #include'd by something.

Pick-to: 6.8
Change-Id: I262d9922128d046221b7fffd0ec481bc0012f55c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 729a6f56d08e3440f18704c1cf0b5672c0b90419)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-30 13:01:38 +00:00
Thiago Macieira
7de18b1467 QFileSystemEngine/Unix: deduplicate the st_mode parsing
Both fillFromStatBuf() and fillFromStatxBuf() had copies of the parsing
of the st_mode / stx_mode field. This deduplicates them and sets up for
when/if other OSes get a statx() system call similar to Linux's.

Change-Id: I7c80d121c21b76d78b81fffd172d205287b595d9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e86b970ea4a299c444a12fb9a087909e4b7374cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-30 13:01:37 +00:00
Shawn Rutledge
9e59a924a0 QTextMarkdownImporter: Fix heap-buffer-overflow
After finding the end marker `---`, the code expected more characters
beyond: typically at least a trailing newline. But QStringView::sliced()
crashes if asked for a substring that starts at or beyond the end.

Now it's restructured into a separate splitFrontMatter() function, and
we're stricter, tolerating only `---\n` or `---\r\n` as marker lines.
So the code is easier to prove correct, and we don't need to check
characters between the end of the marker and the end of the line
(to allow inadvertent whitespace, for example). If the markers are
not valid, the Markdown parser will see them as thematic breaks,
as it would have done if we were not extracting the Front Matter
beforehand.

Amends e10c9b5c0f8f194a79ce12dcf9b6b5cb19976942 and
bffddc6a993c4b6b64922e8d327bdf32e0d4975a

Credit to OSS-Fuzz which found this as issue 42533775.

[ChangeLog][QtGui][Text] Fixed a heap buffer overflow in
QTextMarkdownImporter. The first marker for Front Matter
must begin at the first character of a Markdown document,
and both markers must be exactly ---\n or ---\r\n.

Done-with: Marc Mutz <marc.mutz@qt.io>
Fixes: QTBUG-135284
Pick-to: 6.8
Change-Id: I66412d21ecc0c4eabde443d70865ed2abad86d89
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 25986746947798e1a22d0830d3bcb11a55fcd3ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit eced22d7250fc7ba4dbafa1694bf149c2259d9ea)
2025-03-28 22:49:53 +00:00
Edward Welbourne
b546ab5af4 Purge dangling uses of QDateTime deprecated time-spec changes
QDateTime::{to,set}TimeSpec and QTimeZone::setOffsetFromUtc()
shouldn't be referenced in docs aside from their own; they are
deprecated from 6.9.

Fixes: QTBUG-135238
Pick-to: 6.9.0 6.8
Change-Id: I835cfaa888dd3079f96719cd1c413dc7c2796fdb
Reviewed-by: Magdalena Stojek <magdalena.stojek@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 8c943392ae2ae554e496f11d9a3dd6c2c2e762e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:24 +00:00
Axel Spoerl
75663be3b5 QXdgDesktopPortalTheme: Refactor base theme creation loop
The search for a base theme was handled in 2 separate loops.
Combine those in sync with QGuiApplication.
Make list of theme names const, as it doesn't and mustn't change.

Pick-to: 6.8 6.5
Task-number: QTBUG-134702
Change-Id: If4ae8212bbefa2934639feec983b94e8e2d6b168
Reviewed-by: Jan Grulich <jgrulich@redhat.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 63ba867dddd5bfe3827f48eb24884c534c80541a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:23 +00:00
Axel Spoerl
12ea4c92a3 Refactor and fix platform theme selection
Finding a platform theme for the list of theme names happened in two
separate loops. The first loop checked for a platform theme plugin, the
second for a platform integration plugin. In case a theme name was
passed from the environment (with the -platformtheme command line
argument or by setting QT_QPA_PLATFORMTHEME), it was ignored if it was
a platform integration plugin and a platform theme plugin was found
in the first loop.

Combine both loops, in the assumption that the list of theme names
is always correctly prioritized.

Pick-to: 6.8 6.5
Fixes: QTBUG-134702
Change-Id: I2703236dc0f406aeb48529f8e53de76c394b7172
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 8ede178fd3427233ce368a2f69363a30a9468215)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:23 +00:00
Volker Hilsheimer
ae0bd2c52d macOS a11y: maintain reference count for cached elements
Retain elements when storing them in the cache, so that they only get
destroyed when they are neither stored as rows/columns, and removed
from the cache. If storing an element in the cache replaces a different
element with the same ID, release that before retaining the new one.
Give the insertElement() function a bool return value so that callers
know whether the element has been retained, so that they can correctly
release their own reference.

Release elements when they are removed from the cache so that it's
easier to see that the calls are balanced. For that to work, forward
declare QMacAccessibilityElement as an NSObject type.

A special case are place-holder cell elements. Those are not inserted
into the cache until the interface is requested, so when those get
inserted into the cache, we don't have a local reference to release -
it's the reference held by the rows/columns array.

However, we don't want stale elements in the cache, so when we release
the rows and columns arrays, also remove all cell entries from the
cache. Otherwise we end up with stale elements reporting outdated
values.

As this might invalidate references that our test object holds,
refresh the test object when triggering a model update.

Amends 1f7e926411d1e0d958c37dc597f24101d410c46b.

Pick-to: 6.8
Fixes: QTBUG-134784
Change-Id: Ib3cce35058e4c80e3edc97ae578584610ee93487
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit b1ed5f656f064e553b33752f8e87d2f5b9553e38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:23 +00:00
Karim Pinter
2d6a4293be Remove library requirement from the im configure feature
The feature doesn't require library nor dlopen support, even for
input context plugins (which work fine in static builds).

Task-number: QTBUG-135146
Pick-to: 6.8
Change-Id: Id171fccffa78f2d8233d800a6ea3469e9f440f79
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5901f0ba09e4df91be3767badd8252cbdfed28e8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:22 +00:00
Marc Mutz
573c39ff00 tst_QSplitter: fix memleak in replaceWidgetWhileHidden()
QSplitter::replaceWidget() is decumented to un-parent and return the
original widget (the one that the newWidget) replaces, so the caller
of the function is responsible for deleting it, which the test
function neglected.

Fix by storing the returned object in a unique_ptr for delayed
deletion at the exit of the function. This is the minimally-invasive
change.

Amends fb56a0f2ce34e95d955095c01ecf2943046be85e.

Pick-to: 6.8 6.5
Change-Id: Ia63ebfde59b1c5ef8ddb6c3f3ab10b28d5bf6cff
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f9d9630e9ec4963b779ed98b9fc50ac03c9156d6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:22 +00:00
Eskil Abrahamsen Blomfeldt
af31f1f2c3 Improve underline drawing for fonts in QPainter
In the underline drawing code in QPainter there were
some issues causing

First of all, if an underline was very thick, then we would
still just offset the drawing by 0.5 (as if it were 1 pixel
wide) causing part of the underline to appear on top of the
text. The shift here is intended to move the top edge of the
underline to the top edge of the pixel where we want to
draw it, so we need to offset it by half of the actual line
thickness.

In addition, fractional line widths look bad when drawn with
aliased painting, which is the default. Depending on where
the text would be, the thickness of a line might vary. Even
if it's very close to an integer, e.g. 1.04 as in one case,
then it will still sometimes fill two pixels if it happens to
be placed directly between them. To ensure that we always fill
the same number of pixels, we round the line thickness to
nearest integer when antialiasing is not enabled.

Pick-to: 6.8
Fixes: QTBUG-134626
Change-Id: I95bae3ac16010fc133995e5f9b6c2e5d022e3743
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 2b5533af920726723479557356f56d0778bcabd3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:22 +00:00
David Faure
13aac36f69 Use u' ' instead of QLatin1Char(' ') in qkeysequence.cpp
Easier on the eye.

Amends ada885dfd55d5c386d04039babee43e49ccab5c5.

Pick-to: 6.8
Change-Id: Id218288ccc4556abb7c9a199f27b7dcb6a3ba73e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit e9dbc016e133e881ffb4d9994735c15c96699e0f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:22 +00:00
David Faure
ba9fa54b92 QSFPM: fix mapping corruption in mapFromSource() on hidden row child
source_to_proxy (called by mapFromSource) was unconditionally
creating a mapping for the parent of the given source index,
even if that parent is in fact filtered out in the proxy.
That mapping would then just say "-1" for the (also filtered out)
child row.

Afterwards, inserting a visible child (which makes the parent visible,
in a recursive QSFPM) would see that the mapping for the parent
already exists and fail to update it properly.

Various symptoms could ensue, such as an out-of-bounds access in
gm->proxy_rows.at(source_parent.row()) in a subsequent call to
can_create_mapping (as I had on KMail startup for years, randomly) or
a visible child that fails to appear (as in the unittest).

Fixed by using create_mapping_recursive() which returns 'end' if
the row is filtered out, going up the tree if necessary to
create mapping for parents on demand (so that the call to
filterAcceptsRow is cached).

Fixes: QTBUG-76976
Pick-to: 6.8
Change-Id: I25a3bf6b147092c1231ab6441e636264fd0c4222
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit 90a82ad8e59792fb430a1a11c9a0c2f94878303e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:22 +00:00
Tor Arne Vestbø
a81f33eff3 macOS: Remove unused variable in CHECK_SPAWN macro
Pick-to: 6.8
Change-Id: I821655019ece82767ea09fb838b8ba513ca5530b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5489aac90b2f8eefd7f7ca4e6f4fe75d141f23b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:21 +00:00
Tor Arne Vestbø
4f249a3c89 macOS: Remove unused variables in a11y implementation
Pick-to: 6.8
Change-Id: Ib011f09119e324ce08837448eb82249f0b79a33e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 002badc3abdea577651b58c5d61c35ea7c38240a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:21 +00:00
Tor Arne Vestbø
cd5c10b33b macOS: Remove unused variable in QMacStyle::drawPrimitive
Pick-to: 6.8
Change-Id: I42cdd765a19e26a4e4a1a276d2db552188003736
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c805af528499080f3400ff4cde7b05998cd70dc0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:21 +00:00
Tor Arne Vestbø
0bdf8cd4f8 Cast NativeResourceForIntegrationFunction via QFunctionPointer
To fix warnings with Xcode 16.3:

/Users/torarne/dev/qt/qtbase/src/widgets/widgets/qtabbar.cpp:117:6: warning: cast from 'QPlatformNativeInterface::NativeResourceForIntegrationFunction' (aka 'void *(*)()') to 'SetContentBorderAreaEnabledFunction' (aka 'void (*)(QWindow *, unsigned long long, bool)') converts to incompatible function type [-Wcast-function-type-mismatch]
  117 |     (reinterpret_cast<SetContentBorderAreaEnabledFunction>(function))(q->window()->windowHandle(), identifier, q->isVisible());
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Pick-to: 6.8
Change-Id: Ie7b5ace64c1aad5f970bc1a23e59c5724fcd92b5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit cf8f9580da5414dfc3f79b4c83c6684497a3241c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:20 +00:00
Marc Mutz
00ecdd55c6 QErrorMessage: fix UB (invalid cast) in Private::setVisible()
The function can be called from ~QDialog(), in which case a cast of
q_ptr to QErrorMessage is UB.

Says UBSan:

  errormessage.cpp:33:5: runtime error: downcast of address 0x7fff5089a6e0 which does not point to an object of type 'QErrorMessage'
   0x7fff5089a6e0: note: object is of type 'QDialog'
    00 00 00 00  30 74 4e 6a 12 7f 00 00  80 aa 00 00 90 61 00 00  08 76 4e 6a 12 7f 00 00  00 00 e0 1a
                 ^~~~~~~~~~~~~~~~~~~~~~~
                 vptr for 'QDialog'
       #0 0x7f1267ce7d12 in QErrorMessagePrivate::q_func() qerrormessage.cpp:33
       #1 0x7f1267ce7d12 in QErrorMessagePrivate::setVisible(bool) qerrormessage.cpp:410
       #2 0x7f1267caaa25 in QDialog::setVisible(bool) qdialog.cpp:757
       #3 0x7f12654efb28 in QWidget::hide() qwidget.cpp:8179
       #4 0x7f1267caa239 in QDialog::~QDialog() qdialog.cpp:398
       #5 0x7f1267ce72f8 in QErrorMessage::~QErrorMessage() qerrormessage.cpp:287

Fix by casting at most to QDialog* (QWidget* would actually have
sufficed).

Add a code comment.

Amends e0bb9e81ab1a9d71f2893844ea82430467422e21 (I think; it might
have been present in a different form before that).

Pick-to: 6.8 6.5
Change-Id: I61a8692f073c2d2f379ea02fa580f7fe46691c1c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 0e322aa41984fb8f6259ca8249fdfff6c3ea7e13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:20 +00:00
Marc Mutz
d146cfa268 tst_QPushButton: don't leak m_touchScreen
Same problem as in 49a87936ef50acb1ab7156809bf5f85671d36f24, same fix:
hold the result of createTouchDevice() in an owning pointer.

Amends d15d9d49ac1e5120c052bb6c7e8bac5350eea357.

Pick-to: 6.8 6.5
Change-Id: I348336d82c167d95545c9e3d46e7479606605df9
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 4981333ff3f8a5826a21ebf14c4f1e097a4d03dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:19 +00:00
Marc Mutz
681e3fe5c1 tst_QFrame: fix memleak in testPainting()
Similar to 5be58ac9271555eed3a2884d827f30c164d2277d for tst_QWidget,
this test leaked the result of QStyleFactory::create() and the fix is
the same: cache across the test function calls. This time, it's for
performance; there's like 50 different data tags for this function...

Amends a8723871ee7125b97ce5467b94198e93a528c960.

Pick-to: 6.8 6.5 5.15
Change-Id: I95cc1dc4459489904f3a5e0347570eb07ccdfde8
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 44a2d8cc2066a6230bc26d78070e75e3f19c7832)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:19 +00:00
Marc Mutz
f1bf3cc6ee tst_QDialogButtonBox: fix memleak in hideAndShowButton()
The old code created the top-level widget on the heap, without a
parent, so the test function leaked it.

Fix by creating on the stack instead.

This means we need to move the definition to before that of the child
button box (itself created on the stack), to avoid the double-delete
that would happen if the automatic parent would delete its QObject
child and then the compiler deletes the child again because it, too,
is an automatic variable. If, OTOH, the parent is declared before the
child, the child will have unregistered itself from its parent when it
was deleted.

Amends bbb71e7e80f292c2e69faef81b1624832981147e.

Pick-to: 6.8 6.5
Change-Id: I9489daace3bbbeecfaedcb5780a6b29a82c8d4ff
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 8352112e580bad1e95de39088d673d0d8954119f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:19 +00:00
Marc Mutz
cf1259a40e tst_QButtonGroup: fix memleak in task209485_removeFromGroupInEventHandler()
A QButtonGroup does not own the buttons it contains, so this test
function leaked the button, despite a thing called "ButtonDeleter".

That thing doesn't _actually_ delete the button, it merely removes it
from the group.

To prevent the code from instilling same confusion in the next reader
as it did in this one, inline the whole thing and condense it down to
a single connect() statement, using a lambda.

Sometimes, another level of indirection (or two) does _not_ solve
problems...

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I0002f0dd86d505d1aa089d696776051fddbf4c1e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit bfefcec65045ab52a705d0bf5a4eef845d63dbe8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:18 +00:00
Marc Mutz
4c769f92a8 tst_QButtonGroup: fix memleak in keyNavigationPushButtons()
While a QButtonGroup is-a QObject, unless it has a QObject-parent, it
won't be deleted by, say, the parent of the buttons it contains, so
this test function leaked the QButtonGroup.

Fix by giving it the dialog as parent. This is just a QObject
parent-child relationship; it does not change the behavior of the
button group, nor the dialog, except that the latter now deletes the
former as its QObject child when it itself it deleted.

Amends e7cff5bca7aefaea63e80598babf6bd7917aa1c3.

Pick-to: 6.8 6.5 5.15
Change-Id: Ic633179252c72e7ee47a57be73944a6aa589637b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ccd0ea0b4e402f02dee73c211d62cef70d3e001f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:18 +00:00
Marc Mutz
e014490142 tst_QAbstractScrollArea: fix memleak in task214488_layoutDirection()
QCoreApplication::sendEvent() does not take ownership of the event,
postEvent() does, so this test function leaked the QKeyEvent it
created on the heap.

Fix by creating it on the stack instead. Add a scope to limit the
lifetime of the event object to just the sendEvent() call.

Amends the start of the public history.

This doesn't completely make the test asan-clean, it still suffers
from the QScroller::grabGesture() leak (QTBUG-135055).

Pick-to: 6.8 6.5 5.15
Change-Id: I8c93e03b2ea919ab80a1d508f008853779eb89af
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 0e314d34340b65f88ba5d0e6f04f844813188281)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:18 +00:00
Marc Mutz
ba9d8cc422 tst_QGraphicsItem: properly init QGraphicsSceneDragDropEvent
Nothing was setting its proposedAction() and dropAction(), but they
were read in QGraphicsScenePrivate::cloneDragDropEvent(), leading
UBSan to complain about reading an invalid value for that
enum. Interestingly, Valgrind didn't find this issue, probably because
of the strong security options we're now activating by default for a
Qt build (stack protector, trivial-auto-var init, ...).

Says UBSan (excerpt):

  qgraphicssceneevent.cpp:1591:15: runtime error: load of value 3200171710, which is not a valid value for type 'DropAction'

To fix, explicitly set the two properties on the locally-created
QGraphicsSceneDragDropEvent. I didn't go the way of "fixing" this by
initializing the members in QGraphicsScenePrivate, because the rest of
the test doesn't trigger any other error, so Qt itself is
well-behaved, and proactively initializing stuff prevent tools from
noticing inconsistencies.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: Ibc9663e8afcd1f7ff9d0e3c646f70e0ceded67a9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit c0dbfe6c8776fb2f8ca1d7051a605329a9764b83)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:18 +00:00
Marc Mutz
15b3d364ae QTapGestureRecognizer: fix UB (invalid downcast) in recognize()
The old code cast the event to QTouchEvent* ahead of checking that it
actually is of a type() that suggests is-a QTouchEvent.

I'm not sure this was UB, because we weren't dereferencing the result
until after we checked type(). Then again, who am I to argue with
compiler writers (= same people that write ubsan)?

Says UBSan:

  qstandardgestures.cpp:402:29: runtime error: downcast of address 0x7fffedb894f0 which does not point to an object of type 'QTouchEvent'
   0x7fffedb894f0: note: object is of type 'QEvent'
    ff 7f 00 00  c0 db 01 cf 99 7f 00 00  15 00 00 00 01 00 00 00  01 00 00 00 99 7f 00 00  b6 c4 14 f5
                 ^~~~~~~~~~~~~~~~~~~~~~~
                 vptr for 'QEvent'

Fix my delaying the cast until after we know that event is-a
QTouchEvent. All other recognize() overload already behaved correctly.

As a drive-by, use auto (RHS contains the type) and mark the result
const.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: Ifa9e940232b93b2ecf666c35536519a8385c9800
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 03daf6685eda50d79b9b4598ebf6c301def73daa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:17 +00:00
Marc Mutz
e215b930e2 tst_QTreeView: fix memleak in fetchUntilScreenFull()
The TreeModel class was lacking the destructor, so the m_root TreeItem
was never deleted (it was held in a non-owning pointer and had no
parent).

Instead of adding ~TreeModel(), port to holding m_root in unique_ptr
instead. This creates a bit more churn, but communicates intent
better, and makes sure the item is never without an owner.

Amends e74af68654c0eb127277c73e20bda409b83d157b.

As a drive-by, fix the indent of the else clause of a ternary.

Pick-to: 6.8 6.5 5.15
Change-Id: I2f5c8852b8bee89c63933c118a4599d6a17de8e2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 7cf8b2d0303ea81a8e22fcaee7db7bb7303d0376)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:17 +00:00
Marc Mutz
81451de0e6 QDesktopUnixServices: don't leak the QDBusPendingCallWatcher
When, like in tst_QApplication::qtbug_103611(), a QApplication object
is destroyed without calling exec(), then QDesktopUnixServices leaked
its QDBusPendingCallWatcher, because the connection to the slot that
would deleteLater() the watcher was disconnected, and the watcher had
no QObject parent that would otherwise reap it.

Fix by actually deleting the watcher in ~QDesktopUnixServices(), if
it still exists (which implies disconnecting, of course).

This makes tst_QApplication asan-clean on Linux/X11 (was: "75466 bytes
leaked in 965 allocations").

Amends de609d84b9cee4a481d1718c00b09105d8c2ae69.

Pick-to: 6.8 6.5
Change-Id: I28a08abdb1be65a8746702ad304282de4e1100d7
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 567da5e3e0070b7a0dd9ba1acbe9347c6cc1d0fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:17 +00:00
Marc Mutz
8ebe07a76d QHeaderView: port from qt_saturate to q26::saturate_cast
The commit that introduced the qt_saturate call did use that old
function in order to stay compatible with Qt 6.5, which never received
q26::saturate_cast. This patch ports to the new function in branches
that have it.

Pick-to: 6.8
Change-Id: Iadd9d2c92ea1e37095b71b1647db61dec2b8333a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b5a87a665cbb37a09e9750449f0d2980dd035464)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:17 +00:00
Marc Mutz
c6ae521e5b tst_QMenuBar: avoid UB (invalid downcast) in allowActiveAndDisabled()
When the test functions runs off the end (or returns from a failed
QCOMPARE/QVERIFY), `activeMenu` is destroyed while it's the
QMenuBarPrivate::activeMenu, and the following focusInEvent() on the
QMenuBar causes QMenuBarPrivate::setCurrentAction() to access
`activeMenu` when it has already ceased to be a QMenu.

Says UBSan:

  qpointer.h:75:14: runtime error: downcast of address 0x7fff87934860 which does not point to an object of type 'QMenu'
  0x7fff87934860: note: object is of type 'QWidget'
   00 00 00 00  08 f1 0e be 17 7f 00 00  80 c8 00 00 90 61 00 00  b8 f2 0e be 17 7f 00 00  00 00 62 c6
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QWidget'
    #0 0x7f17baf57be5 in QPointer<QMenu>::data() const qpointer.h:75
    #1 0x7f17baf57be5 in QPointer<QMenu>::operator QMenu*() const qpointer.h:83
    #2 0x7f17baf57be5 in QMenuBarPrivate::setCurrentAction(QAction*, bool, bool) qmenubar.cpp:351
    #3 0x7f17baf5a200 in QMenuBarPrivate::focusFirstAction() qmenubar.cpp:245
    #4 0x7f17baf5b727 in QMenuBarPrivate::focusFirstAction() qmenubar.cpp:1260
    #5 0x7f17baf5b727 in QMenuBar::focusInEvent(QFocusEvent*) qmenubar.cpp:1259
    [...]
    #34 0x7f17b93373d6 in QWidget::~QWidget() qwidget.cpp:1508
    #35 0x7f17badb4658 in QMenu::~QMenu() qmenu.cpp:1789

Since I couldn't fix the problem on short notice, I created
QTBUG-135151 to track it.

For now, simply close the QMenuBar on all exists from the test
function to avoid this code path.

Task-number: QTBUG-135151
Pick-to: 6.8 6.5
Change-Id: Id8c9ee090d8bbc5ec22ce3f2ff7485766640ab43
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 83af06b0e5d1ca3aa348debd39f88dfbdbf117b8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:16 +00:00
Topi Reinio
16755adc05 Doc: Update copyright year in the global configuration
Pick-to: 6.8 6.5
Fixes: QTBUG-134788
Change-Id: I118d15df4e644dbed1a3de5efdb0b5d5a0e11c20
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 7018db691688bf4500e8398e9ad7b5a9a8ff3779)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:16 +00:00
Mårten Nordheim
93047640a2 QTest::ignoreMessage: Clarify what encoding we assume for parameter
So future-me and others don't have to look through the source code to
figure it out.

Pick-to: 6.8 6.5
Change-Id: I1f6e46cec256112226cad4d24ed52e4818635ae8
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d2d74673f3dccc04894f2ea67fc7662cc6ef400b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:16 +00:00
Marc Mutz
fc16260be6 tst_QLayout: fix memleak in removeWidget()
A QLayout that was removeItem()ed from its parent layout no longer is
deleted by it and has to be deleted manually, which the test function
failed to do.

To maintain the rest of the test function as faithfully as possible,
don't delete the layout right after the removeItem(), but delay until
the exit from the test function, using unique_ptr.

Amends 867c0b8d8a53974074b1fff5b132f3ae9f150066.

Pick-to: 6.8 6.5 5.15
Change-Id: Ia915d29bda348849033a6b9eb282dcb26a68c383
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 20d5a3cda94e474245351542eeac526a0f759a02)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:16 +00:00
Marc Mutz
3518bb1d28 tst_QTreeView: fix memleak in expandAfterTake()
QStandardItems that were taken out of their QStandardItemModel need to
be deleted by the caller, which this test function forgot to do.

Store the item in a unique_ptr, so it isn't deleted until after the
next populateModel() call. Deleting immediately may change what the
test function checks for.

Amends 6012285e7dedb4364e2db087b7d5cbfc2973320a.

Pick-to: 6.8 6.5
Change-Id: I45a0a2f598febc75fd9ef683525c973476dcd7e0
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit a8c55cb54767bd3519c91872b0d9992dcb9b13fd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:15 +00:00
Marc Mutz
d05f5a503c QXcbDrag: Fix UB (unaligned load) in handleFinished()
According to the XDND spec¹, the window-ID of an XcbFinished message
is in xclient.l[0]. That's Xlib terms, though. In xcb terms, it's in
xcb_client_message_event_t's data.data32[0]. This is how all QXcbDrag
functions handle it (e.g. move()), except handleFinished(), which
casts the uint32_t array to a (misaligned) ulong one.

¹ https://www.freedesktop.org/wiki/Specifications/XDND/#index29h3
  (the fragment doesn't look like it's stable, it's the section
  titled "XdndFinished (new in version 2)")

Says UBSan:

  qxcbdrag.cpp:1051:12: runtime error: load of misaligned address 0x60400078ba9c for type 'const long unsigned int', which requires 8 byte alignment
  0x60400078ba9c: note: pointer points here
    c0 01 00 00 28 02 e0 08  01 00 00 00 c8 01 00 00  00 00 00 00 00 00 00 00  93 23 00 00 00 00 00 00
                ^
    #0 0x7fa3ea3a957c in QXcbDrag::handleFinished(xcb_client_message_event_t const*) qxcbdrag.cpp:1051
    #1 0x7fa3e9e20dec in QXcbConnection::handleXcbEvent(xcb_generic_event_t*) qxcbconnection.cpp:607
    [...]

I have a hard time seeing how it could have worked in big-endian
systems. In LE ones, it only works because the high bits of l[0],
which come from data32[1], are stripped again when the value is
narrowed for passing to findTransactionByWindow(). But the 'if' before
_could_ mis-detect a zero xcb_window_t for a non-zero one if data32[1]
wasn't empty...

To summarize: this is a mess (that's a technical term).

Fix by removing the pointless cast, and just read data32[0], like
elsewhere in the file.

Amends c3f9de62966d32d8e33d62eb374fe2657a4cfebe(!).

Pick-to: 6.8 6.5 5.15
Fixes: QTBUG-127517
Change-Id: Ie7c3718bada52ff82c16f814eee8ec57248fbfbf
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 6ac40faa80ed2faf92ec95759baf2fde7697c207)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:15 +00:00
Even Oscar Andersen
7d1903a5d9 Add security header for qaccessible.cpp
The text interface, like textAtOffset, parses data coming
in from the user. Therefor tagging as security critical.

Task-number: QTBUG-134483
Pick-to: 6.8
Change-Id: I3c97813d4fba719e7972693510a0b9a78cb1348f
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
(cherry picked from commit 26d950bb7790ab0b4822bfe91d2a6e3daf0cb3d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 16:32:15 +00:00
Konsta Alajärvi
1001ff9b94 Remove Blacklist entry for tst_QApplication::closeAllWindows()
tst_QApplication::closeAllWindows() is blacklisted but does not seem
to fail anymore.

Unblacklisting the function.

Fixes: QTQAINFRA-6894
Pick-to: 6.8
Change-Id: Ia6157cc767a191121c4026f1c17edcad3b526d5c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f386f8326667589d9e446282972561cfae966611)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-28 06:15:14 +00:00
Alexey Edelev
2c2612d935 Teach syncqt to look for module headers in install path
If we build the specific module against installed Qt syncqt cannot
detect the installed module headers, since it only checks the build
paths. This adds the installIncludeDir argument for syncqt so it
now attempts looking for the included header file in Qt install path.

This will raise early warnings in Qt per-module builds too, but not
only when building top-level Qt or for non-prefixed builds.

Pick-to: 6.8 6.5
Change-Id: I5a28ec35a776b5b39f4a8923c9bf91e857f45e4a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5a93c457e5b7bdbd79144270ddceb60a6f36c6de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 23:46:53 +00:00
Christian Ehrlicher
0a8737901e QIconLoaderEngine: use scaledPixmap() to properly pass dpr
QIconLoaderEngine::paint() was still using QIconLoader::pixmap() to
retrieve the pixmap for painting instead QIconLoader::scaledPixmap()
which takes the devicePixelRatio as additional parameter. In the case
of icon themes this could pick up the wrong pixmap (from the wrong
folder).

Pick-to: 6.8
Fixes: QTBUG-135159
Change-Id: I69ceada35f36c64675c4147cf284a180a4c69915
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit c5c6df40bee57cc28427d36b4c7c6860ae14b722)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 21:10:04 +00:00
Alexandru Croitor
ea47e479a2 CMake: Allow echoing RunCMake test command output via an opt-in
This will be used in a new manual test in qt5.git, to show progress of
long-running commands.

Store the diff in a new patches subdir, to make it easier to re-apply
when we update the file from upstream.

As a drive-by, store patches from the previous modifications that were
done before this change.

Pick-to: 6.8
Change-Id: Ib73908e20fac7fe0bd620400d483625238fa37d1
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Cristian Le <cristian.le@qt.io>
(cherry picked from commit d8caf6d89f662d4b3f0c0633fcce46e0f46ec5a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 21:10:04 +00:00
Mårten Nordheim
10d3076a93 Include qtcoreglobal.h from qtcoreglobal_p.h
Otherwise including only the private header leads to QT_CONFIG being
undefined.

Amends 38bb72720aef4caf3de6c1c68ab46435d7c8d65c.

Change-Id: I0960d38c98d64348ebf1cec481417bdb21eed9a6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7293f05380f945757b30dc2eb6d10f3f4a8ec884)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 21:10:04 +00:00
Edward Welbourne
0191826f43 Tolerate spaces at start and end of a POSIX zone descriptor
It's easy to do and makes an unremarkable user error harmless.
In the process, add a comment to make QTBUG-112006 visible in the code.

Pick-to: 6.8 6.5
Fixes: QTBUG-135109
Change-Id: I6b9cb431bf5b005fc0f9cdbb5cf30c90fa1154c4
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
(cherry picked from commit f68240616208f4388cc219d58d618184b5db82de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 16:34:13 +00:00
Edward Welbourne
18a08d81f4 Fix parsing of most significant group of digits
The first-group minimum size limit is only relevant when there's
*only* one separator: a smaller group is allowed when there is a later
separator. QLocaleData::numberToCLocale() was, however, rejecting a
short first group without regard to what came later. Expanded two
grouping tests, that previously checked we *generate* correct strings,
to round-trip the strings and verify we get the right answer back.
Some of those duly failed. Fixed the parsing to check the right
condition on seeing a group separator.

That let valid groups get accepted. In the process, added some
test-cases that we do correctly reject invalid forms. Made sure the
fix also gets those right.

Pick-to: 6.8 6.5
Task-number: QTBUG-134913
Change-Id: Ifa5351adba4eec232917a343d4a73fb4656d1d32
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 754666dbe8c897d16d453f96d6a1374a07462fd8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 16:33:58 +00:00
Edward Welbourne
ae31e6e6ac Catch invalidly-placed exponents on conversion to C locale
Although the number-parsing code to which the C-locale form is later
passed was already rejecting such malformed texts, it's better to
catch it earlier and to make the check overt in that parsing. Added
some tests cases that would fail if this wasn't checked; but they do
pass already in the parent.

Pick-to: 6.8 6.5
Change-Id: I5ef9e483317ce4dc519ddc7c4c016dcad5cb22c4
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
(cherry picked from commit f1d48552e4dfbcdbfd060dd8dd924ae433e7f4c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 16:33:53 +00:00
Edward Welbourne
d94d5bcd61 Replace several *_idx variables with an enum and a bool
Thanks to Mate Barany for pointing out that the *_idx variables are
now all reduced to serving (via comparison with -1) as
booleans. Replace them with a "where in the parse are we ?" enum
variable and a "do we need some digits ?" bool.

Restructure to make that work. This needed to recognize (the letters
that make up) Inf and NaN so as to know when not to object to a lack
of digits. Since NumericTokenizer already has a matcher for those,
export its access to that as a public method and use that to simplify
its own uses of the matcher. Added some test-cases suggested by this,
that actually pass in the parent, as qt_asciiToDouble() could see the
result was malformed in any case, even when they weren't caught by bad
digit-group sizes (as "inf,000", "1,inf", "NaN,000" and "1,NaN" were).

Pick-to: 6.8 6.5
Task-number: QTBUG-134913
Change-Id: Ie1730530a4e34a76ba1836a25212e4ec27dad15f
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit d1879c3a399091693e690f970a113510e705d4d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 16:33:46 +00:00
Edward Welbourne
8f955142ed Straighten out QLocaleData::numberToCLocale()
It was a bit convoluted, making it hard to reason about parts. The end
of the whole number part can happen at the very end, after the loop,
or when we hit the exponent or fractional part. That means the check
of grouping rules at the end of the whole number part had to happen
after the loop as well as within it. To avoid duplication within the
loop, the handlingof exponent and fractional part was done within the
handling of grouping, reprising the exponent and fractional part after
they're handled earlier in the loop.

Package the decision-making for that handling in a lambda (and
document some relevant details there) so that the duplication is
harmless and move into the handling of the exponent and fractional
part separators, where it belongs. This lets the bulk of the loop body
simplify into a straightforward if/else-if cascade, making it easier
to reason about (in preparation for some imminent fixing of quirks and
corner cases).

Since reviewers needed to understand what the GroupSizes members mean,
in order to make sense of this, I've also added some comments to the
struct's declaration to at least let future readers know what's what.

This refactoring should be harmless and change nothing; it is also
needed by an imminent fix, that I shall pick back into LTS branches.

Pick-to: 6.8 6.5
Task-number: QTBUG-134913
Change-Id: Ib352aa9ab8341914e40d9c087b497db15a180ebb
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit cdcaaaeee3e8526faee950036bef7e8efaa60e17)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 16:33:40 +00:00
Marc Mutz
e1c4af8efd tst_QWidget: fix a memleak in destroyedSignal()
The test checks that the destroyed() signal is emitted, even in
exceptional cases. It has three degrees of freedom:
- blockSignals() or not
- QObject* or QWidget* as the connect() sender
- slot in a child of the deleted object or in an unrelated object
  (one of the latter caused a leak of the DestroyTester)

The code was very repetitive and one scenario may have been checked
twice (QObject*, no child, blocked signals), which probably means we
forgot another (didn't check).

Make the test data-driven, and DRY further using templates for the
QObject/QWidget cases.

The leak fix is to use unique_ptr to hold the QWidget, and a scope
guard to delete the DestroyTester. I didn't want to use QPointer (or
qdialog_p's QAutoPointer), because we're checking a mechanism that
strikes very close to QPointer, and we should not depend on knowledge
of the exact QPointer implementation to convince ourselves that we're
not testing the same thing twice here. Besides, by making the delete t
conditional, we can use ASAN to detect if we got the need to delete
wrong.

Amends e72e5aa83a0a287ea7e19158b39917eb3daef1d9.

Pick-to: 6.8 6.5 5.15
Change-Id: I3bac9f81c33a24e1096041dfc3323e079fd46f8a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 780c67ad80035a7347818ff7d762e6d3975ead73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 12:41:42 +00:00
Marc Mutz
9de65d3d68 tst_QWidget: don't leak QStyle objects
The result of QStyleFactory::create() must be deleted by the caller.

Some test functions stored it in a QScopedPointer, while others
didn't, each causing a leak of a QWindowsStyle object.

DRY the test functions (except the one that checks that 'delete
widget.style();' works) by introducing an owning pointer at the test
class level, to be reused by test functions. This is not so much for
caching the object across test functions (though this is a nice
benefit, too), but in order to keep the owning pointer out of the test
functions, and allow most functions to just do

   setStyle(deterministicStyle()).

Found by ASAN.

On my machine, this test is now ASAN-clean, except a) the usual
cp-demangle.c leak and b) destroyedSignal(), which still leaks.

As a drive-by, pass a QStringLiteral instead of QL1SV to
QStyleFactory::create() and port one QVERIFY( != ) to QCOMPARE_NE().

No amends, it'd be too many. Not picking back far, because others
don't care, and I expect lots of conflicts when backporting, due to
many different amended commits.

Change-Id: Ie9e7faf21bc177e08af56c659dc58870ad3cf6ff
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5be58ac9271555eed3a2884d827f30c164d2277d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 12:41:42 +00:00
Marc Mutz
75e042173d QFileSystemModel: remove an unneeded const_cast
QAIM::createIndex() takes a const void* pointer, so we don't need to
const_cast the const away.

Amends the start of the public history.

Picking all the way back, because I'm hunting a memleak here, and
can't say, yet, whether these lines need to be modified or
not. Besides, this change is 100% safe: either it compiles and works
as before or it doesn't compile. There is no silent breakage possible.

Pick-to: 6.8 6.5 5.15
Change-Id: I2f9284540beed9d1ab027ac1e24f1c527537e122
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9f2db4acd7d063b884cf3ad4f085f1644ba925db)
Reviewed-by: Daniel Smith <daniel.smith@qt.io>
2025-03-27 12:41:41 +00:00
Bartlomiej Moskal
141f061130 Android: Do not modify Touch Event position in JAVA code
In QtWindow class, the Touch Event coordinates were increased by Layout
position. That allows to move to global coordinates.
In the same time, in 15674f4ce9ea455b47f68d8871d5676d7a731630 commit, we
started mapping coordinates of Touch Event to Global position. That
cause the issue with incorrectly handled touches for example with
QDialogs.

To avoid this issue, we will stop modify Touch Event position in JAVA
code. We will send only localPosition to not make transformation twice.

With this change, all events received from JAVA have local position of
their window.

Pick-to: 6.8
Fixes: QTBUG-130576
Fixes: QTBUG-127925
Change-Id: I6b58e0369959840f869e31a3d96425c64507b39d
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
(cherry picked from commit 23fd2cfb015226d6894b9cbe5fa50b43f0134e99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 12:41:41 +00:00
Bartlomiej Moskal
1bf44cc71f Android: Fix touchDown event coordinates
In the touchAdd method, the mapped touch point is divided by the
platform integration screen size.
In order not to mix different coordinate systems, we should use
platformWindow to correctly calculate global position of touch event.

Pick-to: 6.8
Task-number: QTBUG-130576
Task-number: QTBUG-127925
Change-Id: Ic7653a60fb3def181f29a3e28b963878dc54a99e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 01d25533b4f3c63c0484930e06664ad61ce24748)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 12:41:41 +00:00
Thiago Macieira
0381e77205 QMessageLogger: reject negative values for QT_FATAL_xxx
Amends ceb859bf036dfdd1c54eec403006eac62a0d09b8

We'd accept negative values and keep counting downwards, reaching 0
again only after a full underflow[*]. Effectively, this meant that a
negative value was the same as zero, so this makes the behavior
explicit. The commit introducing checked_var_value() said in its
changelog:

 For compatibility reasons with previous
 versions, if the variable is set to any non-empty and non-numeric value
 different from 0, Qt will understand as "stop on first warning".

Negative values are not "non-empty and non-numeric", so this commit
chooses to make the current behavior explicit.

[*] atomic under- and overflows are defined behavior, but only if the
atomic operation is the one producing it. The current code is doing the
subtraction by itself in the call to testAndSetRelaxed(), so underflows
are still UB. If/when this is replaced by atomicMutate, that might
change (and note to self when implementing that!).

Pick-to: 6.8
Change-Id: I594ed31f1cc7fc04ea98c6e86bdcaa3a4aa59114
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit c8ecd0eb22d5f2578439b8fed4db8879a91cb026)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 12:41:40 +00:00
Thiago Macieira
137aac07a9 QMessageLogger: Make sure we don't count to 0 QT_FATAL_xxx
Amends commit b933a5668cc5647d26378f8a9a52901d0497585d ("Make sure we
don't count down past 0 QT_FATAL_CRITICALS"), which introduced the CAS.

Apparently it was a design decision then that only one thread would call
qAbort(), while the others would happily continue. For example, for the
common case of QT_FATAL_WARNINGS=1:

    // T1                      T2
    v = n.loadRelaxed()                               // v = 1
    v != 0                                            // true
    n.testAndSet(v, v - 1, v)                         // n = 0
                               v = n.loadRelaxed()    // v = 0
                               v != 0                 // false
                               return v == 1;         // false

This commit changes that design, for two reasons. First, a semantic one:
if one thread has detected a fatal condition, it must be equally fatal
for all threads. Second, we must accept a meaningful time between the
detected condition and the call to qAbort() and thus the time until its
effects take. In the worst case scenario, T1 could get suspended
indefinitely, at which point T2 having concluded that warnings weren't
fatal will happily execute forever. [This could happen *because* of
having called abort(), and though that's a SW bug elsewhere, we should
not let our other warnings and criticals continue.]

The fix is simple: we never decrement from 1. That way, if multiple
threads start their verification at the same time, they will all see the
value 1 and will all abort. The abort() standard library function is
thread-safe, as our replacements for it.

Pick-to: 6.5 6.8
Change-Id: I03fbcbac26bd1f34d631fffd43bb9c27d51783d0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 6e37cd4176368bee838161f5353038027bcdbe50)
Reviewed-by: Daniel Smith <daniel.smith@qt.io>
2025-03-27 12:41:40 +00:00
Marc Mutz
99032b8fa8 tst_QHeaderView: fix UB (invalid downcast) in testStylePosition()
The view that's being created in init() is not a
protected_QHeaderView, but only a "normal" QHeaderView, so casting it
to protected_QHeaderView is not valid.

Says UBSan:

  tst_qheaderview.cpp:3338:37: runtime error: downcast of address 0x604000087050 which does not point to an object of type 'protected_QHeaderView'
  0x604000087050: note: object is of type 'QHeaderView'
   00 00 00 00  d8 d2 e6 0b b2 7f 00 00  80 88 00 00 c0 61 00 00  08 d6 e6 0b b2 7f 00 00  00 00 be be
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QHeaderView'

Fix using the usual trick: forward-declare tst_QHeaderView and make
QHeaderView itself befriend it directly.

Amends bff78163f6dc83d833b2097a51453523cfa7b00b.

tst_QHeaderView is now asan/ubsan-clean, except for some signed
overflows in calculateAndCheck(), filed QTBUG-135201 to track it.

Pick-to: 6.8 6.5 5.15
Change-Id: I718695bef26e72f442bd677c6bad05bab561163f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
(cherry picked from commit 8beaab9483405603ffb17a3472bef8dd088227ff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 12:41:40 +00:00
Marc Mutz
9c9146a5cd QHeaderView: fix UB (signed overflow) in setOffset()
I have no idea why setOffset() would accept all int values, but
tst_QHeaderView::getSetCheck() checks the function with both INT_MIN
and INT_MAX (albeit without having show()n the object it so tortures),
so try to make it work(-ish).

0 - INT_MIN overflows, of course, so use saturation math to calculate
the result. This might not scroll to pixel precision, but it couldn't
have done so before, either (no int value can possibly represent the
mathematical value, otherwise it wouldn't have overflown). But at
least we now don't run into UB anymore.

Said UBSan:

  qheaderview.cpp:418:9: runtime error: signed integer overflow: 0 - -2147483648 cannot be represented in type 'int'
   #0 0x7f183ffa4a5f in QHeaderView::setOffset(int) qheaderview.cpp:418
   #1 0x55f5ca56a5fe in tst_QHeaderView::getSetCheck() tst_qheaderview.cpp:437

While q26::saturate_cast was only picked to 6.8, its predecessor,
qt_saturate(), was picked to 6.2, so use that, for now, and port to
q26::saturate_cast in a follow-up.

As a drive-by, mark ndelta const.

Amends the start of the public history.

Pick-to: 6.8 6.5
Change-Id: I118c917ccd588c0b6d407090609f4d17075bbab6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 03d1e81516be9af37fa08900f9a2d88d34abc4df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 12:41:39 +00:00
Marc Mutz
9747e0a8b1 QAbstractItemView: fix UB (invalid downcast) in Private::shouldAutoScroll()
Says UBSan:

  qabstractitemview.cpp:4442:18: runtime error: downcast of address 0x604000026790 which does not point to an object of type 'QAbstractItemView'
  0x604000026790: note: object is of type 'QWidget'
   00 00 00 00  08 b1 cf 9f 33 7f 00 00  80 24 00 00 60 61 00 00  b8 b2 cf 9f 33 7f 00 00  00 00 be be
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QWidget'

I did not reserch what the problem was that the code comment referred
to, but we now have QWidgetPrivate::get() (incl. in 5.15), so use
that.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: If658d21694f6806eafdf678b8d5ff7ed62e93513
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 3b3b5968d0a51a1aa3a402f8e042f3a5a2c3329e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 12:41:39 +00:00
Marc Mutz
2c9baee470 tst_QAbstractItemView: fix memleaks in testDelegateDestroyEditorChild()
After removing the QTreeWidgetItems from the QTreeWidget, they have no
parent anymore, and so no-one deletes them and they're leaked.

Add a vector<unique_ptr> to hold such items until the end of the
function. This is the minimally-invasive fix. If we were to delete the
items right after removeChild(), we might be changing the test, and if
we deleted them only at the end of the function, we'd still be leaking
them on a failed QCOMPARE().

Amends 1d799e91082092821a04885bd9d069febefc37da.

This doesn't completely fix tst_QAbstractItemView; it still suffers
from the QScroller leak, QTBUG-135055.

Pick-to: 6.8 6.5
Task-number: QTBUG-135055
Change-Id: I2d3c661d5331ae33bb945f850fccdaa934f7a2dd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 9ea9818eeb29e79e7f12505a21669902d443dc1f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 12:41:39 +00:00
Marc Mutz
2ec89d4908 tst_QCalendarWidget: fix memleak in showPrevNext()
QObject parents own their children, but not the other way around. So
the parent-less QWidget *parent created on the heap was leaked.

To fix, create it on the stack instead, but for that to work, it must
be declared _before_ its eventual child, otherwise the parent would
delete the child as a QObject child, followed by the compiler deleting
the child as an automatic variable = double-delete.

Amends ab536c3c71deaaa3b67ca87c47628355d9f348e8.

Pick-to: 6.8 6.5 5.15
Change-Id: Ibccf229fc056665e3b854e1a94e1f4b5bf7a89e1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 3c7719f2c248a2710c75fa47e12759188abf673d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 12:41:39 +00:00
Marc Mutz
4a16b18fb4 tst_QCompleter: fix memleak in hideWidget()
QLineEdit::setCompleter() doesn't reparent the completer under the
line edit, so this test function leaked the object (and with it,
"22260 byte(s) leaked in 214 allocation(s)"; seriously, what does a
QCompleter do with 20+KiB of memory!?).

Fix by giving the completer the line edit as parent.

Amends 24859d7deaf995e992f0d9439a1c476126d5f654.

Pick-to: 6.8
Change-Id: Ic14a32c982dd4c75ae527188e53a7f20af714038
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit bdd2cefcf3236279986191f5d76a0af19d4d3a2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 12:41:38 +00:00
Marc Mutz
b3ad704003 tst_QMenu: fix memleaks in tearOffMenuNotDisplayed()
QActions can be added to many widgets at the same time, so addAction()
doesn't reparent them.

Having no (QObject) parents, the QAction objects in this test were
consequently leaked.

Fix by giving them parents.

Passing `this` would have worked, but has the drawback that if you run
the test twice (by naming it twice on the command line), actions with
identical shortcuts would accumulate and potentially change the
result. Therefore, add an automatic QObject to act as their
parent. This is the minimally-invasive fix.

Amends 198225983df9f402bb368b449f1abeea95ff0dce.

Pick-to: 6.8 6.5
Change-Id: I59881b10076ba790502483242f620aeed3e99575
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit ad0d6be77814dcf484f87a1d89bb30b6652dff92)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 12:41:38 +00:00
Marc Mutz
988ae2e3a2 tst_QMenu: fix memleaks in transientParent()
QActions and QMenus can be added to several widgets, so addAction()
and addMenu() don't transfer ownership of their argument.

Having no (QObject) parents, the QMenu and QAction objects in this
test were consequently leaked.

Fix by giving them parents.

Amends 493a85a9e468874471057910a61e7c54a45eee83.

Pick-to: 6.8 6.5
Change-Id: I2c48a55de26c5ed487d2e42e50e0b2fbb6ddf98c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 850d352111d618539d5659e139cfae9f2124fc3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 12:41:38 +00:00
Liang Qi
cd26d3470a D3D12MemoryAllocator: fix the build with llvm-mingw 18.1.8 WoA
C:/qt/qtbase/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.cpp:144:32: error: unknown warning group '-Wnonnull-compare', ignored [-Werror,-Wunknown-warning-option]
  144 | #pragma GCC diagnostic ignored "-Wnonnull-compare"
      |                                ^
C:/qt/qtbase/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.cpp:9902:9: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to false [-Werror,-Wtautological-undefined-compare]
 9902 |     if (this == NULL)
      |         ^~~~    ~~~~
C:/qt/qtbase/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.cpp:10053:9: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to false [-Werror,-Wtautological-undefined-compare]
 10053 |     if (this == NULL)
       |         ^~~~    ~~~~
C:/qt/qtbase/src/3rdparty/D3D12MemoryAllocator/D3D12MemAlloc.cpp:10118:9: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to false [-Werror,-Wtautological-undefined-compare]
 10118 |     if (this == NULL)
       |         ^~~~    ~~~~
4 errors generated.

This amends 84fb0de413ec574aab778d863c56e0d9a7f7ef6e .

See also
* https://clang.llvm.org/docs/DiagnosticsReference.html
* https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

Pick-to: 6.8
Change-Id: I2c8d27ade8a123bc4ff2fa5082e161c042335c6c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
(cherry picked from commit 34be5083bddffc38b3034ac8a04b5b6b698d5e4e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 12:41:37 +00:00
Rami Potinkara
9b67f62950 Android: Unblacklist tst_QRhi::renderPassDescriptorCompatibility
With current CI Android emulation this test seems to pass.
Does not seem to be flaky either.

Fixes: QTQAINFRA-6336
Pick-to: 6.8
Change-Id: I863b2744a63b5f90fcc42570945f3f761a3da021
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 9d507910db679a150f1f06f93d617346dde08f9d)
2025-03-27 12:41:37 +00:00
Mårten Nordheim
6a684a53b3 QFileSystemEngine/Win: Use GetTempPath2 when available
Because the documentation for GetTempPath nows says apps should call
GetTempPath2.[0]

Starting with Windows 11[1], and recently Windows 10[2],
GetTempPath2 was added. The difference being that elevated
processes are returned a different directory. Usually
'C:\Windows\SystemTemp'.

Currently temporary files of an elevated process may be placed in a
world write-able location. GetTempPath2, by default, but can be
overridden, places it in a directory that's only accessible by SYSTEM
and administrators.

[0] https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppathw#remarks
[1] https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2w
(Minimum supported client - Windows 11 Build 22000)
[2] https://blogs.windows.com/windows-insider/2025/03/13/releasing-windows-10-build-19045-5674-to-the-release-preview-channel/
(This update enables system processes to store temporary files ...)

[ChangeLog][QtCore][Important Behavior Changes] On
Windows, generating temporary directories for processes with elevated
privileges may now return a different path with a stricter
set of permissions. Please consult Microsoft's documentation from when
they made the same change for the .NET framework:
https://support.microsoft.com/en-us/topic/gettemppath-changes-in-windows-february-cumulative-update-preview-4cc631fb-9d97-4118-ab6d-f643cd0a7259

Pick-to: 6.8 6.5 5.15
Change-Id: I5caf11151fb2f711bbc5599231f140598b3c9d03
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 69633bcb58e681bac5bff3744e5a2352788dc36c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 09:09:01 +00:00
Alexey Edelev
9bde2afb5c Name (_)qt_internal_android_app_runner_arguments properly
The function is located in public CMake commands and should be '_'
prefixed.

Amends a905d26f14da1cf86b8490331c0cc41c2a45b283

Pick-to: 6.8
Change-Id: I2817105de4e60d9e5d9a65479af2d11ac6406dae
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit be5845e8ca8d4a8d5b9606295b672b591c660a01)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-27 08:54:09 +00:00
Thiago Macieira
00ef067a2d QMessageLogger: test that QT_FATAL_{WARNINGS,CRITICALS} work
Pick-to: 6.8
Change-Id: I8a7f56d67043bae14e10fffdfbaf3060486edbf1
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 1dcc5a6dd28606c7959d0626f74f8c05e112b1fc)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-03-26 18:13:45 +02:00
Paul Wicking
e70fcdfe5b Doc: Drop "Unknown base" spurious regex from config
This regex pattern instructs QDoc to not include the matching warning in
its warning count. The warning has changed to a report, however, which
won't count towards the warning count in any case, so the regexp isn't
needed anymore.

Task-number: QTBUG-131459
Task-number: QTBUG-134219
Pick-to: 6.8
Change-Id: Ic461c63b62bd25fb2d1f3b485c46db55e52e20cf
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit a8dab8590a611ed570d937754a66497bc88d4e49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 15:54:16 +00:00
Marc Mutz
c228b13e76 qcompareheleprs.h: protect CompareThreeWayTester from -Wdeprecated
The namespace contains traits to check for presence and noexceptness
of compareThreeWay() overloads. One of those overloads, the (raw) ptr
one, is deprecated, and therefore throws a warning when one of these
traits hits it. But this is beside the point, because it's not
actionable by the user.

Fix by wrapping the whole namespace in QT_WARNING_DISABLE_DEPRECATED.

This fixes one of the two remaining -Wdeprecated warnings in
tst_qcompare (which the test tries its best to defend against, by
using QT_WARNING_DISABLE_DEPRECATED around the lines, too, but it
didn't help in this case), namely this one:

  qcomparehelpers.h: In instantiation of ‘constexpr bool QtOrderingPrivate::CompareThreeWayTester::compareThreeWayNoexcept() [with LT = int*; RT = int*; typename std::enable_if<hasCompareThreeWay_v<LT, RT>, bool>::type <anonymous> = true]’:
  qcompare.h:689:91:   required from ‘auto qCompareThreeWay(const LT&, const RT&) [with LT = int*; RT = int*; typename std::enable_if<disjunction_v<QtOrderingPrivate::CompareThreeWayTester::HasCompareThreeWay<LT, RT, void>, QtOrderingPrivate::CompareThreeWayTester::HasCompareThreeWay<RT, LT, void> >, bool>::type <anonymous> = true]’
  tst_qcompare.cpp:847:5:   required from here
  qcomparehelpers.h:1229:34: warning: ‘constexpr Qt::strong_ordering Qt::compareThreeWay(const LeftType*, const RightType*) [with LeftType = int; RightType = int; typename std::enable_if<disjunction_v<std::is_same<T, U>, std::is_base_of<Container, T>, std::is_base_of<U, T> >, bool>::type <anonymous> = true]’ is deprecated: Wrap the pointers into Qt::totally_ordered_wrapper and use the respective overload instead. [-Wdeprecated-declarations]
   1229 | { return noexcept(compareThreeWay(std::declval<LT>(), std::declval<RT>())); }
        |                   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  qcomparehelpers.h:999:31: note: declared here
    999 | constexpr Qt::strong_ordering compareThreeWay(const LeftType *lhs, const RightType *rhs) noexcept
        |                               ^~~~~~~~~~~~~~~

The last warning actually pertains to the body of qCompareThreeWay()
calling Qt::compareThreeWay() on pointers. Even though we try to
suppress that one, too, for testing purposes, it's not clear how it
can be fixed without hiding it for all users of qCompareThreeWay(), so
this is left for another day.

Amends 3d231e27a8c38f8e840e161e76be3a153d6b0aa9.

Pick-to: 6.8
Change-Id: Id434629435ea8ea89d03e46096866283ab792b54
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 75e10a0656eca0fb8dee71be1ad504707be1f9b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 15:54:16 +00:00
Giuseppe D'Angelo
687c944820 tst_qdbusperformance: include what you use (QElapsedTimer)
Pick-to: 6.8 6.5
Change-Id: I2f880d4ad38f5f3c509c8ddcdad59108d915517b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b12a5bf41a722337b3addde9c82b233126e17174)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 15:54:16 +00:00
Eskil Abrahamsen Blomfeldt
a9418f0ab5 Account for rounding error when rounding height metrics
In Qt 5 we would ask FreeType for height metrics. FreeType
always returns rounded metrics, so for e.g. DejaVu Sans at
pixel size 21 it would return ascender=20 and descender=5,
which is actually incorrect, since the actual ascender is
19.49. The descender is rounded correctly. This is likely
due to the use of fixed point math internally.

In Qt, we would account for this error by setting the
leading to -1, so that the rounded height still becomes
24. (This is also technically incorrect, since the line gap
of the font is 0.)

In Qt 6, we got the same fixed point rounding error (so
ascender becomes 20 instead of 19), but we didn't account
for the error, so we would end up with lines that were 25
high instead of 24.

To reduce the chance of getting this error, we do the full
metrics calculation in floating point numbers instead. For
the case in question, we will then get arounded ascender of
19 and descender of 5, giving us a height of 24.

Fixed point numbers are still used for storing the results,
so while it's less likely, we could still end up with the
same error. Therefore, we also apply the same trick as in
Qt 5 when this occurs: Adapting the leading of the font to
account for the rounding error if it occurs.

[ChangeLog][QtGui][Text] Fixed an issue where the line
distance for hinted fonts would be off by one for specific
sizes of some fonts.

Fixes: QTBUG-134602
Pick-to: 6.8
Change-Id: I09f1806199b7b2b02a932bb65fe4da055bd60f51
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 3728032e03b3bf95daa7115c734173a0070d85c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 15:54:16 +00:00
Giuseppe D'Angelo
6dc3e49b36 Examples: port from QCheckBox::stateChanged to checkStateChanged
The former is deprecated.

Change-Id: I94de7a6c6bbea61cd75820389e8039cb92c7ee6a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 600388ff2ad24408d64ed5ea8fc1b793f6398f28)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 15:54:15 +00:00
Axel Spoerl
364f01d8f1 XdgDesktopPortal: Prevent c'tor re-entry
XdgDesktopPortal requires a base platform theme, which is created in
its c'tor. If XdgDesktopPortal was shipped as a plugin of its own,
it would find itself as a plugin, create itself as its own base theme
and thus end up in an infinite loop.

Factor out the key check from main.cpp as a static bool in
QXdgDesktopPortalTheme.
Ignore XdgDesktop keys when scanning for plugins suitable as a base
theme.

Fixes: QTBUG-134703
Pick-to: 6.8 6.5
Change-Id: I4aab1e77a48251581369f371e4c9af308ef0a02b
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 3404a1491eaba482544cd0588c94fd29a69e1cc0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 15:54:15 +00:00
Axel Spoerl
56db6d25a4 qguiapplication.cpp / init_platform() - optimize ranged loop and style
Use std::as_const() for a QStringList in a ranged for-loop.
Use auto * for a pointer.

Pick-to: 6.8 6.5
Fixes: QTBUG-134702
Change-Id: Ia092933fe959afdd6b6e0a9743e3603c29b291d8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 22e05d74b2d01cc49c2893f66824d6e229558320)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 15:54:15 +00:00
Antti Määttä
f39b02ed4b Rhi: Add SampleVariables feature
The feature is required to check if gl_sampleID etc are available in the
fragment shaders.

Task-number: QTBUG-134999
Change-Id: Id26c75780011a7553d332ae22e69aab632891998
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 86e3573671ec3ea919e534957bf9dc320f853575)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 15:54:15 +00:00
Marc Mutz
cbc2f2a6ee QFileDialog: fix UB (invalid cast) in Private::setVisible()
The function can be called from ~QDialog(), in which case a cast of
q_ptr to QFileDialog is UB.

Says UBSan:

  qfiledialog_p.h:78:5: runtime error: downcast of address 0x7ffe7a8ad5a0 which does not point to an object of type 'QFileDialog'
  0x7ffe7a8ad5a0: note: object is of type 'QDialog'
   fe 7f 00 00  30 44 d8 fb d2 7f 00 00  80 b4 00 00 90 61 00 00  08 46 d8 fb d2 7f 00 00  00 00 00 00
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QDialog'
    #0 0x7fd2f96d7587 in QFileDialogPrivate::q_func() qfiledialog_p.h:78
    #1 0x7fd2f96d7587 in QFileDialogPrivate::setVisible(bool) qfiledialog.cpp:860
    #2 0x7fd2f95465f5 in QDialog::setVisible(bool) qdialog.cpp:757
    #3 0x7fd2f6d88768 in QWidget::hide() qwidget.cpp:8179
    #4 0x7fd2f9545e09 in QDialog::~QDialog() qdialog.cpp:398

Fix by casting to QFileDialog only on show() (in createWidgets()), not
hide(), and otherwise cast at most to QDialog* (QWidget* would
actually have sufficed).

Add a code comment.

Amends e0bb9e81ab1a9d71f2893844ea82430467422e21 (I think; it might
have been present in a different form before that).

Pick-to: 6.8 6.5
Change-Id: I4e206f7c36c03e8cb8a36001beae283628960073
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit a6743bd3c787e03d2ee3b791260e21e539131181)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 12:35:23 +00:00
Marc Mutz
54e67a13aa QWidgetWindow: fix UB (invalid downcast) in Private::handleDragEnterEvent()
The handleDragEnterEvent() function is not only called for
QEvent::DragEnter, but also, in handleDragMoveEvent(), for
QEvent::DragMove, in which case the fully-derived event passed as an
argument is a QDragMoveEvent, and not its subclass QDragEnterEvent.

Code in Qt seems to assume that it's ok to cast an object down to a
more-derived class than the most-derived dynamic type, as long as no
extra state is being added between the two, but C++ does not chare
that view.

Says UBSan:

  qwidgetwindow.cpp:1000:38: runtime error: downcast of address 0x7ffe7b34c6e0 which does not point to an object of type 'QDragEnterEvent'
  0x7ffe7b34c6e0: note: object is of type 'QDragMoveEvent'
   00 00 00 00  e0 62 70 42 aa 7f 00 00  3d 00 00 00 00 00 00 00  00 00 00 00 00 c0 58 40  00 00 00 00
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QDragMoveEvent'

Furtunately, handleDragEnterEvent() doesn't actually need its argument
to be a QDragEnterEvent; QDragMoveEvent suffices, so we can just
change the argument type back to QDragMoveEvent and remove the cast in
handleDragMoveEvent().

Add a bit of \internal docs to describe the discrepancy between the
function's name and argument type.

Amends f8944a7f07112c85dc4f66848cabb490514cd28e.

Picking all the way, because this is risk-less: Either the code compiles
and then it works as before (minus the UB), or it doesn't compile.

Pick-to: 6.8 6.5 5.15
Change-Id: I5be53b023d389902b43e9a896d074edea1c4ff2d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e89c0a7fb54a15b8df1d2938e2f01ef14f3bf7e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 12:35:23 +00:00
Kai Köhne
db63625c50 Doc: Fix QThread documentation snippet
WorkerThread needs an explicit constructor, otherwise

    WorkerThread *workerThread = new WorkerThread(this);

will fail. While at it, at some infrastructure code so that the
.cpp file actually compiles.

Change-Id: I35835b1be3da2a1f75222594197f6013b41a7b4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 68a16558171abccd15f5446ac208e105cf337dc0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 12:35:22 +00:00
Alexey Edelev
ab04b4ba8e Use 'file(CONFIGURE' in qt_configure_file for CMake >= 3.18
Use the original functionality as the fall back solution for
the introduced by CMake 'file(CONFIGURE' command.

Pick-to: 6.8
Change-Id: I2be7e3bf80a577cdf8292c9f47bb127fa71615b6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ec5f4fe580975594edcf7cff42433526a6ec43ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:47:01 +00:00
Alexey Edelev
b27ba33a66 Move detecting of USE_TERMINAL flag to a separate function
The logic is generic, make it accessible from the function.

Pick-to: 6.8
Change-Id: Ib361399722dba689891d301e20b3f713450e676f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit cda51bcd9cdffc7f5541f1bba90dc608575fb07b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:47:00 +00:00
Alexey Edelev
11721dffdf Add getter for the path to androiddeployqt executable
Return the androiddeployqt TARGET, which can be used in custom commands
or if the target doesn't exist, fall back to old approach and use
the full path to the host androiddeployqt. If both are not found,
encourage users to reinstall Qt or report the bug.

Pick-to: 6.8
Change-Id: I9f487b0f0af8703a9387b9c0cf8baae47859658e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 2c86eaee49ff2e02129b00ec86157aa3166d6f06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:47:00 +00:00
Alexey Edelev
59905e0678 Move the genex that returns Android SDK tools revision to a function
The genex will be generic, so make it accessible from function.

Pick-to: 6.8
Change-Id: I83246890e2d81f3cdbbd8fe2b93d59968623a889
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9819e9c2e0928094ffbb4daba3f01d8e04570b00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:47:00 +00:00
Alexey Edelev
91fc9fe796 Change _qt_internal_android_get_target_android_build_dir signature
Swap the argument order so the "output" is the first argument.

Pick-to: 6.8 6.5
Change-Id: I1325af97f1d6540c6897b51f1b5736b4534f6412
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b434e0be797f8e347d58077b8ef21086d7a7d055)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:47:00 +00:00
Alexey Edelev
801482208c Prepend '_' to qt_internal_android_get_target_android_build_dir
Adjust the function name according to our naming convention for
private function locating in public cmake scripts.

Pick-to: 6.8 6.5
Change-Id: I3a108cdb43bd4b3d8cf29ac4c42c7c20c541afc8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2adf9410607ec14a56fe1ac2eefa53bf4bb4e646)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:59 +00:00
Alexey Edelev
2eff82ea39 Move the Android deployment config type detecting to a separate function
Since the deployment config type detecting is generic, move it a
separate function.

Pick-to: 6.8
Change-Id: If925b6e14ba0d64a003e7f9ae2a5d701b7886920
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f10f609db9488629a1abf8c363f32dbd3abdf456)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:59 +00:00
Giuseppe D'Angelo
1aed8b0b75 Examples: include what you use (QElapsedTimer)
Pick-to: 6.8
Change-Id: Icb2ae16d8d6b9083c1118ef2489fa2a1d7db9bdf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 52d3cb8904eb0582d163cb9d51a6e835c5b4fa68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:59 +00:00
Giuseppe D'Angelo
f24dcf7bdb Examples: fix UB calls into QElapsedTimer
Calling restart() without start() is illegal, so don't do that; use
start() instead.

Pick-to: 6.8 6.5
Change-Id: I2ff5151f588cb926ccecc3d9997615e63f36ee24
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 029407117f0584aea7722ff7702c9f4b83fa9013)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:59 +00:00
Marc Mutz
3b8a5859f8 tst_QGraphicsEffectSource: fix memleak in pixmapPadding()
The test function didn't delete the heap-allocated QGraphicsScene,
because, a comment indicated, there was some "corruption in scene
destruction".

Fix the memleak by creating the scene object on the stack. A local
asan+ubsan build is clean, and so is a valgrind run, so whatever it
was, it seems fixed by now.

Amends the start of the public history.

Picking back to verify that it's been, indeed, fixed in all active
branches.

Pick-to: 6.8 6.5 5.15
Change-Id: Ic7f96c7195d58ccbff45b17f76fb2babd1c1b648
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 429338154540f92a3efdbe8813a41f98dddeaa08)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:58 +00:00
Marc Mutz
eba728f1a3 tst_QGraphicsScene: fix memleaks in taskQTBUG_7863_paintIntoCacheWithTransparentParts()
The test function created QGraphicScene objects on the heap, but never
deleted them. They were added to a View, yes, but a view doesn't own
the scene it renders, so this didn't help.

Fix by creating the scenes on the stack instead.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I939e028dbfd68b216ef67c3773f085ba98817b05
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit d8b79dc1c949cd4cb5472f53545fbdd94f6e5b3b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:58 +00:00
Marc Mutz
081023ec0e tst_QGraphicsScene: fix memleak in taskQTBUG_5904_crashWithDeviceCoordinateCache()
The test had it the wrong way around: it deleted the QWidget it had
added to the QGraphicsScene, which thus becomes the widget's owner,
but left the scene itself undeleted, leaking it and all the items (but
not the widget ;-)).

Create the scene on the stack, so it's deleted by the compiler, and
release() the widget into the scene.addWidget() call. Since
QScopedPointer::take() is deprecated, port to std::unique_ptr.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: Idbf821a35a7db802a68923fc09b185ddc3181245
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit fdcf54062cfd372d528948da4637b98b403e174e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:58 +00:00
Marc Mutz
b859f192e9 tst_QGraphicsScene: fix memleaks in selectionChanged()/removeItem()
A QGraphicsScene owns the items added to it, but if we later
removeItem() one again, then we're also responsible for freeing the
item. The test functions didn't do that, so we leaked the item.

In order to not change the rest of the functions by deleting the item
earlier than it had been before, install a qScopeGuard() to delete it,
right after we removed it from the scene again.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I8ab50626a0b5d52825bb329233ab8efe6c1291dc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3651769d52108b01b142a3bcaae530e949eafa68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:58 +00:00
Marc Mutz
e926cbf218 tst_QGraphicsItem: fix memleaks in sceneEventFilter()
A view doesn't own the scene it renders, because scenes can be in
multiple views. So if the test function doesn't delete `anotherScene`,
no-one else does, either.

To fix, allocate it on the stack (like `scene`), and not on the heap.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I2f0bfc5dfafd68a347553335f5ac5f2d081d56ad
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0617d177ac9d584ed6e5298e0fbe1a78ea682ce9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:58 +00:00
Marc Mutz
2cb473b266 tst_QGraphicsItem: fix memory leaks in mapRectFromToParent()
The items were not added to any scene, so nothing ever deleted them.

Hold them in unique_ptr, taking care to delete the parent, if any,
last, even though it was created after its child.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I9980530efb3386e15b81232e526a1d8d3bb3c36d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 284283c5b286a5265d8408b543de8314f7b1aa47)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:57 +00:00
Marc Mutz
5b4e57778a tst_QGraphicsItem: fix leak of m_touchDevice
The result of QTest::createTouchScreen() needs to be deleted by the
caller, and this test didn't do that.

To fix, put the object into a unique_ptr.

Amends 982b70d37db337b2c57a3cfce0f24c3d00a598d6, though the code it
replaced seems to have had the same problem.

Pick-to: 6.8 6.5 5.15
Change-Id: I361a0b37b717ac543b003fb48a4a6934b6d79a03
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit e9a7c4a224a5859fb954b149ea0a0d3b0e4ada13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:57 +00:00
Marc Mutz
96aa7232c7 QFontDialog: fix UB (invalid cast) in Private::setVisible()
The function can be called from ~QDialog(), in which case a cast of
q_ptr to QFontDialog is UB.

Says UBSan:

  qfontdialog_p.h:43:5: runtime error: downcast of address 0x604000026b90 which does not point to an object of type 'QFontDialog'
  0x604000026b90: note: object is of type 'QDialog'
   00 00 00 00  30 a4 26 31 45 7f 00 00  80 b9 00 00 90 61 00 00  08 a6 26 31 45 7f 00 00  00 00 be be
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QDialog'
    #0 0x7f452ecad24d in QFontDialogPrivate::q_func() qfontdialog_p.h:43
    #1 0x7f452ecad24d in QFontDialogPrivate::setVisible(bool) qfontdialog.cpp:959
    #2 0x7f452ea2b5f5 in QDialog::setVisible(bool) qdialog.cpp:757
    #3 0x7f452c26d768 in QWidget::hide() qwidget.cpp:8179
    #4 0x7f452ea2ae09 in QDialog::~QDialog() qdialog.cpp:398

Fix by casting at most to QDialog* (QWidget* would actually have
sufficed).

Add a code comment.

Amends e0bb9e81ab1a9d71f2893844ea82430467422e21 (I think; it might
have been present in a different form before that).

Pick-to: 6.8 6.5
Change-Id: Ic1a63ff02b1a1435499a6980772b1b75236f31f7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 41480dbd4abadf13c26e487ae23ce681866b6af3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:57 +00:00
Marc Mutz
c50d67e86f QColorDialog: fix UB (invalid cast) in Private::setVisible()
The function can be called from ~QDialog(), in which case a cast of
q_ptr to QColorDialog is UB.

Says UBSan:

  qcolordialog.cpp:72:5: runtime error: downcast of address 0x7ffd37909750 which does not point to an object of type 'QColorDialog'
  0x7ffd37909750: note: object is of type 'QDialog'
   fd 7f 00 00  30 34 6e 35 4a 7f 00 00  80 b9 00 00 90 61 00 00  08 36 6e 35 4a 7f 00 00  00 00 f2 a6
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QDialog'
    #0 0x7f4a32e8738a in QColorDialogPrivate::q_func() qcolordialog.cpp:72
    #1 0x7f4a32e8738a in QColorDialogPrivate::setVisible(bool) qcolordialog.cpp:2154
    #2 0x7f4a32ea5675 in QDialog::setVisible(bool) qdialog.cpp:757
    #3 0x7f4a306e7768 in QWidget::hide() qwidget.cpp:8179
    #4 0x7f4a32ea4e89 in QDialog::~QDialog() qdialog.cpp:398

Fix by casting to Qcolordialog only on show() (in initWidgets()), not
hide(), and otherwise cast at most to QDialog* (QWidget* would
actually have sufficed).

Add a code comment.

Amends e0bb9e81ab1a9d71f2893844ea82430467422e21 (I think; it might
have been present in a different form before that).

Pick-to: 6.8 6.5
Change-Id: I006406b6cf1012fc3c7a910abcfe14bc119a2b29
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 0be1ca029cc21e72d9f5408dea99722fba9bc321)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:57 +00:00
Marc Mutz
c831210d0b tst_QScroller: fix leak of m_touchScreen
The result of QTest::createTouchScreen() needs to be deleted by the
caller, and this test didn't do that.

To fix, put the object into a unique_ptr.

Amends 982b70d37db337b2c57a3cfce0f24c3d00a598d6, though the code it
replaced seems to have had the same problem.

Picking all the way back, since this code hasn't changed in ages, and
so conflicts are unlikely. Also, there appears to be a remaining leak
in QScroller::grabGesture(), and we don't know, yet, how far we'd pick
that one, but verifying it will likely be helped by the test not
otherwise leaking. Filed QTBUG-135055 to track the issue.

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-135055
Change-Id: I6ab3402671f768c6a33b682d456145f18629e6cb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 49a87936ef50acb1ab7156809bf5f85671d36f24)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:57 +00:00
Marc Mutz
f988f8fc30 QMessageBox: fix UB (invalid cast) in Private::setVisible()
The function can be called from ~QDialog(), in which case a cast of
q_ptr to QMessageBox is UB.

Says UBSan:

  qmessagebox.cpp:182:5: runtime error: downcast of address 0x7ffdccfbda00 which does not point to an object of type 'QMessageBox'
  0x7ffdccfbda00: note: object is of type 'QDialog'
   88 7f 00 00  30 94 4a 73 88 7f 00 00  80 8c 00 00 90 61 00 00  08 96 4a 73 88 7f 00 00  00 00 fb cc
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QDialog'
    #0 0x7f8870f9a8a3 in QMessageBoxPrivate::q_func() qmessagebox.cpp:182
    #1 0x7f8870f9a8a3 in QMessageBoxPrivate::setVisible(bool) qmessagebox.cpp:1660
    #2 0x7f8870c6b3b5 in QDialog::setVisible(bool) qdialog.cpp:757
    #3 0x7f886e4ad4b8 in QWidget::hide() qwidget.cpp:8179
    #4 0x7f8870c6abc9 in QDialog::~QDialog() qdialog.cpp:398

Fix by casting to QMessageBox only on show(), not hide(), and
otherwise cast at most to QDialog* (QWidget* actually suffices).

Add a code comment.

Amends e0bb9e81ab1a9d71f2893844ea82430467422e21 (I think; it might
have been present in a different form before that).

Pick-to: 6.8 6.5
Change-Id: Ia163483c1998924a0d9c9fd589311af24a93d1fe
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 8b4900bffff3386e108847c9e1ffe9a15e05e5d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 08:46:56 +00:00
Nicholas Bennett
8a2ba3b3ac Docs: Add ndk r27c to supported versions for active Qt 6 LTS releases
Update the macro so that where the supported ndk version is referenced
in docs are updated in all places used.

Pick-to: 6.8 6.5
Task-number: QTQAINFRA-6479
Change-Id: I93164f2ec48c71ab99ee2ccba02f6adb0ac4dd89
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-03-26 08:46:56 +00:00
Nodir Temirkhodjaev
7dbda42554 qnetworkinterface.cpp: Rename "interface" variables to "iface" to fix a unity build
On Windows the "interface" is defined as "struct".

Pick-to: 6.8
Task-number:  QTBUG-122980
Change-Id: I1a80c9e40d59449bb3c3773679a95405ea39d630
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 23a4b586f7137a86028e731dbaf800b1ebcf738a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-26 05:21:57 +00:00
Thiago Macieira
e495e0ea28 tst_QMessageLogger: rename helper main.cpp -> qlogging_helper.cpp
So it's easier to find in the IDE, as otherwise everything is
"main.cpp".

Change-Id: I8d4663c84603113376a1fffd2f78f87635f3310f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 037f6be4280ed73a3fd53ca55fb38ad10b0db3ab)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-03-25 23:26:41 +02:00
Volker Hilsheimer
4874a7b13c QComboBox: close the container explicitly before destroying it
QComboBox destroys the container of the view in its own destructor,
before the QWidget destructor is entered. The container is a toplevel
widget, so destroying that will destroy a platform window, triggering an
accessibility update cycle that calls back into Qt. As the QComboBox has
not yet reached the QWidget destructor, it still considers itself as
visible and focused. The accessibility query will therefore operate on
it, as the focused object. Probing the state accesses the view.

The view however is already partially destroyed, as the container's
destruction has already passed the QWidget destructor deleting all its
children. As a result, we are returning a pointer to a QAbstractItemView
that's already in the QWidget destructor, resulting in a crash.

Options for fixing this would be resetting the view pointer in
~QComboBoxPrivateContainer to nullptr and to test for that in client
code. Doing that triggered crashes in tests, as QComboBox::view() so far
has never returned a nullptr no matter the state of the combobox.

So instead, close the container explicitly before destroying it. This
way, any update cycle resulting in reentrancy (such as accessibility of
backingstore flushing when the container closes) will be completed
before objects are destroyed.

This amends fde358dd9069d0695f113ec6ba98efebedd1e520, which added the
explicit destruction of the container, for similar reasons.

This seems to be a combobox-specific problem due to the combination of
explicit destruction of (toplevel) child widgets, resulting event
processing, and exposing of internal widget states through public API
as part of the widget's accessible state.

Pick-to: 6.8 6.5
Fixes: QTBUG-132310
Change-Id: I74df5b71906ce8153b12ddc35b897a44e7752907
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 74e5a51babe0a133ce0fe9b907ef77cc606fbcb9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-25 16:53:58 +00:00
Alexandru Croitor
d3e03d1da0 CMake: Fix list(REMOVE_ITEM) usage with older CMakes
Older CMakes error out with

CMake Error at cmake/QtSyncQtHelpers.cmake:156 (list):
  list sub-command REMOVE_ITEM requires two or more arguments.

if the last expanded variable is empty.

Fix by doing an explicit non-emptiness check.

Amends e7834e90f38891382f830da7700f00ebd81f21a8

Pick-to: 6.8
Task-number: QTBUG-134672
Task-number: QTBUG-128730
Change-Id: I3c355a02519c2c450235770b2ff8c92416615a9f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 9ff4b5341fc30a6154e20d7c83a35f594c7ec92b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-25 16:00:10 +00:00
Paul Wicking
23a8355991 Add .gitreview file
`git-review` is a command line tool for interacting with Gerrit.
Some IDEs offer support for this tool, either natively or through
plugins. The tool relies on a configuration file, .gitreview. Adding
this configuration file to our repositories simplifies initial setup
for contributors that use the tool directly or through their IDE of
choice.

The configuration file adds a remote called 'gerrit'. This is the
default for the tool, and also the name set for
codereview.qt-project.org by Qt's `init-repository` script. Thus,
the configuration should work seamlessly alongside other repository
helpers.

Task-number: QTBUG-132604
Pick-to: 6.8
Change-Id: Ic14f4ac93dae34701e2a35b1802ab2d7b740985e
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
(cherry picked from commit bf15cf1cfa9cf7ac15f521fa417b07dea9bb3ac7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-25 08:40:27 +00:00
Marc Mutz
3383817a2d QDBusListener: remove ChangeSignal's defaut ctor
Coverity complained that the default ctor didn't initialize its two
members. This is true, and it even remains true if the user of the
type explicitly asks for value-initialization (ChangeSignal s = {}) as
opposed to default-construction (ChangeSignal s;).

Remove the default ctor as the minimally-possible fix. It was only
needed because of a call to QFlatMap::value(1-arg), which,
incidentally, constitutes a double-lookup, because it is following a
contains() call. Replacing that combo with find() and it.value()
avoids the double-lookup and removes the need for the type to be
default-constructible.

Amends 0328e4297e339de8a2acd84979c667936f6fadf8.

Coverity picked this up as a new issue following
53fb13456fffe8bfd192f9197c6d1703854b49a2, so there probably is another
CID for this for the same code in the old location, but my Coverity
search-foo is insufficient to find the corresponding CID, without
undue effort, so I didn't try.

Manual conflict resolution for 6.9:
- tracked contents from qdbuslistener* back into qgenericunixthemes.cpp,
  whence 53fb13456fffe8bfd192f9197c6d1703854b49a2 moved them.

Coverity-Id: 478089
Pick-to: 6.8 6.5
Change-Id: I912bf2af343b98fe62faf2d4bf8a6d1f385593e8
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit d624454586bc040c381091f45ca43dcb43f7112c)
2025-03-25 09:40:26 +01:00
Christian Ehrlicher
33eb981101 Windows11Style: don't draw progressbar label for vertical progressbars
Since the label of a progressbar is drawn right of the bar, it does not
make sense to draw a label for vertical bars. This is consistent with
windows and windowsvista style.

Pick-to: 6.8
Fixes: QTBUG-132459
Change-Id: I6610a1ef1b4074a6301aac12928c1dfe99ffd457
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit a37606310e397e13dba223dc858555c9f26ce9b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-25 05:15:40 +00:00
Kai Köhne
e2977d2e97 Windows: Add helper function to initialize COM per thread
This adapts a pattern first introduced for qtmultimedia (7398c5daa9).

Pick-to: 6.9.0
Change-Id: I4682fcf49fe074c55b4a70a1e1ec659b33b31bbb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f5ac4a7f1471d580f2f8e6d471c1bf1771a0b2e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-24 18:27:25 +00:00
Volker Hilsheimer
43a4b9c1f2 QObject::disconnect: warn if a wildcard call disconnects from destroyed
Qt relies internally on connections to the destroyed() signal of
application-objects, for example to clean up accessibility interface
implementations or other data structures that would otherwise grow or
hold danging pointers.

The QObject::disconnect function is already documented to be potentially
dangerous, as a wildcard call (with signal, receiver, and method
defaulted to nullptr) will disconnect everything. However, what happpens
to work in one Qt release might break things in another if we add code
that relies on connections to destroyed().

To make users aware of the danger of a wildcard disconnect call, and to
help with fixing the issues that might arise, emit a warning when a
wildcard disconnect() breaks an existing connection to the sender's
destroyed() signal.

Do this while we hold the connection mutex, and only if all parameters
to the disconnect() call are wildcarded. This happens very rarely, and
should never happen in performance critical code.

Fix the only test I found emitting this warning due to a wildcard
disconnect (the drag'n'drop subsystem relies on the destroyed signal).
Store the only relevant connection instead so that we can disconnect
when done.

Fixes: QTBUG-134610
Pick-to: 6.8
Change-Id: I9e6dcade0d5572345b71e3e8f06902bbea1ef89a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit a79d5b8d0856a8f6c4de56a8d982c84ea20905a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-24 18:27:25 +00:00
Alexander Stippich
b630ed4ef8 rely on CUPS for multiple page ranges in unix version of QPrintDialog
Since the introduction of QPageRanges with Qt6, multiple/arbitrary page
ranges are broken in the unix implementation of QPrintDialog due to a
possible double application of the page ranges: on the application side
and on the server side with CUPS. Reason for this is that the
QPrinter::PrintRange is set to PageRange instead of AllPages.
The latter is needed when relying on the CUPS server-side page range.
However, the server-side page range is always applied later on.

Restore the behavior of Qt5 and set the PrintRange to AllPages for
multiple/arbitrary page ranges and rely on the server-side filtering
with CUPS.

Pick-to: 6.8
Change-Id: I1b85552a8cf2509b11a81db028f957584043f3ee
Reviewed-by: Albert Astals Cid <aacid@kde.org>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 2428cbf44e3e2aa4eaf00c9548ac5a74685101c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-24 18:27:25 +00:00
Marianne Yrjänä
93e78b87bf Add QNX8.0 CI enablers
Task-number: QTBUG-131708
Pick-to: 6.8
Change-Id: I60c1be5fc117e5861147d9b194106b63a8b62aab
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f673d381295ccafe9d993277655e57eaae630e89)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-24 18:27:25 +00:00
Christian Ehrlicher
1b0b5c3280 Windows11Style: Don't modify palette for QCommandLinkButton in polish()
The windows vista style modifies the palette for a QCommandLinkButton to
match the vista style. For windows11 we simply use the same color as for
a normal button so no need to modify the palette is needed.
Since the vista style does not reset the palette on style change, the
wrong color is still used in the widgetsgallery example when switching
from vista to win11 (or fusion).

Pick-to: 6.8
Task-number: QTBUG-130480
Change-Id: I963215295ee1d2e483b5b58045752474c920c64b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit 6e8b6250e73c90d1e37a8ae65ad22bc4143f6b85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-24 18:27:25 +00:00
Axel Spoerl
f06b8f1779 QtCore: fix build w/o itemmodel
removed_api.cpp included qabstractitemmodel.h unconditionally.
Wrap it in #if QT_CONFIG(itemmodel)

As a drive-by, add the missing blank line after the initial

    #if QT_CORE_REMOVED_SINCE(6, 8)

Amends cbda9583521633fa6e8a9274d2e47aa14c8bd175.

Pick-to: 6.8
Change-Id: I6888d9a76078a2473a0a8f063cf8b93ac3025385
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 32d23904b29fcab0d7dfca3d6ac9b97563ba88ff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-24 18:27:25 +00:00
Morteza Jamshidi
ce0349b410 Show window without activating if WindowDoesNotAcceptFocus flag is set
Added an extra condition to only show the window (without activation)
if Qt::WindowDoesNotAcceptFocus flag is set. (Mostly from qml)

Fixes: QTBUG-130912
Change-Id: I6b7a9cd03d726315b8531600c6a8b33436a3348b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit cf9c94e85160a9d0f03e284ff92995900076faee)
Reviewed-by: Morteza Jamshidi <morteza.jamshidi@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2025-03-24 14:22:41 +00:00
Alexey Edelev
504ec42a0f Make HostInfo versioned
Generate and install the HostInfoConfigVersion file for the
HostInfo package. The package had no strict version compatibility
as Qt modules before, so we avoid adding them here too.

Pick-to: 6.8 6.5
Change-Id: Iaee43639dd87d911946c8ce72c4849f43599d08e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit fc956519963ea962b93367523a9761f07dd16be7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-24 14:12:48 +00:00
Ivan Solovev
fe7cb24195 docs: Clarify adding a continuation to a QFuture with multiple results
Explain that the continuation should take QFuture<T> as a parameter in
order to be able to access all results.
Add notes with examples to the QtConcurrent::mapped and
QtConcurrent::filtered overviews.

Task-number: QTBUG-133522
Pick-to: 6.8 6.5
Change-Id: I65655aadc8d4623b147d22a9bf9b2189c80b14c5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 4b18a8946bac34143a5eb85e669be01b8ced32fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-24 12:15:56 +00:00
Antti Määttä
842ee4f393 Mark QCtfServer as security critical
QCtfServer uses QTcpServer to accept connections with security sensitive
commands.

Pick-to: 6.8
Change-Id: I793e716560fedcf6155f36beeeafdcc0429fe092
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 6a534cf5048ebb8b4641d4715a92be3ea0a6bb06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-24 12:15:56 +00:00
Joerg Bornemann
ac67f0dc96 Doc: Fix typos in qt_deploy_runtime_dependencies documentation
Pick-to: 6.8
Change-Id: I273f4e8626df6242e82e015d76e5692b29afdec1
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 17a9343ace849fcc6c3514b0b744bc0827472455)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-24 08:49:25 +00:00
Marc Mutz
607115f1e2 QMessageBox: really fix UB (invalid cast) in Private::canBeNativeDialog()
The code comment above the cast is correct, but the code wasn't: While
we're receiving the result of the cast in a QDialog pointer, the cast
is still to QMessageBox*, and whether that cast is in the Q_Q macro or
not doesn't change the fact that it's invalid.

Says UBSan:

  qmessagebox.cpp:2804:31: runtime error: downcast of address 0x7ffebfd87140 which does not point to an object of type 'QMessageBox'
  0x7ffebfd87140: note: object is of type 'QDialog'
   2b 7f 00 00  30 94 57 b9 2b 7f 00 00  80 8c 00 00 90 61 00 00  08 96 57 b9 2b 7f 00 00  00 00 d8 bf
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QDialog'

The trivial fix is to cast only to QDialog.

Amends 29b2506e8cf0c792821a3ddb28e62080cd66ae28.

Pick-to: 6.8
Change-Id: Ia3f6c08b62f6bed274f43baab881a0d802bd986b
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
(cherry picked from commit f4dd7e29a68c4439e3da40db4eb2d67999d316b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-23 21:08:22 +00:00
Giuseppe D'Angelo
b10616fe3e tst_qlatin1stringmatcher: include what you use
Pick-to: 6.8
Change-Id: I35a6e9b4c3fa9e04add85db790a6b6dc42e51a48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 643086b135ef020850c0b46ae23a28479968683a)
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2025-03-22 13:17:15 +00:00
Fabian Kosmale
4a79ed90f1 Q_DECLARE_OPAQUE_POINTER: Document footgun
Using Q_DECLARE_OPAQUE_POINTER means that the metatype system won't have
any knowledge about the type, beyond it being a pointer. That leads to
all kinds of unexpected errors in code that needs to introspect the
meta-type information to handle QObject's and gadgets, notably but not
limited to QML.

Warn about using Q_DECLARE_OPAQUE_POINTER for gadgets and QObject's, and
offer Q_MOC_INCLUDE as a potential alternative for some use cases.

Pick-to: 6.8 6.5
Task-number: QTBUG-127012
Task-number: QTBUG-134883
Change-Id: I4fe53f277d0aa51ef552d04f642364aa6613ef7c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 0a567a7f926f433cbd1294131aac0e80dcfd7943)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-22 10:18:51 +00:00
Shawn Rutledge
bbceab7932 DropSite example: handle application/x-color
Show the color that is dragged in, both graphically and textually.
Revert to default palette for other data types. Prioritize colors
over text: if an application (such as kolourpaint) offers both x-color
and text, the color is probably the intention, and the text may be
just a hex string for placing into a color text field.

Pick-to: 6.8
Fixes: QTBUG-134313
Change-Id: I6c19f1220712881d2057bc9758bbc8cbd9247c81
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 1750acc3921148b0ffc8f9f1421b87a2f5522a2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 19:39:34 +00:00
Eskil Abrahamsen Blomfeldt
1b119638ac Revert "Don't support subpixel positioning for color fonts"
This reverts commit fd9c9788f73cb088229701dd92443aa04005a4a3.

This change failed to consider the fact that color fonts may
also contain non-emoji characters and can be used for regular
text. In this case, it very much makes sense to support
subpixel positioning.

If needed, a more specific optimization can be made for emoji
characters later, but for now we just revert to fix the
regression.

Task-number: QTBUG-134626
Pick-to: 6.8
Change-Id: I07fece03d02b62811c2def26c19c5225a08a0037
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit e72b2f19300f5a5e2b4c58926024ba332d65e75c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 19:39:34 +00:00
Marc Mutz
27f59f908d QUrl: add a link in a code fragment
Writing "adjusted()" would have produced a link automatically, but
since an argument is present, the function name is not a link. Add it
manually. Omit the parentheses and the argument, because that's how
QDoc renders "adjusted()", too (only the function name is the link).

Amends 1aa4ad46e4878072be9acb8389572e7f9e8198df.

Pick-to: 6.8 6.5 5.15
Change-Id: I350a277f91e486256ca014e554beea3348b6ca96
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 39aac934387afe3b50c1dff4c739080202a7a4df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 19:39:34 +00:00
Giuseppe D'Angelo
df8ba5c184 QJUnitTestLogger: include what you use
Adds a missing include for QElapsedTimer.

Pick-to: 6.8
Change-Id: I3dbc19eb38bb44cae1e38a0c72981a14bc571cd5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4a3e56ee87180be5bf60011c882ea411b66fc2f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 19:39:33 +00:00
Marc Mutz
af6a417acb QTriangulator: make a primeForCount() precondition explicit
Coverity complains that the binary search algorithm can yield high =
32, which, when passed to primeForNumBits(), will overflow
prime_deltas[]. This is true, for negative 'count', or, more general,
if the MSB of 'count' is set.

Add a Q_ASSERT(count >= 0) to inform Coverity (and other readers of
the code) that this function is only expecting non-negative arguments.

Amends 4adf5e1a9ef4fe78f4b70b7462943246903f4f11, which didn't fully
solve the issue, at least not as far as Coverity is concerned.

Pick-to: 6.8 6.5
Coverity-Id: 11295
Task-number: QTBUG-134543
Change-Id: I994dd1d1850c6644188a9fc0b83973614dd51e6b
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 536cd1ce20a59e4daaf3a09c115f2dc5ad9cbf91)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 19:39:33 +00:00
Michał Łoś
4ac20b3e5a Pass VxWorks touch ranges via environment variable
Some VxWorks touch device drivers return improper value of min and max
ranges in both axes (both 0 for both axes). This makes any touch point
position equal to (0, 0), making touch unusable in Qt.

[ChangeLog][Platform Specific Changes][VxWorks] The user can now
override touch ranges that the driver returns, by setting the
new parameters "rangex" and "rangey" on the environment variable
QT_QPA_VXEVDEV_TOUCHSCREEN_PARAMETERS with comma-separated
min and max touch ranges for X and Y axis respectively.
For example, add rangex=10,815:rangey=15,1024

Task-number: QTBUG-115777
Change-Id: I4f4aba7ee66e76b80438888697f84c4db9896c3d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 276ccda2f3e96984b392c0429a5da8b804baacdf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 19:39:33 +00:00
Alexey Edelev
01aff4a1c3 Avoid using the PROJECT_VERSION when accessing the HostInfo package variables
The related functionality meant to be enabled by BuildInternals, which
makes the lookup of the pre-defined HostInfo version based on either
calculated or pre-defined INSTALL_CMAKE_NAMESPACE.

The PROJECT_VESION(_MAJOR) meanwhile is hardcoded by the current Qt
repo, which is not necessary aligned with BuildInternals/HostInfo.

Pick-to: 6.8 6.5
Change-Id: I61052c93ce2d6ee3c6d8025da2e078edcde48d0d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 56ec6b4843ff1e3763ad9cb608acfb21ea4db341)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 19:39:33 +00:00
Alexey Edelev
3627d0ed2d Make the HostInfo package lookup properly versioned
Avoid hardcoding the HostInfo package version, use the
INSTALL_CMAKE_NAMESPACE as the reference for the find_package calls.

If we assume that the package follows the versioning in the future,
we should consider the Qt version, to avoid any version related
issues.

Pick-to: 6.8 6.5
Change-Id: If84550ab82f8de51ff5af41c7f31838c4ed53a67
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a67c13d1a68db40d1c2e9f89bcc76aa244feb8d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 19:39:32 +00:00
Thiago Macieira
b758518896 JSON/CBOR: fix conversions from QVariant containing longs and qfloat16
[ChangeLog][QtCore][QCborValue] Fixed conversions from QVariant when the
variant contained long, unsigned long, or qfloat16.

[ChangeLog][QtCore][QJsonValue] Fixed conversions from QVariant when the
variant contained long, unsigned long, or qfloat16.

Pick-to: 6.8
Fixes: QTBUG-134756
Change-Id: I08d069dd639c0fc5a15afffd4067762ec94d606d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 895b1c0ab358189dd3d7330207bbc69e36427350)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 16:05:25 +00:00
Thiago Macieira
469c071d69 QVariant/QMetaType: fix conversions to/from qfloat16
Needed to make some conversions explicit, since you can't assign to a
qfloat16 from double.

[ChangeLog][QtCore][QVariant] Implemented converting of qfloat16 to and
from the other numeric types, text conversions to and from QString and
QByteArray, and conversions to and from QJsonValue and QCborValue. This
should make qfloat16 behave the same as float and double.

Also flip the order of arguments in one of the addComparePairs(): left
side is actual, right side is expected. I noticed on the copy & paste
to do the qfloat16 above it.

Pick-to: 6.8
Task-number: QTBUG-134756
Change-Id: I6a6c469d21746a07c18efffd6b3b961c73c0e2f2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a4daf4939644ea3a087a8c03b1ec962e2e4defa8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 16:05:24 +00:00
Thiago Macieira
f754cd0ce9 QVariant: use QMETATYPE_CONVERTER_ASSIGN_DOUBLE to convert from QCborValue
No-op change. All this does is explicitly wrap the right side of the
expression in a double() function-style cast.

Pick-to: 6.8
Change-Id: I84bc14bf75b4d0a046dcfffd19f318eaf7fe0e9f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit ab45c44fb5471cef907334a1f6d7dbad279dd707)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 16:05:24 +00:00
Thiago Macieira
d0665d2628 tst_QVariant: overhaul the conversion-comparison tests with templates
This makes the tests more exhaustive than they were, with far less
repetition. Also adding the testing of conversions for which we don't
have a toXxx() getter, because those exercise different code paths
inside of QVariant, and yet should produce the same result.

Pick-to: 6.8 6.5
Task-number: QTBUG-134756
Change-Id: I99664a53da674bcbd992fffd5f290cfe51259d5b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 42e0f9811095fc73c5c1209632247446e6229b3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 16:05:23 +00:00
Safiyyah Moosa
1f6346df1c Doc: Mention how devicePixelRatio tracks changes
Currently the QWindow::devicePixelRatio() documentation mentions that the device
pixel ratio can change, but it does not explain how to track the changes.
This patch adds that the QWindow instance receives the event of type
QEvent::DevicePixelRatioChange when the device pixel ratio changes.

Fixes: QTBUG-128182
Pick-to: 6.8
Change-Id: I2107015a07f30167c9f7324959b47ada0a75988d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ada114f8b37b62fe80332105507b1afc20424aa6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 15:11:44 +00:00
Mårten Nordheim
657ccdab53 Mark QHttpNetworkConnectionChannel as final
To suppress clang-tidy's
bugprone-pointer-arithmetic-on-polymorphic-object
because we store a dynamically allocated array of
QHttpNetworkConnectionChannel objects in QHttpNetworkConnectionPrivate
and index into this all over the code.

Pick-to: 6.8
Change-Id: Ibcdf7c8acc4a57eaf36bca3719733655053ac818
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 930dfd11dd7d8a0135c5d80d047b95bb8a55cbcd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 14:25:32 +00:00
Alexey Edelev
3b8f6bb3d6 Swap sending of SETTINGS ACK frame and emitting the signal
This allows API users sending the HEADERS and DATA frames after the
SETTINGS ACK right from settingsFrameReceived slot, and keep the
expected frame order.

Pick-to: 6.8
Change-Id: I7900e786074d1d534c2e14f00e2aedf8dbb3a9d9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d3292dbeb60cc4f13be06e07a7408a0d0817975d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 09:55:05 +00:00
Mårten Nordheim
70f13cfbb1 tst_QLocale: Fix failing test on Norwegian Bokmål
It was failing because making it latin-1 turned it into:
"Norwegian BokmÕl, Latin, Norway"

While we expected:
"Norwegian Bokm\xE5l, Latin, Norway"

Amends e323d46cdaecffebb3f9fa55934e4eb4868611cf.

Change-Id: I55fe21331d1cb3abd66780e103aee8b603509818
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d359035c804021f59da70a75d962bfeafd320a71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-21 09:52:20 +00:00
Alexandru Croitor
b6ab8c113d CMake: Fix dbus and vk headers to be excluded from doc generation
Before this change, if someone called ninja Gui_generate_docs, it
would implicitly depend on sync_all_public_headers -> Gui_sync_headers
which would generate dbus headers.

This caused trouble with the new 'build doc tools from
qttools/dev/HEAD' approach, because an older pre-built dbus tool might
be passed a newer option when integrating a qtbase change that passes
the new option.

To avoid that, we now filter out the dbus headers from the list of
headers that should be processed by syncqt when building a
documentation target.

We do the same for the qvkgen generated headers.

This also removes the dependency on the ${target}_sync_headers target,
which means there is a potential issue when someone manually calls
`ninja sync_all_public_headers Gui_sync_headers` or something like it,
which would spawn two syncqt processes that access the same files
concurrently. This is an edge case that should not happen, but if it
ends up happening, we will have to implement some kind of lock file
mechanism.

Pick-to: 6.8
Fixes: QTBUG-134672
Task-number: QTBUG-128730
Change-Id: I9061f9495e2faa77744f5f5c0de8fedd362ba228
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit e7834e90f38891382f830da7700f00ebd81f21a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-20 21:34:18 +00:00
Christian Ehrlicher
04cb0a1b55 QLabel: don't cache scaled pixmap in QIcon
Caching the scaled QPixmap directly in QIcon is not a good idea
 - the cached pixmap might be used as starting point for a pixmap with
   another size so it gets blurry
 - QIcon has no caching mechanism to throw away unneeded QPixmaps after
   some time so the memory usage grows indefinitely

Pick-to: 6.9.0
Fixes: QTBUG-134930
Change-Id: Ic490ba15438a5cd07a555692e1d08cd1c211d005
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7a238e1225f49b81772516ed5d0a5a4f4f2e9268)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-20 21:34:18 +00:00
Mårten Nordheim
10e546f015 QNetworkAccessManager: don't resend non-idempotent requests
Requests that may lead to a different state when performed multiple
times (non-idempotent) should not be automatically re-transmitted if an
error occurs after we have written the full request.

We assume all custom methods are potentially non-idempotent.

[ChangeLog][QtNetwork][QNetworkAccessManager][Behavior Change]
Non-idempotent requests are no longer incorrectly re-sent if the
connection breaks down while reading the response.

Fixes: QTBUG-134694
Pick-to: 6.8 6.5
Change-Id: Ie8ba7828ce9375359c2326f06426fe1a1e568fef
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 4c9a4ecd358da3bf371a2441cccd8a66c86f2d3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-20 21:34:18 +00:00
Christian Ehrlicher
438516cf34 Windows11Style: Use correct font when a pushbutton has a menu
When a pushbutton has a menu, the menu indicator is drawn as the glyph
ChevronDown from Segoe Fluent Icons font. But later the font is not
reset so it's also used for the push buttons label. Since the icon font
has no valid glyphs for most of the characters, a replacement is used
but this might not be the one set for the pushbutton.

Pick-to: 6.8
Change-Id: I25c9b993450e7fe740addb153259f46b570ad8f7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 1c26a93b3d5cccd48d18ef2e8b1879c093c15794)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-20 21:34:18 +00:00
David Faure
b3f39fdd55 QRhi: fix data race on rubLogEnabled
* Handle QSG_INFO with the proper macro rather than with an invalid
  const_cast
* Remove the racy bool rubLogEnabled, read the atomic from the
  logging category directly

WARNING: ThreadSanitizer: data race (pid=427588)
  Write of size 1 at 0x7f89d5be2530 by thread T12:
    #0 QRhiImplementation::prepareForCreate(QRhi*, ...) qrhi.cpp:8863
  Previous read of size 1 at 0x7f89d5be2530 by thread T11:
    #0 QRhiResourceUpdateBatchPrivate::free() qrhi.cpp:9907

Pick-to: 6.8
Change-Id: Ied5171ea5bb97372daced8afe3ad894d49961069
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 3cc947e98f6237c86160589143e69c13c965e226)
2025-03-20 22:34:17 +01:00
Volker Hilsheimer
e0b17563b8 macOS a11y: collapse branches on identical condition
No need to test twice whether the row's columns array is initialized.

Pick-to: 6.8
Change-Id: Iead06f98ad421202bb4b71ae8efbd784ab3e87c1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit bd6e55c856e3c016048410f69919e443c71628bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-20 21:34:17 +00:00
Edward Welbourne
31d64b725d Correct case of QLocale::toString(double, ...)'s exponent separator
The function follows various libc functions in forcing the caller to
decide the case of the exponent separator, rather than allowing them
to opt for the case the locale normally uses. At Qt 6 I changed the
code reading from CLDR to not force the case, but didn't change
toString() to force lower when that was requested. Since the function
is documented to use lower-case when that's what it asks for, change
it to do what it says in its documentation. A caller who wants the
locale-appropriate case is thus obliged to call exponential() and scan
it for lower- or upper-case letters and select the right one of 'e'
and 'E' (or 'g' and 'G') to match.

This partially reverts some test changes made in
commit d5bb8d5150498dc059e8c17f224c66fb1a6bcf32 and expands the
QLocale tests to include ones matching those it changed. Fixed some
tests of QDoubleValidator that previously turned 'e' in the input into
'E' in the output; roughly alternate between changing the input to
match the output and the other way round, to be sure we exercise both
branches of the test.

Pick-to: 6.8 6.5
Task-number: QTBUG-134785
Fixes: QTBUG-134768
Change-Id: I5cffbd772a166efab9f7a5145289771c16be1658
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 05c8a48612be38a3c50bb5ed9daf1adfc221b9f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-20 21:34:17 +00:00
Edward Welbourne
cbce9bbcbf QDoubleValidator: don't assume the locale's exponent separator is 'e'
Some locales even have multi-character exponent separators. Scan the
actual locale-appropriate separator to determine whether it contains
any cased characters; if upper, prefer 'E' format, of lower prefer
'e'; but match the case of the input string in any case, when it has
case. Use 'e' when it has no case.

This doesn't currently change any test data, due to the bug that
QLocale::toString(double, 'e',...) uses the locale-appropriate case,
even if that is upper-case, contrary to its own docs. However, fixing
that bug breaks some of the tests of QDoubleValidator without this fix
to prepare for it.

Pick-to: 6.8 6.5
Task-number: QTBUG-134768
Change-Id: I0ba5bbdb507b8b6efdf6dc134c387fd3b4bcbeb2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8c88a077ccc8350a44fd97fd082dbc328b5dd11f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-20 21:34:17 +00:00
Magdalena Stojek
4caff4f064 Add translation lookup for mimetype descriptions
Extend QMimeType::comment() to support translations from .qm files as a
fallback when system-provided translations (e.g., shared-mime-info) are
unavailable.

Task-number: QTBUG-127004
Change-Id: I23060ab7a690c774691b2d96174e77a252c047ad
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2edb56977309daff0e2bb92bb5f64f8e0ac47da9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-20 18:15:18 +00:00
Christian Ehrlicher
753e0032dc Fusion style: Fix drawing mdi close button with dpr != 1.0
Fix the drawing of the SC_TitleBarCloseButton for fractional dpr by only
drawing two lines with a width of 2 instead 6 single ones as the single
ones might get disturbed due to rounding.

Pick-to: 6.8
Fixes: QTBUG-133834
Change-Id: I711cef885ed04fa695c24ee3e536697a0ebb3868
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9b35b477f7d4b37a33204c837309a0ede0101129)
2025-03-20 19:15:18 +01:00
Marc Mutz
d027d6d9da QUuid: fix qHash() on 64-bit platforms
The old implementation from Qt 5 time only affected the 32 LSB of the
result. The upper bits were completely determined by the seed, and the
seed alone. To see this, note that all except the seed are at most
32-bit values, and no shifting out of that range occurs, either.

Fix by just using qHashBits(), making sure (with a static_assert())
that QUuid has unique object representation (= can be compared for
equality using memcmp()).

[ChangeLog][QtCore][QUuid] Improved the performance of the qHash()
function on 64-bit platforms by populating all bits of the output
(was: only lower 32 bits).

Amends 55d68a16aafb93aa15bcdbd78892006777b6067a.

Pick-to: 6.8 6.5
Change-Id: Ibf67350f571889fd21e0acc82639c053c0d606b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit bb846a22c37dcb085829676d8feb7c203d21c886)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-20 18:15:17 +00:00
Marc Mutz
dd1349240f QSqlQueryModel: memoize roleNames()
The return value of this function is constant and some users (QML?)
may call this function often, so memoize the result of the function
instead of re-creating the QHash on every call.

Amends 40206a9f6d7635bb19305d1c8d74908808e3529e.

Not picking to Qt 5, because I'm unsure about the state of magic statics
there, and I don't want to take out the Q_GLOBAL_STATIC sledgehammer.

Pick-to: 6.8 6.5
Change-Id: I8311e93ea16982c82e8312e1e104d95ed062fe6b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 0d0a151e0d3a93bcd289751b56959a7655a049d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-20 18:15:17 +00:00
Giuseppe D'Angelo
4ee61659c3 tst_qeventdispatcher: include what you use
Pick-to: 6.8 6.5
Change-Id: Iae24fd5186946b6389e46b6bb69e393e353cb898
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ab1d9772aa6b29793b46e35aeec231c4ab655730)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-20 18:15:17 +00:00
Edward Welbourne
b15a288f09 Fix a double test to actually test double, rather than float
The macro body did not use its type parameter and both uses of the
macro in fact passed float for that parameter in any case, making the
so-called double version of the test actually a redundant clone of the
float form. This code is very ancient (harald, 2006).

Pick-to: 6.8 6.5 5.15
Change-Id: Ib6b7231c2737346784385473a94f3936b08aed33
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a52a979abd58bde5823b15324595776b1e2e62b9)
2025-03-20 15:55:11 +01:00
Magdalena Stojek
25e94ec4b3 QXmlStreamWriter: Ensure correct newline handling with auto-formatting
Previously, QXmlStreamWriter would incorrectly insert a newline before
the first token when writeStartDocument() was not used, while
auto-formatting was enabled.
This fix ensures that the first token is written inline without an extra
leading newline, while preserving expected formatting for subsequent
tokens.

To achieve this, two new flags have been introduced:
- didWriteStartDocument: Tracks whether writeStartDocument() was called.
- didWriteAnyToken: Ensures that at least one token has been written
before allowing newlines.

Fixes: QTBUG-28721
Pick-to: 6.8
Change-Id: I8be7e8fc6ac0e63304359d24c6c8372e5ba42bb4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c3295bd59cb1c3b858b6a858aba4481adeea209b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-20 10:18:52 +00:00
Giuseppe D'Angelo
a070cb5b91 tst_qregularexpression: include what you use
Pick-to: 6.8 6.5
Change-Id: I9e283a1065b37bb4c9d05468e75545d61762482b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b0895d1bd782626e7f6f64bc828271b2acfdf97b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-20 00:02:16 +00:00
Thiago Macieira
2d34d2ae9b QMetaType: suppress non-conversion content in convert()
Many of the conversions are implemented by macros and may include
conversion from a type to itself. We never call the convert() function
with those parameters, so that code can be safely suppressed.

Change-Id: I31904243ae8f750a3002fffd85f944305f0eee6b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 3e1d147986cfbce0da7cd0623aad5c1351642bc6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-19 22:27:07 +00:00
Tor Arne Vestbø
a833d93f59 Only default top levels to Qt::WA_ContentsMarginsRespectsSafeArea
When safe area margins are in play, such as on iOS and Android, or on
macOS in 6.8 and above when the NSWindowStyleMaskFullSizeContentView
styleMask has been set (manually or via Qt::ExpandedClientAreaHint in
6.9), then widgets with a layout will by default try to avoid the non-
safe areas.

This worked well as a safe default, ensuring widget applications filled
the entire window with its background color, while constraining the
layout of children to the safe area.

However, for those that explicitly want to put content in the non-safe
areas, by setting Qt::WA_ContentsMarginsRespectsSafeArea to false, the
story was a bit cumbersome, as we set the attribute to true by default
for all widgets. Meaning, any child widget put into the non-safe areas
that itself had a layout (such as a push button) would also need the
Qt::WA_ContentsMarginsRespectsSafeArea = false override.

We now default Qt::WA_ContentsMarginsRespectsSafeArea to true only for
top level widgets on creation, and leave it up to the user to manage the
attribute for the other use-cases, as they then need to be in full control.

[ChangeLog][QtWidgets] The Qt::WA_ContentsMarginsRespectsSafeArea attribute
is no longer set by default for non-top-level widgets. Top level widgets
still default to Qt::WA_ContentsMarginsRespectsSafeArea=true, so children
are laid out in the safe areas, but overriding the attribute for the top
level now allows placing widgets in the non-safe areas without also setting
the Qt::WA_ContentsMarginsRespectsSafeArea attribute to false for every
descendant widget that overlaps the non-safe area.

Task-number: QTBUG-133215
Pick-to: 6.8
Change-Id: I7b1d420d730ee896ec2fb61aadacd94473dc9681
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 16081f414d9cfd752c0e6152fbfa386bdbade7a4)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2025-03-18 20:11:34 +00:00
Marc Mutz
8287fb63ef QConcatenateTablesProxyModel: cache roleNames()
The return value of this function only changes when models are added
or removed, and some users call this function often (an earlier
version of QGenericItemModel did, possibly QML does?), so cache the
result of the function instead of re-creating the QHash on every call.

Use QAbstractItemModelPrivate::defaultRoleNames() so we don't need
an instance to get the base class' contents. Amend the comment in
QAIM::roleNames() asking to keep the two in sync.

Amends 5ffb9d7ae6d60fb370b79f8222dab7d7e628fa4f.

[ChangeLog][Important Behavior Changes][QtCore][QConcatenateTablesProxyModel] The
roleNames property is only updated (lazily) on addSourceModel() and
removeSourceModel() now (was: on every call of the function). If your
source models change their roleNames() dynamically, you need to call
invalidateRoleNamesCache() manually when they do.

Change-Id: I32edc93ff9ff7b252ca04f0d61b54b2244d0be48
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f3256e059f4e675f6e8d0cda710c3f979d84bc2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 19:45:58 +00:00
Marc Mutz
53d8347210 Q(Multi)Map: micro-optimize take()
Instead of the RVO-unfriendly¹

    auto r = std::move(it->second);
    erase(it);
    return r;

use map::extract(), if available. The RVO-unfriendly code now only
plagues old-fashioned compilers that, in 2025, didn't, yet, manage to
implement C++17 _cpp_lib_node_extract. The rest enjoys C++17
guaranteed RVO.

Amends 14090760a87f23509b7bb5ad846537c766cb44a5.

¹ theoretically, this code is eligible for NRVO, but embedded in a
  larger function like this, it won't kick in on most compilers.

Reported-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Pick-to: 6.8
Change-Id: I6654fa7f5ed80d07369eb6a2b37f1e82cd3aa7f0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit ed92f6c22fa59de1e536e1631053ae5565dcc0e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 19:45:54 +00:00
Laszlo Agocs
322520ad62 Remove 6.7 preliminary tag for QRhiWidget
Pick-to: 6.8
Change-Id: Iab453b9c0cf4f158f9ca13294dcd053fb35daf93
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 00155dabf354ce19c9eb381f351a6cf10788bf32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 19:45:54 +00:00
Karim Pinter
4a296214dd Add support for using static EGL libraries on VxWorks
On VxWorks there is dlopen, but the feature can be turned off for static
builds, so Qt can use EGL even when dlopen is not present. In
qeglplatformcontext.cpp dlsym needs dlopen feature. There is no dlopen
on windows neither on Integrity.

Task-number: QTBUG-134671
Pick-to: 6.8
Change-Id: I7ced5f53ca21a8b0ceb25732ed4b1dc6c0bb1300
Reviewed-by: Janne Roine <janne.roine@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3c919b6d0df486b7319faf8e4f366ab457e9f852)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 16:06:40 +00:00
Marc Mutz
34c5b311fc QFileSystemModel: memoize roleNames()
The return value of this function is constant and some users call this
function often (an earlier version of QGenericItemModel did, possibly
QML does?), so memoize the result of the function instead of
re-creating the QHash on every call.

Use QAbstractItemModelPrivate::defaultRoleNames() so we don't need
an instance to get the base class' contents. Add a comment to keep
the two in sync.

As a drive-by, port from the QByteArrayLiteral macro to _ba UDLs.

Amends 32b586864e3a4398da38c045f4ac0823c3dc3c57.

Pick-to: 6.8
Change-Id: If00b51e60930c974e6f8f928711dc78ba1f42b93
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fde232c855d59009503fe6dbaadd10346ab0830a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 16:06:40 +00:00
Giuseppe D'Angelo
c6b9d41f78 QElapsedTimer: port some restart() calls to start()
...when the return value is unused.

The code should already be safe from restart()'s preconditions: either
the timer is explicitly checked for validity before the call, or we can
reason about the code (in testlib, the functions are called after the
one that starts the timer, making it valid). Therefore, this is just a
"cosmetic" cleanup (and a super-micro-optimization), but Marc doesn't
want to think about the qtestlib changes and says to pick it all the
way, "just in case".

Pick-to: 6.8 6.5
Change-Id: I73cf287ce1314fc3626734ec64ddf5884afe3383
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit baffc8e47df15190cd85705099698a72e2bdbfa0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 16:06:40 +00:00
Giuseppe D'Angelo
46c9c90ec4 QNetworkAccessManager: protect more QElapsedTimer with isValid() checks
It might be redundant, but I can't definitely prove that these timers
are already started by the time we call elapsed() or restart() on them;
I "just" think they are because the CI is happy with the existing code,
even when adding assertions into QElapsedTimer.

As a precautionary measure, add more isValid() protections to QNAM code.
Also replace restart() with start() since the return value is unused.

Pick-to: 6.8 6.5
Change-Id: Ic64ab27116d8b1cb6c14e18dee79a15aa40844ce
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit dd7065616665e983349263bc5d600d764e164003)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 16:06:39 +00:00
Giuseppe D'Angelo
06b02f003e Fix calls to non-started QElapsedTimer functions
It's illegal to call elapsed() or restart() (sic) on a non-started
QElapsedTimer, so don't do that. In QNAM code, this has been observed by
adding assertions into QElapsedTimer, which then make network tests
crash. (While I am unable to run the network testsuite, this is
reproducible locally by running tst_QNetworkDiskCache::setCookieHeader).

The QTextStream test also calls restart() without a start(), but then it
calls elapsed()+start() which is the whole point of restart(), so amend
accordingly.

Pick-to: 6.8 6.5
Change-Id: I5cfe308f64b631b68b92843b409777a6b9176828
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 585471b138b195cb9020200cae760f119903df85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 16:06:39 +00:00
Tor Arne Vestbø
a6795882d8 windowflags manual test: Add option to force window recreation
Not all flags have an affect on an already created window, depending
on the platform and existing flags. Add option to force recreating
the window.

To aid debugging we also now log platform destruction/recreation events.

Change-Id: I7822cb58eaed51d72ed4ea3244f1f4113964cff7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit d56dbdd48cb6149b6697b1e695ee7e2de1151bee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 11:22:40 +00:00
Magdalena Stojek
3bce1f5946 QDom: Fix setAttributeNode() to properly replace existing attributes
This fix ensures that QDomElement::setAttributeNode() correctly replaces
an existing attribute with the same name. Previously, calling
setAttributeNode() with a new attribute of the same name resulted in
both the old and new attributes being present, violating the expected
behavior described in the documentation.

Fixes: QTBUG-15125
Pick-to: 6.8 6.5
Change-Id: Ibdda37a65f6e754d9f7e68e725d3438bbb2d9e0c
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 8c991345847e4b050d746a3efc28ddfa7115a130)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 10:50:08 +00:00
Marc Mutz
56976f8f08 tst_QConcatenateTablesProxyModel: extend shouldMergeRoleNames() with removal
We should also test removal, not just addition.

Amends 5ffb9d7ae6d60fb370b79f8222dab7d7e628fa4f.

Change-Id: I0842a6be6230362e2095f6c8b2b1ced230826c5e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e15ef96bcb59de31937881b8e901f94bcf98355a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 06:22:08 +00:00
Marc Mutz
89bc556da0 QSqlQueryModel: restore RVO in data()
The return of a default-constructed QVariant 'v' from three branches
invites NRVO, but most compilers won't let it kick in, because there
are two return statements that don't return 'v'.

Return an rvalue from each branch, so RVO is guaranteed (since C++17)
to kick in.

Amends the start of the public history.

Picking back all the way, since it's risk-free.

Pick-to: 6.8 6.5 5.15
Change-Id: I495885bee3ebba63c9e52640903c792011c1dee2
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 26ba78900d6dae5be24b83004f0f91db74ac95e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-18 06:21:52 +00:00
Christian Ehrlicher
091a54400b Fusion style: simplify CC_TitleBar paintings
The painting of the various icons for CC_TitleBar was done with the idea
to do some fancy alpha blending. But it actually was never used and just
makes the drawing code a lot more complex than needed. Therefore merge
the drawing code for textColor and textColorAlpha into one.

Fixes: QTBUG-131492
Change-Id: I89ac7bcf76f5264cb85cd8a00f0d74da4b85fd7c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 04e00e4e6c753ae7fb5ffa67be6db65257f6dd7d)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-03-17 19:11:49 +00:00
Wladimir Leuschner
ef2731cfc4 WindowsQPA: Adjust close button and hover color for custom titlebar
Adjust toe color of the close button to match the native color. Adjust
the hover text color for the close in light mode to match the native
behavior.

Fixes: QTBUG-133945
Change-Id: I2c9fafba9fee65f45f3878168b67b0d0a4b2a54c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit b24b9bba68821d4abb905d434e4b9442c65ff0c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-17 16:03:40 +00:00
Wladimir Leuschner
5641db1f9f WindowsQPA: Add default icon to custom titlebar
In case that no application icon was provided, use the IDI_APPLICATION
icon when Qt::WindowTitleHint was provided.

Fixes: QTBUG-133941
Change-Id: Ifb479a7056e0841215d525c2346938bda31fc1c6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 92a14cdc36c4b2c30e4c7dfe7568b1835cb63093)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-17 16:03:34 +00:00
Marc Mutz
0159e662ee ECMEnableSanitizers.cmake: fix GCC's "note: variable tracking size limit exceeded" when using asan
Upstream pull requests:
- https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/519
- https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/521

Says the commit message:

> Set the max-vartrack-size parameter to 0 (= unlimited) to avoid
> GCC's "note: variable tracking size limit exceeded with
> -fvar-tracking-assignments, retrying without" message you get when
> you compile with asan sometimes.
>
> This is reported¹ to speed up compilation, not slow it down.
>
> ¹ https://stackoverflow.com/a/75704837/134841

Pick-to: 6.8 6.5 5.15
Change-Id: I2489bbe3d3cb12cc52d7041499e38bb05c73aa3a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 39ec71237f79f1a1aecd278b8c610e70c9cd1c67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-17 15:46:45 +00:00
Alexey Edelev
1c708527fb Fix the condition that enables/defaults exceptions
Not sure why it worked at implementation time. But now it definitely
doesn't. We may check the EXCEPTIONS flag value, since it's the
equivalent of its presence/non-presence in the argument list.

Amends f98fd705290ac7bd9434552a07e38b775e6a6dbf

Task-number: QTBUG-118901
Change-Id: I9769b4921a2f72d31aea2b0bffd2511edd89f88f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7106e492bcbb4ce22bd735c56df459a9744f8c5b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-17 14:45:05 +00:00
Tor Arne Vestbø
516cce13e2 macOS: Preserve styleMask bits that we don't control when updating mask
We use QCocoaWindow::windowStyleMask to compute a new styleMask for the
NSWindow, based on the QWindow flags. However, some styleMask bits we
do not control in this function, so we need to preserve them in case
they were already set on the NSWindow, as otherwise we end up clearing
those bits. We did this already for NSWindowStyleMaskFullScreen, but now
we do it for all style mask bits we don't control.

This fixes an issue after QCocoaWindow::applyContentBorderThickness()
started calling setWindowFlags to control NSWindowStyleMaskTexturedBackground,
after the introduction of the Qt::NoTitleBarBackgroundHint window flag in
a1e6fed44964a3eb14045bf819d232d6cbad9f59 and then
bddc0198297828ba29e5cf4b39e07412a506a551.

The symptom was losing the NSWindowStyleMaskDocModalWindow style mask
for sheets or other modal windows with a QTabWidget in them, as that
widget ends up calling applyContentBorderThickness().

Fixes: QTBUG-134447
Change-Id: Ie3e9ca3ff14f84ce70438d3633bd283fb78b9e8c
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b90b473ee01bc3dfce88cce3d0f6ebb8ee0f7f57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 027624b4d59b65f9f8b4ccf23611d988c4633614)
2025-03-17 09:56:00 +00:00
Dennis Oberst
de02c59757 Fix mixed-type usage of qFuzzyCompare
When building Qt with a non-double qreal type, i.e.
QT_COORD_TYPE=float, mixing types on qFuzzyCompare will result
in ambiguities since only

        qFuzzyCompare(float, float)
        qFuzzyCompare(double, double)

are accepted.

Pick-to: 6.8
Change-Id: I4450516ffdf019ef8288aefd99a8e729c039bcd1
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d693a06522f660076afaa22eb7c677da290254d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:38 +00:00
Joerg Bornemann
b4177967dc QMake: Add ability to link against xcframeworks with Xcode
This adds rudimentary support for linking against xcframeworks. We can
now do
    LIBS += /absolute/path/to/some.xcframework
and this will end up in the frameworks section of the Xcode project.

This is required for linking against the FFmpeg xcframeworks we're
providing for iOS.

Pick-to: 6.8
Task-number: QTBUG-86387
Task-number: QTBUG-129651
Change-Id: Id212700d3554689160d23eafb26d99ac43b91062
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 1185f651e3ddfacdc828a3ddd3a40cf963f6407b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:38 +00:00
Bartlomiej Moskal
2054b00216 Android: Fix for opening Url with authority
It seems that even we correctly get Uri from FileProvider, we still do
not used it. This patch started to use Uri received from FileProvider.

Additionally, to avoid the issue of case insensitivity, we started using
QString directly instead of QUrl for the openURL method.

Fixes: QTBUG-133702
Pick-to: 6.9.0 6.8 6.8.3
Change-Id: Ia3b5b6f1562194af4211b9d5bf6a0d56b43c1b05
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 7ca68d0e2eb130f7d9f6c4d8cc8cbb0bbb068746)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Ahmad Samir
f92b172757 QCryptographicHash: centralize resizeForOverwrite() call
hashLengthInternal() already returns the size for each algorithm, so call
resizeForOverwrite() in one place. The hash lengths are specified by the
respective RFCs, so they have to be the same with/without OpenSSL
(confirmed by looking at the OpenSSL source code). So use
hashLengthInternal() in the EVP code paths and replace
result.resizeForOverwrite(EVP_MD_get_size()) call with an assert.

MD4_RESULTLEN isn't available when USING_OPENSSL30 is defined,
hashLengthInternal() returns 16 for md4, since MD4_RESULTLEN == 16,
just use 16 directly.

Change-Id: I5526d5e840b4882f3e5229df239b86924daee475
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 8786a930d1fee3ad330166a056c87684802733b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Thiago Macieira
db36fea295 qHash: break up the long line and add constexpr to the 1-arg catch-all
Amends 798c23189c7fb73629c1a98361cb1f50446fecf1.

Task-number: QTBUG-126659
Task-number: QTBUG-134683
Task-number: QTBUG-134690
Pick-to: 6.9.0
Change-Id: I7ab4e1f9170366c6495bfffd37b61336b10d4da6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit eb1342a3c261d5a4f10add5275c4167da3e8c941)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Andreas Eliasson
54cc218f46 Doc: Don't add padding to div that wraps the pre element
The current style adds padding to non-pre elements, such as any p or div
elements. The final html adds a wrapping div with a .pre class that
also gets padding added to it. This patch removes the padding from this
wrapping div.

Fixes: QTBUG-133710
Pick-to: 6.8 6.5
Change-Id: I6411dcda9cfed5f0f82d8bd9ea8dc809b1a3b4d6
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 9e61bd24659d7db1ac90fe3ce4f686c5cdb47874)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Bartlomiej Moskal
6e0d7c4020 Android: Update qtprovider_paths.xml file
The qtprovider_paths.xml is used by FileProvider[0]
The file defines the different file locations that can be used for
sharing content (with other apps). Previously it used only the
files-path type (for private files inside internal storage).

According: qstandardpaths_android.cpp file, we need much more here.

This commit adds more file types to qtprovider_paths.xml

[0]https://developer.android.com/reference/androidx/core/content/FileProvider

Task-number: QTBUG-133702
Pick-to: 6.9.0 6.8 6.8.3
Change-Id: I29c8eb3d00490e9127d0aa646b4c50643b5f51ac
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 4a54c32e6bd149b7b5086fc69180b2b92c5f33fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Thiago Macieira
23d97f7566 QDirListing/Win: improve performance by setting WinLnkType earlier
This line in QDirListingPrivate::checkAndPushDirectory() was causing a
call to GetFileAttributesEx() for every single directory entry when
recursion was enabled:

    // Follow symlinks only when asked
    if (!iteratorFlags.testAnyFlags(F::FollowDirSymlinks) && entryInfo.isSymLink())
        return;

That happened because QFileSystemIterator::advance() never set
QFileSystemMetaData::WinLnkType in knownFlagsMask, because QFSMD is
supposed to contain the information about what that .lnk was pointing to
and we don't want to read it unnecessarily.

However, we *do* when the directory entry is *not* a .lnk file. For
those cases, we can set WinLnkType in knownFlagsMask, which will cause
QDirEntryInfo::isSymLink() to return false without having to make
further system calls.

This change is fragile and this code deserves a bit of refactoring
(starting with getting rid of The Boolean Trap). All calls to either
fillFromFindData() or fillFromFileAttribute() are currently protected by
a .lnk filename check (all of them are either in this function or inside
of QFileSystemEngine::fillMetaData()).

Fixes: QTBUG-134699
Pick-to: 6.8
Change-Id: I87b19f89035bcd7e1c1ffffd14eac5fb5ac3e693
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 606ba105074cff21384e5da66f56f05d6ce49992)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Christian Ehrlicher
8d0f762177 Windows11Style: allow overriding of palette for QPush/ToolButton
Honor the palette set by the stylesheet when drawing a
QPush/ToolButton.

Pick-to: 6.8
Fixes: QTBUG-134497
Change-Id: I33b9cdf8d4999e1fccdae250543db541b66b3b7d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b0dec15d2d9f0b8f18c7b071a68bf0702dcc0c4a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Marc Mutz
ef60ea194e QSimplex: split QConcreteSimplexVariable from QSimplexVariable
The latter was used both as a concrete type as well as a base class,
driving Coverity nuts because it couldn't prove that we weren't
deleting derived classes (AnchorData) through a QSimplexVariable
pointer.

This is the same issue that Coverity took with QBrushData (CIDs
218724, 11772), and the solution is the same
(cf. 3bbc9e29ef59683351cf35c19a8bd4a030615c64):

Split the Janus-headed class into one that acts only as the base class
(and has a protected dtor) and one that only acts as a concrete class
(and we can mark it final).

The protected dtor in the former now statically ensures we don't
delete a derived class object through a QSimplexVariable pointer.

We don't need to modify AnchorData subclasses, because AnchorData
introduces a virtual destructor.

Coverity-Id: 390828
Pick-to: 6.8 6.5
Change-Id: I981c02e69af44ebacd4ba3aec76792e14eb15836
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit a405834ae694ef791d0b648b9a6bb65b67904731)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 13:33:37 +00:00
Lars Schmertmann
5ed1dcd1cc Fix usage of API functions on Windows 1607 (Build 14393)
* Windows Server 2016, Windows 10 LTSB 2016 and Windows 10 version 1607:
  SetThreadDescription is only available by Run Time Dynamic Linking in
  KernelBase.dll. See [1].
* According to [2] UiaRaiseNotificationEvent should be available on
  Windows Server 2016 but in fact it is not.

[1] https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreaddescription
[2] https://learn.microsoft.com/de-de/windows/win32/api/uiautomationcoreapi/nf-uiautomationcoreapi-uiaraisenotificationevent

Fixes: QTBUG-134075
Pick-to: 6.9.0 6.8 6.8.3
Change-Id: I3c4c733a4112a72b75f91f017a278dff2454e100
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a9e251332cbec0f64c9c085349836af7276c55d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-16 10:41:32 +00:00
Eirik Aavitsland
3e2fcff478 Doc: QPicture uses QDataStream, forward warning against untrusted data
Make this explicit, with a link.

Pick-to: 6.8
Change-Id: I8b8b64c88daacba43df1eecf5a347c0a89d837e1
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit ca26e804501d0fba45b703e281f48b3e90584335)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 17:01:56 +00:00
Thiago Macieira
2b5e55e161 QSettings/Doc: fix the information about what's case-sensitive and not
The docs didn't match the implementation.

Fixes: QTBUG-40283
Pick-to: 6.8
Change-Id: I054a22409aa8b2d198b0fffd6346b9859c55681a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 0de9b3f126efcaec4f4acc89b4b8d07a702d5a35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 17:01:56 +00:00
Giuseppe D'Angelo
c376c79b91 QTimeLine: do not restart() an invalid QElapsedTimer
It's UB (as per docs). Creating a QTimeLine and calling
setCurrentTime() will end up calling restart() without having called
start() first. Moreover, the return value of restart() isn't used,
so that's useless work.

Pick-to: 6.8 6.5
Change-Id: I53c80838f60fae406a44ffe2cf578c6c79cc9df4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a43453d9a2b12943cb4528a4249fce407a3318f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 17:01:56 +00:00
Marc Mutz
49f7778698 tst_QStringApiSymmetry: fix -Wunused-parameter
Amends 5fc1e9fa0c1925654412af5bf46ff95da99bc190.

Pick-to: 6.8 6.5
Change-Id: I399c74874e7824ac32c76f8b093123bd8ba07fdd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 871564434cb40bccc93f6497b62ea0ba16033f0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 17:01:55 +00:00
Giuseppe D'Angelo
275a47b92c sequential_erase: amend the predicate passed to erase_if
LWG4135 applies to the quoted Standard paragraph (and therefore
to our own code as well).

https://cplusplus.github.io/LWG/issue4135

Pick-to: 6.8
Change-Id: I05caa4cba001ecc473412c789738480d8eafa0c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 41ffc92f18a1a492720d432f00761e5574076060)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 13:45:03 +00:00
David Faure
e8de198ef7 Export QLoggingRegistry::instance()
so we can use Q_LOGGING_CATEGORY_WITH_ENV_OVERRIDE outside QtCore.

Otherwise clang++/macos says
Undefined symbols for architecture x86_64:
"QLoggingRegistry::instance()", referenced from:
QLoggingCategoryWithEnvironmentOverride::QLoggingCategoryWithEnvironmentOverride(char const, char const) in qrhi.cpp.o

As Thiago suggested, don't export the whole class to autotests,
export only the symbols they need. This simplifies the code.

Pick-to: 6.8
Change-Id: Id653385376a2a7604dddd2f520a0a90de5a541f6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8500343037950719119968a2d64e781a5635c658)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 00:48:02 +00:00
Eirik Aavitsland
b82a0cb15f Add Qt-Security tags to texture file reading code
According to QUIP-23

Pick-to: 6.8
Change-Id: I286f76e72a253b67b033a88d24bacdefb714e58f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 5ef9b4efe128b4c26845c9e1f19e3e9be429c19c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-15 00:12:41 +00:00
Morteza Jamshidi
74ef408290 Fix header generation issue with multiple qt6_add_win_app_sdk calls
Use EXISTS path insead of using find_path because find_path finds the
last target's generated headers, but we want to generate headers for
each target separetely.
Ammends 95c70bbc5bed906fc3d24eebfb00592d48b30a74

Fixes: QTBUG-124800
Change-Id: Ib2b9ceefbc6d11f9bf67fdc6ce25dea3366afe3d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 15932205522fc695168f79869fc7d78d65596739)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-14 10:48:01 +00:00
Marc Mutz
05cab5fdac Mark QSimplex{,Constraint} final, AnchorData non-copyable
These final touch-ups for CID 390828 make the code easier to
understand and safer, because more unsafe operations are now forbidden
(subclassing and copying).

Coverity-Id: 390828
Pick-to: 6.8 6.5
Change-Id: I2e43be71d8c3db59d95e69ec16c41c1547a2f180
Reviewed-by: Magdalena Stojek <magdalena.stojek@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 912388b3068e831e4fbd9b3c31a62c79ee91c72d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-14 09:11:43 +00:00
Marc Mutz
3d0243711e qhighdpiscaling: de-pessimize optional<> use
std::optional::value_or() should not be used when its argument is a
non-trivial type, because the argument is created and destroyed
independent of whether it is used in the end. In this case, we don't
even need an optional, because parseScreenScaleFactorsSpec() takes
the output of qEnvironmentVariable() (not -OptionalString) as-is, so
we can just drop the unneeded optional-(un)wrapping.

Since this patch apparently removes the last user of
qEnviromentVariableOptionalString(), mark that function as
[[maybe_unused]]. Outright removal may cause cherry-picks to fail,
so will come as a follow-up.

Amends 4d1f13f3549a73f5ca4e64dac9137e83138080fa.

Pick-to: 6.8 6.5
Change-Id: Ic2bb8a3aa8e946b957047ff4faf48c4082fc9c01
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit bee49bde04777eae348aead0abc3212fa945c0ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-14 01:14:08 +00:00
Marc Mutz
52b20a1351 QImage: introduce a class invariant that format() is in-range
Coverity complains that image.format() is used to index into
qPixelLayouts[] when it may be NImageFormats.

Most code paths (e.g. QImageData::create()) defended against that, but
e.g. QImage::reinterpretAsFormat() did not (at least not overtly), as
didn't some of the backend functions.

Add checks, document the invariant on 'format' and assert it in
QImage::format().

If this doesn't convince Coverity, we'll need to turn qPixelLayouts[]
into a function, so that it can defend itself against out-of-bounds
access.

Pick-to: 6.8
Coverity-Id: 390711
Coverity-Id: 390720
Coverity-Id: 390758
Change-Id: I29431193face3cae8be56f01da8dced19c3abb38
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit a2e60ebee3737548d1be14fdbb39b08c515ae602)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-13 21:09:31 +00:00
Thiago Macieira
cd395a7999 3rdparty: update TinyCBOR to v0.6.1
[ChangeLog][Third-Party Code] The copy of TinyCBOR in Qt was updated to
0.6.1.

Manual conflict resolution for 6.9:
- worked around 34f60877bdb54786c62fd1bf5b44a81430aa411f not having
  been picked to older branches

Pick-to: 6.9.0 6.8 6.8.3 6.5 5.15
Change-Id: If5d5ef6220874ae8858efffd1712a567597b6317
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7df128675a22391bc3ade2a45b558bc38eee1c67)
2025-03-13 07:58:02 +00:00
Marc Mutz
6d2421d812 QGraphicsAnchorLayout: make createSlack() return a proper struct
... instead of std::pair.

This is in preparation of breaking QSimplexVariable up into
QSimplexVariable (with protected dtor) and trivial subclass
QConcreteSimplexVariable, to statically ensure that we're not deleting
derived classes (AnchorData) through QSimplexVariable pointers (which
is UB, and subject to a Coverity complaint).

This is basically the same program we did for QBrushData, culminating
in 3bbc9e29ef59683351cf35c19a8bd4a030615c64.

This second patch modernizes the code a bit and, by scoping the
variable holding the return value of createSlack() tighter, allows the
use of auto and therefore isolates the code from the changes in the
final patch of the series.

Pick-to: 6.8 6.5
Coverity-Id: 390828
Change-Id: I15b51a3118c7ef33e8351a3e198abaebf4300d61
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 3aa431e3fe42d7eb943f6b9920ad47b074856abe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 23:52:00 +00:00
Marc Mutz
e02348117c QSimplex: scope iterators tighter in for loops
This is in preparation of breaking QSimplexVariable up into
QSimplexVariable (with protected dtor) and trivial subclass
QConcreteSimplexVariable, to statically ensure that we're not deleting
derived classes (AnchorData) through QSimplexVariable pointers (which
is UB, and subject to a Coverity complaint).

This is basically the same program we did for QBrushData, culminating
in 3bbc9e29ef59683351cf35c19a8bd4a030615c64.

This first step scopes iterators of for loops in the for-loop, and, as
drive-bys, makes them use auto and the shorter cbegin()/cend(), so
they fit into a single line, and fixes the extra {} around single-line
bodies (only in touched lines).

Pick-to: 6.8 6.5
Coverity-Id: 390828
Change-Id: I439e0a10ebb316a33e92c42c255ee209139d47a2
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 49809c6e41101a11b5a264c7e8b4d4ce05d3c04a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 23:51:54 +00:00
Marc Mutz
18f0dd9bdf QCssParser: statically verify QCssKnownValue arrays
Port from explicit array sizes to implicit ones, followed by an
explicit size check. This prevents mistakes where, due to missing
initializers, value-constructed trailing elements cause lower_bound()
to be called out-of-contract, such as the one
5d8f815e101da3ae9cd6a666cc097853f52b21da fixed.

Also statically verify that the arrays are sorted. This doesn't work
on GCC < 10, e.g. QNX, so guard it the same way we did in
qhttpheaders.cpp in e3fe3997ebd2baaafdfa7aa3c1eb95e8048268f8.

Task-number: QTBUG-103721
Pick-to: 6.8 6.5
Change-Id: Ia55149102013fa4e1619be68a69bc52b46e0f006
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ddf69669d39919b20a2710211911587353fa3dce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 23:51:53 +00:00
Alexey Edelev
8909279d3e Ensure optional_arg is reset in qt_internal_add_global_definition
Othewise there is a risk that variable is taken from other scopes.
(Random finding).

Pick-to: 6.8 6.5
Change-Id: I2517adec5d82639e95ac2758633109413811cf9a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6685da4ec9e3b1eb8a09052c3abb2d614f96d7cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 21:55:31 +00:00
Kai Uwe Broulik
66a10a141e QTabWidget: Draw base for corner widget only if QTabBar::drawBase
QTabBar draws PE_FrameTabBarBase only when drawBase is enabled,
so QTabWidget should honor this as well.

Otherwise, there will be an awkward line below the corner widgets
but not the tab bar when disabling drawBase on the built-in QTabBar.

Pick-to: 6.8
Change-Id: I7621476d66c3580282846dc924cd0b3700ce250f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit d28881fa335f20947b0329bc8f537bf7b577a257)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 20:37:09 +00:00
Marc Mutz
4a352937e3 Long live Q_PRE/Q_PRE_X!
As decided with lazy consensus on the development ML¹, we'd like to
separate precondition checking from internal consistency checking.

Add a new Q_PRE/Q_PRE_X macro for the former, to leave Q_ASSERT/_X for
the latter.

As requested in review, modernize Q_PRE_X vis-a-vis Q_ASSERT_X by
skipping the `where` parameter (defaulting it to Q_FUNC_INFO).

Added as undocumented API, for now, to pick back to all active
branches without actually promising semantics different from Q_ASSERT,
a change that, realistically, will only happen for 6.10 at the
earliest. But by making the macro available to all active branches, we
avoid conflicts when picking changes back, and the change is rather
risk-less.

Apply to QStringView, to have at least one user.

¹ https://lists.qt-project.org/pipermail/development/2024-August/045588.html Items 1-3.

Pick-to: 6.8 6.5
Task-number: QTBUG-98965
Change-Id: Ia04248a64c8feba80cce10f8f5cbde580436db88
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit eb3df4edbc0ca04a892728e54962ad0daef4a78e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 20:07:36 +00:00
Thiago Macieira
97b41af2a2 QThread/Unix: split the destruction of the exiting thread's QThreadData
As noted in the comment, we had a chicken-and-the-egg problem with
plugins and the event dispatchers: we need to destroy the event
dispatcher when plugins are still loaded (otherwise we could and did
crash) but we also wanted the QThreadData to exist when the plugins
unload.

The solution for that is to split the work: destroy the event dispatcher
first, then unload pugins, then destroy the current thread's
QThreadData. On ELF systems, this is guaranteed to work because we set
the init_priority to call destroy_current_thread_data() to higher than
QLibraryStore. In other systems, it's a best effort with dynamic
libraries and not guaranteed at all with static builds (don't even
report bugs).

Fixes: QTBUG-134080
Fixes: QTBUG-133861
Task-number: QTBUG-132697
Task-number: QTBUG-102984
Task-number: QTBUG-132381
Pick-to: 6.9.0 6.8
Change-Id: Ifaa28bb87338f4117d51fffdf721da68c0762e5a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 6763e25cbc16cf8c54ab9b1ef97030aab9bb0eec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:35 +00:00
Lucie Gérard
5fb7e0ccbb Update licensing of files with infrastructure type
A QUIP 18[1] update sets git files, REUSE.toml and licenseRule.json
as infrastructure type files. They are licensed with:
LicenseRef-Qt-Commercial OR BSD-3-Clause

[1]: https://contribute.qt-project.org/quips/18

Pick-to: 6.8
Change-Id: Ia7b9ae097ff80bd184256e0b7efa0dd7cfa63def
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e70d7e611e3f3a02c56ae60001edad046a34fc62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:35 +00:00
Shawn Rutledge
ed75628c37 Mark HTML, CSS and Markdown parsers as security-critical
Pick-to: 6.8
Task-number: QTBUG-134508
Change-Id: Ib973b9344a19fa2f8c79e2a2ceddf530d9ab62cd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2a85bdc77a5822dc228374a5d18bc416b7b1820c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:34 +00:00
Wladimir Leuschner
a3fb8e9abc WindowsQPA: Add default window title to custom titlebar
In case that no window title was provided use the
QCoreApplication::applicationName when Qt::WindowTitleHint was provided.

Fixes: QTBUG-133942
Change-Id: Ieeff0ba97bd996225c6f83f691fc1c149e3d7172
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5d8c3a598588a950aa8dbab7a72cc5e6de7bd3a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:34 +00:00
Marc Mutz
e897b68239 qdrawhelper: (attempt to) fix Coverity warning about op being uninit'ed
Unlike in other cases of structs, Coverity doesn't say which field,
exactly, it considers uninitialized in `op` upon return from
getOperator(). Manual checking confirms that all fields are written in
all branches (and all configs, btw), with the following exceptions:

- src* fields are not written in QSpanData::None mode, but this branch
  is marked as Q_UNREACHABLE()

- `linear`/`radial` are only written in QSpanData::Linear- or
  RadialGradient mode, which means that their (unnamed) union is not
  written in Solid/ConicalGradient/Texture modes

Assuming it's the latter branch that trips Coverity, introduce a
std::monostate member, noGradient, to said union, and initialize it
Solid/ConicalGradient/Texture modes. This makes the union a kind of
optional, but without the churn of actually introducing a
std::optional<Union>.

The effect is that in those modes the active union member is now the
empty monostate, so static analyzers will not complain about `linear`
or `radial` being uninitialized (because they're not active members).

'noGradient' being the active union member should also help statically
and dynamically (ubsan, one day?) detect accesses to `linear` or
`radial` when they're not active. Before, I believe the first declared
of the two was implicitly active.

Amends the start of the public history.

Pick-to: 6.8 6.5
Coverity-Id: 11400
Change-Id: I743363cc06af3778f85c205bfb6880c696229f92
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 8492ba01ba3e3bdf717c9e7f40ddad412c297945)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 15:16:33 +00:00
Magdalena Stojek
72564afb5f Expand Qt XML documentation on behavior changes in Qt 6
Adds a more detailed overview of behavior changes between Qt 5 and Qt 6
in the Qt XML module. This update is based on multiple reported tickets
highlighting behavior differences, where users requested further
explanations.

Fixes: QTBUG-134503
Pick-to: 6.8
Change-Id: I2e25268c6de7fd7e3a0e0244b83bb2ba616ef60e
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 275396b013cf10fa647c3b6a262ae46f180621d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:46 +00:00
David Faure
b26e30e1b7 QKeySequence: tolerate spaces when parsing a key sequence string
Fixes: QTBUG-130063
Pick-to: 6.8
Change-Id: I0f0aff0ca0824cd1c9297cd18a1f5cf9a2a44951
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit ada885dfd55d5c386d04039babee43e49ccab5c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:46 +00:00
Lauri Pohjanheimo
598db6f4b1 SwiftShader sw check added to enable tests on hardware
On CI an Android emulator with SwiftShader software graphics
implementation is used. SwiftShader implementation is unable
to emulate this OpenGL functionality.

QSKIP the test if it is run in Android platform,
OpenGL and SwiftShader sw graphics implementation is found.

Task-number: QTQAINFRA-6333
Task-number: QTQAINFRA-6334
Pick-to: 6.8
Change-Id: I560aa796e7f364e645ebb41f89120673a0f59a5b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-03-12 11:21:45 +00:00
Marc Mutz
a069569ea2 QTextMarkdownWriter: reduce unnecessary relocations
Instead of a static constexpr QL1SV object (which force the compiler
to allocate storage and therefore causes relocations), use a mere
automatic constexpr object (which doesn't). There never was a need to
make this object static, as constexpr is enough to force the compiler
to constant-fold them.

Difference:
  qtextmarkdownwriter.cpp.o:
- 0000000000000000 l     O .data.rel.ro.local     0000000000000010 maybeEscapeFirstChar(QString&)::specialFirstCharacters
  0000000000000000 l    d  .data.rel.ro.local     0000000000000000 .data.rel.ro.local

See
  https://stackoverflow.com/questions/19067010/finding-where-relocations-originate/19338343#19338343
for the script to generate this output.

See https://www.akkadia.org/drepper/dsohowto.pdf Section 1.6 for why
we care.

As a drive-by, port from QL1SV to _L1 UDL.

Amends ca4774131b9b8ee40b4d7f5c1ba296af4700207f.

Pick-to: 6.8
Task-number: QTBUG-100536
Change-Id: I31e124962e03b8b40df9153b09f627e8e22a8119
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit db6f8821fcf0028f83b4c27c8de2399c99577272)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:45 +00:00
Marc Mutz
55fadd025b QCssParser: shrink indexOfId by half
All offsets fit into [0:255], so use uchar instead of short to store
them, cutting the storage requirement of the array in half (-86 bytes).

As drive-bys
- make the array constexpr
- fix formatting (only in touched lines)
- port from explicit to implicit bounds with explicit bounds checking

The latter has the advantage that we don't get value-initialized
elements appended silently, cf. 5d8f815e101da3ae9cd6a666cc097853f52b21da.

Pick-to: 6.8 6.5
Change-Id: I336f850a586fd2fde8f62c65223f547402fbaa75
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 67e9e2a7e2ee6a7687a5aa01214e70dffb6eb688)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:45 +00:00
Moss Heim
ba5e146082 Docs: fix typo
\l instead of \\l

Amends d3117e97014af029b2c117daef9695b87103ab25.

Pick-to: 6.8 6.5
Change-Id: I0b6aaef6de839f29e0671d382d4555f8ab0afe47
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7bec2f6b4278a6331d1991f32a8d8fc637c9c584)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:45 +00:00
Christian Ehrlicher
6cdae4ea3e QIcon: call qt_findAtNxFile for all devicePixelRatios available
QFile::addFile() was searching for '@N' - image file where N corresponds
to the devicePixelRatio of the QGuiApplication. Since we can have more
than one screen, all different devicePixelRatios should be considered.

Change-Id: I7c844e163c5b5ca8752d8461139d7abf39c2e8a5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9684691d51335362665e85ced591cffae3ea5360)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:45 +00:00
Eirik Aavitsland
9a8bc72b93 Add Qt-Security tag for ICC profile parsing
According to QUIP-23

Pick-to: 6.8
Change-Id: I7c7b24d8a2d0ca8ae0b330573839723497fdfd38
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 523973f16b378956d41a33f4d270e6aa70f025da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:44 +00:00
Eirik Aavitsland
2f3faf7c8e Add Qt-Security tags to gui image, icon and imageio files
According to QUIP-23

Pick-to: 6.8
Change-Id: I10d6109d2365e9252ab60f5c3bdfc8de2d606f15
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 5157ce7c59b704bd080908f24c6ccdf7cb585eeb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 11:21:44 +00:00
Mitch Curtis
bd2bc4087f Make dprgadget manual test directly openable in Creator
This avoids the need to run qt-cmake-standalone-test and then import
the test, as described in QTCREATORBUG-25389.

Pick-to: 6.8 6.5
Change-Id: Ie9694569c24dc0c714c2538819e7d9d8ff7e44e4
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit b35ea9b974c965c01cd0a8340a7885621e4413ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 06:07:48 +00:00
Aurélien Brooke
cf12826dc4 QArrayDataPointer: use Data::deallocate() instead of raw free()
Be symmetrical with the Data::allocate() in the constructor.

This is not strictly a no-op since we now call the exported symbol
QArrayData::deallocate() instead of inlining a free() call. However, it
allows future sized-free optimizations.

Pick-to: 6.8
Change-Id: I2ef00a897f56a32a0f1188f69f159834e6ca5b64
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 41c47fdd192cafa001b6e67defc314af5c1d6316)
2025-03-12 05:58:22 +00:00
Mikhail Paulyshka
1921783936 qsimd: perform RDSEED sanity check in case if available
Fixes: QTBUG-134538
Pick-to: 6.8 6.5
Change-Id: Iab51337b9b27ccf48a0e60c08cf14706112b6235
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1b8d08532227866409088c6c45e215acfbf33cc7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-12 05:58:22 +00:00
Marc Mutz
f249a5182f QMovableArrayOps::Inserter cleanup [3/3]: cut out the where middle-man
It turned out that we've been maintaining both displaceFrom and its
copy, `where`, in parallel.

This is not needed, so only maintain displaceFrom.

Pick-to: 6.8 6.5
Change-Id: I8c13420ae3fd284e362c4dd1f1b06d2847780c86
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit f18e8cebfcb9053bec3221f88a3944a781114530)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:32 +00:00
Even Oscar Andersen
ae145bd28f Add QAccessible::LocationChanged to QWidget
Issue the event when geometry has changed to match QML.

Task-number: QTBUG-115926
Pick-to: 6.8
Change-Id: I31d87a2b07c1cbdb31063bdbf146f21310103798
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c1fba2d4ee47d2ce69b56d69629cd13b1439a107)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:29 +00:00
Volker Hilsheimer
c90130a72d QDockWidget: fix documentation of the new dockLocation property
Follow the standard syntax for property documentation.

Amends cbd2f56c14159a1a566f4e423b910256724fdb6a.

Pick-to: 6.9.0
Change-Id: I3557eba1990b684a35ab70f95e7f8ccf33850537
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit df96b28f65ad0ba1094c756929cfcdd9f19e4529)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:29 +00:00
Marc Mutz
619af4198e QHttpHeaders: de-pessimize Private::replaceOrAppend()
All callers of replaceOrAppend() (present and future) pass an rvalue
`value`, so take advantage of C++17 guaranteed copy elision, take
`value` by value and move it into place.

Even for implicitly-shared classes, a move (pointer swap) is cheaper
than a copy (atomic ref-count upping/downing; ca. 100x slower than a
normal int).

Amends d8f6425fef1050525480afec662a417a7645c22e.

Pick-to: 6.8
Change-Id: Ia52a2ec2c079f515f92b0890e42669d4ba435c20
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 8761fa5b8bec2f9b80550523e824f4e3141aca49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:29 +00:00
Marc Mutz
5482f0d0a9 QQOpenGLProgramBinaryCache: split FdWrapper to fix a Coverity UNINIT warning
Coverity complained that mapSize was used in ~FdWrapper uninitialized
when the object was destroyed before map() had been called on it. This
is a False Positive, because in that case, ptr == MAP_FAILED, and we
wouldn't be reading mapSize.

But be nice and split the FdWrapper class into two, by creating an
object managing only the mmap() part of equation and returning it from
map(). The most-natural choice for such an object would be a
unique_ptr with a custom deleter, but that has built-in knowledge of
nullptr (ie. doesn't call the deleter on nullptr), which, at least
theoretically, is a valid return value of mmap() (the error case is
(void*)-1), so write a small struct ourselves.

Coverity-Id: 390668
Pick-to: 6.8 6.5
Change-Id: I43d635617bd26120cf402241bf59680fe63d071a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 1d2dda041a419740dff16dbb4addc6d93583f08d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:29 +00:00
Marc Mutz
a211cb81ee QUnicodeTools: collapse adjacent identical case statements
They were left in to for easier reviewing when the old function
pointer table was changed to this switch. In this second step, we can
now collapse adjacent duplicates into one each.

Pick-to: 6.8 6.5
Change-Id: I7b7fa8991817895a01c63251ab3b0ecc95b5756b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 455e0ff42a68849b8d76dd8fbac58a35fa2dc866)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:28 +00:00
Matthias Rauter
b330d8e06a Fix mistakes and inconsistencies in string overview
Amends 80b6f2e63dc537f419186585a528ff749f9ff739

Pick-to: 6.9.0 6.8
Task-number: QTBUG-133882
Change-Id: I8aa5f79838aba0b7fb73e1b884c1a1ceb96aec9d
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit fcde54148dc3ea433bdcaaa550676cd0ab368673)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:28 +00:00
Marc Mutz
5deee1e5ab QCssParser: attempt to fix Coverity OVERRUN issue
Coverity complains, for each findKnownValue() call, that "forming the
address of the element at index numValues of buffer start requires the
index to be no more than the number of elements in the buffer", citing
QCss::NumKnownValues (e.g.) as the out-of-bound index.

Since it's complaining about the initialization of `start` in
findKnownValue(), I can only assume that it is bothered by the `+
numValues` (which moves the pointer out of range) followed by the - 1
(which brings it back into range), so make sure we subtract 1 before
adding to `start`.

That array + numValues would be considered outside the array
(incl. one-past-the-end) is highly irregular, and, AFAICT, caused by
the arrays not storing the resp. "unknown" entry at index 0,
effectively turning the arrays into Pascal (base-1) ones.

Shot in the dark (and a sign of poor/overly-strict deduction
capabilities in Coverity, if this is actually fixing the issue), but
worth a try.

Amends previous fix attempt 204b6c99089bcf7893be326e7d0076402b7abf0c.

Pick-to: 6.8 6.5 5.15
Coverity-Id: 183557
Coverity-Id: 183559
Coverity-Id: 183560
Coverity-Id: 183569
Coverity-Id: 183573
Coverity-Id: 183574
Coverity-Id: 183579
Coverity-Id: 183584
Coverity-Id: 183585
Coverity-Id: 183586
Coverity-Id: 183589
Task-number: QTBUG-83817
Change-Id: I3ad1f744986fe3223571a919b8a537c544ef314c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 66081c52b5b4017ae141f8fa27bd082be1e79422)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:28 +00:00
Marc Mutz
97567dee25 Extend tst_QByteArray::replaceWithEmptyNeedleInsertsBeforeEachChar()
Add rows with needles and haystacks whole length is > 1 (to avoid only
hitting paths that use single-char matching).

Amends 5fc1e9fa0c1925654412af5bf46ff95da99bc190.

Pick-to: 6.8 6.5
Reported-by: Ahman Samir <a.samirh78@gmail.com>
Change-Id: Ie4c695f54d84cdb56b93fee6b7224d93faf00f75
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit b83f104889ecf79e9ff0f5724774736bd21416c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:28 +00:00
Marc Mutz
8af957a950 [docs] QString: fix link and formatting in the qPrintable() discussion
The old code used a `<QString>` to indicate an object of QString
type. I have not seen this pattern used elsewhere, so rewrite the
expression to say "call X on the QString" instead of "call
<QString>.X".

Also, the constData() link in the expression ('X' in the previous
paragraph) was unqualified, so resolved to QString::constData(), but
the result of toLocal8Bit() is a QByteArray, and it's thence the link
should point to. Redirect it manually whereever we fell into that
trap.

Amends the start of the public history.

Pick-to: 6.8 6.5 5.15
Change-Id: I2204522351976be0f045bfd60a30c82c9e784dd6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ab1ce95c8ce38683477373cf84ba5686ea00efed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:27 +00:00
Eskil Abrahamsen Blomfeldt
b6dd07382a Mark low-level text classes as security critical
These files process raw end user provided data and
apply structure to it, through layout and Unicode algorithms.

Extra care should be taken when reviewing changes to these
files.

Pick-to: 6.8
Change-Id: Iba86aec1a185bbbcd40aa2b8d4d0d839bb99ba0d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 2198cdc40630713670064334fb34dc2255980800)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:27 +00:00
Eskil Abrahamsen Blomfeldt
45135e303a Mark font code as security critical
These files process raw font tables from untrusted files.

Pick-to: 6.8
Change-Id: Ie7fbfb667984e2d003b343a2ce011ad0e5aa04d2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 6704e55a9c04014097cc2e90fd75b20ae5da56c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 19:41:27 +00:00
Marc Mutz
e1d0213011 QMovableArrayOps::Inserter cleanup [2/3]: mark most data members const
This makes explicit that the only thing that should be changing is
displaceFrom, which tracks the hole-filling process.

Requires rewriting of the dtor a bit, to skip the nInserts
modification.

Pick-to: 6.8 6.5
Change-Id: I1f0ce17cbeb171704f789624ad1be6ef70e58245
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 75df3a250d84a7e2680a8f229d11eec20b2d3ff0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:22 +00:00
Marc Mutz
431b52d03f QMovableArrayOps::Inserter cleanup [1/3]: inline displace()
Since the ctor is now the only caller of displace(), we can inline the
latter into the former, using ctor-init-list to initialize the
members.

Also fix decltype(bytes) to be size_t, which is what memmove(), the
only user of the value, expects, and ptrdiff_t * sizeof(T) yields
(found by GCC -Wnarrowing complaining).

Pick-to: 6.8 6.5
Change-Id: I3f93e28eebc6deefee8a182eb71a3b0958718ba0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 82d4a81df19fe9aff9d3b1790c2b371a3efc0a99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:22 +00:00
Kai Uwe Broulik
9566a199d4 QTabWidget: Guard QTabBar in documentMode
While QTabBar is created by the QTabWidget and therefore doesn't
need to be guarded, QTabBarPrivate::init calls QStyle::styleHint
which might result in QStyleSheetStyle querying properties on
the QTabWidget while its QTabBar isn't assigned yet.

Pick-to: 6.8 6.5
Change-Id: Ic832d3253c5dc54d8d718760c63f34f0b8bde000
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 61c2d3f10124dbf4c6ddb44bc9790431bd389567)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:21 +00:00
Laszlo Agocs
ec386cd2a9 rhi: vulkan: Double buffer the descriptor sets backing an srb always
This is almost always the case in a typical Quick or Quick 3D rendering
sequence, since there is almost always a uniform buffer, which is almost
always a QRhiBuffer::Dynamic buffer, thus triggering double (or triple,
whatever max_frames_in_flight is) buffering and using multiple
descriptor sets.

This breaks down e.g. when using a compute pipeline and a
texture for imageLoad/store in the srb. If the texture is rebuilt
between frame N and N+1, then in frame N+1 the srb sees that the
descriptor set needs to be rewritten, but that's wrong since frame
N might still be in flight, using that descriptor set.

From now on, pretend that an srb always needs double buffering,
regardless of what kind of resources it references.

Also drop unused code paths. The updateShaderResources function's
argument was never -1, for example, so no point in keeping that logic.

Pick-to: 6.8
Change-Id: If8abb42fd9a2de5aad59ab6ceab3c8086aebae68
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 30dc9ed13fcc2691ed656f6f36d419133856c8cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:21 +00:00
Laszlo Agocs
7d8b81a491 rhi: gl: Fix an srb tracking issue
Have two pipelines that are used with the same srb:

setPipeline(a);
setShaderResources(s);
draw
setPipeline(b);
setShaderResources(s);
draw

If this is repeated each frame, then on the second an subsequent frames
the uniforms for the program behind pipeline b will not be set,
i.e. the glUniformxx calls will be missing.

This is due to the pipeline's own srb tracking
(currentSrb/currentSrbgeneration) works: in the second frame
setShaderResources(s) for pipeline b will do nothing, since
the command buffer's tracked current srb is already s, and
also b's currentSrb is already s.

The problem remains hidden usually because Quick or Quick 3D
does not generate sequences like the above (same srb with different
pipelines).

Pick-to: 6.8
Change-Id: I56b962f0ba12370e0de7c87fb7178a0b9e4b0178
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit e9fa3e42444faec33a33f4c6ce673f08db2280eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:21 +00:00
Laszlo Agocs
fb69590c81 rhi: gl: Fix exposing 3D and array textures as load/store images
The expectation, based on what the other backends do, is that all array
layers and 3D texture slices are exposed (i.e., the whole texture).
Same for cubemaps (all six faces), that at least was in place
already.

This is what the odd-named 'layered' argument of glBindImageTexture
controls. Set it accordingly.

Pick-to: 6.8
Change-Id: If6808069dfc9f3df124e508e40abf8c3423289da
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 25394fab9a3a501311601e45af310b3949dff2c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:21 +00:00
Laszlo Agocs
ffc55b734d Add trusted content notes to QOpenGLShader(Program)
Pick-to: 6.8
Change-Id: I089044e6834ebbb992b36c898eb956959f430522
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit f9a625eb8c774643a8e8a5ff9548634e34bf4fe0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:21 +00:00
Laszlo Agocs
8dbeacbb5c rhi: gl: Specify 3D textures with mipmaps correctly
When used with load/store, it is already correct due to using
glTexStorage3D. On the other code path however, individually
calling glTexImage3D for all the mip levels requires adjusting
the depth for each level, as it is done for width and height.

Pick-to: 6.8
Change-Id: I440cc10303687b686d78da4c614da4325840803a
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit efc911aa58195d2538be7b0343154038f3a2c3b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:20 +00:00
Laszlo Agocs
982483f134 rhi: Add doc notes about security considerations
Pick-to: 6.8
Change-Id: Iee3ef375a5f08a0bac5fed2b45ff1d7a3b146dc5
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 8612bd8345deb77a5670d774abfc73479107faf5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 15:40:20 +00:00
Joerg Bornemann
7138834c91 CMake: Fix permissions of qt-internal-(strip|ninja).bat.in on Unices
These files should not have executable permissions.

Fixes: QTBUG-125534
Change-Id: I893d4d373ee098864b64200dc6c88b57d05d6209
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ba103a6fee8e66748e2f3c52ce9f9e19ff89a850)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 10:18:09 +00:00
Marc Mutz
93c37162af Simplify QLocale::formattedDataSize()
- Introduce symbolic constants for the magic numbers 3 (= log10(base))
  and 10 (= log2(base)).

- Add and use QtPrivate::log2i() instead of manual bit fiddling. This
  makes the two cases nicely symmetric now.

Amends 9d23aebb271ea534a66cb3aceb2e63d9a1c870d6.

Pick-to: 6.8 6.5
Coverity-Id: 474294
Change-Id: I657f34878bc3a9b67b03a4d014b91e6d4de31e13
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9fee7cdfcce00ce6500b8eebf67f4a6c91be98bd)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-03-11 10:18:09 +00:00
Cristian Le
477e9216f3 Make RunCMake compatible with CMake<3.18
Avoid using `cmake_language`.

Reverting commit:
67f97f5478

Pick-to: 6.8
Change-Id: I8311508c904cbc66aa663a0b62f861b7b056b526
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3617409325fb3757d9126e72d4b852fa571f42f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 10:18:08 +00:00
Marc Mutz
2886996de4 Don't leak memory when tst_QOpenGL::fboTextureOwnership() fails
Hold 'fbo' in a (const) unique_ptr instead of a raw pointer, so it is
deleted even if a following QVERIFY/QCOMPARE fails.

This shows that the leak (cf. QTBUG-134557) is not due to the test
itself.

Amends dcbb16a45212d263496df1e5875da6205e4f5f53.

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-134557
Change-Id: I2f854d5ff036b7ca5e51d2e9ecb1d04bf7a39a61
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit b615c477f6472f0e3935aea05c099966c1d3ef47)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 10:18:08 +00:00
Marc Mutz
b2feff382d tst_QOpenGL: don't leak 1399341 byte(s) [...] in 1439 allocation(s)
That's what asan reported for a run of this test executable.

Create `ctx` on the stack instead of the heap to fix the leaks.
For `fbo`, use a std::optional.

After these fixes, the test still leaks 64 bytes in 2
allocations. These seem to be QOpenGLSharedResourceGuards in a
QOpenGLFramebufferObject. Created QTBUG-134557 to track the issue.

Amends
- 68974d8e647febb80a47d9cf6ce9452f3ce4fa21 (fboHandleNulledAfterContextDestroyed())
- bb760d9514ed617ee8e7344152b3fa697b2c4171 (bufferMapRange()/bufferCreate())
- 0541516907da117c391b6c8d9820209673fcd9cd (vaoCreate())

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-134557
Change-Id: Icc318cd76b9f3ddf71bc294cb96d88485c42d7bc
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 7a1cd692e0b36acfc005332b50d7ef3e11b94e71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 10:18:08 +00:00
Tim Blechmann
b7ec18cfdb cmake: don't pass ftemplate-depth with clang-cl
clang-cl does not support -ftemplate-depth. so we should not pass it
when MSVC is defined.

Pick-to: 6.8
Change-Id: I7f411187c476fa275b677f96a19f782262dc4545
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 39015c049b3f39a27737236b6740f7f5038ab75b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 10:18:08 +00:00
Lauri Pohjanheimo
935d1d633c QRhi test renderToTextureArrayOfTexturedQuad unblacklisted
On CI an Android emulator with SwiftShader software graphics
implementation is used. SwiftShader implementation is unable
to emulate this OpenGL functionality.

Blacklisting removed. QSKIP the test if it is run in Android platform,
OpenGL and SwiftShader sw graphics implementation is found.

Task-number: QTQAINFRA-6330
Pick-to: 6.8
Change-Id: Ib0832f35b63540d57a273fc6dba1e310de917439
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-03-11 12:18:08 +02:00
Christian Ehrlicher
6f4ddfaef3 QFusionStyle: Disable SH_EtchDisabledText
SH_EtchDisabledText is not widely used in fusion style and where it is
used it
 - does not make any real difference for light mode
 - makes the text look like one missed the glasses

Therefore disable this hint for fusion.

Pick-to: 6.8
Fixes: QTBUG-134533
Change-Id: I42fc20349603cf610ee725802f1095008eafd183
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit c8338d8e77699d1b8d239a4cba30adf22f15acf2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-11 05:12:51 +00:00
Tim Blechmann
246c644622 unreachable: silence warning with clang-cl
clang-cl does not warn about return after unreachable, but would warn
about the unused variable after return.

Pick-to: 6.8
Change-Id: Ia0fcff4f536d51d56eb915a9130cc3f72437d8d1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1bdf5059ceae7b202f015728bf8817b644e2e5fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 11:13:59 +00:00
Marc Mutz
7ee176bcbe QUnicodeTools: reduce unneeded relocations
Turn the charAttributeFunction array of function pointers into a
switch. This has two benefits:

- The compiler now warns when we introduce a new QChar::Script value
  and statically forces us to think whether a new attribute handling
  function is needed.

- A table of function pointers requires relocations. A switch might
  not. GCC uses a jump table to implement this switch, jumping to
  distinct lea instructions fetching distinct function pointer values,
  and thereby removes relocations, while Clang actually forms a
  function pointer table and turns the switch into an indexing
  operation (with compiler-generated guards). I didn't check whether
  Clang's table actually requires relocations, relinfo.pl doesn't
  report any reductions, but it's become unreliable over the years,
  because it doesn't for GCC, either.

Difference:
  qunicodetools.cpp.o:
- 0000000000000000 l     O .data.rel.ro.local     0000000000000108 QUnicodeTools::Tailored::charAttributeFunction
  0000000000000000 l    d  .data.rel.ro.local     0000000000000000 .data.rel.ro.local

See
  https://stackoverflow.com/questions/19067010/finding-where-relocations-originate/19338343#19338343
for the script to generate this output.

See https://www.akkadia.org/drepper/dsohowto.pdf Section 1.6 for why
we care.

Instead of collapsing identical return statements from adjacent case
statements into one, keep the per-case return statements for now, to
aid review, and clean up in a follow-up commit.

Amends dd7d8304bbe599320b163b94e9a4ad9a6f35b740.

Pick-to: 6.8 6.5
Task-number: QTBUG-100536
Change-Id: Ic5b6bd29e3a3a88f0d194fa7d76272a4770b9840
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 74765ebe65b8b67b2d2bbe3f4fa3eb1879d030aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 11:13:59 +00:00
Marc Mutz
b173da88f4 QMovableArrayOps::Inserter: move the displace() call into the ctor
Coverity complained that ~Inserter() will access at least displaceFrom
and displaceTo uninitialized, which is correct, if none of the
insert() overloads have been called in-between. This is a brittle
construct, even though, currently, all users of the class comply.

To help Coverity (and other readers of the code) understand what's
going on, move the displace() call that creates the hole in the
container which the insert() overloads then fill from said overloads
into the ctor, original-RAII style (ctor acquires the hole, dtor closes
it, if needed). This means all fields are initialized in the ctor now.

This is safe, as displace() cannot fail by itself (just a memmove()),
but requires moving the (pos, n) (= hole) information into the ctor
instead. The displace() call in the insert() overloads now becomes a
read of its return argument, displaceFrom.

(Incidentally, that shows that we have maintained the same pointer
twice in the insert overloads, something we'll clean up in a
follow-up.)

In order to verify the insert() post-condition (ie. that we filled the
whole hole created by the ctor, or threw an exception trying),
continue to pass the count to insert().

As a drive-by, rename the insert()-overloads to insertRange() and
insertFill() to match the existing insertOne() function, and to better
express what their purpose is.

Pick-to: 6.8 6.5
Coverity-Id: 378364
Coverity-Id: 378461
Coverity-Id: 378343
Change-Id: I1a6bc1ea0e5506d473f6089818797b02d09ba13e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit aa8e8ffd321dc96650c11ebe3cd4017e7cc8edac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 11:13:59 +00:00
Lauri Pohjanheimo
e37e3d9045 Unblacklist tst_QRhi::RenderToFloatTexture and skip on Android-Sim
On CI an Android emulator with SwiftShader software graphics
implementation is used. SwiftShader implementation is unable
to emulate this OpenGL functionality.

Blacklisting removed. QSKIP the test if it is run in Android platform,
OpenGL and SwiftShader sw graphics implementation is found.

Task-number: QTQAINFRA-6332
Pick-to: 6.8
Change-Id: I241a2c6772291795d26b9c2a563f4f9412605cf6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-03-10 07:52:42 +00:00
Thiago Macieira
8e94b67ba1 CBOR/JSON: fix crash when comparing strings with different length
Amends 8e5ce9cd369230256045864d6fad38dbd8bee413, which introduced the
QtPrivate::equalStrings() call. At that time, equalStrings() had already
required equal lengths (see 1560e0161af70b5cf88a70e55c0b502612d433cd),
so no excuse.

[ChangeLog][QtCore][QCborMap and QJsonObject] Fixed bug that could
result in a crash or failing to find a entry in the map/object with non-
ASCII keys.

Manual conflict resolution for 6.9:
- Port from keyView() to key(), because the former is a 6.10+ feature.

Pick-to: 6.8
Fixes: QTBUG-133744
Change-Id: I6b0f8b0a2e47d3ef905afffda6c4c079814a0914
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 54daec43a041cb69cff31cbfd1dd0b7127e8ba87)
2025-03-10 08:52:41 +01:00
Giuseppe D'Angelo
8181c4868a Disable -Werror=tsan on GCC < 15
QGlobalStatic has a warning suppression for -Wtsan because of its
usage of std::atomic_thread_fence, which TSAN doesn't support.
That header is included in QtCore's PCH, and that triggers a GCC bug
that causes the warning to be emitted despite the suppression [1].

In a developer build, the warning turns fatal.

We could either disable PCHs in such a build configuration
(TSAN+developer-build+GCC < 15), or: simply make the warning non-fatal
on earlier compiler versions.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64117

Pick-to: 6.8 6.5
Fixes: QTBUG-134415
Change-Id: If80a4acdb1372d00804a60361f6c3d6893b96106
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a72077a88903fe532f6a749677eb4da4ea99f79f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 07:52:41 +00:00
Eskil Abrahamsen Blomfeldt
d7127c02ff windows: Fix rendering monochrome glyphs in color fonts
If we encounter a normal, monochrome glyph in a color font, we
go via the normal glyph rendering code path. But since we are
drawing into a color-capable glyph cache, we need to make sure
the image we draw has an alpha channel.

This was inadvertedly broken by the refactoring in
1b85143d217042876209794bf8d0361b7ce8834f, causing black
backgrounds on all such glyphs. Since the default font in Qt Creator
is a color font, it was noticed when upgrading this to 6.9.

Fixes: QTBUG-134473
Change-Id: Iee7eb73a5727324e2ff3bacc2d9ae45cb64fd0b9
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
(cherry picked from commit 54555755f8780e4e7c665a1502309da9fa807066)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 81bbbc3fc47e47b9cd77248bbaaf35477f562895)
2025-03-10 07:52:41 +00:00
Juha Vuolle
7ad9a2d391 qtwasmserver to serve assets from the provided path parameter
qtwasmserver accepts a positional path argument which tells where to
serve the assets from. The argument wasn't actually used, and this
resulted in always using the cwd.

In addition add a check for the path directory existence. Otherwise
this becomes only visible as a 404 Not Found error.

Amends: 156e5c8b690d01ad3043d2163168c4ea3608a046

Fixes: QTBUG-134393
Change-Id: Iacfafe8a2fb2409169b09a17dbc9ffed0ad16fdf
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit fcada7c5c395a7006ecef184c3ca43fff1023616)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 07:52:41 +00:00
Tim Blechmann
aca60117ee QWindows11Style: fix clang-cl warnings
QRect QRect rect and tableView are not used and clang-cl warns about
that.

Pick-to: 6.8
Change-Id: I35ae933b437952c6748e4b09d139cc06c9ce33cb
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 1d83bffb291192f04db6f33313291147472f7014)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 04:53:49 +00:00
Thiago Macieira
87c790851e tst_Q*Application: avoid race conditions during exitFromThread
Amends commit bfbd1a281dd00c47df315c06e895bf5d53cd8764. I've noticed
this on my Mac, because the main thread crashed at the same time as the
exitFromThread() thread was exiting and was running ~QLibraryStore:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x106)
  * frame #0: 0x00007ff8020533be libobjc.A.dylib`getMethodNoSuper_nolock(objc_class*, objc_selector*) + 47
...
    frame #19: 0x0000000103839694 QtCore`QCoreApplication::exec() at qcoreapplication.cpp:1454:32
    frame #20: 0x0000000101fc94ea QtGui`QGuiApplication::exec() at qguiapplication.cpp:1993:12
    frame #21: 0x0000000100004b59 apphelper`exitFromThread(argc=1, argv=0x00007ff7bfeff318) at apphelper.cpp:50:5
  thread #8, name = 'QThread'
...
    frame #11: 0x00007ff8020c4f94 dyld`dyld4::APIs::dlclose(void*) + 178
    frame #12: 0x0000000103e82476 QtCore`QLibraryPrivate::unload_sys(this=0x0000600001254160) at qlibrary_unix.cpp:252:24
    frame #13: 0x0000000103e793fc QtCore`QLibraryPrivate::unload(this=0x0000600001254160, flag=UnloadSys) at qlibrary.cpp:561:36
    frame #14: 0x00000001039740c8 QtCore`QFactoryLoader::~QFactoryLoader(this=0x00000001029e5e70) at qfactoryloader.cpp:438:21
    frame #15: 0x00000001039745e9 QtCore`QFactoryLoader::~QFactoryLoader(this=0x00000001029e5e70) at qfactoryloader.cpp:425:1
    frame #16: 0x0000000101eb723c QtGui`void std::__1::__destroy_at[abi:sn180100]<QFactoryLoader, 0>(__loc=0x00000001029e5e70) at construct_at.h:67:11
    frame #17: 0x0000000101eb7209 QtGui`void std::__1::destroy_at[abi:sn180100]<QFactoryLoader, 0>(__loc=0x00000001029e5e70) at construct_at.h💯3
    frame #18: 0x0000000102046762 QtGui`QtGlobalStatic::Storage<QFactoryLoader, (anonymous namespace)::Q_QGS_piLoader>::destroyYourself(nextState=Destroyed) at qglobalstatic.h:61:9
    frame #19: 0x0000000102046736 QtGui`QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS_piLoader, (anonymous namespace)::Q_QGS_piLoader>::~Holder(this=0x00000001029e5e61) at qglobalstatic.h:83:9
    frame #20: 0x00000001020465d9 QtGui`QtGlobalStatic::Holder<(anonymous namespace)::Q_QGS_piLoader, (anonymous namespace)::Q_QGS_piLoader>::~Holder(this=0x00000001029e5e61) at qglobalstatic.h:82:5
    frame #21: 0x00007ff8022f4231 libsystem_c.dylib`__cxa_finalize_ranges + 402
    frame #22: 0x00007ff8022f4052 libsystem_c.dylib`exit + 35
    frame #23: 0x000000010000755a apphelper`exitFromThread(int, char**)::$_1::operator()(this=0x000060000175612c) const at apphelper.cpp:47:9

Pick-to: 6.9.0 6.8
Change-Id: Ib1c72c7975b247cc2d17fffd6c5de89a95c22dad
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e6a6757c1485d09a4b7a124d67260f06d8022fef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 00:14:29 +00:00
Thiago Macieira
e7edc43913 tst_Q*Application: debug a crashing application
Implemented for lldb and gdb. MSVC comes with lldb.exe (it doesn't work,
but maybe some day). I couldn't find out even how to install cdb.exe, so
that's left as a task for someone else.

Pick-to: 6.8
Change-Id: I9d93747476531d4cfd53fffddecc5b3339d2fd7c
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 0f9860618ff9d045c8371338274f633e38994e3e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 00:14:27 +00:00
Thiago Macieira
eaff6a7a03 tst_Q*Application: centralize even more the running of the helper app
Instead of having to make changes to both tst_qcoreapplication.cpp and
tst_qapplication.cpp.

Pick-to: 6.8
Change-Id: Ib451048e40b163c2c3a3fffdf7b39bcb28c9cccf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit b03921eb9fad7a71dc13d92af2e0e994fcc1ca67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 00:14:27 +00:00
Thiago Macieira
9e18d7ded5 tst_Q*Application: centralize the mainAppInAThread skipping
By adding a way for the apphelper to let the caller know that it must
skip this test.

Pick-to: 6.8
Change-Id: I750e7188b8f54cea7278fffd584f8fbf433f496b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 00a30f4312876f6f2919b6a47ff404d503255e2f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-10 00:14:26 +00:00
Marc Mutz
f2cc2c9074 QTriangulator: Q_DISABLE_COPY_MOVE(QInt64Set)
The class is unsafe for copy, as it would double-delete m_array,
and the move operations aren't implemented, either.

Found while fixing CID 11295.

Pick-to: 6.8 6.5 5.15
Coverity-Id: 11295
Change-Id: I8a615aaea3a8a4ad6abc8a5a9990c2dba5cfa65d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d429fceeebff24c112df3cf202e48bc338551554)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-09 13:16:28 +00:00
Marc Mutz
7f01e20c37 QHttpHeaderParser: remove unneeded relocations
Instead of a static constexpr QL1SV object (which force the compiler
to allocate storage and therefore causes relocations), use a mere
automatic constexpr object (which doesn't). There never was a need to
make this object static, as constexpr is enough to force the compiler
to constant-fold them. The lambda doesn't have access without a
capture, of course, but that is easily solved my moving the object
definition into the lambda itself.

See
  https://stackoverflow.com/questions/19067010/finding-where-relocations-originate/19338343#19338343
for the script to detect these issues.

See https://www.akkadia.org/drepper/dsohowto.pdf Section 1.6 for why
we care.

Amends 18aff2b424577b4560b32698038e9bcf68a54b88.

While at it, remove the static from the lambda, too. While it doesn't
cause relocations, it might, on weaker compilers, cause a thread-safe
static prologue to be emitted, and it's not needed, either.

Pick-to: 6.8 6.5
Task-number: QTBUG-100536
Change-Id: Iaede4d02a84ea2e49b42f3da93a77cb8391df5bb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f8647f8951207b66e3a2d7130fd5f75c3b14b5e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-08 02:55:16 +00:00
Edward Welbourne
a872a3a73c Narrow some #if-ery on QT_BUILD_INTERNAL to test more normally
Only a small early part of tst_QTimeZone::utcTest() actually needed
access to internal APIs, so only apply the #if-ery to that part.

Pick-to: 6.8 6.5 5.15
Change-Id: Ifebd70005f87bbef5d03fa24fe33134fd802e2e5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 92ec27e461ef3d3567cad11c5ca83368b985669d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-07 13:47:37 +00:00
Edward Welbourne
103a636e00 Turn a comment in a test into an actual check
Saying the code should produce no warnings is all well and good, but
testing it produces no warnings is obviously better.

Pick-to: 6.8 6.5
Change-Id: Iafa82027fde9ef6c7157b42ff3bbcccb3d097230
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 0b67d446566005e6409f816a6f223f26ef1994ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-07 13:47:31 +00:00
Edward Welbourne
26cda01b29 Distinguish system locale from corresponding CLDR-derived one
Previously it was displayed as if it had been constructed from its
language, script and territory; but it is distinct from the locale
constructed in this way and may produce different results.

Report the system locale as QLocale::system() with its language,
script and country within /*...*/ following it, instead of as
QLocale(...) with these as its parameters. Add a test of the debug
output, verifying that it has the form intended.

[ChangeLog][Important Behavior Changes][QLocale] Message logging now
distinguishes the system locale from the corresponding locale -
generated from its language, script and territory - based on CLDR
data.

Fixes: QTBUG-133922
Change-Id: Ic6fb137821fb7bf29d0f6446a46225cadd54b82a
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit e323d46cdaecffebb3f9fa55934e4eb4868611cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-07 13:47:30 +00:00
Marc Mutz
887c7a4b89 Revert "QString::replace: fix a performance regression"
This reverts commit 315210de916d060c044c01e53ff249d676122b1b.

The change was not correct. If the newly-inserted reserve() call
actually grows the string, and `after` aliased a part of the old
string, it will now reference deleted data, as the q_points_into_range
check now comes too late.

Change-Id: I2e016b8b90f74126dfc7126800b7b7fde96a091e
Pick-to: 6.8 6.7
Task-number: QTBUG-127549
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit d1539331dd813c83916a323f6cdc7fd6aacb0043)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-07 13:12:06 +00:00
Topi Reinio
f08721bb39 Doc: Fix incorrect \fn signatures
Several \fn signatures were either incorrect or missing qualifiers
required to make QDoc match the documentation with the declarations.

These were not caught in the CI when testing documentation builds due
to a bug in QDoc.

Task-number: QTBUG-134250
Change-Id: I7a4af11d9bc3687597b348cc2d4ee15212e0281f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b6a01d7d22583263a16242af604e74bbe694d766)
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2025-03-07 08:19:24 +00:00
Axel Spoerl
9c58b6ce1d Re-implement QPlatformTheme::requestColorScheme() in QGtk3Theme
QGtk3Theme remained unresponsive to programmatic color scheme changes,
after QPlatformTheme::requestColorScheme() had been introduced.

Add functionality to QGtk3Theme.
Fall back to qt_fusion_palette, when the requested color scheme isn't
supported by the current GTK3 theme (e.g. Adwaita-dark doesn't support
light mode).

Functionality has to be manually tested with the widget gallery
example.

Fixes: QTBUG-134022
Task-number: QTBUG-132929
Pick-to: 6.8
Change-Id: I1160c7afc1f1fcb6ec93d65ef54cb45a65a63863
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit 738c180c4f03bf82efce04dc4c751cd6eb0043c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-07 03:13:29 +00:00
Marc Mutz
d4e0f8ee11 QUrl: add a missing std::move()
The deslashified QString can be moved into place here.

Found by Coverity.

Amends 5e936b60fc921e21b8153a83113886a1de333b57.

Pick-to: 6.8
Coverity-Id: 477475
Change-Id: Ibdaae0a9acae56960e16d5a6fd77fc1e08036af0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 692f1a38a405b8bbef961b64d2577b4fbb2a03f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 22:02:08 +00:00
Marc Mutz
8e564bd00f qurlrecode.cpp: fix Coverity ARRAY_VS_SINGLETON issue
Coverity has this checker where it complains if you use a T as a
T[1]. The C++ standard says that this is fine¹, but qurlrecode.cpp,
specifically, is security-critical, so we shouldn't leave Coverity
issues unfixed in there.

So replace ucs4 with a buffer[1] array and make both dst and ucs4
point to buffer's first (and only) element.

Amends 2b82923c8fba5dcff707e344acdf9db8c444a55e.

¹ https://eel.is/c++draft/basic.compound#3.sentence-11

Pick-to: 6.8 6.5
Coverity-Id: 378435
Change-Id: I8ab2f70b542088e90dc43e616a0202e8c756f204
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7a32a2238f52217bc4f0dc4c9620a2a2d350a1ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 21:57:50 +00:00
Marc Mutz
e744561c35 QFontEngine: reduce unnecessary relocations
Instead of static constexpr QL1SV objects (which force the compiler to
allocate storage for them and therefore cause relocations), use mere
automatic constexpr objects (which don't). There never was a need to
make these objects static, as constexpr is enough to force the
compiler to constant-fold them.

Difference:
  qfontengine.cpp.o:
- 0000000000000040 l     O .data.rel.ro.local     0000000000000010 QFontEngine::findGlyph(QLatin1String) const::gid
- 0000000000000000 l     O .data.rel.ro.local     0000000000000010 QFontEngine::findGlyph(QLatin1String) const::uni
  0000000000000000 l    d  .data.rel.ro.local     0000000000000000 .data.rel.ro.local

See
  https://stackoverflow.com/questions/19067010/finding-where-relocations-originate/19338343#19338343
for the script to generate this output.

See https://www.akkadia.org/drepper/dsohowto.pdf Section 1.6 for why
we care.

Amends 176816f21324bf736389037c62538a25f2522808.

Task-number: QTBUG-100536
Change-Id: I3cdf42c9758ec32654b378a2b27b565a6c92c26b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
(cherry picked from commit 511ee39570a104d07eb4c9fb0d8a8fb775e9b38a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 21:57:45 +00:00
Marc Mutz
3c1b01ec3e ucstricmp8: fix Coverity ARRAY_VS_SINGLETON issue
Coverity has this checker where it complains if you use a T as a
T[1]. The C++ standard says this is fine¹, but qstring.cpp,
specifically, is security-critical, so we shouldn't leave Coverity
issues unfixed in there.

So replace uc1 with a decoded[1] array and make both output and uc1
point to decoded's first (and only) element.

Amends 45838673df6e64a6fd42570c4e8874c5181f7717.

¹ https://eel.is/c++draft/basic.compound#3.sentence-11

Pick-to: 6.8 6.5
Coverity-Id: 378348
Change-Id: Ib149386defd8b263df522a4f12b1af1b3fc1a20c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4eb9e0d3eedfc1b6de968308167af01b19f6ffe7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 21:57:44 +00:00
Marc Mutz
ece3fefdd0 QGenericUnixTheme: reduce unnecessary relocations
Instead of static constexpr QL1SV objects (which force the compiler to
allocate storage for them and therefore cause relocations), use inline
functions or mere automatic objects (which don't).

We'd normally call the inline functions fooKey() { return "foo"_L1; },
but since one of them "foo"s ends with "Key" already, put them into a
namespace instead, the name of which is taken from the comment that
used to introduce the static constexpr objects in the old code.

For the QL1SVs in the ctor: port them to QStringLiterals, because
their only use is to pass them to a function taking const QString&, so
this saves allocations. There never was a need to make these objects
static, as constexpr would be enough to force the compiler to
constant-fold them.

Unlike my earlier advice about how to create an empty QString most
efficiently, don't keep using ""_L1, use u""_s. This is because
there's no shared empty QString in Qt 6 anymore. It might still make
sense to add a more light-weight way to create an empty QString,
esp. one which is not referencing local data, but QString::_empty, to
extend the lifetime of the payload until QtCore unload time, but that
is outside the scope of the current patch.

Difference:
  qgenericunixthemes.cpp.o:
- 0000000000000000 l     O .data.rel.ro.local     0000000000000010 QGenericUnixThemeDBusListener::QGenericUnixThemeDBusListener()::signal
- 0000000000000040 l     O .data.rel.ro.local     0000000000000010 QGenericUnixThemeDBusListener::QGenericUnixThemeDBusListener()::interface
- 0000000000000080 l     O .data.rel.ro.local     0000000000000010 QGenericUnixThemeDBusListener::QGenericUnixThemeDBusListener()::path
  00000000000000c0 l     O .data.rel.ro.local     0000000000000010 QGenericUnixThemeDBusListener::QGenericUnixThemeDBusListener()::service
  0000000000000000 l    d  .data.rel.ro.local._ZTV24QGenericUnixThemePrivate      0000000000000000 .data.rel.ro.local._ZTV24QGenericUnixThemePrivate
  0000000000000000 l    d  .data.rel.ro.local._ZTV16QKdeThemePrivate      0000000000000000 .data.rel.ro.local._ZTV16QKdeThemePrivate
  0000000000000000 l    d  .data.rel.ro.local._ZTV18QGnomeThemePrivate    0000000000000000 .data.rel.ro.local._ZTV18QGnomeThemePrivate
  0000000000000000 l    d  .data.rel.ro.local._ZN13QMetaSequence12MetaSequenceI5QListIN2Qt3KeyEEE5valueE  0000000000000000 .data.rel.ro.local._ZN13QMetaSequence12MetaSequenceI5QListIN2Qt3KeyEEE5valueE
  0000000000000000 l    d  .data.rel.ro.local     0000000000000000 .data.rel.ro.local
- 0000000000000000 l    d  .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener6s_rootE  0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener6s_rootE
- 0000000000000000 l    d  .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_signalsE       0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_signalsE
- 0000000000000000 l    d  .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_settingE       0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_settingE
- 0000000000000000 l    d  .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener10s_providerE     0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener10s_providerE
- 0000000000000000 l    d  .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_dbusKeyE       0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_dbusKeyE
- 0000000000000000 l    d  .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener14s_dbusLocationE 0000000000000000 .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener14s_dbusLocationE
  0000000000000000 l    d  .data.rel.ro.local._ZN9QtPrivate25QMetaTypeInterfaceWrapperIvE8metaTypeE       0000000000000000 .data.rel.ro.local._ZN9QtPrivate25QMetaTypeInterfaceWrapperIvE8metaTypeE
  0000000000000000 u     O .data.rel.ro.local._ZN13QMetaSequence12MetaSequenceI5QListIN2Qt3KeyEEE5valueE  00000000000000d8 QMetaSequence::MetaSequence<QList<Qt::Key> >::value
  0000000000000000  w    O .data.rel.ro.local._ZTV24QGenericUnixThemePrivate      0000000000000020 .hidden vtable for QGenericUnixThemePrivate
  0000000000000000  w    O .data.rel.ro.local._ZTV18QGnomeThemePrivate    0000000000000020 .hidden vtable for QGnomeThemePrivate
  0000000000000000  w    O .data.rel.ro.local._ZTV16QKdeThemePrivate      0000000000000020 .hidden vtable for QKdeThemePrivate
- 0000000000000000 u     O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener6s_rootE  0000000000000010 .hidden QGenericUnixThemeDBusListener::s_root
- 0000000000000000 u     O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_signalsE       0000000000000010 .hidden QGenericUnixThemeDBusListener::s_signals
- 0000000000000000 u     O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener14s_dbusLocationE 0000000000000010 .hidden QGenericUnixThemeDBusListener::s_dbusLocation
- 0000000000000000 u     O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_dbusKeyE       0000000000000010 .hidden QGenericUnixThemeDBusListener::s_dbusKey
- 0000000000000000 u     O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener10s_providerE     0000000000000010 .hidden QGenericUnixThemeDBusListener::s_provider
- 0000000000000000 u     O .data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_settingE       0000000000000010 .hidden QGenericUnixThemeDBusListener::s_setting
- 0000000000000000 u     O .data.rel.ro.local._ZN9QtPrivate25QMetaTypeInterfaceWrapperIvE8metaTypeE       0000000000000070 .hidden QtPrivate::QMetaTypeInterfaceWrapper<void>::metaType
  RELOCATION RECORDS FOR [.data.rel.ro.local._ZTV24QGenericUnixThemePrivate]:
  RELOCATION RECORDS FOR [.data.rel.ro.local._ZTV16QKdeThemePrivate]:
  RELOCATION RECORDS FOR [.data.rel.ro.local._ZTV18QGnomeThemePrivate]:
  RELOCATION RECORDS FOR [.data.rel.ro.local._ZN13QMetaSequence12MetaSequenceI5QListIN2Qt3KeyEEE5valueE]:
- RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener6s_rootE]:
- RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_signalsE]:
- RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_settingE]:
- RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener10s_providerE]:
- RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener9s_dbusKeyE]:
- RELOCATION RECORDS FOR [.data.rel.ro.local._ZN29QGenericUnixThemeDBusListener14s_dbusLocationE]:
  RELOCATION RECORDS FOR [.data.rel.ro.local._ZN9QtPrivate25QMetaTypeInterfaceWrapperIvE8metaTypeE]:

See
  https://stackoverflow.com/questions/19067010/finding-where-relocations-originate/19338343#19338343
for the script to generate this output.

See https://www.akkadia.org/drepper/dsohowto.pdf Section 1.6 for why
we care.

Amends 0328e4297e339de8a2acd84979c667936f6fadf8.

Pick-to: 6.8 6.5
Task-number: QTBUG-100536
Change-Id: I1fd65e3ed5bceeb2a49141834dbd12f4bf42cc8c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 1370ecf293b258ba74a1187c5bbf8e1a192765e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 21:57:38 +00:00
Marc Mutz
72fddb0935 QZip: fix Coverity warning about reading uninit'ed fields from z_stream
Coverity complains that inflateInit2() will read stream.opaque, which
wasn't initialized by us. At least in the copy of zlib that is
contained in Qt, this is false.

But xxflate() in qbytearray.cpp value-initializes its z_stream (and
therefore doesn't manually need to set .zalloc and .zfree), so do that
here, too.

Amends the start of the public history.

Pick-to: 6.8 6.5
Coverity-Id: 310213
Change-Id: I487072a0d2375a932f3ffb9a1f252fec9e2f2d0d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a817ba8e9c42dfffd31eb26ac522488c2a4ec61e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 21:57:36 +00:00
Christian Ehrlicher
660a63d739 QIcon::pixmap() make sure to always return a correctly sized pixmap
Some icon engines might not be able to return a properly sized pixmap.
Therefore we must make sure within QIcon::pixmap() to return a pixmap
with the requested size. This is done by simply adjusting the device
pixel ratio instead scaling to avoid the loosy scaling until the icon is
drawn later on.
The dpr adjustment was already done for dpr == 1.0 so the function
returned different results for different device pixel ratios ...

Pick-to: 6.8
Fixes: QTBUG-133412
Change-Id: I66f2ac76ebf240a625649171b4553a3b95d7c3a1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f142bd121c5be67a5701c849cea25e7abe4cd720)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 21:40:09 +00:00
Jøger Hansegård
69cdf3cbbb Add missing comparison operators for Microsoft::WRL::ComPtr on MINGW
MINGW's implementation of Microsoft::WRL::ComPtr lacks comparison
operators, and calling operator==() on them will implicitly convert them
to bool before comparing the resulting bool values. Two non-zero ComPtr
instances will therefore always compare equal, even if they point to
different interfaces.

This patch adds ComPtr comparison operators if they are missing, and
replaces existing includes to wrl.h or wrl/client.h with
QtCore/private/qcomptr_p.h

Pick-to: 6.8
Change-Id: I8123d9d874ae53ebfd6d381b69097e75527848b6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6d1384034deb681c1c4a656a1582f3e1606b1c1a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 21:23:04 +00:00
Cristian Le
d7e2d6b22c Use _qt_internal_dealias_target
Pick-to: 6.8
Change-Id: Iffc1148ed7655c724ea0609be01978ab7d5e7f8f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 10affadd125b615b47979c4469be55bdbe5a189d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 21:09:24 +00:00
Cristian Le
7394e342f7 Add helper function _qt_internal_get_real_target
Also a shortcut `_qt_internal_dealias_target`

Pick-to: 6.8
Change-Id: Ic772896f7bf2f3fb05dd4799b1a8aabbc4379930
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 86c4a179e52b096fe3825e0fb8be3a362637230f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 21:09:18 +00:00
Alexandru Croitor
6e0139caf7 CMake: Add a special skip genex marker when walking libs
Useful to annotate certain linking expressions that need to be skipped
for inclusion in prl file generation. E.g. $<TARGET_OBJECTS>
expressions that represent propagated object libraries, which are
handled by the rcc_objects walk lib code path, and thus need to end up
in prl RCC_OBJECTS section, instead of the
QMAKE_PRL_LIBS_FOR_CMAKE one.

Pick-to: 6.8
Change-Id: Ib08b00200b6b06d32eab15ecb15c0820eec2a908
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ce0004dff7b8a5f5030c2f060a659b9c5e6e62ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 20:29:05 +00:00
Juha Vuolle
0c7bea06c4 Allow unhandled custom uri-scheme opens to create QFileInfoEvent
On macOS custom uri-scheme opens may generate a QFileOpenEvent that
the applications can handle. However when adding support also for
QDesktopServices::setUrlHandler(), this delivery mechanism stopped
from working because the event was unconditionally consumed /
delivered to only the url handler.

Instead change the logic such that if the url handler does not
handle it, allow a QFileInfoEvent to be created.

Amends: 664c7ffb212eb898ed03f7b19c883400fa027b6b

Fixes: QTBUG-134316
Pick-to: 6.9.0 6.8 6.8.3
Change-Id: Ib1ed371ef531586bf549cf473b2a54748584d91d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 4755f52c08aac424b18ad94404ca8f7dabf8220d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 20:29:03 +00:00
Matthias Rauter
15ea46495f Correct the diagrams in string overview
Amends 80b6f2e63dc537f419186585a528ff749f9ff739

Pick-to: 6.9.0 6.8
Task-number: QTBUG-133882
Change-Id: If53f8feb73255f8ba035290944b10af2cdf6baf9
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit feefea87b7130bea23510819ea34b3c620686f53)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 19:02:37 +00:00
Assam Boudjelthia
a6e68f636e Android: account for edge-to-edge in tst_android
When running on Android 15 with target sdk set to 35 (Android 15),
the new edge-to-edge behavior is enforced, so the test needs to
account for that and take the full screen size instead of deducting
the insects.

Pick-to: 6.9.0 6.8
Task-number: QTBUG-132311
Change-Id: I178265b02878206ba95c8f83507963ce0bd0d732
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
(cherry picked from commit 1f3c5f8f9025057f9a7f6b6143f33a529583ab19)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 18:43:54 +00:00
Rami Potinkara
07f088d340 Android: bump Android target API level to 35
This patch
-updated target API level to 35 into build tools
-updated target API level to 35 in build.gradle files

Task-number: QTBUG-129461
Task-number: QTBUG-130284
Pick-to: 6.9.0
Change-Id: Iebdc99e6f607352652c3f0022f17de60eae97d58
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 997a1fae98d35cd0d4d16f37ab68afe2729ff551)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 18:43:48 +00:00
Mitch Curtis
c785ab7a62 Improve QList::move docs
- State that both arguments must be within bounds.
- Add example.

Pick-to: 6.8 6.5
Change-Id: Ieba9c3469a2c8cf8c20d867abff5865d96c3ee6e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 6b361119ef413a229b95145ed3d3f51a7388a020)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 17:50:51 +00:00
Giuseppe D'Angelo
f45d0214f9 CMake: map more -sanitize options in the doc
These were supported by Qt 5's configure.

Pick-to: 6.8
Change-Id: I3d902bb9e211f1dfecbf0835203e7b9e60fb41f6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 077412a3cfd52b326cdba768156683cd94841330)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 02:45:47 +00:00
Lucie Gérard
20cca622cc Remove unnecessary comment
Pick-to: 6.8
Change-Id: I8407ddb117941bc9e28b18998ff1e824ded2b1d9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 38e39902c6b2056d4600c2f8b425fde26cca179c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 02:45:40 +00:00
Ivan Solovev
7a7c7322fa QFuture: avoid warnings about unreachable code with /W4 in MSVC
... when instantiating the MetaTypeQFutureHelper for QFuture<void>.

Simply enabling /W4 for tst_qfuture also generates this warning, but
also much more. So I'm not providing any unit-test here.

Amends 90d9a86c2e762c9426d0facbd54ed5dbff574ecd.

Fixes: QTBUG-133406
Pick-to: 6.9.0 6.8 6.5
Change-Id: I22a53b872818763b80f333f597ddd19a1c1e30ac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ff6bf61b17ee4fc8ca11e016242d7c3399a02045)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 02:45:32 +00:00
Allan Sandfeld Jensen
01d1a2265c Add copyright holder to the SPDX line
Fixes: QTBUG-134392
Change-Id: I50f36af1c4ff91e3ab51db0abaf5b2b088fd8742
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 06b50e5d6c22bbf59fba61bb0e000fdd6a1bf347)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 02:45:25 +00:00
Fabian Kosmale
0f4cd43bc2 Warn about QML registration macro without include
In some setups, e.g. when using precompiled headers, the compiler will
see all definitions necessary to compile a class containing a QML
registration macro. However, moc won't be able to resolve the macro to
its expanded text, and thus miss the information.

This leads to a runtime failure when the QML engine cannot find the
type, because it has not been registered (as qmltyperegistrar relies on
the information collected by moc).

To avoid this, teach moc about the registration macros, and warn
when encountering them. We do this by comparing identifiers inside
classes against the names of the QML registration macros.
We do not error out, as a user might use the names of the macros as
normal identifiers, especially in a non-QML project (as unlikely as this
might be).

Warning out when finding a registration macro might sound
counter-intuitive, but works because moc should not actually see the
macros at this stage: When the header is included, macro expansion will
replace the macro with its expansion; only when the header is missing
will we ever see the macro as an identifier.

Task-number: QTBUG-134148
Pick-to: 6.8
Change-Id: I2f213444993a9d782a027c2dc25ffcbe0824ddca
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
(cherry picked from commit fd88f44c15e969da3228ab2b0a302e78e2ccc8de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 02:45:16 +00:00
Eskil Abrahamsen Blomfeldt
bf37860a71 Upgrade Harfbuzz to 10.4.0
[ChangeLog][Third-Party Code] Upgraded Harfbuzz to version
10.4.0.

Fixes: QTBUG-134282
Pick-to: 6.8 6.5 5.15
Change-Id: Ib36df2ae6b0fa4cf667b25d460473d45e8b34350
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ecc8ca605c30ce7268a3d05c2fe6f6f6e337de5d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 550db195afba3a5e4aa12d2bb476cb26c9f89a63)
2025-03-06 02:45:08 +00:00
Giuseppe D'Angelo
3e32c9b55b QThread: disable pthread_clockjoin_np when building under TSAN
TSAN does not support intercepting pthread_clockjoin_np (only join,
tryjoin and timedjoin), and will claim that an application leaks threads.
Disable the clockjoin codepath when building under TSAN.

Unfortunately I can't seem to find a version check for the sanitizers to
apply here and know if and when TSAN will get this support.

Change-Id: If12419e5d600e519bf4315d27f74d74a87dcf792
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 84d6309cf1eaf7632298d1305ce17f5f7497e1c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 02:44:59 +00:00
Volker Hilsheimer
cb8a6a5ea9 Doc: fix documentation warning for QByteArray::fromCFData
\brief tags are not used for member function documentation.
Explicitly set the prototype for qdoc instead, it doesn't seem to
know what to do with the definition in an ObjectiveC file and
produces link warnings.

Pick-to: 6.9.0
Change-Id: I89252e7b84586e987ed6d950d90142e916d8f1df
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 03efe9a21bb7a879ae51e3ad007dd2cdb8c6d981)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-06 02:44:47 +00:00
Cristian Le
0bdad95d0c Make qt_internal_set_warnings_are_errors_flags genex-ed
Fixes: QTBUG-132705
Pick-to: 6.8
Change-Id: I57987f1ae1c6d6adc4a2d0151f365c24605b940e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit e3af89f7b4e8daa9cbfcc0d2c7cec7b7478f9406)
2025-03-05 17:47:17 +01:00
Christian Ehrlicher
8b59467d20 QStyleHelper: fix compilation with disabled features
When certain features are disabled, qguiapplication.h does not get
included which results in a compiler error. Therefore add it directly.

Pick-to: 6.9.0 6.8
Fixes: QTBUG-134235
Change-Id: I7836fc52c5037ca15c7ce48617c9f814d71963aa
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 98653cca453fe3d88807d1a314ae17efadd7c958)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-05 01:36:09 +00:00
Christian Ehrlicher
d6802feee0 QDrawUtil: Cleanup qDrawPlainRoundedRect/qDrawPlainRect
Cleanup the drawing code to avoid useless drawings by only calling
drawRect once with the correct parameters. This also removes rendering
artifacts due to e.g. rounding errors with a dpr != 1.

Fixes: QTBUG-132187
Pick-to: 6.8
Change-Id: Ib5eff89c8bdcbd0c86954e78dadaad83346c92ff
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 611031e4f069aea6a0312b5c459247094204d5eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-05 01:36:07 +00:00
Thiago Macieira
2125135064 a11y uia: fix build: MinGW has those macros
Don't do proxy checks for the thing you want to test. Whenever possible,
test the thing you want to test.

We can't check for the definition of certain structs, though. Those have
to remain a proxy check.

Pick-to: 6.9.0 6.8
Change-Id: I5003e785706cd66923e4fffd6b11254233d09dc5
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9c4c5dc9f9c4358489d138dc4cf5aa6131b1bd24)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-05 01:24:04 +00:00
Morten Sørvig
a1a872e2d2 wasm: disable text drag for text edits
Disable text drag if asyncify is not enabled.

Fixes: QTBUG-131256
Pick-to: 6.8
Change-Id: I6589f11dda42c2f41db610e7cfece8a3db6573db
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 665acc02cf106071d57d012bb68250c2ea5d0a2c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-04 17:50:21 +00:00
Marc Mutz
e2129f6548 QWidget: init data in ctor, not Private::init()
This should fix Coverity's hallucination that QWidget::data is used
uninitialized, or, after 58b9250aea0b1b41c8cbd1033149371a93a5b2c1,
dereferenced while it's still nullptr.

Coverity-Id: 475552
Coverity-Id: 475551
Coverity-Id: 475550
Coverity-Id: 475549
Coverity-Id: 396828
Pick-to: 6.8 6.5
Change-Id: I49705b8bc44082fc68a59c2c98c4e37a6d841b19
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit bcd29a9eab00c77bc402b9d4242f097d19c92044)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-04 17:08:33 +00:00
Leena Miettinen
9a0716b728 Doc: Use Qt Design System colors also in help CSS
- Replace colors in offline-dark.css
- Do not use the note and attention icons in offline templates

Task-number: QTBUG-133761
Pick-to: 6.9.0 6.8
Change-Id: I55e81d6c3887764542e23c8f85f4d46e273b3885
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit c770015876390de0cc9c77a3d5b123637204b92c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-04 17:08:33 +00:00
Kai Uwe Broulik
2a1a34307d QCssParser: Add missing palette roles
Qt CSS allows to read palette colors by using "palette(role)" but
the supported roles haven't been updated since at least Qt 5.12,
therefore placeholder-text and accent are not recognized.

An "accent-color" property has been added to *set* the accent
color on an object when it was introduced but it wasn't possible
to *read* the accent color, even though it was documented to work.

For sake of completeness, add tooltip-base and tooltip-text as well.

Also amend the comment in QPalette to mention QCss and add a
static_assert so this doesn't happen again.

Pick-to: 6.9.0 6.8
Change-Id: I59ed09dc91fa18ca0356857c8ddb43946b309035
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 9194366923e409243617c34b640e82b54a2e7e05)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-04 17:08:33 +00:00
David Faure
149be782bb QSortFilterProxyModel: don't call index(row, 0) if there are no columns
This is invalid, e.g. it asserts in
QConcatenateTablesProxyModel::index()

Fixes: QTBUG-134210
Change-Id: I21acad9497d423b0366991296e8dd498d51395ea
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 93694e99c214a5166fc842f92659e42260230dce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-04 12:11:00 +00:00
Christian Ehrlicher
4003ca0d32 QStyleSheetStyle: fix CT_MenuItem with custom font
When a menu has a custom font size set, the size was adjusted to reflect
this *after* the additional widths for icon or checkmark was added.
When the used font is larger, the additional width added for the icon or
checkmark will not be honored then.
Therefore the size with the new font has to be added before adding the
size for the icon/checkmark.

Pick-to: 6.8
Fixes: QTBUG-115356
Change-Id: I33e83022bea9e3a531ac8e1651d8655076d88b4b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5436c4a363aa856180ce2949c2f5eeed451abfa9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-04 07:59:04 +00:00
Christian Ehrlicher
b338217360 QWidget: Don't offset the clip region for windows using effects
When a top-level widget has a graphic effect applied,
QWidgetPrivate::clipToEffectiveMask() must not use the parent widget for
the mask calculation as this prevents the loop below from bailing out in
the first loop (w->isWindow()) and might mess up the clip region when
there is a widget with a mask in the parent chain.

Pick-to: 6.8
Fixes: QTBUG-131893
Change-Id: I5d5777e730bee309db21ad5eb65387d19321ee6c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 49f462b7f873ecba6bb205697338a4f1eef6d307)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-04 07:59:02 +00:00
Christian Ehrlicher
351357c3a0 QCssParser: don't allow negative values for cuts in border-image
The spec does not allow this and qDrawBorderPixmap can not handle it.

Pick-to: 6.8 6.5
Fixes: QTBUG-107904
Change-Id: I5873dec2312865fb96ccccd3cc2292c6b9e1d4f0
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 254fc6a9782b29180cd545e18c34bcaf4cc03a7a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-04 07:59:00 +00:00
Assam Boudjelthia
b172090299 Android: fix uncompressed libs loading from split APKs
When split APKs, when an AAB is used for example, the native libraries
are kept in a separate APK and not under the main app APK, thus, we
need to use that instead to get the path of the native libs otherwise
the app would crash failing to load Qt libraries.

Amends 0db5b424cdaede8724886e8a1eda1380382d9aaf.

Pick-to: 6.9.0
Fixes: QTBUG-134101
Change-Id: I930ba005aaefc15e4500b7290167892dc2428066
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 75367d1cfe564953d980b0c6917257f8ec0faa93)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-04 01:22:25 +00:00
Milian Wolff
0437f1925b Optimize QUtcTimeZonePrivate common case for UTC id/name
When the name/id is "UTC" then we can reuse the interned
string literals, which allows us to get rid of extra memory
allocations (and frees later on) for these strings.

This patch brings another hefty relative improvement to my benchmark.
Compare the following results for tst_QTimeZone::utc benchmark as
built on my machine with:

    Config: Using QtTest library 6.10.0, Qt 6.10.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 14.2.1 20250207), arch unknown

Before:

    102.004937 nsecs per iteration (total: 102,004,835, iterations: 999999)
    452.836869 CPU cycles per iteration, 4,44 GHz (total: 452,836,417, iterations: 999999)
    1,182.801068 instructions per iteration, 2,612 instr/cycle (total: 1,182,799,886, iterations: 999999)
    267.143901 branch instructions per iteration, 2,62 G/sec (total: 267,143,634, iterations: 999999)

After:

    36.708812 nsecs per iteration (total: 36,708,776, iterations: 999999)
    169.024518 CPU cycles per iteration, 4,6 GHz (total: 169,024,349, iterations: 999999)
    601.286607 instructions per iteration, 3,557 instr/cycle (total: 601,286,006, iterations: 999999)
    139.051610 branch instructions per iteration, 3,79 G/sec (total: 139,051,471, iterations: 999999)

Relative Delta:

            before   after    improvement
    nsecs   102.0    36.7     2.78x
    cycles  452.8    169.0    2.68x
    instr.  1182.8   601.3    1.97x
    branch  276.1    139.1    1.98x

Pick-to: 6.8
Change-Id: I4aae3ac59edc173f96751d7e05335ad6b63f7275
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit c67659149f7f3a4600a211e82bfd067a8e08ae51)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-04 01:22:25 +00:00
Milian Wolff
22e66638a6 Optimize QTimeZone::utc()
Instead of using the QTimeZone ctor taking a string representing
UTC which then first needs to be parsed, use the offset-from-UTC
ctor with an offset of 0.

This approach is much faster, compare the following results for
the tst_QTimeZone::utc benchmark as built on my machine with:

    Config: Using QtTest library 6.10.0, Qt 6.10.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 14.2.1 20250207), arch unknown

Before:

    358.686871 nsecs per iteration (total: 358,686,513, iterations: 999999)
    896.524312 CPU cycles per iteration, 2,5 GHz (total: 896,523,416, iterations: 999999)
    2,227.000427 instructions per iteration, 2,484 instr/cycle (total: 2,226,998,200, iterations: 999999)
    560.000375 branch instructions per iteration, 1,56 G/sec (total: 559,999,815, iterations: 999999)

After:

    102.004937 nsecs per iteration (total: 102,004,835, iterations: 999999)
    452.836869 CPU cycles per iteration, 4,44 GHz (total: 452,836,417, iterations: 999999)
    1,182.801068 instructions per iteration, 2,612 instr/cycle (total: 1,182,799,886, iterations: 999999)
    267.143901 branch instructions per iteration, 2,62 G/sec (total: 267,143,634, iterations: 999999)

Relative Delta:

            before   after    improvement
    nsecs   358.7    102.0    3.52x
    cycles  896.5    452.8    1.98x
    instr.  2227.0   1182.8   1.88x
    branch  560.0    267.1    2.10x

This is quite a significant change for such a trivial patch.

Pick-to: 6.8
Change-Id: I5872fe8f1158ff9f6bf306ca8b069559cb59beec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 765193693982abdbc53910ff0d7d1149332ca83e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-04 01:22:25 +00:00
Milian Wolff
9cba61e5eb Add explicit test coverage for QTimezone::utc
Basically this should work exactly the same as constructing the
QUtcTimeZonePrivate directly. Follow-up performance optimizations
should not change any of this behavior.

Pick-to: 6.8 6.5 5.15
Change-Id: I2a3e78965f3a553b8b70cb12f7772b9fdfbf7bf7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7a79ce13a93aab724e8943d83fc903c88466d053)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-04 01:22:25 +00:00
Marc Mutz
5ad97482a9 QWidget: DRY the ctors, use ctor delegation
Don't repeat the body in the two QWidgets ctors, call one from the
other instead.

This will help fighting Coverity's hallucination that QWidget::data is
used uninitialized, or, after 58b9250aea0b1b41c8cbd1033149371a93a5b2c1,
dereferenced while it's still nullptr.

Coverity-Id: 475552
Coverity-Id: 475551
Coverity-Id: 475550
Coverity-Id: 475549
Coverity-Id: 396828
Pick-to: 6.8 6.5
Change-Id: I1f9a8b93871143b420b9c8f247e49d57510a2379
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 66268742861c3eb9b3d97c2758a1babbae850e1f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-04 01:22:24 +00:00
Thiago Macieira
de3cf05b77 QUrl: decode square brackets in fromLocalFile()
QUrl has an intentional deviation from RFC 3986 when it comes to those
characters, matching the behavior of major browsers: we distinguish the
forms '[' and ']' from their encoded forms. However, for local files,
they are definitely identical, because there's no such thing as a
percent-encoded file names.

[ChangeLog][QtCore][QUrl] QUrl::fromLocalFile() will now decode the
square bracket characters '[' and ']' to their percent-encoded forms.
This will be visible in calls to toString(), toEncoded(), or the encoded
form of path(). QUrl's comparison operator will consider the old
(created from an encoded URL string) and new forms to be different.

Pick-to: 6.8
Fixes: QTBUG-134073
Change-Id: I9eae083007103e34f73cfffd59a618069eba0e19
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 5e936b60fc921e21b8153a83113886a1de333b57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-04 01:22:24 +00:00
Christian Ehrlicher
9433e8b68d Style: pass widget to styleHint() where appropriate
QStyle::styleHint() take the QWidget as optional third parameter. Add
this to calls to styleHint() where appropriate.

Task-number: QTBUG-2501
Pick-to: 6.8
Change-Id: I95b85d51ce98540920243b37473b97426eb40ab4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6f813bcb441ee195d88cc9fd39921bc4b5fa0192)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-03 19:10:50 +00:00
Christian Ehrlicher
bea6b0e944 Style: pass widget to styleHint() where appropriate
QStyle::styleHint() take the QWidget as optional third parameter. Add
this to calls to styleHint() where appropriate.

Task-number: QTBUG-2501
Pick-to: 6.8
Change-Id: I62aa251f7dd9d78178ea8aefc1e2882d3ac040be
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5b320c146b2d67bb9bec92d647ec7fb5ae6b601d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-03 19:10:48 +00:00
Thiago Macieira
6deb5098a1 tst_QUrl: improve toNSURL()/toCFURL() tests
This extends the test with a few more rows, and with delimiters that the
Apple APIs seem to encode differently. Rather, it's QUrl that deviates
slightly from the standard: we keep the delimiters unchanged,
regardless, like browsers do.

Task-number: QTBUG-134073
Pick-to: 6.8 6.5
Change-Id: I20a7b66a9959b17597cffffdf3652b9167d00d07
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 31753e722cd441de371be8f1e11b3bf089b187e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-03 17:24:57 +00:00
Alexandru Croitor
ee8cd91279 CMake: Remove semicolon from SBOM external document references
The external doc references need to be appended as strings, not list
elements, otherwise there will be semicolons in the output SPDX file.

This issue was inherited as-is from the upstream SBOM generation
project.

We are fortunate the json converted files are missing the semicolons
due to implementation specifics.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I2b91775d59d64709b72ff7130dd4f6b506ef8244
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 94e19f42e80fdd8bc03c2f83b351e9662cdac8a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-03 16:31:28 +00:00
Cristian Le
192d87010a Unit test qt_internal_add_compiler_dependent_flags
Pick-to: 6.8
Change-Id: I12e476e1d7e36492811d2becf58e13923b443caf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit e070742ab5e122fbde3ced017709e940a92a6a46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-03 15:34:11 +00:00
Cristian Le
cdb34e0486 Add qt_internal_add_compiler_dependent_flags helper
Helper function that groups together compiler specific options and conditions

Pick-to: 6.8
Change-Id: Ibec52a19852ad528007f50316a52d2f867b5fe37
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 167b38712d2d8157393e0753f11c6c41b1740de5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-03 15:34:05 +00:00
Konsta Alajärvi
9239e7cdef Unblacklist tst_qrhi renderToTextureArray
Try to unblacklist renderToTextureArray test on android

Fixes: QTQAINFRA-6334
Pick-to: 6.8
Change-Id: I59c914b66645dc30e7f1a34f9aefc7fb66e95a67
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit a34b5d60e010a0dfd451b1d6fff6798bdedc61b4)
2025-03-03 11:45:55 +00:00
Christian Strømme
a234b472d7 visionOS: Change how the initial immersion style is set
Set the initial style to be automatic, that's the default. With this
change we also get rid of the warnings shown on application startup
complaining about the application not defining an initial immersion
style:
"Since your app does not define an initial immersion style in its
Application Scene Manifest, the default immersion style will be
applied. This does not match the immersion style defined at runtime
'full'. To make sure your app's state matches its runtime behavior
define an initial immersion style."

Change-Id: I1b8bba5f919b72d4f2507a19a30de49e8bfcd708
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 08146377db8ce782bac5b9561338ba20f7101ac5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 16:15:11 +00:00
Axel Spoerl
8633c8e446 tst_QScroller::overshoot(): improve diagnostic output, blacklist on mac
Test is flaky on macOS.
Use QCOMPARE_LT instead of QVERIFY(a < b).
Blacklist on macOS.

Task-number: QTBUG-134105
Pick-to: 6.8
Change-Id: I8f1274ad67bd9ead392ecd0f9c9b7a01dc3edb1e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 7c7731a8229a44050c02d33c7111e4d522909c1d)
2025-03-02 17:15:04 +01:00
Thomas Moerschell
ce7cf1a8b1 QScroller: Fix no overshoot behavior
Correct previously mixed up parameters to pushSegment(). stopProgress
can be set to 1 so stopPos is the only terminating condition.

Pick-to: 6.8
Change-Id: If590555ed08170800b67063aa10e853411180aa3
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 84e09e060bedd37d8de7cded7e430371e335c029)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 17:15:02 +01:00
Marc Mutz
bcdd7c260b Long live \constraints!
We have divergence in the way we document function, operator and
constructor constraints. About half use \note, while the other
doesn't. Some say "if and only if" while others say just "participates
only if".

So add a qdoc macro, \constraints, to semantically mark up these
constraints. It expands to a section titled `Constraints`, and
uses a predefined sentence (prefix) for constraints.

Documentation for constraints is moved to the end of the comment
blocks to separate them from the rest of the text.

Apply them to all the standard-ish constraint documentation blocks
(grepped for "participate"). I didn't look for other, one-off, ways
documentation authors may have documented constraints, but I'm also
not aware of any.

Re-wrap lines only if the result fits into a single line.

As a drive-by, drop additional "if"s, as in "only if X and -if- Y" to
make the texts work with the `Constraints` section.

Fixes: QTBUG-106871
Pick-to: 6.8 6.5
Change-Id: I18c2f9f734474017264e49165389f8c9c7f34030
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b7a67b46e66f161def5bf879f19c66d3fcec1d8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 07:10:48 +00:00
Andreas Eliasson
f87929371a Doc: Improve deprecation description for QApplication::fontMetrics()
Add a link to QFontMetrics, which provides more information about the
differences between QFontMetrics and QFontMetricsF and why the latter
is the preferred choice.

Fixes: QTBUG-127528
Pick-to: 6.8 6.5 6.2
Change-Id: Ib5713a9d39bf312a6eae6b8b1a6d1dc1d47e25be
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit bdf453afd7613d3e88099defb759444537527195)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 07:10:47 +00:00
Vladislav Tarakanov
593f69a861 QCupsPrintEnginePrivate: Use "true" for "landscape" option
CUPS treats the "landscape" option as a boolean value
(IPP_TAG_BOOLEAN). In this case, all values ​​other than "true", "on" and
"yes" are considered as false. As a result, using an empty string as the
value for the "landscape" option results in the print area still being
portrait.

Currently, the problem with printing landscape images (png, jpeg, etc.)
in Qt programs (e.g. Okular, Gwenview) occurs on Fedora 41 and other
distributions using cups-filters v2.0+.

The patch adds passing the value "true" instead of an empty string for
the "landscape" option, as CUPS expects for changing the orientation.

Pick-to: 6.8
Change-Id: Ib7ad1e2debcfff10e673757c97ef5614fb59a6ca
Reviewed-by: Albert Astals Cid <aacid@kde.org>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit a77173486aaf9d2e4107f6e1120ac2316ae1c96f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 07:10:47 +00:00
Nicholas Bennett
f5de04d9c4 Docs: Create \Q4A macro for "Qt for Android" and replace instances
"Android" is trademarked and needs to be referenced in a certain way.
The following steps were taken:
-Created qdoc macro.
-Updated "Qt Android" and "Qt for Android" to use \Q4A in qdoc files.

The macro will need to be adopted in all documentation projects.

Task-number: QAA-2836
Pick-to: 6.8 6.5
Change-Id: I4b52247a4ed52047242a06404e6d3aa19de9c16c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 9c6c6d7d388bee01ea4e5ea102d3b0ed359c3f00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 07:10:47 +00:00
Eskil Abrahamsen Blomfeldt
1a4e2e869f Update Harfbuzz to version 10.3.0
[ChangeLog][Third-Party Code] Upgraded Harfbuzz to version
10.3.0.

Pick-to: 6.8 6.5 5.15
Change-Id: I3a4daaa9c0747c4f4717ac8f0f9e7baf9a9a449e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 82a3357d007837b1d54dcf6dd6309363649d186f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 07:10:47 +00:00
Thiago Macieira
0777144b45 QColorDialogOptions: delete QSettings code and stop saving globally
[ChangeLog][QtGui][QColorDialogOptions] The class no longer
automatically saves settings such as the custom colors to a global
QSettings("QtProject") shared by all applications and no longer restores
custom colors from there. Applications that wish to retain the custom
color settings should use customColors() and setCustomColor() with their
own settings files.

Task-number: QTBUG-133805
Change-Id: I49cd7312054f41ca4cdbfffdcb60d6ea242393fc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9a753fa656a9bcae4193ceb38cfaf6e21641ddc2)
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2025-03-02 00:46:01 -03:00
Milian Wolff
cc6074c543 Add maybe_unused in benchmark to guard against nodiscard in the future
Requested by Marc Mutz when adding the utc() benchmark.

Pick-to: 6.8 6.5 5.15
Change-Id: I6f97f9e4dab07d10718280b4fb7ac158e42b8d67
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1f0bcec874dba8adbdf8de34e899565e89e80a38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-01 23:45:17 +00:00
Milian Wolff
c4618d6020 Add a benchmark for QTimeZone::utc
On my machine this gives me:

```
********* Start testing of tst_QTimeZone *********
Config: Using QtTest library 6.10.0, Qt 6.10.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 14.2.1 20250207), arch unknown
PASS   : tst_QTimeZone::initTestCase()
PASS   : tst_QTimeZone::utc()
RESULT : tst_QTimeZone::utc():
     358.686871 nsecs per iteration (total: 358,686,513, iterations: 999999)
     896.524312 CPU cycles per iteration, 2,5 GHz (total: 896,523,416, iterations: 999999)
     2,227.000427 instructions per iteration, 2,484 instr/cycle (total: 2,226,998,200, iterations: 999999)
     560.000375 branch instructions per iteration, 1,56 G/sec (total: 559,999,815, iterations: 999999)
PASS   : tst_QTimeZone::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 374ms
********* Finished testing of tst_QTimeZone *********
```

Profiling shows some quite unexpected code paths that
I will try to optimize in follow-up patches. Note that
this function can be called frequently when deserializing
QDateTime over a QDataStream e.g. - I have stumbled over
it while profiling some KDE PIM code in akonadi.

Pick-to: 6.8 6.5 5.15
Change-Id: I7439df53ae8512c766f63cb4b0d4f33d14aa3a01
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 29c7beac2e0065cc0d03b9db6a701f7c690c6f56)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-01 23:45:17 +00:00
Marc Mutz
8e2c6a5904 tst_QByteArray: check replace() doesn't replace the terminating \0
It doesn't.

Pick-to: 6.8 6.5 5.15
Change-Id: Ica3fb2b8a65d0f9d14490ecdcce72eba82258916
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit fff69288781bf946ad645fd781ad51ab48ebcbdc)
2025-03-01 21:02:09 +01:00
Marc Mutz
c653cf1171 tst_QByteArray: check replace() with empty and null needles and haystacks
Some time ago, we spent a lot of time fine-tuning the behavior of
indexOf() and split() w.r.t. matching of empty needles, or in empty
haystacks. Make sure that (QByteArray) replace() is behaving
consistently.

It isn't. Filed QTBUG-134079 to track the issue.

Pick-to: 6.8 6.5
Task-number: QTBUG-134079
Change-Id: I16af5d2bb5b309a56e81854be434fa9430ae284f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5fc1e9fa0c1925654412af5bf46ff95da99bc190)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-01 20:02:02 +00:00
Alexandru Croitor
dcb72b5315 CMake: Add function to set up SBOM generation defaults
Move the setting up of options like QT_GENERATE_SBOM into a separate
function, that can be called by projects other than Qt.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I337c4e9b0b3154ff97f494887bf88ee01e8ed00c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit dc5c7f9ead7e47b92c5717ca24d585a718a8b5f0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-01 18:26:19 +00:00
Alexandru Croitor
2769ef7174 CMake: Include license and license file attribution in SBOM comment
Some attribution entries don't have a SPDX license id specified, in
that case it's good to at least include the free-form license name and
file path.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I75bb5c30645684ea74fe94da92ea30eb29965ad4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit cf9f09cd60e3db37643ac6cf6cfd51aa00749892)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-01 18:26:16 +00:00
Giuseppe D'Angelo
35c18eba64 QColorTransferGeneric: fix the BT.2100 PQ EOTF
The PQ EOTF formula for BT.2100 [1][2] was incorrect. Fix it; while at
it, rename the variables to match the symbols used in the original
formula.

The inverse EOTF was correct, but also rename the variables there (for
the same reason).

[1] https://www.itu.int/rec/R-REC-BT.2100-2-201807-I/en
[2] https://en.wikipedia.org/wiki/Perceptual_quantizer#Technical_details

Change-Id: I6ce3a609824bee82053a16b3ff3cfc7cb396ce8f
Pick-to: 6.8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit a7ff4679facb9a44dff8b63a7e461ababa6aedfb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-01 11:57:55 +00:00
Ulf Hermann
b9169c1210 QByteArray: Make gcc 12 happy
It somehow concludes that asize may be negative and would then cast to
an obscenely large size_t. This produces the following warning:

.../qbytearray.cpp: In member function ‘replace.constprop.isra’:
.../qbytearray.cpp:2579:23: warning: ‘memcpy’ specified bound between 9223372036854775808 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
 2579 |                 memcpy(d + to, a, asize);
      |                       ^

Check for asize > 0 rather than asize != 0.

Pick-to: 6.8 6.5
Change-Id: I63bccb1bf3ff45d539af4efe6843d2c648d7cb86
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 177cd123d29f818413db4bb7a9d92b8485c95947)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-28 23:15:07 +00:00
Eirik Aavitsland
8159f4626b Raster engine: Fix painting of zero length, square cap wide lines
Such lines are rendered by drawing a capless line that is pen-width
long, i.e. a square, to represent the two line caps. However, the line
length offset was added before any transformation, so one could end up
with a long line being rendered if the world transform had a large
scale, say.

Pick-to: 6.8
Change-Id: Idff8a2de54c97e35facc8f4e09c43dfea7397588
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 56de11397559af3b9694ef2b99d93a469889ae5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-28 20:05:00 +00:00
Laszlo Agocs
e71708a6e5 rhi: d3d: Fix 3D textures exposed via UAV
The docs for D3D11_TEX3D_UAV do not mention accepting -1 as WSize,
unlike D3D12_TEX3D_UAV. Hence passing in m_depth for D3D11.

Fixes: QTBUG-129300
Pick-to: 6.8
Change-Id: I517d23e076039543361d2bca1b91cddd47abcfaa
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
(cherry picked from commit 6f89357f59b507c0dcdc177bc1ecfbbc94d6fed3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-28 12:12:05 +00:00
Marc Mutz
d561d864eb QByteArray::replace(): use std::string instead of QVLA<char>
QVLA preallocates space for 256 entries, and while that should be
enough for most uses, it may be too much in the way of stack usage.

Instead of using a QVLA with a non-standard preallocation, use the
more compact std::string benefitting from its SSO.

Pick-to: 6.8 6.5
Change-Id: Ia22543fb287a1976f316f7a4d27b23a22f511463
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 7c21630ce625817f1dc8e7182023b3fc6d36ac37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-28 10:50:03 +00:00
Jani Heikkinen
b0e9665e7d Revert "Revert "Android: update to Gradle 8.12 and AGP 8.8.0""
This reverts commit 22f33e1bd2c43e0223cd52b94e6ecead56a2e1b5.

Reason for revert: Needed provisioning changes are now in

Change-Id: Ibc1d1833942394efec0c24dc7e7a3e6ada5b8eea
Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2025-02-28 10:04:46 +00:00
Alexandru Croitor
37c60080dd CMake: Handle installing files with same name during SBOM generation
It's possible for a project to install a custom file with the same name
into different destination directories, and want to include them in
the SBOM.
Previously this failed at CMake generation time with an error like:

CMake Error: Files to be generated by multiple different commands:
qt_sbom/SPDXRef-PackagedFile-foo-bar.cmake

This happened due to using a non-unique filename for the generated
SBOM building file, as well as the spdx id the file name is based on.

Include a short hash based on the installed relative path of the file
to avoid spdx id clashes, and thus generated file name clashes.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I4c2ecd4652708504ef299af9b6f53d680d542382
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 9245d0a0f0761364e7b5b3d1c5c96cba16522820)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 19:19:48 +00:00
Alexandru Croitor
5fd8af81ad CMake: Handle DIRECTORIES in SBOM custom file sets
Previously one could only pass an explicit list of FILES to
_qt_internal_sbom_add_files. Add a new DIRECTORIES option, which will
glob the given directory paths, and include the found files in the
SBOM.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ia27afa93460d9f2e4462a49e30e4d6338300e8f7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 9db03c9dca1b7e403458fd9f43adb17a0ac8e55c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:45 +00:00
Alexandru Croitor
8a1dcd2bb9 CMake: Extract Qt-specific license concluded handling
Extract the handling of the license concluded expression for Qt
entities into the Qt specific handling file.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ib6f9a64f66dae0c971c43e8fffbc54362487b271
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ba93956be1179e4b4afaaecdf53b918b724cf500)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:44 +00:00
Alexandru Croitor
1f8a8da7c2 CMake: Unqtify THIRD_PARTY_SOURCES handling for SBOM attributions
Nested SBOM attribution targets were always created with the
QT_THIRD_PARTY_SOURCES type even in user projects.
Set an appropriate type depending on whether we are handling a qt
entity type or not.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Id8144d1b8093de78f2987a611a6de8e6d4777084
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0d9106bf7670b08c4bae11c3986b9cf3e0818b52)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:43 +00:00
Alexandru Croitor
68856adf1d CMake: Add a new SBOM entity type: THIRD_PARTY_SOURCES
It mirrors the Qt-specific QT_THIRD_PARTY_SOURCES one, to be used when
creating an SBOM attribution target that references a 3rd party
library's sources, as opposed to a complete 3rd party library.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I8f7f9f7386ffdc18dd8ae6ee32e39019639f5303
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8b06d37fb08d22e9f81ae2653aeafc105fc5bb61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:41 +00:00
Alexandru Croitor
db7e6d6fed CMake: Remove leftover code after refactoring
The assignment is not used anywhere.

Amends f1ac316191c010b1389f6f3549c9f0b4424b9936

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I3e6326b2782ab42dee8219353953ee6f4378ccfb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 17c482d818facd8f7d821aac87876ae079ff79d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:40 +00:00
Alexandru Croitor
8d8cf0bbfe CMake: Re-order SBOM embedded qt_attribution.json fields
Put the attribution file path and entry first, followed by the id,
and the rest of the fields.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I478a48980e6207646189d6b80ec57dbc9efb4902
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a5c7eb97ceb19ac90f8117240ad04cc717803555)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:38 +00:00
Alexandru Croitor
c276fa45dc CMake: Allow creating nested SBOM attribution targets for all entities
Allow creating nested SBOM attribution targets also for non-Qt targets
in user projects. This will allow using qt_attribution.json files in
user projects.

Rename PARENT_TARGET to ATTRIBUTION_PARENT_TARGET to make it clear
what the parent target is for.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ia08ee934a9dc03827fcc26d0fc90e072499e8a21
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a2ddd4fbd88353b21617e539266196b592683a3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:37 +00:00
Alexandru Croitor
21c5970da4 CMake: Allow including specific attribution ids in SBOMs
Previously one could attach all attributions from a
qt_attribution.json file to a target, or a specific entry based on a
given numeric index.

This is not always practical, as the index of an entry can change, and
including all entries might be too much.

Allow specifying a list of attribution ids to include in the SBOM.
This will parse all the attribution entries and only include those
that match the given ids.

If a list of ids is provided, and any of them is not found, an error
will be shown.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I2ca442fe0cd6d18773861f90f32ab7380aaeacdd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 52045e51e7e95f31a37127215c53e430fa77c8d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:35 +00:00
Alexandru Croitor
1dc3a9cac2 CMake: Sanitize nested SBOM attribution target names
To avoid issues with characters like "/" which might come from
attribution ids.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I65bec3b301f7fe1008cfd06aba3e1fbbb93f38c3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4a0b5661fdd1f1120018efb5f08bfbc1ed16cc13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:34 +00:00
Alexandru Croitor
59745fc798 CMake: Remove type restriction on attribution file extra SBOM info
So it can be used in other non-Qt projects.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I11d81d2c6819906fffbffe81f4db1b7af28cb99b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 6cd7f0c09b71ea49bdd3dd925b9a85dfe6cc943e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:32 +00:00
Alexandru Croitor
bccb4c8328 CMake: Remove type restriction on attribution download location
So it can be read / used in other non-Qt projects. We don't have such
a restriction on other keys read from the qt attribution files.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I225d83b26c68323761a8b13b3e6442057b5f7c7f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 422f5d859f3056433e6ee33ea389f2ecff1543d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:57:30 +00:00
Marc Mutz
0e7f52c872 tst_QStringTokenizer: check when the lazy range may be empty
Only when using SkipEmptyParts...

Pick-to: 6.8 6.5
Change-Id: I7dd67b801fa0deaab14eb7bb7e9905f60891ec48
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit cef7892135b4fccc85512629e8bee76ddfbc3240)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:11:35 +00:00
Alexei Cazacov
18dd4f9479 Doc: Move 'Classes for string data' topic to Qt Core and add it to TOC
Fixes: QTBUG-133954
Change-Id: If51abefc39eaae29f7d533af2974017793ef9358
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit baeed8e1e75db988aa53aa56353aa9c1f821b542)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 15:11:33 +00:00
Konsta Alajärvi
31e6f4a2ca Unblacklist tst_qrhi threeDimTexture()
Unblacklist tst_qrhi threeDimTexture() test function, by skipping
it with Android OpenGLES.

Fixes: QTQAINFRA-6333
Pick-to: 6.8
Change-Id: I795dd73fc7b35ab065f206030458088d829be9c8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d8f75f34c94aadff98722ec236a43115dfae8956)
2025-02-27 09:27:51 +00:00
Sze Howe Koh
206a8fec2c [Doc] QObject: Sync warnings of isSignalConnected() and receivers()
Extends e75c1a00e31723f1c9deb8427725fa0a58fae2a8 because calling
receivers() in disconnectNotify() can deadlock too.

As a drive-by, some statements are generalized further:
* "expensive initialization" -> "expensive operations" since that is
  what the relevant snippets actually show.
* The potential race condition is not limited to "after this function
  returns and before the signal gets emitted"

Task-number: QTBUG-106025
Change-Id: Iff014706b9e8d8147e3bbb9ac51542197eec5db3
Pick-to: 6.8 6.5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f5b874fd2d393b783dad85c95a158383420e481a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 06:57:25 +00:00
Thiago Macieira
54ef8bf929 Use QThread::isMainThread() in a few places
It's thread-safe, whereas trying to load qApp isn't in Qt 6.x (will be
in 7.0) and dereferencing it to call QObject::thread() will probably
never be. It's also faster, being a single function call instead of two
or three.

This is not an exhaustive search, it's just a few places I found while
searching for QThread::instance().

Pick-to: 6.8
Change-Id: I3b4e1c75bb3966e2cd2dfffd79bfc8a40f6cf40b
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6fb39ca2cbb111469ce09c8342997eb5375e3239)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 06:57:25 +00:00
Ahmad Samir
d47af17a0d QDir: improve mkdir/mkpath API docs
Pick-to: 6.8 6.5
Task-number: QTBUG-132633
Change-Id: Iafe4a20bacbbf55d19377e8cd04f940d4f2a66f6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 23981aae0e059d876d441bfffae9d9d0fd671bde)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-27 01:04:10 +00:00
Rami Potinkara
d2f48abeb5 Android: update Android SDK to version 35.0.1
This patch updates the macro AndroidBuildToolsVer to
version 35.0.1.

The version 35.0.1 is used elsewhere, see
b49421a984ac2b203b7995f3787b67184c990089

Amends: 9b475eadfcf04194a094454f65295c3a456000a4

Task-number: QTBUG-129462
Pick-to: 6.8 6.5
Change-Id: Ic15e12c563fa3d16315daa13b6f6b6ef19535954
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 7a7093eb87ebc986555b855611018066e2c39bed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 21:27:28 +00:00
Giuseppe D'Angelo
79539c50cd Q_DECL_EQ_DELETE_X: properly version the check for Clang
Clang 20 has fixed the referenced issue. Once more this shows the
importance of versioning compiler-related checks...
Amends 1b1ae345025d1cac953985d4cfebd20fadb6bc99.

Change-Id: Iea88d466883562b0130639d7c0f2f3b984acdbc2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fb1824a9d669c601ebd540c9ca16a9687d7d9706)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 20:13:12 +00:00
Cristian Le
926abdce78 Bundle Kitware's RunCMake test module
Introduce a new module `TestInternalPrivate`.

Kitware's RunCMake allows to create more granular unit tests using
`cmake -P` scripts instead of configuring, generating and building full
projects.

[ChangeLog][Third-Party Code]
Add upstream cmake's RunCMake test infrastructure module to
src/testinternal/3rdparty/cmake to aid in creation of cmake auto-tests.

Pick-to: 6.8
Change-Id: I08cb7c6dc6f61bde29f176d58295f4f660b34ca8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 39e7946cb6562c6f9b1baf5c44b1694922d0538e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 16:06:36 +00:00
Alexandru Croitor
143b016277 CMake: Add quotes around QT_DEBUG_OPTIMIZATION_FLAGS compiler flags
To more easily spot white space differences.

Pick-to: 6.8
Change-Id: I1e07960f78c95ca536243ce5c4fc6c302c47a7db
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2dd0c4520fdee50a3511ca2f83decdf807ba2cb3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 16:06:35 +00:00
Alexandru Croitor
38835684b3 CMake: Fix full rebuilds when using MSVC and reconfiguring the build
When reconfiguring an MSVC -release build with 'cmake .' after a full
build, instead of being a no-op, it rebuilt everything.

This happened because of CMAKE_CXX_FLAGS_RELEASE being accidentally
modified on each reconfiguration, resulting in extra whitespace being
added to the compiler command line rules.

Specifically, this was because we always added '-O2 -Ob3 ' as a string
to the compiler flags, but due to stripping, always tried to remove
only '-O2 -Ob3' (no trailing white space) when removing the
optimizations flags, resulting in an extra white space for each run.

Remove the trailing white space after '-Ob3 '.

Amends 2fb134f3fe8fdeb1f36c346cff3b09a2b7a095a7

Pick-to: 6.8
Change-Id: I46eb4c3b769ae6b063fe62df05c0cb92f13bda30
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit fdb9a5141446ed8aa767d88a921c24221b0704ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 16:06:34 +00:00
Cristian Le
1fa408f328 Make AdditionalTargetInfo.cmake optional
Pick-to: 6.8
Change-Id: I8b8d6383b6c50e9403bc90e76d4da8eb6c314854
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2433d02856bb55150d62d84b71b7d8a90c0ce81f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 16:06:33 +00:00
Cristian Le
0bd6b909ab Add interface to install EXTRA_CMAKE_FILES in other paths
If the source file sets `QT_INSTALL_PATH` property, it will install the
CMake files in the relative path starting from the config-dir in both
the build and install paths.

Pick-to: 6.8
Change-Id: I86197d62bfac96f9c142d8abfe85c9b6f6f1a527
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit aef789ad97ee9b8f3254a0e315a0d8a4785bcbf7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 16:06:30 +00:00
Eirik Aavitsland
5f3708e190 Update bundled libpng to version 1.6.47
[ChangeLog][Third-Party Code] libpng was updated to version 1.6.47

Pick-to: 6.8 6.5 5.15
Change-Id: I11a0f266dddaad480a7700c3cdc4ec6da8de2fae
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 8b75f4735b36a77b6426c7dab55190416e6a4af5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-26 07:45:35 +00:00
Giuseppe D'Angelo
dbd149375b Docs: uppercase spelling of utf-8
It should be spelled UTF-8 (official name by the Unicode Consortium).

Pick-to: 6.8
Change-Id: Ib358d0870e77f0cb4cdb920ed5ca829f100707a1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0770171dcda24a567d6f57b87fdd284011e56e16)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-25 20:35:41 +00:00
Fabian Kosmale
34625db91a qt-cmake-create: Modernize QML template
- Do not use a version for the executable module target
- Rely on QTP0001 for the RESOURCE_PREFIX (via
  qt_standard_project_setup)
- Do not use OUTPUT_DIRECTORY to avoid a URI mismatch, potentially
  causing issues with the implicit import. Instead, use
  RUNTIME_OUTPUT_NAME to avoid a conflict between folder and executable
  name.

Change-Id: Ic6188d96042e7b34eb3f423daf2b57290ca18a11
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit e84145d6c14e92c3a499904f70046bc3ceee5960)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-25 03:04:43 +00:00
Michael Weghorn
6f559732cf QWizard: Drop obsolete sentence in QWizard::currentId doc
Commit 2140edaaab0bf61f354db521efca773568becc56 introduced
QWizard::setCurrentId that allows setting the property
directly, so drop the obsolete sentence in the QWizard::currentId
doc stating that this isn't possible.

Pick-to: 6.8 6.5
Change-Id: I5e7da2323e66a6e8bfd653dfebcba4363023b744
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 71246cbdc64c4a5b3b3859421221bcc36c4a61c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-24 23:57:34 +00:00
Alexey Edelev
16639502a7 Make PlatformGraphics lookup QUIET
Let's do not litter user's logs with our internals.

Pick-to: 6.8
Change-Id: I79e9210960f1298a6e8e2b6f10e1bfefdbfede7f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f9a05c7cae10c05b701003f8ed848d0bfef8290a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-24 22:38:38 +00:00
Lauri Pohjanheimo
3fe904e231 RenderToRgb10Texture test unblacklisted
On CI an Android emulator with SwiftShader software graphics
implementation is used. SwiftShader implementation is unable
to emulate this OpenGL functionality.

Blacklisting removed. QSKIP the test if it is run in Android platform,
OpenGL and SwiftShader sw graphics implementation is found.

Task-number: QTQAINFRA-6331
Pick-to: 6.8
Change-Id: I4a7e64e464ea04409154be2e7b3135ecd88a29fc
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-02-24 09:16:05 +02:00
David Faure
ebbf2d298b Document the default value for QAbstractItemView::editTriggers
Change-Id: I4456dcfcecf739299533167867208e1943bc4a26
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
(cherry picked from commit 408959c8c85badfcd374b21fb2e6071c40e5cba4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-23 12:15:39 +00:00
Thiago Macieira
9593852f24 CBOR: remove QT_X11_DEFINES_FOUND dead code
Amends commit be0f1af3f1829da0d321c12dbd40d5743d3b2eb5 ("CBOR: remove
the X11 True and False for good"), which removed the #define from the
top of the files, but didn't remove the checking of the macro from the
bottom of them.

Change-Id: I92e76842a4117f6feed3fffdac2fcec01367101e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 00f3ca950a6cab105c95b53ce2b3b93282abcea8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-23 07:56:00 +00:00
Thiago Macieira
fab3e958da QT_TEST_EQUALITY_OPS: insert QCOMPARE before the current code
The macro, as it was, makes debugging REALLY hard:

FAIL!  : tst_QStorageInfo::operatorEqual()
 The computed value is expected to be equal to the baseline, but is not
  Computed (lhs == rhs)   : 0
  Baseline (expectedEqual): 1
  Loc: [qcomparisontesthelper_p.h(178)]

It prints the location of the macro helper, not the line that called it,
so one has to guess which of the many uses in a function has failed. And
it prints the boolean of whether the comparison result is the expected
value, not the values of left and right.

QT_TEST_ALL_COMPARISON_OPS also needs a similar fix, but I don't have
time for it. Ideally we'd replace the qScopeGuard with a proper QTest
failure report, which would extract the printers for Left and Right.

Change-Id: I7a643066137c5fcdb9e7fffd83d9bf7cf4cccd6c
Reviewed-by: Rym Bouabid <rym.bouabid@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 4a4c4252919d4894c7e5c6f2e636dda5dc1b1d0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-23 01:34:06 +00:00
Christian Ehrlicher
5518a384b2 SQLite: Update SQLite to v3.49.1
[ChangeLog][Third-Party Code] Updated SQLite to v3.49.1

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-132862
Change-Id: I544a7e2435315469fc174e2b2bf8c9ddbcf78c06
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit bc06c7c61a4fe8fb695d581e43779fa5351febbf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-22 23:02:47 +00:00
Eskil Abrahamsen Blomfeldt
e51d03e334 Escape calculating vertical windows-metrics if they're too big
This amends 073fae097ce40bee1532c252a8c696840b5dfc16 which added
an escape before calculating the vertical metrics if they were too
big and would overflow. It missed one spot, which was when using
the winAscent/winDescent instead of the typo-metrics.

Change-Id: Ib6a7705f6676c66bfd04b37efa30fe2d1b99581c
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
(cherry picked from commit f846754663aae1652e4eec9a441ee222af352319)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 23:23:28 +00:00
Alexandru Croitor
dbfd84ae4c CMake: Rework SBOM PURL handling
Previously, only 3 purl entries could be added to a target, which
tightly coupled to Qt's needs: a QT one pointing to code.qt.io,
a MIRROR one pointing to github, and an upstream one pointing to some
upstream third party location.

Rework the implementation to allow for an unlimited number of PURL
entries and to allow more flexibility when adding PURLs in a user
project.

The new syntax for adding PURLs to a target, which is also the basis
for a future public API is as follows:

qt_internal_add_sbom(<target>
    PURLS
        [[PURL_ENTRY
            PURL_ID <id>
            PURL_TYPE <type>
            PURL_NAMESPACE <namespace>
            PURL_NAME <name>
            PURL_VERSION <version>]...]
    PURL_VALUES
        [purl-string...]
)

The PURLS keyword is used to specify multiple PURL entries, each
starting with the PURL_ENTRY keyword. The PURL_VALUES keyword is used
to specify a list of pre-built purl strings.

PURL_ID is an optional argument used to identify a specific purl
entry, which is mostly needed for Qt's needs, to post-process them
further.

The rest of the options are pre-existing from the previous
implementation.

Implementation-wise, there's a new custom parser to be able to parse
and validate PURL_ENTRY arguments.

The VERSION option was renamed to PACKAGE_VERSION, to avoid some
issues in cmake_parse_arguments parsing with nested VERSION options.

The NO_PURL option was removed because it makes no sense in the new
implementation, because if you specify some PURL arguments, there is
already an intention to generate a PURL entry.

Qt entities no longer have a restriction on which specific purl ids
they can have.

The new Qt specific purl IDs have been renamed:
- QT -> GENERIC
- MIRROR -> GITHUB

Amends f7e1123620b623be0c321b54eaba7a1d618a7ce1

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I050decece1c6d9e6e0e06547043f864d6f497ea7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit a28a9e194cbcaf501c93df988c7dc6f5e09ee5d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 19:49:41 +00:00
Alexandru Croitor
2d51fc3c69 CMake: Move generic PURL function from qt-specific file to main one
Move generic PURL function from qt-specific file to main one. It was
mistakenly added to the wrong file during the initial split.

Amends f1ac316191c010b1389f6f3549c9f0b4424b9936

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I1884f53ee7d30a25b873d85ee04b8c8d1e0532f5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit fd622bc3ae90ba27069744bf61524139f1642872)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 19:49:41 +00:00
Alexandru Croitor
a70a4f65fe CMake: Move more Qt-specific SBOM PURL functions to the right file
The Qt specific functions belong in the
QtPublicSbomQtEntityHelpers.cmake file, not
QtPublicSbomPurlHelpers.cmake.

Amends f1ac316191c010b1389f6f3549c9f0b4424b9936

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: If5dd77672306c520404b294a6b5bde4f0e6ab8bc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e7cdf9d4385f02fa82e2d9f23abb8aa06f9440b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 19:49:41 +00:00
Wladimir Leuschner
b1979646fb QWindowsTheme: Set highlight color to accent color in light mode
GetSysColor(COLOR_HIGHLIGHT) did not report the right highlight color in
light mode palette, Leading to a wrong accent color on
Windows. This patch uses the accent color analog to the dark mode
palette for QPalette::Highlight.

Fixes: QTBUG-130458
Pick-to: 6.8
Change-Id: If21f392e31c3187c28e871919ff17f417c8d144b
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit a55db2cbee914d7bdc5678f35da297b79aec7613)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 14:54:42 +00:00
Toni Saario
1a5499ce5f Coin: Extend VxWorks restart matching to RTPLib errors
Running many tests on the VxWorks in the emulator without
restarting it between can cause exhaustion of some
resources and cause an RTP spawn fail in some tests.

This change will restart the emulator in such cases, which
allows the test to try again on fresh boot.

Change-Id: I5ad715f243867d43b055271d6bc61ca4ccb3089b
Reviewed-by: Simo Fält <simo.falt@qt.io>
Reviewed-by: Michał Łoś <michal.los@siili.com>
(cherry picked from commit 5be7a9773e106f9675e8d57121c298539f4ce343)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 14:52:54 +00:00
Marc Mutz
56c05f47f6 QByteArray::remove(n,n): minor code cleanup
The result of d.begin() is only used in one of the branches, so
defining it outside both branches is a bit unmotivated; instead, drag
toRemove_start out of the else branch and reuse it in the then branch,
too.

Amends 358b7a9e747549f85c1d1631dfb21210b52b36f5.

Pick-to: 6.8 6.5
Change-Id: I162d72de7097a1257c8a0a01b69c36fc87466114
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 2831ce613fdaebe94e35a8afe45a057004548991)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 13:28:47 +00:00
Marc Mutz
72f41f8756 QByteArray: delegate to replace(char,char) from replace(QBAV,QBAV)
Don't go and build (among other things) a Boyer-Moore table for the
trivially optimizable replacement of single characters with single
characters. Just call the existing replace(char, char) overload.

Pick-to: 6.8
Change-Id: Ic69527bdaa5ce95bf937295366b94366e2ace933
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 60af93847e365fc00ccc4bcf61bb90ef6da1f0b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 13:28:41 +00:00
Marc Mutz
6cefb8be96 QLocale: fix UB (signed overflow) in formattedDataSize()
Coverity complains that qCountLeadingZeroBits() may return 64 and then
the RHS will be out-of-range for int. Of course, 64 leading zero bits
means that the argument is 0, which we excluded in the first `if` of
the if-else chain.

I can only guess (because it doesn't tell me which value of `bytes` it
is using for the analysis) that Coverity assumes bytes ==
numeric_limits<qint64>::min() and considers the overflow in qAbs() to
yield a 0, because, it being UB, it may yield anything.

Be that as it may, the fact remains that formattedDataSize() invokes
UB when passed numeric_limits<qint64>::min(), as confirmed by ubsan:

   global/qnumeric.h:479:26: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself
   text/qlocale.cpp:5062:82: runtime error: signed integer overflow: -2147483648 * 3 cannot be represented in type 'int'
   text/qlocale.cpp:5062:26: runtime error: division by zero
   FAIL!  : tst_QLocale::formattedDataSize(English-Decimal-min) Compared values are not the same
      Actual   (QLocale(language).formattedDataSize(bytes, decimalPlaces, units)): "-inf bytes"
      Expected ("output")                                                        : "-9.22 EB"

So fix the overflow by using the new QtPrivate::qUnsignedAbs(). Then
sit back and await Coverity's verdict on the next run.

[ChangeLog][QtCore][QLocale] Fix issue when calling
formattedDataSize() with numeric_limits<qint64>::min().

Amends 9d23aebb271ea534a66cb3aceb2e63d9a1c870d6.

Pick-to: 6.8 6.5 6.2 5.15
Coverity-Id: 474294
Change-Id: I9a5a5acbdcf881a624bb827ca1dd970771f1bb6e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit b93575de01760ff2ab0d817557a642c71cdb4414)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 13:28:39 +00:00
Marc Mutz
9479f9bbfc tst_QCryptographicHash: remove remnants of BigData split
The ensureLargeData() and 'large' members were only used in BigData
tests that have since moved to a different executable.

Amends fff217824b532da7306af1ac755581e76e098a27.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: Idc99a868e082098dda4e1bee62470370c7e20f62
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 5cd046f154a0a31635c935bf6c9f1abd27837b80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 13:28:37 +00:00
Marc Mutz
646bea85a5 QByteArray: don't recurse when needle or replacement alias *this
While the idea to delay the construction of the QVLAs until we know we
need them is elegant, we're doing a lot of checks twice or thrice this
way, so merely re-set the a, b pointers and otherwise continue
executing.

This requires us to default-construct the QVLAs before potentially
assign()ing to them, but that ought to be cheap, given the compiler
can see everything that's going on in QVLA.

Pick-to: 6.8 6.5
Change-Id: I4e42d5ab48711af91cc1785171524be5fb45ae2f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 4308ab70cafa4398aa72dfe63bc580a6ecff9e52)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 13:28:34 +00:00
Patrick Stewart
09c093f969 Close the Qt namespace even when QT_NO_TRANSLATION is defined
Pick-to: 6.8 6.5
Change-Id: I5e463b81f7e73b2946a0e3b3036a09de2105307b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c9c8abb52d4ba77c551513baf678be0761d1c895)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 11:46:18 +00:00
Christian Ehrlicher
3cd991037d QSqlTableModelTest: misc cleanup
Cleanup QSqlTableModelTest:
 - use pmf QSignalSpy ctor
 - use QCOMPARE/QCOMPARE_GE instead QVERIFY where possible
 - properly close additional databases so temporary folders created for
   sqlite can be deleted on exit

Pick-to: 6.8
Change-Id: I84e8960b81128c141a0e2cd6d03837c9b5ac6652
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit a47dc990793a1e299e9ba869e1d6c76fa0bf9d65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 11:46:16 +00:00
Joerg Bornemann
3c178b40e7 configure: Fix the -sbomdir argument
The argument must be added in qt_cmdline.cmake to work.

Pick-to: 6.8
Change-Id: Ic256c0fda0caf3794b37ad8c5e8b6515fb45b0e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5971e94bafacfebdcd28ef84a7cfea61ffd48689)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 10:52:15 +00:00
Thiago Macieira
81443770ce QDirListing: std::exchange is <utility> not <memory>
The Clang analyser in Qt Creator was letting us know that <memory> was
unused in this header. Also, this is Include What You Need.

Pick-to: 6.8
Change-Id: Id7c260818f9e84847971fffda11da096169a0047
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 9dc8bc80de03ccf52fabf63855128c5852d51605)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 03:21:18 +00:00
Even Oscar Andersen
87e28fc8ec wasm: call focus on window if not editable
We used to call focus on the input element even for things
like pushbuttons.

This will display a keyboard on android, instead call
focus on the focus window.

Fixes: QTBUG-133781
Pick-to: 6.8
Change-Id: Ide4d6ec21a14f17b40d3d3de077c0ab073682f19
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
(cherry picked from commit 442e2f4aeb2081c1b8344a8f5cc2c6f2e7bb7d5b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-21 00:03:29 +00:00
Tor Arne Vestbø
9fbb8e0090 iOS: Set LD_ENTRY_POINT for generated Xcode project
We normally override the entrypoint to _qt_main_wrapper via the -e flag
to the linker, but if a Swift file is added to the Xcode project, Xcode
does some magic, building the app as a shared library, and wrapping it
with the Swift code into a custom executable. The -e flag will then be
a noop when linking our shared library.

To work around this we set the custom LD_ENTRY_POINT Xcode build setting,
which triggers Xcode to pass -e when linking the wrapper-executable.

This works in practice, but produces a warning on the console that the
entrypoint is not found, which has been reported as FB16519113.

Fixes: QTBUG-133577
Pick-to: 6.8
Change-Id: I9d8310b39ac5a4900693df55c2e5bfa346c0300a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 430ba7c0f826ee6f91fbfdc861525cb62b8e725c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-20 19:11:47 +00:00
Wladimir Leuschner
4488dfcbf6 QWindows11Style: Add horizontal offset for Qt::AlignVCenter Labels
The progressbar label overlaps with the progressbar grove, when
vertically centered aligned. This patch adds a y offset to the
label, in case it is vertically centered to avoid the overlap.

Fixes: QTBUG-128458
Pick-to: 6.8
Change-Id: Iac977f83f09c2e4d12d1e0ed5f0eab3120c07b96
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 564633f9d4e4cc8fa361de8165a9dfb203b7248e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-20 17:36:15 +00:00
Eirik Aavitsland
87e53579ea Windows: Fix rounding error in BitmapInfoHeader calculation
A potential rounding error in calculating the padded scanline length
could lead to the biSizeImage field being assigned a too small value.

Fixes: QTBUG-133782
Pick-to: 6.8 6.5
Change-Id: I251212cf2859f7268fc8ad6ca1cbc57f2bb1f1c0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 3d389ee2ac6478a470f19e73826a3889dd117337)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-20 17:01:13 +00:00
Alexandru Croitor
9491249fc6 CMake: Avoid warnings _qt_internal_sbom_replace_qa_placeholders
We should only pass the VERSION option if we have a value to pass.

Fixes warnings like the one below when using CMake 3.31:

CMake Warning (dev) at cmake/QtPublicSbomAttributionHelpers.cmake:511
(cmake_parse_arguments):
  The VERSION keyword was followed by an empty string or no value at
  all.
  Policy CMP0174 is not set, so cmake_parse_arguments() will unset the
  arg_VERSION variable rather than setting it to an empty string.
Call Stack (most recent call first):
  cmake/QtPublicSbomHelpers.cmake:954
  (_qt_internal_sbom_replace_qa_placeholders)

Amends bc3bbb51b7b48d3c4a44a432441938863582242c

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I671a9153d72b21b6aed2112bea45f577a5cee4eb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4174f388e6804fb138f625aab3eb75b90c2c7bd4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-20 17:01:11 +00:00
Mate Barany
5581c62922 Do not keep the headers and message body in case of temporary redirect
The implementation of GET requests with body (QTBUG-112871) keeps the
body after it has been redirected. However, in case of temporary
redirect (status code 307) this seems to be an incorrect behavior.

Reset the headers and the body in case of temporary redirect.

Pick-to: 6.8
Change-Id: I10be702b017a42cca27a37dfe2249da2f59c0328
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit f6a5c7e011d24db22afa5a3bf92749b9bb9e9354)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-20 15:12:31 +00:00
Eskil Abrahamsen Blomfeldt
e7562a50b9 Accept multiple fonts with the same family and style name
When the style name is included in the request to
QtFontFoundry::style(), then it will ignore the other properties
and just return the hit that matches it. This is because we want
the style name to take precedence over all other properties when
the user specifies it in a request.

However, we were using the same function to check if a specific
font already exists. If we are registering a font and it is
already in the database, we want it to replace the existing one.
But for fonts such as the variable "Noto Sans Display" there would
actually be multiple styles in the family that were called the
same ("Regular") but had very different properties.

Due to how fonts are populated on GDI, this issue did not occur
there, so the issue is perceived as a regression in Qt 6.8 when
we switched to DirectWrite as the default backend.

We fix this by ignoring the style name when checking if the font
already exists and instead prioritizing the specific properties
it has. If multiple different styles with the same name exists,
they will all be registered.

Note that it will not be possible to differentiate between the fonts
using the style name, same as before, but you will now at least
be able to select the different styles by specifying properties
such as weight.

[ChangeLog][QtGui][Fonts] Fixed an issue with font families where
only the last of multiple sub-families sharing the same name would
be registered.

Pick-to: 6.8
Fixes: QTBUG-131574
Change-Id: I86a04547065c2d9ef88d9a761af95af33eb9b3d6
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 1d6f71779f05df1af3daacd48f309cd92523152a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-20 13:18:05 +00:00
Eskil Abrahamsen Blomfeldt
333a08c98f Fix divide by zero when opening font on invalid image
If you open a QFont on an invalid image, its dpi will be 0. In
other places we check for this before calculating the point
size, but this was missing in one spot, causing divide by
zero.

This would happen e.g. in the tst_QFontMetrics::same() test.
While it would pass normally, running this with an undefined sanitizer build would warn about the division by zero.

There's nothing useful we can do with the fonts on the invalid
image, so like in the other places, we just leave the point size
as is when this happens.

Pick-to: 6.8 6.5 5.15
Change-Id: I4769e23e2b4dbb92f675cb8a77f8554c90bc2afd
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
(cherry picked from commit c136de2deb46fb5f60728bc5a4083b9439ea0a3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-20 08:27:14 +00:00
Thiago Macieira
c1bb08ab26 QVariant: don't use the static CanUseInternalSpace with existing objects
It's possible for the QVariant to have been created by an older or newer
build of the library in question in which the type in question was
relocatable but has ceased to be, or wasn't relocatable but now is.

[ChangeLog][QtCore][QVariant] Fixed a bug where QVariant could misbehave
regarding types that changed from non-relocatable to relocatable (or
vice-versa) and not all uses of it were recompiled. To benefit from this
fix, applications must be recompiled, but they will be safe going
forward.

Pick-to: 6.8
Change-Id: I222806b3804df6272abdfffd45f96312d23be1af
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit eb87b0444ac8fec4d86bc26dc4bec80f82953f7c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 21:55:14 +00:00
Jani Heikkinen
22f33e1bd2 Revert "Android: update to Gradle 8.12 and AGP 8.8.0"
This reverts commit e60b493c2e5c672528efd7e0bc8f659e0fd2e2e5.

Reason for revert: temporarily revert it to pass submodule
update round.

Change-Id: I63e8cf78c93d84add4aaaee388b01f2c15cca312
Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
2025-02-19 18:52:16 +00:00
Eric Beuque
dcf09c0c63 Fix bad signal restoration which can cause infinite loop
This fix the FatalSignalHandler destructor to restore properly the
signal handler which cause an infinite loop when a signal is emitted
like SIGABRT or SIGINT and when we are using two QTest object in same
program.

Fixes: QTBUG-132121
Pick-to: 6.8 6.5
Change-Id: Ie9476e1ff9c0f29c3e35ae6dff565fab4a77ba86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 50d1a22e5c6361e7c1ef09432b2a151eee3e6114)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 18:14:09 +00:00
David Boddie
73e9605765 doc: Remove link to missing showShaded() function
Pick-to: 6.8
Change-Id: I8a70558521a6829e0bd99f03a7aa695681061945
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit c08ca6ff02af9d735b2692b958c1666ea96996bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 17:14:17 +00:00
Wladimir Leuschner
7cab94a4c8 QWindows11Style: Use Highlight color for ItemView with alternating rows
When using alternating rows in ItemViews, the currently selected item is
hard to distinguish from the background colors. This patch uses for
ItemViews with alternating row colors the highlight color for the
selected and hovered item.

Fixes: QTBUG-133118
Pick-to: 6.8
Change-Id: Ib5dbe0f58d5970c41cc9d14cf2188a7e5b1abd1a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit c3d2a4972ca6bec5bfe9dbe989e2dc6e347f02c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 17:14:16 +00:00
Edward Welbourne
320a3b1328 Avoid returning null from find{Next,Prev}InOrder(non-null)
The checkNode(p) call relies on p being non-null, so CodeChecker
grumbled. In any case, we should be returning node_impl if we fall off
the end of the structure (which shouldn't be possible, since we
descended into the three and can't come back out on the way up without
passing through node_impl, for which we check). Include a null-check
in checkNode(), save the nsURI.isNull() check when !p->isElement()
makes it redundant and fix some coding style nits while I'm about it.

Amends commit 8609982791928a30a6d836b25810143a064f8c6f

Coverity-Id: 474724
Coverity-Id: 474725
Coverity-Id: 474726
Change-Id: Id622a91d2e443276756e50729cf155b10f7164a1
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit 82ae262de27534170060e61e8d1f4b045ae13fb8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 17:04:00 +00:00
Edward Welbourne
05b91b1195 Fix UB in QTextStreamPrivate::putNumber()
Negating a negative value may attempt to negate the minimal value for
the signed type, whose only set bit is its sign; this is UB. So don't
do that. Since the non-decimal branch of the code just prepends
locale.negativeSign(), and we're passing -1 as width parameter to the
QLocalePrivate formatters (so there's no zero-padding, whose size
would be reduced to make space for a sign), we can treat decimal the
same as all other bases. This, furthermore, simplifies the code.

In the process, I noticed (because a test only done for decimal
failed) that if QTextStream::ForceSign is set, this code-path for
negatives would prepend the minus sign before a plus sign supplied by
QLocaleData. Skip the flag to include sign, for negative input, since
we'll be including a negative sign anyway. Remove the QEXPECT_FAIL()
from the test I've added for this in a preparatory commit.

Purge one now-redundant comment and revise some others. Expand on why
we need to hack octal zero to display two zeros. Add a second test row
to keep the lonely zero-row company in the test for that.

Fixes: QTBUG-133269
Pick-to: 6.8 6.5 5.15
Change-Id: I35c9bdf34b812cff578de9b0a2570a60e6145c80
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 44ddb34da07f7fdb2214cb39b56cf114d4aa209e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 17:03:58 +00:00
Marc Mutz
4372292136 QBenchmarkPerfEvents: help Coverity understand the code
Coverity thinks that r may be negative and not -1 and warns that the
cast to quint64 may overflow.

Change the check for `== -1` to `< 0` to help Coverity (and other
readers of the code) understand that this cannot happen.

Amends c63420a117fe67107466d806890e901d091cb1d5.

Pick-to: 6.8 6.5 6.2 5.15
Coverity-Id: 474172
Change-Id: I7615e0ef152e1e6e9cbc6dec1b8ecd4f8879521c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 24a26ed3a3842398276ae54602e8e1936a2f2323)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 16:45:02 +00:00
Marc Mutz
173eebbd96 tst_QLocale: actually check formattedDataSize() with qint64
... not just int, and not just non-negative values.

Reveals a problem with bytes == numeric_limit<qint64>::min(), says
ubsan (example; all min64 fail):

    global/qnumeric.h:479:26: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself
    text/qlocale.cpp:5062:82: runtime error: signed integer overflow: -2147483648 * 3 cannot be represented in type 'int'
    text/qlocale.cpp:5062:26: runtime error: division by zero
    FAIL!  : tst_QLocale::formattedDataSize(English-Decimal-min) Compared values are not the same
       Actual   (QLocale(language).formattedDataSize(bytes, decimalPlaces, units)): "-inf bytes"
       Expected ("output")                                                        : "-9.22 EB"

So exclude that from testing, for now.

Pick-to: 6.8 6.5 6.2 5.15
Coverity-Id: 474294
Change-Id: Ia1f8e87c58a9fdc2668b6745956e913384cff4c7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 562cb8e4d9c5e6482b8c6b85fbb6f735d3000ad2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 16:44:55 +00:00
Cristian Le
aa0e38c607 Fix: Use _qt_internal_set_source_file_generated
`SKIP_AUTOGEN` was a bit too zealous.
Hotfix for 6865c21e41be5d86b5a04889bfe28fac55c89f29

Fixes: QTBUG-133850
Change-Id: I6ec984a7a5d8eefb56e53a0f56c4f4384a56e0ae
Reviewed-by: Nicolas Fella <nicolas.fella@kdab.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 97517b20aaaccb9f2bfa6d571a71f40560507476)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 16:44:53 +00:00
Marc Mutz
76783a4487 tst_QCryptographicHashBigData: skip Sha1 tests on ASAN CI builds
The SHA-1 test has started to time out in CI ASAN builds recently, so
skip it there. Keep it on non-CI or non-ASAN builds, though.

Amends c6e092a5f84b7fc72556897b50c7697152967925.

Pick-to: 6.8 6.5 6.2
Change-Id: I8d653c2a8304cfae290befafda570d5c49dd4536
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 929466ba64c503cc1a7c6205f0a424350a9a201f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-19 14:50:38 +00:00
Konsta Alajärvi
fd15b2178a Unblacklist tst_qrhi renderToTextureSampleWithSeparateTextureAndSampler
Unblacklist test function by skipping it with Android with Vulkan.

Fixes: QTQAINFRA-6335
Pick-to: 6.8
Change-Id: I2ee093542f09f68044baa044b697a09af066fcd8
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Lauri Pohjanheimo <lauri.pohjanheimo@qt.io>
(cherry picked from commit 83a4128ecbc260231b942f811b34fbe7595b14bc)
2025-02-19 10:35:44 +00:00
Axel Spoerl
4c1aef25ce Correct childNumber() reference in editable tree model example
childNumber() has been renamed to row() in the code, but not in
the documentation.
Correct it.

Pick-to: 6.8 6.5
Change-Id: Ibe6f1f27c0dd1982ff663dc680738babf2db87d7
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit d0cb3c0acdd4a482fd749684f282451bdd13557f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:21 +00:00
Topi Reinio
d83f820ab4 Doc: Ignore 'Unknown base <type> for QML type' warnings for now
These warnings are false positives when testing in the CI
when a documentation module containing the  base type is meant
to be loaded as a dependency; In the CI, the .index files for
doc dependencies are not available so we see this warning.

Ignore these warnings for now in the global documentation config.

Pick-to: 6.8
Change-Id: Ic1711bf7389e9f9d4a04e3b72b2c9f8b25539357
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 3336422289079b421797ac2d194241976929c7d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:20 +00:00
Alexey Edelev
09e4baf5eb Ensure <target>_copy_apk_dependencies is called for QtC build
QtC doesn't use the make_[apk|aab|aar] targets, it runs the deployment
manually. The top-level android build target for QtC is the
<target>_prepare_apk_dir target. Make it depending on
<target>_copy_apk_dependencies target, to ensure that all abi-specific
artifacts are copied before running the deployment procedure, from
either QtC or command line.

Amends 44149f9d8b62b5343a5d06628b0c9588f035ccc2

Fixes: QTBUG-133810
Fixes: QTBUG-131862
Pick-to: 6.8
Change-Id: I4f3630798658a793b0c96a99fc4644ec1dd0504b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7a6b3e1a9c0555e91f3e510b63bc0cc18bb1ef16)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:20 +00:00
Alexey Edelev
af7ca1d159 Mention QT_ANDROID_MULTI_ABI_FORWARD_VARS in QT_ANDROID_BUILD_ALL_ABIS docs
Help users to navigate in docs.

Pick-to: 6.8 6.5
Task-number: QTBUG-107893
Change-Id: I95774e03ba4027dad82ba652b3f119f19b9d6760
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 4d6a2850ad72a9f4ca9eae49d543809c10e1fe0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:20 +00:00
Thiago Macieira
56993ad559 QThreadStorage: don't print the destruction ordering warning on app exit
This warning here was very confusing (so I'm also updating the language
to be clearer what it means). It is here to advise users of
QThreadStorage that they may have destroyed the object before all
threads using the object have finished. That means there will be memory
leaks, hence the user should fix the issue.

But the one time we don't care (too much) about memory leaks is when the
application is about to exit -- all memory is being released back to the
OS anyway. This may happen because of Static De-Initialization Order
Fiasco: the Q_GLOBAL_STATIC or equivalents holding QThreadStorage were
destroyed before the QThreadData for the exit()ing thread did. That
problem became more prevalent after the series of changes ending in
commit 2f69a05bd0cd7ce63890f709ff3ed7a4f78acd70, because that made the
QThreadData clean up happen very late in the execution.

Unfortunately, there's no way for us to know when we're being called
during application exit, so this is the next best thing:
QCoreApplication::instance() does not exist. We're using a private
function in QCoreApplication because in Qt 6.x, QCoreApplication::self
is not atomic and reading it would be a data race.

The QThread::currentThread() call was superfluous, because it was always
true. It was a relic from Qt 3, from before we had QAdoptedThread.

Pick-to: 6.8
Fixes: QTBUG-133500
Change-Id: I48d84d76f2b72483ed92fffdd54c6ad17e3d67d3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit fd857d400a098598072ff08b0a54f4ba2589357b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:20 +00:00
Thomas Moerschell
69f78f3cbe QScroller: Remove workaround for timer start
The CI is flakey, likely due to missing timer events. Instead of
skipping the first event, start the timer only when the new state has
been set.

Task-number: QTBUG-30133
Pick-to: 6.8
Change-Id: Ia58e4b091d8791d1b77642ded67312bc3927d0b7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c093b57c8696079fc3408796e0e17c62a990bce2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:20 +00:00
Ulf Hermann
5dddcc3cdc Doc: Clarify need to qt_add_standard_project_setup early
Pick-to: 6.8
Fixes: QTBUG-115050
Change-Id: If8b3aabd0072bfb2bef6dea106af06524f144990
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8f5c6434e81f554989557ea9643aa6f323903aba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:20 +00:00
Alexandru Croitor
057ef3e1d3 CMake: Add project supplier to generated source SBOM
Make sure to specify the creator organization when calling reuse to
generate the source SBOM.

This replaces
  'Creator: Organization: Anonymous'
with
  'Creator: Organization: TheQtCompany (https://qt.io)'

Pick-to: 6.8
Fixes: QTBUG-133796
Change-Id: I3532d9f35ca3eacd9c20bee7db88f35c76db9672
Reviewed-by: Lucie Gerard <lucie.gerard@qt.io>
(cherry picked from commit 52a64aca2099a1efc5a8819c9e60a57aefde4370)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:19 +00:00
Michael Cho
224fc1daaa CMake: Add support for pkg-config files on macOS
This enables generation of pkg-config files that work with Qt's
libdir-installed macOS frameworks. QtFinishPkgConfigFile.cmake
wasn't modified as POSTFIX has no impact on framework name.

Change-Id: I2da8f43608e778aa286ad625b70c5be20b447193
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 7a31e402f24ec29c571f825e06bd569477501dfc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:19 +00:00
David Boddie
3009ca730d doc: Fix a couple of typos that cause broken links
Pick-to: 6.8
Change-Id: I7f9aafa12d98475fc28230fcb25ba6a4570889aa
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 3c4ec4de1426e42055a09cbe37b7ea2448da4943)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:19 +00:00
Eskil Abrahamsen Blomfeldt
80b39d24ec Treat variation selectors as ignorable chars
The variation selectors only make sense in the context of the
previous glyph and should never be shaped by themselves, therefore
we should not pick a different font engine for these even if
the cmap does not support it. They are sometimes needed to
properly resolve the emojis, but the OpenType rules in the font
may not be written with them in mind.

If the cmap lookup fails for these, then Harfbuzz will map them
to a zero-width space, thus ignoring them when resolving the
OpenType rules.

We treat these the same as other control characters and just
ignore them when doing font merging.

Note: This was handled through an ad hoc mechanism prior to
the introduction of the emoji segmenter in 6.9.When the emoji
segmenter is disabled, we still use this mechanism, which
depends on us not ignoring the character in that case.

Fixes: QTBUG-133480
Change-Id: I8fa4e8d5e1aabad0946b8fd3fff044e2b2af5d0e
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit cf674f38450f623d94e5695a221a186c0e551e27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 13:53:31 +00:00
Lucie Gérard
770f9e5897 Correct doc/images licensing
Pick-to: 6.8
Change-Id: I202366f8294920fa4ac15f95a4352d5c56c1a6cd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e5fab54e54b47b71585781b5f69ccf8d7668ec9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 13:12:18 +00:00
Matthias Rauter
b05f06d5b9 Silence warning in tst_qwidget.cpp
Amends: 1a0f056f318417ba5e54c8110257b75cf5537acb

Pick-to: 6.8
Change-Id: Ib67016bbb7d5abe48224d23d49e36e2e01e416fc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2c15086b7ed561b59cfb0d028c35d15631c12738)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 13:12:18 +00:00
Giuseppe D'Angelo
7b0e3fb969 qcompare_impl.h: include what you use
Both enable_if and is_null_pointer belong to type_traits, include it.

Amends 631a0cc45cbe70940746cd944d325d7d3bab8c15.

Pick-to: 6.8
Fixes: QTBUG-133808
Change-Id: I9626ba80b2d9799d1bfed8ca9c9090691b8d8715
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 72cde6f7dd9102d0c3730a75a6c85af69b8a0e3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 13:12:17 +00:00
Marc Mutz
a5bafadf8e QByteArray: optimize replace(char, char)
Write every byte only once.

Amends 83c2c5055405f09043c35b93cd5ba9b9969f3174 (as well as the start
of the public history).

Pick-to: 6.8
Task-number: QTBUG-106185
Change-Id: I883b2f00c754806882131a09dc3cbc5613420151
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 2753924fcbeb29fa5b34782bd6ad6ed4fe4b51f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 10:15:24 +00:00
Christian Ehrlicher
0d36941a78 Windows11Style: don't modify palette for buttons in polish()
There is no need to screw up the palette of buttons in polish() - the
colors are not honored at all.

Pick-to: 6.8
Task-number: QTBUG-132433
Change-Id: I4df1f046690d1aa9b07fc538441d6ea50d0216ce
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit 6a46395614bf89a8b69fd2b7edb9503bd8f16ceb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 05:15:13 +00:00
Thiago Macieira
6ad615cd12 GUI: no need to unregister input device if list is destroyed
Fixes: QTBUG-133776
Pick-to: 6.8
Change-Id: If4a148e3ebf753ccd661a5ed1b321dbd7751576e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 1040728e39b8b898d6e96b79a4c7bfcd0cb3f027)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 02:03:24 +00:00
Frédéric Lefebvre
e20364d6c9 Harden tst_QWindow::framePositioningStableAfterDestroy()
StablePosition was in some cases recording a wrong position, as it was
taking the framePosition and considering it to be the widget's
position. That erroneous position was then used to place the window,
resulting in a correct position but a wrong framePosition.

Wait and check for the window.geometry() and the
window.frameGeometry() to be different. If not the frame
has not been updated, or there is no frame when there
should be one. The test will most likely fail because
of this.

Fix flakiness on Opensuse 15

Pick-to: 6.8 6.5
Change-Id: I8e05ee7769de4efc2ac55ec7afbe366f76e325db
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 21ef8bed6d738551c1a322e78366d3c347a0e09e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 17:20:25 +00:00
Cristian Le
d61c784273 Use _qt_internal_set_source_file_generated
Migrate implementations that set `GENERATED` source property

Task-number: QTBUG-125077
Change-Id: Ia77ecf8422bf3983f7746c26e5a9994d1f6415f2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 6865c21e41be5d86b5a04889bfe28fac55c89f29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:54 +00:00
Shawn Rutledge
78dd1c5cd0 doc: Add QTextDocument::MarkdownFeature docs
Detailed docs were omitted before (and QTextMarkdownImporter::Feature is
not public) because
- "GitHub dialect" is a moving target (although we may have supported
  all known features when it was introduced). We should reserve the
  right to add to the feature set accordingly: so the numeric flags
  can be expected to change.
- the writer mostly ignores the feature flags and writes back to
  GitHub dialect; only the front matter can be omitted that way
- recognizing non-URL links seems fuzzy; md4c does it, so we allow that
  feature, but if it goes wrong it would be an md4c bug
- hex flags look strange: in fact they come from
  https://github.com/mity/md4c/blob/master/src/md4c.h#L306
  If we assume that they might change, it would be better not to
  document the numeric values in detail. But so far, md4c has never
  removed any, only added a few (and we don't yet support all the
  new ones).

Change-Id: I6552da1226bf7ad6242432c1d5d3df9ec8f61d6f
Reviewed-by: David Boddie <david.boddie@qt.io>
Reviewed-by: Tommi M. Tauriainen <tommi.m.tauriainen@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 280025fc7e97ad943ed2938f6434cadf94bd635f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:54 +00:00
Cristian Le
3ad691586e Add _qt_internal_set_source_file_generated function
Create a function `_qt_internal_set_source_file_generated` that sets the
source file property `GENERATED` along with Qt relevant properties:
- `SKIP_LINTING` if CMake>=3.27 and `QT_FEATURE_lint_generated_code`

Task-number: QTBUG-125077
Change-Id: I0ef5f7901f502366aaf2d020554c72e4845101b6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit f654519c7bd142d5cc9f81e0c826dfd31956791d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:53 +00:00
Alexandru Croitor
f32dbf337d CMake: Add internal API to check if json SBOM generation deps are met
Will be used by WebEngine configure checks to check if the
dependencies are met and show an according error message if not.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I56d46fe5cf12051903d1aec893336be5ae8983a2
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 414b73075c537481280179ea78748dd2a6b45f9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:53 +00:00
Alexandru Croitor
25840bcc32 CMake: Make sure to look up deps when converting json to tag SPDX doc
When converting a json SPDX document to a tag/value SPDX document, we
need to make sure that the python dependencies are looked up.
After they are looked up, either error out or silently return
depending on whether the operation is required or not.

By default when _qt_internal_sbom_generate_tag_value_spdx_document is
called it is required to succeed and thus requires the python
dependencies to be present. A caller can opt out using the OPTIONAL
argument.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Iccb68f900f4892a816360843dd87f9e469104bf7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8b6b17ae87abcdb2120255b490ce6fe03b0e2e08)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:53 +00:00
Alexandru Croitor
4ae0667e2b CMake: Improve error reporting about missing SBOM dependencies
Improve wording when python or some dependency is missing, deduplicate
the strings and make sure to mention what is actually missing.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I26af38f0330a5462c6001cae03c46284e742fbda
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ad82afb05417e2b07a55a4520105b1f01a802487)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:53 +00:00
Alexandru Croitor
71130a16f8 CMake: Work around upstream AUTOGEN issue with discarded dependencies
Upstream CMake has a nasty bug where AUTOGEN dependencies are
discarded if a library is added as a dependency more than once (or
rather the number of times it is added is not equal to the number of
configured build configs).

This can result in racy build failures, where a <module>_autogen
target is supposed to depend on some <other_module>_sync_headers
target, but doesn't, and thus moc generates empty metatypes files
because it can't find a synced header.

To avoid the AUTOGEN dependencies from being discarded, manually
add all dependencies passed to qt_internal_extend_target to the
AUTOGEN_TARGET_DEPENDS property.

The issue is fixed in CMake 4.0, so the workaround is gated on the
cmake version used. Add a flag called
QT_NO_AUTOGEN_DISCARDED_DEPENDENCIES_WORKAROUND to disable the
workaround, in case the fix gets reverted upstream.

Pick-to: 6.8 6.5
Fixes: QTBUG-133725
Change-Id: I857d7e774fc9f9f5203a58311daea5e7177e0d67
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit fcb20586316aff2ccc39e2ae840b79f8b0e904a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:53 +00:00
Alexandru Croitor
ac0e10db65 CMake: Always save SBOM python interpreter path
To ensure that when we find the interpreter, but not some python
dependency, we actually show the error about the dependency.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ib4f42e04f071f800d0f5bbe3700a1208e1017a19
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 46ee11a426292bc1538b5138501136b2dadc7173)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:53 +00:00
Giuseppe D'Angelo
0730c7ea55 Update PCRE2 to 10.45
New upstream version.

Importing note: 10.45 is missing a licence file for the sljit
dependency. This is tracked upstream at

https://github.com/PCRE2Project/pcre2/issues/686

so it may get fixed in 10.46 (in which case the import script /
qt_attribution.json may need to be amended).

[ChangeLog][Third-Party Code] PCRE2 was updated to version 10.45.

Pick-to: 6.8 6.5
Change-Id: Ifa0430782bed8ffb1c26f44ca6eb06cd26aaa1f9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3cb58b053c26603ba1d541b3c9c51ec25212ee80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 16:13:53 +00:00
Marc Mutz
a639174daa qhighdpiscaling: de-pessimize qEnvironmentVariableOptional*() functions
Don't call qEnvironmentVariableIsSet(), since it locks the environment
mutex. Since qgetenv() and qEnvironmentVariable() both report whether
the value was set (returning non-isNull()), we can avoid the extra
mutex lock (and envvar lookup) by just calling those and then checking
for isNull().

In qEnvironmentVariableOptionalReal(), in addition, use qgetenv()
instead of qEnvironmentVariable(). While on Windows, that may convert
encoding, QString::toDouble() first converts to Latin-1, and only then
converts to double, so we avoid one encoding conversion, even on
Windows; on Unix we avoid two.

Amends 4d1f13f3549a73f5ca4e64dac9137e83138080fa.

Pick-to: 6.8 6.5
Change-Id: I6803e2277b324c2568726765245681bcbf517362
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 8669bc97ff6811bae304a8bb2a0e3af2bb78cfe0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 12:56:12 +00:00
Alexei Cazacov
03fc43b5e9 Docs: Move qmake-specific documentation out of Qt's documentation
This commit moves the third-party-libraries.html topic to the qmake
documentation. The topic is renamed and links to it are corrected.

See also: 623150

Task-number: QTBUG-132504
Change-Id: I711400d887b7e4894021b0433eb1cd61dfdd5349
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 1e7e0b0cacaae4fb0bb2b730dd6cdb34d7e93afe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-17 09:43:40 +00:00
Giuseppe D'Angelo
5adddf6cd9 QMenu: make mousePopupPos a QPointF
QMenuPrivate::mousePopupPos is a QPoint which gets set to
QGuiApplicationPrivate::lastCursorPosition, and only read from
QMenuPrivate::hasMouseMoved to determine if the mouse has moved enough.

When the last mouse position is not known, lastCursorPosition.toPoint()
returns {INT_MAX,INT_MAX} (see c5792dcfd631abb4f9e2b92cd6e88d7e5c373406
for the reasoning). This is extremely prone to overflows. In fact, one
was happening into QMenuPrivate::hasMouseMoved:

  (mousePopupPos - globalPos).manhattanLength()

On the first mouse move the subtraction yields an enormous result which
overflows manhattanLength.

The solution is simple, make mousePopupPos so that these calculations
happen in fp coordinates. The length itself is only used as a threshold
against QApplication::startDragDistance, so its representation doesn't
actually matter.

Pick-to: 6.8
Change-Id: I9c8e30a637de120d086d6f7171725702c205da78
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 7736823500fe8d97bc6d12ffb88001d34d1980bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-16 18:08:23 +00:00
Cristian Le
ea4a6cfdfa Check the PROJECT_NAME more thoroughly
This was missed in 3e1a223318dbda50a010ba851841a9e51c80c42b

Task-number: QTBUG-127953
Pick-to: 6.8
Change-Id: I2ff6cafe852ec2696aea37e2e79e3c8b95c0e8ca
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b8b6382b02457963fa5d0e67e069dc92e6d6c9d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-15 03:48:58 +00:00
Thiago Macieira
c6fdf954e3 QResource: try to survive being created during application shut down
Similar to commit 12d4bf1ab52748cb84894f50d437064b439e0b7d, which was
for QLocale. Like it, QResource can be used very late in the execution,
like for example the logging system. For example (simplified):

 #9  0x00007ffff759d497 in resourceMutex () at /io/qresource.cpp:188
 #10 0x00007ffff759d615 in QResourcePrivate::load (this=0x41c940, file=...) at /io/qresource.cpp:333
 #11 0x00007ffff759dc19 in QResourcePrivate::ensureInitialized (this=0x41c940) at /io/qresource.cpp:386
 #14 0x00007ffff75011a9 in QLibrarySettings::load() at /global/qlibraryinfo.cpp:80
 #22 0x00007ffff7501756 in havePaths () at /global/qlibraryinfo.cpp:149
 #23 0x00007ffff75028e3 in QLibraryInfoPrivate::paths (p=QLibraryInfo::DataPath, usageMode=QLibraryInfoPrivate::RegularUsage) at /global/qlibraryinfo.cpp:613
 #26 0x00007ffff758e4f0 in QLoggingRegistry::initializeRules () at /io/qloggingregistry.cpp:309
 #34 0x00007ffff758f007 in QLoggingRegistry::instance () at io/qloggingregistry.cpp:424
 #35 0x00007ffff758c50b in QLoggingCategory::init () at io/qloggingcategory.cpp:188
 #43 0x00007ffff758c6bb in QLoggingCategory::defaultCategory () at io/qloggingcategory.cpp:317
 #44 0x00007ffff750ff8e in qt_message_print (msgType=QtWarningMsg, context=..., message=...) at global/qlogging.cpp:2036
 #45 0x00007ffff7509515 in qt_message(msgType=QtWarningMsg, context=..., msg=...) at global/qlogging.cpp:360
 #46 0x00007ffff750a712 in QMessageLogger::warning (this=0x7fffffffd8b0, msg=...) at global/qlogging.cpp:600
 #47 0x00007ffff790e083 in QThreadStorageData::finish (p=0x41b588) at thread/qthreadstorage.cpp:160
 #50 0x00007ffff78ed423 in QThreadPrivate::finish (this=0x41b5e0) at thread/qthread_unix.cpp:404
 #51 0x00007ffff78ec8ed in destroy_current_thread_data (p=0x41b520) at thread/qthread_unix.cpp:154
 #52 0x00007ffff78ec9ec in Cleanup::~Cleanup () at thread/qthread_unix.cpp:204

Task-number: QTBUG-133206
Task-number: QTBUG-133500
Pick-to: 6.8
Change-Id: I7b653afb1b41ef3c1c9afffdaa93e6558740016b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit ba18ae3869fd6703fbaad548d2421a82e7e675cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-15 03:48:53 +00:00
Thiago Macieira
ddd0a08490 tst_QGetPutEnv: use a lambda instead of a macro
Neater and more debuggable. This code was added in Qt 5.4, before we
could use C++11.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: Icd8acccb4a9ae1f500e7fffdc4d4fc7c310cbb89
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b888bc09ce33a91800cb2119a52097897f3d62d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-15 03:48:44 +00:00
Thiago Macieira
ff7675817d qEnvironmentVariableIntValue: fix off-by-one with MSVC's getenv_s
This meant a string containing the octal form of INT_MIN (-020000000000)
would be just too long and getenv_s() would fail. This was never caught
because code that was meant to test different bases simply forgot to use
the base. Amends commit bb56586e32677ee9be23bffa4f3cc9a913ef192f.

I've renamed the rows to be the text being parsed, so it matches the
previous rows and it makes clear what was being parsed just by reading
the test's output. That also revealed a duplicate row to be removed.

[ChangeLog][QtCore][QtEnvironment] Fixed a bug that caused
qEnvironmentVariableIntValue() to fail to parse octal values from
-020000000000 to -010000000000 with MSVC. Other compilers were not
affected.

Pick-to: 6.8 6.5
Change-Id: I9095d86cccd9e8001e85fffd6fbbcd6a9a1678c3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 83f2d1130aa49228a8a87547660791708735dd4b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-15 03:48:33 +00:00
Thiago Macieira
16b8fc51fe QCborStreamWriter: remove stale doc about 2 GB size limits
Those applied to Qt 5's int-based size types.

Pick-to: 6.8 6.5
Change-Id: Id8436bae9c641e33770bfffdd55bb1b883863a7c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit e62407b429f4dc5d900e77a26410f87f56c7d5cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-15 03:48:23 +00:00
Ulf Hermann
3fd08e19d4 QLibraryInfo: Consider resource paths as absolute
This is what QDir::isRelativePath() does, for better or worse. We've
used QDir::isRelativePath() before and we shouldn't change the behavior.

Amends commit c74cba1117355a6312b1f0cc815efa4cdea4bbfa

Pick-to: 6.8
Change-Id: I03e3e921977af2b9c6ff2593535d846d6ce28fe2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit dd2dc8c70d0227ff235a8c7feaca7d7c4ead9c63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:42 +00:00
Thiago Macieira
b6d2f86695 tst_QFontEngine: fix argc going out of scope
Q{Core,Gui,}Application constructors take a reference to argc.

Amends 4db368d4741eff4d2b2942c25d5e633648e23a64.

Change-Id: I0a0c9a0ba574133ac7b8fffdb80e4656267d2ed2
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 434222f635ac134c64dd1d523f1f81dc1c598d90)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:41 +00:00
Thiago Macieira
5b10a1e8b4 tst_QByteArrayView: stop using std::basic_string<signed char>
That's not a valid type for the Standard's string, because the Standard
doesn't allow for std::char_traits<signed char> either.

Pick-to: 6.8
Fixes: QTBUG-133689
Change-Id: Icd0d4928fa4cdc9d806bfffd4053f0eb1073e6b4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 0cc41083c30c1474a862a34b59a4f755d4c51640)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:41 +00:00
Thiago Macieira
0fef016748 QLoggingCategory: remove init() and merge with the constructor
Nothing else calls it.

Drive-by initialize the two pointers via NSDMI.

Pick-to: 6.8
Change-Id: I8c51cf5126aeb8bd6254fffdd21a37526329bbf3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit c7ec043e4643d4b18731fdf2efc14976a81e1809)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:40 +00:00
Thiago Macieira
edb8d08e46 QDesktopServices: don't use openDocument if the URL has a query
[ChangeLog][QtGui][QDesktopServices] Fixed a bug that caused
QDesktopServices::openUrl() to discard a query when opening a local file
URL that contained a query but no fragment.

Pick-to: 6.8
Fixes: QTBUG-133663
Change-Id: Ie8fa190036417f590540fffdcf03e53f3c99b38f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit aad0ab897f61bcb6ac9ba908afd1ee33e05fe4db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:40 +00:00
Thiago Macieira
b80f632f28 QStringConverter: mark QStringConverterBase as removed in Qt 7
It's an internal class containing the common content between
QStringConverter and QTextCodec (Qt5CoreCompat) so the latter didn't get
the new API from the former.

This allows us to remove the QStringConverter::Flags qdoc hack too.

Change-Id: Iacf32fb88e3c3d0ea369fffd153356cec308e3dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c2fa41a081e4c9fe308dcd47283537eedf05c24a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:39 +00:00
Mårten Nordheim
9a634a5c4b QByteArray(View)::lastIndexOf: Guard against needle > haystack
Otherwise we would traverse beyond bounds.

We calculate the delta in sizes between the haystack and the needle and
if this delta is smaller than the starting position
(the `from` argument) then we start from there.

The default value for `from` is size(). With the needle being longer
than the haystack, the delta is negative and we set our starting
position to be the delta, i.e. we start before the start of the
haystack.

[ChangeLog][QtCore][QByteArray/QByteArrayView] Fixed a bug in
lastIndexOf() that could lead to out-of-bounds access when the needle
is longer than the haystack.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: Id5cd772f00b0c3c50fbf61b4e888bba5587391ee
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d25e5e2cb78a2e2f2a1791fed250421ce9eefc46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:39 +00:00
Mårten Nordheim
6dbb95e69c QNetworkInfo: Document threading restriction
Specifically on Windows we use COM, which requires being
de-initialized in the same thread as it was initialized.
Given that QNetworkInfo is a GLOBAL_STATIC with a qAddPostCondition
(iirc APPLICATION_STATIC was not yet implemented at the time) to
delete the backend when qApp is destructed, we need to cope with
destruction happening on the main thread.
If the backend is loaded on a secondary thread, the thread may
have shut down, or we may not otherwise be able to rely on
emitting Queued emissions to perform the destruction.
Conversely we also can't trivially move the construction to the
application thread (eg. using BlockingQueued emission during first load)
because we may cause a deadlock.

This leaves us with just documenting where the first load should happen.

Fixes: QTBUG-133644
Pick-to: 6.8 6.5
Change-Id: I7f52e884151c6c24acc34f1112faabc897d9b0f9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6ad2918de4a300d11472edcafe62f07ae2f63cd8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:39 +00:00
David Boddie
25107519e5 doc: Add missing fromArray() documentation
QAnyStringView::fromArray() was not documented, leading to a broken
auto-link that referred to it.

Pick-to: 6.8
Change-Id: Ibf3704da8b3f16e56589bd649ce1e63a7cbd3739
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f9334be98e4deb9e9a4a30f5f22e92b571670938)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:38 +00:00
David Boddie
8014b45a7a doc: Change links from begin() and end() to constBegin() and constEnd()
It appears that there are no longer relevant begin() and end() functions
to link to. constBegin() and constEnd() are the relevant alternatives.

Pick-to: 6.8
Change-Id: If6fc421ee08364de9a879fb704a7989046b9b43a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit c8e59d682cc2c6a5cbe124575bb54316af55bed1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 20:54:38 +00:00
Laszlo Agocs
80dee1a9f9 rhi: vulkan: Don't assert in VMA when vk header is older than runtime
Building Qt with e.g. a version 1.2.x Vulkan SDK and then running
on an implementation providing 1.3 or 1.4, one will likely get an
assert in debug builds upon initializing the memory allocator.

Work it around by restricting the apiVersion passed in based on the
preprocessor macros.

Pick-to: 6.8
Change-Id: Ia689ffc29d5675b84b6683e289d0725d7e47220b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit b6d4c1368d38242a8c677efc3144c10cfe363179)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 15:12:05 +00:00
Volker Hilsheimer
afc5747e9b JNI: generate QtJniTypes forwarding header for the namespace
The documentation claims that this is where the namespace and the macro
definitions live, and it's convention to have a Qt<Namespace> header for
Qt namespaces.

Pick-to: 6.8
Change-Id: Ia49001d61f0967df84344779909860cf65c3623c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 6c61d7b0f804ae5c048af95abef4d41ecc8862df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 14:44:26 +00:00
Cristian Le
cedaf89b0f Simplify genex expressions
Simplifications:
- `COMPILE_LANGUAGE` accepts comma-separated list since 3.15

Pick-to: 6.8
Change-Id: I4af316a463b5771bf5b37a6b4d77e41adba60977
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 51dc4cdd42cc57072b4e9da3aa02029597d4676c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 11:25:09 +00:00
Rami Potinkara
7918d0699c Android: update Android 15 SDK 35 to docs
This patch updates the macros for Android
maxApiVer, AndroidMaxVer, AndroidPlatformVer,
AndroidBuildToolsVer variables to reflect
Android 15

Task-number: QTBUG-129462
Pick-to: 6.8 6.5
Change-Id: Ia6edfa7811dd8c98a0a99c10d8781aa09384bdfa
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 9b475eadfcf04194a094454f65295c3a456000a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-14 10:09:33 +00:00
Tor Arne Vestbø
1b993a787d iOS: Pause display link when app moves out of active state
The applicationWillResignActive documentation describes that the app
should "use this method to pause ongoing tasks, disable timers, and
throttle down OpenGL ES frame rates". Similarly, the more modern
sceneWillResignActive describes that the app should "use this method
to quiet your interface and prepare it to stop interacting with the
user. Specifically, pause ongoing tasks, disable timers, and decrease
frame rates or stop updating your interface altogether."

In practice the application enters the inactive (as opposed to the
backgrounded) state when the user brings up the app switcher, or
enters split-view mode, as described by the "Adopting Multitasking
Enhancements on iPad" documentation.

We do propagate the inactive state as Qt::ApplicationInactive, but
it was up to the application itself to react to the state.

To adhere to the documented behavior, we now skip update request
delivery if the app is not active. Once it becomes active again
we re-try the update request delivery.

Relying on the exposed state of window was not an option, as the
window is still technically exposed, even if the app itself is
inactive.

This hopefully fixes a GPU crash observed (only) on A10 iPads
(iPad 7) with iOS 18, when the user entered split-view mode,
possibly due to changes in the system Metal-based OpenGL driver:

  void IOGPUScheduler::signalHardwareError(eRestartRequest, int32_t)
  void IOGPUScheduler::hardware_error_interrupt(IOInterruptEventSource *, int)
  void IOGPUCommandQueue::retireCommandBuffer(IOGPUEventFence *)
      Deny submissions/ignore app[openglwindow] with 2 GPURestarts in 31 submissions.
  Execution of the command buffer was aborted due to an error during execution
      Caused GPU Timeout Error (00000002:kIOGPUCommandBufferCallbackErrorTimeout)
  GLDRendererMetal command buffer completion error
      Error Domain=MTLCommandBufferErrorDomain Code=2
  Execution of the command buffer was aborted due to an error during execution
      Ignored (for causing prior/excessive GPU errors)
  Terminating due to blacklisting by kernel driver

The back-trace always pointed to the display-link callback,
so the assumption is that the crash was triggered by the app
rendering when it shouldn't, during the split-view transition.

Fixes: QTBUG-132314
Pick-to: 6.8 6.5 5.15
Change-Id: Idf1f692daa9d437ee69f9436706777b220fbfbf4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit c812190a921660c748be3324c3a34245b24354e9)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2025-02-13 21:56:31 +00:00
Marc Mutz
4ed56eaafc QLayoutPolicy: use qCountTrailingZeroBits() in setControlType()
This is more efficient, because it maps to a single assembler
instruction on most ISAs, and also avoids a Coverity warning about the
loop not terminating and thus 1 << i overflowing, if type == {}.

The clone class, QSizePolicy, is not affected, since it already uses
qCountTrailingZeroBits().

Amends 6c322a917ad57d57f0ee76825eab3e2e008c5bd4.

Coverity-Id: 474336
Pick-to: 6.8 6.5
Change-Id: Idf62d045d8ac3f0cb15196dd8664ac37d92a9cc2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d71379d447e87843c5a5d91857c4ff253ad4b847)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-13 14:15:43 +00:00
Aurélien Brooke
21a0818903 Qt Concurrent documentation: fix Forward Iterator example container
std::slist doesn't seem to even exist on Google, while std::forward_list
exists in the standard since C++11.

Pick-to: 6.8
Change-Id: I9869c716fb631bc743e656a3b8bbb8ca35c9a1ed
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9e5dae9b8c3d43cfd86719e429f35b032d14c66c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-13 14:15:41 +00:00
Thiago Macieira
904023e2de Fix use of #warning in compilers that don't support them
That becomes an error. So only allow them in GCC-compatible compilers.

Fixes: QTBUG-133376
Change-Id: Idd04be795dd9fd2b43affffd08cd7b8a444bbc43
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 5da95322bd0ed7bfb94028582a82689124646dbd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-13 14:15:39 +00:00
Shawn Rutledge
a4d4ef9df5 doc: Explain the use of QContextMenuEvent cross-platform
...and across Qt Quick and Widgets, and somewhat from a usability
perspective.

Task-number: QTBUG-67331
Task-number: QTBUG-93486
Change-Id: I75085f3a7a8e76c3e67ff5864600324faf262a76
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 6e089a66a4d08a5d788c194560fccdec793e6337)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-13 11:41:28 +00:00
Alexey Edelev
9fcce29068 Remove dead code
Remove unused variables and property get call.

Pick-to: 6.8
Change-Id: I0da26fae813fd201f7fbb24d2b779e62a78250e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 3db7fd6a3f43500319250083a2a59812b5925c1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-12 18:02:46 +00:00
Allan Sandfeld Jensen
a69fdf6410 Update defaults for QPaintDevice
A few values have meaningful defaults, for the rest only warn about
implemented metric.

Pick-to: 6.8
Change-Id: I80c6c8dba6c8d2715daac0463a411bc5117f0bc0
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit da1fbf6053c07df76a4d2518103bdfc40d59cfa8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-12 12:44:20 +00:00
Jerome Pasion
89ee514a27 Qt D-Bus Viewer: Update documentation
-Added information about the location of qdbusviewer
-Fix name to "Qt D-Bus Viewer"

Fixes: QTBUG-118997
Pick-to: 6.8
Change-Id: I90f1e75a04a959d9c739e33779d978b607a8181c
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 1a8ae82bb02120c6128eb720072daf8acda5bd2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-12 12:44:18 +00:00
Thiago Macieira
3d43223448 QLibraryInfo: use fewer QFileInfo in finding qt.conf
This is hot code, run early in the application's life, usually as a
result of the first qDebug() because QLoggingRegistry wants to find
qtlogging.ini. So let's not use QFileInfo, which allocates memory, just
to do string manipulation. These are always filesystem paths.

See commit d59e640c868f3db2d661970f3d34a22013d49053 for a similar change
in findConfiguration().

Pick-to: 6.8
Change-Id: I012daf4a3aa2ebc2c5abfffd2ef7ceac1df2626d
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit c74cba1117355a6312b1f0cc815efa4cdea4bbfa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-12 02:20:32 +00:00
Marc Mutz
6dd6836227 QJsonValueConstRef: remove duplicate Q_ASSERT in objectKey()
Amends 14d1108d3562f6e409505ba49b7bce82d70bd64f.

Pick-to: 6.8
Change-Id: I9fcfb864254d040cd1de8aa0dc818ccd9104487b
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 6aaa874d79805dc6407a68e56f8d9ee128ad37bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 23:45:24 +00:00
Bartlomiej Moskal
bc533b0fb2 AndroidTestRunner: allow to call additional/extra adb call
This commit adds a new parameter (--pre-test-adb-command) to
AndroidTestRunner. The new parameter allows to pass an extra adb command
which will be called by AndroidTestRunner after installation and before
running the test.

To set the mentioned argument the new parameter for qt_internal_add_test
was proposed: ANDROID_TESTRUNNER_PRE_TEST_ADB_COMMANDS.

The new parameter is needed especially for multimedia screen capture
tests. ScreenCapture feature needs an acceptation of Security Popup. It
can be automatically accepted with additional adb command.

Fixes: QTBUG-132249
Pick-to: 6.8
Change-Id: Ib70cd05d60d4594961ca68b554c7aae11cf42240
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b4c82eba03388aa4f9e5b56f633e0e679a3b0123)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 21:04:09 +00:00
David Faure
05016926ae QToolButton: allow opening a menu after it first failed because empty
Commit 353ce5344fbde5a6cecbdd2c131e1cf0f4b7f383 made QMenu::exec()
return immediately (without showing the menu), which meant it never
emitted aboutToHide() and QToolButton didn't reset mouseButtonDown.
Therefore, on the next click on the toolbutton (maybe by then the
menu has actions), it won't even try to show it (because mouseButtonDown
is still true).

Pick-to: 6.8
Task-number: QTBUG-129108
Change-Id: I3f84b9a35eb444fc33d8516c4be130293c04017d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f0508b7ff3d2393521f49dcb1a9e880bf7665a87)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 20:24:40 +00:00
Marc Mutz
7fc08a8a68 BenchmarkQtJson: print errorString() on QFile::open() failure
Amends 1c3ee86f183d46709c070ccd44970e05dc70f83d.

Pick-to: 6.8 6.5
Change-Id: Iaffdbd43fc182a46e1280bc7e023083bbea4a285
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5b52814d643e2a38581850293610acc2d0ee4c69)
2025-02-11 18:21:14 +01:00
Alexandru Croitor
b91da6c943 CMake: Simplify and fix target dependency handling in SBOMs
Previously we had complicated logic trying to differentiate between Qt
targets, system libraries, vendored libraries, custom sbom targets,
whether they are in external documents or not, when generating SBOM
dependencies for a target.

We also lacked the ability to handle regular non-Qt non-system
libraries. This was discovered while creating the SBOM for Qt Creator,
where the code treated all Creator helper libraries as system
libraries rather than just regular dependencies.

Simplify the code by unifying most of the code branches, removing
nested ifs, and removing special handling of some targets when
checking whether they are in external documents.

Now system libraries are marked at qt_find_package time by setting the
_qt_internal_sbom_is_system_library property on the target, rather
than trying to infer it base on the target name and other markers.

Now the logic goes as follows:
- check if system library based on the presence of the
  _qt_internal_sbom_is_system_library property
- check if it's a vendored lib based on walking its libs and checking
  if the _qt_module_is_3rdparty_library property is set
- mark system libraries as consumed
- if not a system library, handle it as a regular dependency, taking
  into account if it's external or not

Also add some debug messages to help keep track of system libraries.
And remove some of the unnecessary code in
in _qt_internal_sbom_is_external_target_dependency and
_qt_internal_sbom_add_external_target_dependency.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ic43fe53446b74badee2cde6d18146e952587c292
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 66261ac0f1f2807916c80b2050536d52b8fe6d3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 17:21:14 +00:00
Ivan Solovev
08ef73f94f tst_qfuture: silence all continuation overwrite warnings
Introduce a helper function to silence this lengthy warning, and use
it consistently in all places where the warning was triggered.

Amends 502a7706b94380d4957a7e594fc7c4c4db8ae81b which introduced the
warning.

Pick-to: 6.8 6.5
Change-Id: Ifa5c7e0182a12885af4db42ef5d68b1f27a0c6bc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a30289ee0be41e8311aef6d8737885b354a9f047)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 17:21:13 +00:00
Alexandru Croitor
59a571c75d CMake: Decouple Qt specific handling from SBOM implementation
The SBOM functions so far had a lot of Qt-specific logic inside them.

Decouple this logic into separate Qt-specific functions or explicitly
guard the code with Qt-specific handling options, to prepare for a
cleaner SBOM public API.

The generic functions then call the Qt-specific ones if various
internal options are set.
This approach is used, rather than directly passing values to the
generic functions because:
- we have cases where we need to recursively pass the values all the
  way down to all recursively created attribution targets
- some of the logic needs to know about values before and after qt
  processing, and this could be achieved with something like lambdas
  but it's not worth the complexity

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I4399c41f4d976f20b16a0bb0c674d4f07ee1ccd4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit f1ac316191c010b1389f6f3549c9f0b4424b9936)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 17:21:13 +00:00
David Faure
bbc46bbc7a QMenu: improve test for "empty menu" to be style-independent
This amends commit 353ce5344fbde5a6cecbdd2c131e1cf0f4b7f383 so that
the behavior doesn't depend on the widget style.
If QStyle::PM_MenuPanelWidth returns 2, then size will be (2x2),
which is hardly a valid menu to show - don't show that either.

Pick-to: 6.8
Task-number: QTBUG-129108
Change-Id: I2daa05932ea00971880747daeffdfa20a8be3f22
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9dfd8410b07b0c484443ad6355004ace5f9b2b8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 17:21:13 +00:00
Ivan Solovev
5b55e8d1f0 QFuture: prevent the continuations from being executed twice
On some very rare cases the continuation could be executed twice in a
multithreaded scenario. Consider the following example:

  auto f = QtConcurrent::run(someFunction);
  f.then(someOtherFunction);

Assuming that QtConcurrent::run() is executed on Thread B, and the
continuation is attached in Thread A, the following call stack is
possible:
1. Thread B: someFunction() is finished
2. Thread B: QFutureInterface::reportFinished() is called
3. Thread B: QFutureInterfaceBase::reportFinished() is called and
             finished.
4. Thread A: then() is called. It checks that the future is already
             finished, so the attached continuation is executed
             immediately.
5. Thread B: QFutureInterfaceBase::runContinuation() is executed.
             At this point it sees that a continuation exists, and
             executes it again.

Step 5 will lead to a crash, because we'll try to access a moved-from
QPromise.

To fix the issue, introduce a flag that is explicitly used to test if
the continuation was already executed or not.

The pre-existing code already uses a concept of a continuation state,
but it cannot be easily extended without convering it from an enum
to flags, because the canceled continuation should still be called
in order to actually execute the onCanceled() handler.

Wrapping QFIBP::ContinuationState into QFlags would increase its size
from 1 to 4 bytes, and manually treating the enum as flags will result
in a more complicated code. So, I simply picked the approach of adding
an explicit flag for this case.

Writing a unit-test is not really possible, but I verified that the
reproducer from the linked Jira ticket does not crash anymore.

Amends dfaca09e85a49d2983bb89893bfbe1ba4c19eab4 that introduced the
continuations, so picking to all active Qt 6 branches.

Fixes: QTBUG-118032
Pick-to: 6.8 6.5
Change-Id: I3e07722495e38367e8e4be2eded34140e22b0053
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 04b5d2b94f96c73a13973f6a57cefbf07d2e850b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 17:21:13 +00:00
Alexandru Croitor
90b128e4cc CMake: Fix location of build time sboms in no-prefix builds
For build time sboms to be found in a no-prefix qt build of a repo,
specifically when finding external sbom documents, the build time
sboms have to be in the same location.

Previously they were in each repo's build dir.
Align the location to be in the qtbase build dir, just like for super
builds.
Also check for QT_BUILDING_QT because we don't want to apply the logic
for QT_WILL_INSTALL not being set in user projects.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I04a066fc0efc91a4f2ee938c190b8632c8c946aa
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 3a5c62d4af9cb07fba065de8a2d1b97531b6fd30)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 17:21:13 +00:00
Alexandru Croitor
81b3e80840 CMake: doctools: Avoid blocking integrations due to version mismatch
It can happen that qt repo version bumps are direct pushed, and not
merged in DAG-dependency order. This can cause a mismatch between the
qttools package version and any of its dependencies, which would block
integrations. To avoid this, we disable the warning about incompatible
package versions when building the doc tools. The version check in
that case doesn't make sense, so it's safe to do.

Amends f7f02c791bcbee44597f1fe24570ebdf352ec648

Pick-to: 6.8
Task-number: QTBUG-128730
Change-Id: I6180ecb09c6a3dee415ae73c11549ee0f709f240
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit a8f55f4729918700b9597843c98f9f2505ff0d23)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 17:21:13 +00:00
Frédéric Lefebvre
829b67074e tst_QGestureRecognizer::swipeGesture set FramelessWindowHint
tst_QGestureRecognizer::swipeGesture() is flaky as sometimes the
gesture event is being sent before the widget's position has
been updated.

The gesture starts in the window frame.

Set flag Qt::FramelessWindowFrame to prevent this from
happening.

Fix flakiness on Opensuse 15

Pick-to: 6.8
Change-Id: I794b022b5a51146ddfa7d6029509c6fa43b9aad6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 6dc0e593939cbeaeb45392d8daf7fcd90e8cb0f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 14:34:57 +00:00
Volker Hilsheimer
288ef3479e Fix warnings in benchmarks from QFile::open being [[nodiscard]]
Pick-to: 6.8 6.5
Change-Id: I8a80af3614a92645be2d64d02ce81e9d263468c8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 1c3ee86f183d46709c070ccd44970e05dc70f83d)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-02-11 09:36:20 +00:00
Volker Hilsheimer
8b2f1b4d1a Fix warning from ignored return value of [[nodiscard]] function
Pick-to: 6.8 6.5
Change-Id: I1e293773d70cda1c58c4f3dc798ce2f65224ed9d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
(cherry picked from commit 823c2bfc13feb13cabc89638423274f560239087)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-02-11 09:36:13 +00:00
Volker Hilsheimer
2a67dcda5e Fix warnings in tests from QFile::open being [[nodiscard]]
QVERIFY the result, with filename printed if useful.

Pick-to: 6.8 6.5
Change-Id: I1b21e213856458b7bc36682dd3671bd29c437b99
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8563ed54053024a4673e2bff9fce506fd648a312)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-02-11 09:35:50 +00:00
Marc Mutz
76c50ca167 qhighdpiscaling: pass QStringView by value
QStringViews should be passed by value, not cref, so sane ABIs pass it
in registers instead of forcing the variable to the stack.

As a drive-by, s/QVector/QList/ in the return type.

Amends 51e2a64ed9360c8e889726c3fbaf649a4d260e0d.

Pick-to: 6.8 6.5
Change-Id: I6b51dfda87643f6c7ec219ac4a8970537bb6b2ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8113a50d71cb9ea320e69c2b10452972e3310f4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 00:51:30 +00:00
Alexey Edelev
ee3c82a234 [vcpkg] Fix the chainloading of the platform specific toolchain files
QT_CHAINLOAD_TOOLCHAIN_FILE might not be set, but
__qt_chainload_toolchain_file falls back to the value initially set
when building qtbase in per-module build scenario. Use the correct
variable(__qt_chainload_toolchain_file) when specifying
VCPKG_CHAINLOAD_TOOLCHAIN_FILE.

Pick-to: 6.8
Change-Id: I331c305a17172a1cc67a6ed8b43b2baa380abc0b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit c65d6319f9379a724ddb4c0757245fe51c93fac5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-11 00:49:15 +00:00
Matthias Rauter
df96b6a707 Unifty logic in QDomNodeListPrivate::forEachNode
All iterations through QDomNodeListPrivate were going through the
forEachNode function with its own internal logic. The newly introduced
iterator works with the similar logic but is written a bit more compact.

Thus it makes sense to replace the forEachNode logic with internal
functions of the iterator.

Change-Id: I22b7ae7a49e2bfaf84bede2fe0b45530a32f8d55
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b1c32afb914a8dda0b1b38bf9d85c1c316b27cf1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:23 +00:00
Thiago Macieira
00caa645ff QLoggingCategory: remove #ifndef QT_BOOTSTRAPPED
Amends commit 670810787318df8a80b2197b49448c18a78bb7ed from 6.8, which
removed qloggingregistry.cpp from the bootstrap library build.

Pick-to: 6.8
Change-Id: I3bb5609707478df771b8fffd3e71eb889eaac53f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 696e11ec729452d246e736e54790411b408f9c3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:22 +00:00
Friedemann Kleint
20646e132c uic: Add #ifdef depending on Qt version for QPalette::Accent
Complements 17c589df94a2245ee92d45839c2cba73566d7310.

Pick-to: 6.8
Fixes: QTBUG-133651
Change-Id: Ieb57df30863f8493cd170d80220ae09177842ede
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 1832ac4d25dd5c32963c47ad38836a0ea2ebd793)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:22 +00:00
David Faure
3af7624967 QConcatenateTablesProxyModel: implement roleNames()
Change-Id: Id74b45f58678df15285c8b9631db1c59a5d62a2a
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit 5ffb9d7ae6d60fb370b79f8222dab7d7e628fa4f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:22 +00:00
Marc Mutz
18b56bbae2 tst_QAnyStringView: test which chars magically convert
QAnyStringView is designed to replace overload sets containing QString
and QChar, among others, so it needs to accept types that merely
implicitly convert to QString and QChar. It achieves this by
maintaining a hidden container to hold the converted QString or QChar
for the duration of the full-expression, much like the compiler would
do if the function took QString/QChar.

This patch adds a check for the single-char ctors to determine whether
they convert or not, by comparing QASV::data() to the address of the
QASV's argument. While it would be interesting to have the same test
for QString, that is outside the scope of this patch.

Task-number: QTBUG-126054
Pick-to: 6.8 6.5 6.2
Change-Id: I30ac2d1199da5a03fe6fee4c9d5ea2a209a003d6
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit f31c37a1312fc4e21a58906e2b883099629fb9e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:21 +00:00
David Faure
f8b100c136 Doc: document RemoveAuthority and RemoveFragment in QUrl
Change-Id: I5ff4898853f1655a902523e7f22344deb5624cc1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit eda83d41f6dbc00403447a9b6b6ed730e6706554)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:21 +00:00
David Boddie
1b245a8a46 doc: Remove invalid link and tone down language
QLatin1StringView::split() appears to be invalid.

Pick-to: 6.8
Change-Id: I11066b8224cce0a6091c758367f602a63c6136a0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 4aff3488b8262ef23f1230b7f530c46ca2d61ac1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:21 +00:00
David Boddie
6de04b08c4 doc: Fix broken links, including auto-links
Pick-to: 6.8
Change-Id: I967304c24e1a593b1b555998a718d0a015e12900
Reviewed-by: Jerome Pasion <jerome.pasion@qt.io>
(cherry picked from commit bddfded80e225cbc112b79ccf5ada20a01e62fcf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:21 +00:00
Mårten Nordheim
5985c90d37 Update UCD to Unicode 16.0.0
They added some new scripts.

There were a few changes to the line break algorithm,
most notably there is more rules that require more context than before.
While not major, there was some shuffling and additions to our
implementation to match the new rules.

IDNA test data now disallows the trailing dot/empty root label,
technically to be toggled off by an option that controls a few things,
but we don't have options. For test-data they changed the format a
little - "" is used to mean empty string, while a blank segment is
null/no string, update the parser to read this.

[ChangeLog][Third-Party Code] Updated the Unicode Character Database to
UCD revision 34/Unicode 16.

Fixes: QTBUG-132902
Task-number: QTBUG-132851
Pick-to: 6.8 6.5
Change-Id: I4569703659f6fd0f20943110a03301c1cf8cc1ed
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 85899ff181984a1310cd1ad10cdb0824f1ca5118)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:21 +00:00
Tor Arne Vestbø
260276642e macOS: Update window flags when updating content border thickness
The titlebarAppearsTransparent property of NSWindow depends on whether
the window has a NSWindowStyleMaskTexturedBackground, so we need to
re-apply the window flags after updating the style mask to ensure we
pick up the updated value for titlebarAppearsTransparent.

Amends a1e6fed44964a3eb14045bf819d232d6cbad9f59.

Fixes: QTBUG-133525
Change-Id: Ifff594f54569ac43ad27917e5f4b2f8a3bae5901
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit bddc0198297828ba29e5cf4b39e07412a506a551)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 21:26:20 +00:00
Frédéric Lefebvre
ea55328741 Tst_QGestureRecognizer::panGesture set FramelessWindowHint
tst_QGestureRecognizer::panGesture() is flaky as sometimes the gesture
event is being sent before the frame and position has had time to
update. The event then starts in the frame and is not received by the
widget.

Set FramelessWindowHint flag to the widget, to remove the need of
updating its frame position and position.

Fix flakiness on Opensuse 15

Pick-to: 6.8 6.5
Change-Id: Id88510a91e3ed0d5ff92fdc31422503744448b3e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit fc0e788d029beac251fda40650154fc6865e1649)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 13:59:52 +00:00
Edward Welbourne
c38718c846 Add terminal rows to various QtTimeZoneLocale tables
This fixes some read-past-end issues in assertions that verify the
next row of a table after the last for a specific locale belong to a
later locale. Since those assertions happen without sight of the table
of which the locale's range is a part, they can't tell when the
range's end is in fact the table's end - so they shouldn't have been
reading from a row there. Fix by putting a row there, that belongs to
a nominal locale with index out of range.

Change-Id: Ib9d227ca4f86c372c13f963a08a8d637eae63ed0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit b37c580169890d5ccacb5746eb4b99dd711efda4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 13:59:50 +00:00
Mårten Nordheim
1aef8b9057 QMultiHash: fix/update class description documentation
It no longer inherits QHash, so drop the references to this.

And remove an extra 'and'.

Pick-to: 6.8
Change-Id: I5c19f7793571fe04f93e0ede37d280d215d95dfc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit dc8055c9149c0ceb42b4313fb7af0a5b78fe1c16)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 13:59:48 +00:00
David Boddie
a8fe95f0ea doc: Fix broken links and incorrect information
ReadOnly was used in places where ReadWrite was the correct value.

Pick-to: 6.8
Change-Id: I26a2f0de55665ac015fe269e8e5f0d23a2f00e5f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4dcff4ed6d24e6aa061e145bb9de9ff93351a2b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 13:20:27 +00:00
Allan Sandfeld Jensen
33b98002c2 Fix config summary CPU subarch line
Was likely broken by abc888c75bf145bb5da2680b7943f1ea3af83202

Change-Id: Ic9ed27255f105272ef60c3a91f3d934c70b91b8b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit a522a0595bc3e908efc7ec70c9d7120c4d5c599b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 11:41:13 +00:00
Bartlomiej Moskal
941434e81f Android: Fix cursorHandle and EditPopup positions
After the commit 28df9a49776a88cb1a8e69348ae19a59b16a5b7e, a regression
occurred in the positioning of cursorHandle and EditPopup.

Previously, these positions were calculated using QtEditText
coordinates, which worked correctly because the QtEditText size matched
the QtWindow size. However, after the mentioned commit, the QtEditText
size no longer reflects the window size. In this case, we need to use
the parent View for calculations.

This adjustment was already made for the single cursorHandle.

This commit also updates the positioning of selection handles and the EditPopup.

Fixes: QTBUG-132589
Pick-to: 6.8
Change-Id: I861292e363452d487284e3f603fe03a21a334aa4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 5bd26fda7a3f0a509a64847b58b916830ebc2d0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 11:41:11 +00:00
Matthias Rauter
6869341dce Make QDomNodeList::It bidirectional only
The new (6.9) iterator for QDomNodeList was implemented as random access
iterator. The underlying structure of QDomNodeList is similar to a
linked list and therefore it is better suited for bidirectional
iterator.

This patch changes the iterator to a bidirectional iterator. Further the
tests are expanded because the new implementation uses more custom code.

Fixes: QTBUG-132527
Change-Id: I796f445e0b883abc2aea613f1fed6f17c4d93dcd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8609982791928a30a6d836b25810143a064f8c6f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-10 10:13:56 +00:00
Even Oscar Andersen
43eb0dbd38 wasm: Truncate input field length to 1px, fix object selection
Having the input field length too wide causes the view to scroll
to contain it. Since it is not visible, setting it to 1px width and
height should work.

Further, input field contents where set on the showInputPanel
call. At this point in time we do not necessarily have an updated
focus object. Hence the input contents is now set on the
setFocusObject call.

Ignore input on showInputPanel/hideInputPanel. This reflects
the current design where showInputPanel do not act unless
inputMethodAccepted(), and hideInputPanel do not act if
m_focusObject.

Still hideInputPanel used to set m_usingTextInput to false,
this behavior is not kept.

Fixes: QTBUG-132057
Pick-to: 6.8
Change-Id: I2d7088def8060df267c5da9e045824decd913faa
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 7dd94d74e4497647ff62c85460643487baf372bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-09 06:56:56 +00:00
Wladimir Leuschner
9f7437fb85 QWindows11Style: Add left margins to Radio/Checkbox indicator
On 150% DPI scaling, the Radio/Checkbox indicators were clipped. This
patch adds an extra margin to the left to avoid this clipping.

Fixes: QTBUG-133117
Pick-to: 6.8
Change-Id: I2e0186cbdad12481922de5ddf00f50daeb94bb37
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 3d45d22b536cd5fa074f6de4d02b1fd049e6b220)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 19:39:19 +00:00
Christian Strømme
5296136496 rhi: Always check and mark the extra buffers for reuse on metal
It's not just with tesselation we're using these buffers, but also for
multiview, which meant we'd continuously grow the pool until we run
out resources when multiview was enabled. Interesting observation
from this is that newBufferWithLength would 'hang' instead of
returning erroneously unable to acquire a new buffer.

Change-Id: Ie30ca44bc7b4b8f29c517fe6c88fafbe46be3d17
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 3c81c8907633fbc154ec4ae3a89e8d86c9ca0832)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 18:22:09 +00:00
Edward Welbourne
055b5a83b4 Modernise tst_QTextStream::manipulators() and add two new data rows
It was using int for two flag columns; we can pass the relevant flag
types now, and we get better type-checking by doing so. Expand the
integral numeric column from int to qlonglong, since that's the type
we actually end up with by the time we're asking QLocale to do our
formatting for us. Add test-cases for things we've lately noticed
aren't right, notably including the min-qlonglong test (which passes
because compilers handle the UB straightforwardly), that needed the
integral numeric column's expansion. Sign-handling for negative values
in hex fails; a later commit shall fix and remove the QEXPECT_FAIL().

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-133269
Change-Id: I39c5339b144b40a30886d8253fa464828ed87629
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 5a230596c8c1f63e662ce17e094e2ae187066d6d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 18:22:09 +00:00
Frédéric Lefebvre
69738c76b4 tst_QGestureRecognizer::touchReplay give fix position
tst_QGestureRecognizer::panGesture() is flaky as sometimes
the gesture event is being sent outside of the parent. It
is being sent in the window frame instead of in the widget.

Fix position of the parent and verify that it is correct.

Fix flakiness on Opensuse 15

Pick-to: 6.8
Change-Id: I00eacb80a7e2e658345d3bc56cdef0c0024d1a1d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 3766b9cb3cb49fdef626526181b6a7fe26870e29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 18:22:09 +00:00
Tor Arne Vestbø
5127aef0bb cmake: Add option to pass additional arguments to _qt_internal_plist_buddy
Pick-to: 6.8 6.5
Change-Id: Icbbfcb7fffa97370c3cdf7440e801eea60de84f0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ab4aac7bf137083a401186029fe70ff00137f279)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:45:27 +00:00
Tor Arne Vestbø
8f837f6e6f cmake: Find Apple ID via IDEProvisioningTeamByIdentifier for Xcode 16.2
The format of the Xcode preferences has changed, so we need to account
for the new format when looking up the default development team.

Pick-to: 6.8 6.5
Change-Id: Ib34c2e5245c13db4d81218a5a2460417e4fc6347
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 469e4237cf32d27609661132727555490086750b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:45:25 +00:00
Tor Arne Vestbø
0ff3a84bc3 Document QSurfaceFormat::ColorSpace deprecation
Pick-to: 6.8 6.5
Change-Id: I894316d0b3df703e5fd07a1c18f579992215e621
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ca250a637297042d39c3e799a1e25ec3168d6f15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:45:23 +00:00
Tor Arne Vestbø
761d516fd4 qmake: Find Apple ID via IDEProvisioningTeamByIdentifier for Xcode 16.2
The format of the Xcode preferences has changed, so we need to account
for the new format when looking up the default development team.

The account identifier (previously an email address) was not used by
any consumers of the provisioningTeams() function, so it was left out.

Pick-to: 6.8 6.5
Change-Id: I81a400000615594336e14c95db86ffa71a5c5ff9
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 380a9fdc872e14e537f3e148c7a1e72be5face2d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:45:21 +00:00
Tor Arne Vestbø
6a23dfba36 cmake: Rename _qt_internal_find_ios_development_team_id
As well as the _qt_internal_apple_development_team_id_computed
property.

It's used for macOS as well, so use `apple` infix instead of `ios`.

Pick-to: 6.8 6.5
Change-Id: I7932166d094a14ac32cce95e6c9fcbfa44bb97b4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit d688c73e083cecc9b9478f09b202b66b92c87e4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:45:19 +00:00
Alexei Cazacov
639f5bf5db Docs: fix minor issues with topic naming
Change-Id: Iaf8d12743a5f43c355f6960f1da0c6764e622bf8
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 32890793caae08c2dc05ce1f68e659f219536ed7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:45:17 +00:00
Ahmad Samir
db1ed43050 QString: add {setUtf16,setUnicode}(const char16_t*) overloads
This is a first step for adding QT_NO_INTEGRAL_STRINGS in the next
commit.

Mark setUtf16(const ushort *) as obsolete.

Use the weak overload workaround, so that the call isn't ambiguous if
it's called on a nullptr.

[ChangeLog][QtCore][QString] Added setUtf16(const char16_t *) and
setUnicode(const char16_t *) overloads.

Task-number: QTBUG-125871
Change-Id: I25d12c19876466c235c0d9928aae6fd332836bf5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit be3bf632e1cf80b16475f8353e4753b38317626b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:45:16 +00:00
David Boddie
ae6b9c0c63 Fix or remove broken and outdated external links in qtbase documentation
Change-Id: Ia78b3b16b89ab3f80d990b6e338b4a0f294ab1ed
Pick-to: 6.8
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 787d1db34745fec2e89cd99f62767079213bb8fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 12:40:43 +00:00
Topi Reinio
f490b4de05 Doc: Clean up output for tabbed content macro
Insert line breaks in the content the \tab macro expands to. This
produces nicer-looking html and also fixes an issue related to
the post-processing done to the generated files.

Fixes: QTWEBSITE-1202
Pick-to: 6.8
Change-Id: If4e7f7242f8687ef84ad715744653c4167cf907f
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 88e4e952d73db9bc442593a96c88ca22ba7ab673)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 08:08:41 +00:00
Liang Qi
4be258fd13 ibus: use logging category for im debug
Pick-to: 6.8 6.5
Change-Id: I5397f1fb14273b77833979d3e66056a7110fd2b0
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Inho Lee <inho.lee@qt.io>
(cherry picked from commit 5c9fd486ae82056614bdb9e685c825b586bb9809)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 03:14:36 +00:00
Pavel Dubsky
775d56f01d Move UUID definitions out of Qt namespace
When UUID definitions are placed within Qt namespace MinGW build fails because specializations of struct __mingw_uuidof_s are now defined in a different namespace.

Fixes: QTBUG-133516
Pick-to: 6.8 6.5
Change-Id: I49270aa2a892d407675dab7b90d3929d120c5224
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
(cherry picked from commit 84b7cef13913139b2ed7e506ace0fa6b97269829)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 02:34:30 +00:00
Matthias Rauter
1d067db128 Extend testing of QDomListIterator
In preparation of changing the random access iterator to a
bidirectional iterator, the tests are extended to ensure complete
test coverage.

Task-number: QTBUG-132527
Change-Id: I8caf93417282631f7982cb12a82b39c00d67c913
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit e4bcd9f1cb0e787c9353589ea48dca6823592d41)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 02:34:30 +00:00
Laszlo Agocs
6446d865be rhi: d3d12: Fix finish() when called outside a frame
Pick-to: 6.8
Fixes: QTBUG-133454
Change-Id: I447610917966a9dcd4b80dc8b84156ce985f9ca9
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 01308ff18e74860dd32472bbff31ca1fabd8339f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 02:34:29 +00:00
Laszlo Agocs
987ff07a85 rhi: d3d12: Fix crash in readbacks
Amends 73405890b8911dd1a58120665ce63a38281c6ce4. The patch here
does the same for D3D12 as that previous one did for the Vulkan
backend.

Others, like D3D11, are not effected because the loop logic there
does not branch.

Pick-to: 6.8
Fixes: QTBUG-133405
Change-Id: I88ac7c841dc0c28fc3f6b37c3402315b52de0a66
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 68e48ac60a9681887999e31f6dff622eb81bdb7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-08 02:34:29 +00:00
Thiago Macieira
01010851cb QProcess/Unix: don't close the childStartedPipe too soon
We were accidentally closing it along with all the other file
descriptors if the CloseFileDescriptors flag was active. That meant we
were unable to report start problems back to the parent process.

So instead of closing everything immediately, we simply mark everything
as FD_CLOEXEC so they'll be closed by execve()'s success. Because we're
using CLOSE_RANGE_CLOEXEC now to detect the system call, we don't need
the configure-time test.

[ChangeLog][QtCore][QProcess] Fixed a bug that caused QProcess not to
report start failures if the UnixProcessFlag::CloseFileDescriptors flag
was active.

Pick-to: 6.8
Change-Id: I4d81d763281354e886d9fffd56ef6ab8b6115715
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 3d007ff2e9caf328f92d65f71a94fd869552b1b6)
2025-02-07 15:27:41 -08:00
Christian Ehrlicher
b2191e4450 SQLite: Update SQLite to v3.49.0
[ChangeLog][Third-Party Code] Updated SQLite to v3.49.0

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-132862
Change-Id: I0978f2d3bd6aab71cded77668912dec4cb569a68
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit eb03784510c037a377c576b298b9b2fccd16759f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-07 20:39:06 +00:00
Jan Arve Sæther
df1786d777 doc: QKeySequence cannot be cast to a QString any longer
bf805455d40b4445f61321439d529cd85cb6bc65 deprecated the QString()
operator in Qt5. Later dccf28b7c344822b7459635099ebe3abdf5fd107 and
2eee9e6fcf9b70681c5d9202d1509d176e48fc31 attempted to remove it
entirely, but a reference to it still remained.

This change also removes the detailed documentation for toString() in
the same paragraph, which previously stated that it generates strings
for use in menus. However, this is not always the case due to
toString(QKeySequence::PortableText). The differences between the two
serialization methods are already well-documented in the toString()
documentation.

Change-Id: I42dbb353bc56354f37b8fc22170f8e588eb97176
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit f06dd091696fed5b47a1bb071a8d5c28abb5c8a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-07 20:38:59 +00:00
Eskil Abrahamsen Blomfeldt
e593626788 Improve hinted rendering quality on Windows
When rendering hinted text on Windows with DirectWrite, the goal was
to keep the rendering and metrics as close to GDI as possible,
minimizing the impact of changing the default font backend.

Therefore, the DWRITE_RENDERING_MODE_GDI_CLASSIC was always preferred
when hinting was on.

However, DWRITE_RENDERING_MODE_GDI_CLASSIC only applies antialiasing
in the horizontal direction, but GDI applies vertical antialiasing
as well. The result is that text will look more aliased with
DirectWrite than it did with GDI, which arguably looks ugly
especially at large sizes and can be perceived as a regression.

Microsoft documentation recommends using symmetric antialiasing
when the pixel size exceeds 16, so this patch enables
DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC for fonts larger than
16px regardless of whether hinting is on.

It's worth noting that for fonts with heavy hinting, such as
Times New Roman, the rendering using
DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC is different from
GDI, although more similar to Freetype. However, the impact
of not having vertical antialiasing is worse and as native apps
are moving towards using DirectWrite, the GDI rendering is not
going to be the definition of a "native" look anymore.

A second thing to note in this patch is that we always pass in false
for the useGdiNatural argument in GetGdiCompatibleGlyphMetrics().
According to the documentation, we should be passing in true for text
rendered with CLEARTYPE_NATURAL_QUALITY. However, doing this causes
wider kerning in certain cases. Since the tighter kerning matches
the layouts we get in native apps, as well as when using Freetype,
I've chosen to pass false for now, to be consistent.

This change also adds a manual test which can be used to switch
between DirectWrite, GDI and Freetype rendering on Windows, so
that it's easy to compare.

[ChangeLog][Windows] Improved hinted text rendering at font sizes
larger than 16px.

Pick-to: 6.8
Fixes: QTBUG-131946
Change-Id: Iebbe5c7affe7df6266ade6b161c31bde3d2caa84
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 407a98d94fb05780f30e77463fb2bd535041a044)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-07 20:37:02 +00:00
Marc Mutz
0e5e850691 QStringBuilder: remove an unneeded cast
memcpy() takes void*, not char*, so the cast from QChar* to char* is
not necessary (and potentially harmful).

Amends the start of the public history.

Pick-to: 6.8 6.5
Change-Id: I7b7178290bd30d93ed9e64b6b84294d0f7576c80
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 7206f6a39d298ed9c94bccf7bdc57498fa73ac36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-07 20:37:02 +00:00
Marc Mutz
267acbc534 tst_QTextStream::stillOpenWhenAtEnd(): use QTRY_VERIFY()
The test is flaky every now and then on the CI, so increase the timeout from
5s to 20s (a previous TRY_VERIFY precheck reported just shy of 10s waiting
time, doubling should be™ sufficient).

Amends the start of the public history.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: I8e64bf8ac1576c0ac71790a03936635016b3b2b7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 40e65f029341a01e16dc88871eb7b24979aea9bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-07 17:01:04 +00:00
Mitch Curtis
56c39a2622 iOS: send context menu event rather than instantly showing edit menu
This allows Qt Quick items to react to the QContextMenuEvent, rather
than immediately showing a native edit menu.

Task-number: QTBUG-35598
Change-Id: Id8f492b549431a42aa26f2d72b418301d2cab3dd
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit e426737d73bdda1b936e52179b08108250907e03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-06 01:21:07 +00:00
Giuseppe D'Angelo
ef42c65ab1 Fix typo in QT_DECLARE_RO5_SMF_AS_DEFAULTED docs
Change-Id: I1f2acc02939171464e05671afcaf3df7ca2b3b8a
Pick-to: 6.8 6.5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 828cfd5d23b3024b0000cab7d2d20eb54971b858)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-06 01:15:30 +00:00
Marc Mutz
97a1b5ffa4 QFlags: make base class SMFs protected
This is from one of the 90s books on C++ Coding Style:

  Destructors of (public) base classes should be either public and
  virtual or else protected and non-virtual.

The dtors of the various QFlags helper classes were public and
non-virtual, allowing slicing and use outside of QFlags.

Fix both following the rule and making the dtors protected.

Previously, this would have been enough, but Clang started to warn
about undeclared copy- and move-SMFs in the presence of a user-declared
dtor, so need to declare all five.

Found in API-review.

Change-Id: I70d1163f7bb42d981bf550418d2775a784bd416e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f080f161237e3310fca0955742218276069e4868)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-06 00:52:52 +00:00
Ivan Solovev
c0d39fd2ed Move qtformat_impl.h into corelib/text
... because it is not really related to IO.
We were choosing between serialization and text, and ended up with
text, because that's where the standard itself puts format [0].

[0]: https://eel.is/c++draft/format.functions

Amends ffac33964d51971a1c1f61308b6f0a60a4133296.

Found in Qt 6.9 API review.

Change-Id: I827322175da81bc027a9e136098b7e84677f43f7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 584ac8185255da9b15360bf0ca50677cba46ac9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-06 00:52:50 +00:00
Marc Mutz
51bbe63d05 Port qcompare.h to qstdlibdetection.h's Q_STL_ macros
... and add more specific #errors.

There are two distinct error cases here:

- First, someone could add more Q_STL_ macros to qstdlibdetection.h,
  so like a switch with -Wswitch, list them all here and #error out if
  there's a Q_STL_ we haven't yet seen. The audience here is Qt
  developers, via the CI.

- Second, one of the "non-major" libraries (ie. not libc++, libstdc++
  or MS-STL) add support for C++20, specifically the std::ordering
  types as announced by __cpp_lib_three_way_comparison, in which case
  we need to retroactively add the correct unordered value here. The
  audience here is both Qt developers, via CI, but also Qt users.

So separate the two error conditions.

Also, for platforms where we don't know the numeric value of
std::partial_ordering::unordered, use Qt's legacy value, for
potentially faster conversions to/from QPartialOrdering. There's no
point in guessing which value _might_ be used by a future STL, and
swapping STLs is _always_ BiC, so we don't need to guess which STL
will follow the Dinkumware ones on QNX and VxWorks.

Amends 0231f33ad121a85368bb3f43273973b9632735dc.

Change-Id: I1d06a18ca5bb26aceb7c76a0f035ecd8d4673547
Reviewed-by: Michał Łoś <michal.los@siili.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 1a74f77f57fff52e0166dd895a8c6d9e09b388a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-06 00:02:44 +00:00
Andrew Forrest
65e9eca63b Android: Fix mouse button processing
Fixes clicking UI elements with a mouse on Android.

8d8cbe87e21f05b7d611ed4be47299977288b267 introduced changes to support
mouse buttons other than Qt::LeftButton, but the release always looked
like no buttons changed, nor were they tracked (m_buttons is always
Qt::NoButton). Qt was not notified of mouse up, so nothing was clickable.

Now all mouse events go through sendMouseButtonEvents, and the last seen
button state is tracked for every event. If a mouse up with no buttons
occurs, the last seen set of buttons is used instead, so Qt correctly
handles the event. Also adds the mouse button state information to
mouse move events from Android, so the workaround for delivering
Qt::LeftButton when a window is tracking a move while a button is
pressed has been removed.

Tested on a Samsung A1 with a Bluetooth mouse.

Fixes: QTBUG-132700
Fixes: QTBUG-130297
Pick-to: 6.8
Change-Id: I241282c2915d7e6cf99db7f0bc1ad2d541349077
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d908e043984dcfed3aa80e30cd1cafacd13b644d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 18:29:25 +00:00
David Redondo
281c45452b QScreen: Add a note to use QWindow::devicePixelRatio if possible
Like QGuiApplication does as well. Also add a note that screen and
window DPR can be different.

Pick-to: 6.8
Change-Id: I1a24cf7f11e945187da9dce4421039350e811997
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 97049278443860d3dd1b1efd20d1f7dabaf72a35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 17:14:06 +00:00
Giuseppe D'Angelo
5ca7ad268a QVLA*: honor the RO5
The various base classes that abstract away template-independent parts
of QVLA have protected destructors to prevent slicing. Re-add the
special 5 (using the macro) and a defaulted default constructor.

Pick-to: 6.8 6.5
Change-Id: I60f036eafc808862a1abee72fd53023dd99b4cc3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c10072895d1061e258d23f3cc2a9050de5236a46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 15:57:31 +00:00
Ivan Solovev
624784a729 [docs] Add three-way comparison overview
Task-number: QTBUG-128837
Pick-to: 6.8
Change-Id: I64ae12994f8a48ee5f4e48ca6ed7f5980476f2aa
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 737c87b2b21e30abf5e51126fd8ff4e45521144e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 15:57:31 +00:00
David Faure
7328f90e64 Linux: autodetect gdb (to add -nograb) even in release mode
Application developers using Qt from their distribution, or from the
official installer, get a release-mode Qt build, where QT_DEBUG wasn't
defined. That's no reason to hit the issue that a breakpoint in
code that gets hit when opening a popup menu should lead to a complete
desktop freeze due to the mouse/keyboard grab.

Change-Id: Idf0df03ce5afb792261b62cabb06fab17b5e2952
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit a176f87a6451412a632866fda1fd79290b9d7520)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 15:57:30 +00:00
Giuseppe D'Angelo
711b86fa24 QtGlobal: introduce a helper macro for declaring the RO5 SMFs as defaulted
If a class honors the RO0 we usually just leave a comment in the class'
body, and don't explicitly redeclare any of the RO5 special member
functions.

In some cases we may need to redeclare (some of) them. The main use-case
so far is to declare a protected destructor for a base class that is
not polymorphic, in order to prevent slicing; the compiler-provided
destructor is always public.

We can easily declare and default such a protected destructor, but that
comes with the problem that now we're violating the RO5 (as far as C++
is concerned, declaring a SMF counts towards the RO5, even if it's
immediately defaulted).

Specifically: by declaring the destructor, the class loses the
compiler-generated move operations, and the copy operations are
generated but deprecated. Clang >= 18 warns about this.

In such a scenario we *must* redeclare all five SMFs... and default them
all. This is boilerplate, therefore I'm adding a macro to streamline it.

Apply the new macro to a couple of cases were manual refactoring has
already been done.

Pick-to: 6.8 6.5
Change-Id: I5dc0ff9770621fbec0b1057c164d0623f901e3e9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fcb57391f73d36914e10ba964dbd9b01fe6f3af2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 15:57:30 +00:00
David Boddie
40dc33a9d3 Fix broken auto-links in QAtomic docs
- There is no load() in Q*Atomic (unlike std::atomic), so link to
  loadAcquire()/loadRelaxed(), depending on context.

- Also remove the template argument, <T>, which prevents qdoc linking.

Amends b62c3a85452aecf4f6c863645db34857b05d5ebf and
329e09a3c303fad1ab001de74924288aae1e7a9d.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: I8c58674ffc7e779fee982555edcd45ed40d4c17d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 9854482835071993968a524878b601c1d9327f1e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 12:08:40 +00:00
Marc Mutz
eb13efc4a6 Unbreak QSet::intersect()
The selection of which set to iterate over and which one to remove
from based on their relative size violates the function's
documentation, which clearly states that items are removed from *this,
and not from `other`, so the result must never contain any elements
from `other`.

Amends 4f2c96eaa8bfa4d8a6dfb92096e4e4030d0cdea7. Instead of reverting
to the gruesome old code with the forced detach-just-to-remove copies,
distinguish four cases:

- if the two sets are shallow copies of each other, then their
  intersection is *this

- otherwise, if either set is empty, clear() *this. This is required
  for one of the tests that 29017f1395b1bc52e60760fa58c92f6fa4ee4f60
  added to succeed.

- otherwise, if *this is detached, perform the operation in-place,
  using removeIf()

- otherwise, create a new set and move-assign to *this to avoid
  detaching just to remove something again. In this case, we can
  continue to iterate over the smaller set, but we need to keep
  picking elements from LHS into the result.

[ChangeLog][QtCore][QSet] Fixed a regression (introduced for Qt 5.2)
in intersect() that caused equivalent elements of `*this` to be
overwritten by elements of `other` if `other.size()` was larger than
`this->size()`.

Not picking to 5.15, as users will have likely adjusted their code to
the buggy behavior, and because removeIf() isn't available there.

Pick-to: 6.8 6.5
Fixes: QTBUG-132536
Task-number: QTBUG-106179
Change-Id: Idfa17c3b3589c4eacec27259fc01df6aeaa6c45f
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 162015e9c6f469951d9212ef655cff16dcace071)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-02-05 13:08:40 +01:00
Marc Mutz
3dff1a3f7b Revert "Optimize QSet::unite"
This reverts commit 92acc94fa98d19929d28feb5d543acf8c50c2290.

The change broke QSet ordering guarantees: The documentation clearly
states that each item from `other` that isn't already in `*this` is
inserted ("STL insertion behavior"). Swapping *this and other breaks
this.

Independent of STL vs. Qt insertion behavior, making the picking of
elements from containers "random" in the sense that the size of the
container is now important, and not merely LHS vs. RHS, is a bad idea.

[ChangeLog][QtCore][QSet] Fixed a regression in unite() that caused
equivalent elements of `*this` to be overwritten by elements of
`other` if `other.size()` was larger than `this->size()`.

Pick-to: 6.8
Fixes: QTBUG-132500
Change-Id: Ia636b62325139d618b5467a643ff710716324296
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 2d1b3028673493cb144060cbec49b1b95f4188d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 12:08:40 +00:00
Marc Mutz
12f39bb2ab QSet: check that unite() and intersect() prefer elements from *this
In Qt versions 5.0..6.7, at least, this used to be the implemented
behavior for unite(). For intersect(), it was implemented up to and
excl. 5.2. Even the documentation states as much:

intersect(): Removes all items from _this set_ that are not
             contained in the other set.

unite(): Each item in the other set that isn't already in this set
         is inserted into this set.

Add checks that the functions behave as documented (hint: they no
longer do, since 6.8 (unite()) and 5.2 (intersect()), resp.), this
being the only correct way to implement these functions (items in
sets may be equivalent, but not identical; it is important that the
set operations work in a manner consistent with insert(), to meet
user's expectation of how these functions work (unite() just
inserts() the rhs, intersect() removes if !rhs.contains). Note that
QSet, unlike other Qt associative containers, actually has STL-style
insertion behavior (insert() doesn't overwrite).

subtract() is the only one that's still true to its docs. A test for
this function will be added in a follow-up commit - eventually.

In anticipation of adding rvalue-other overloads of at least
unite(), add a test with that, too.

Pick-to: 6.8 6.5 6.2 5.15
Task-number: QTBUG-132500
Task-number: QTBUG-132536
Change-Id: Id309ab5192e6d1c9bbeef496cbd7116d306eaae8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 0d4fd5c545b47966c56ed0b9eb9b5c0a8f75c02a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 12:08:40 +00:00
Kai Uwe Broulik
0048e8de0e doc: Fix typo in Qt Style Sheets Reference
It's QAbs*t*ractScrollArea.

Pick-to: 6.8 6.5
Change-Id: I94a8d35c40445883a232a8671e56780afffb2e01
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 46809abbb7cd525e287360455a7fa074eeb800d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 12:08:40 +00:00
Ivan Solovev
bec66636c8 QProcess/Unix: add an actual check of DisableCoreDumps flag
The original patch that added this feature was disabling the core dumps
unconditionally. I guess the check was simply forgotten.

Amends 9df6e8ad3b3a7a57af87e6a3fef2ef793610cb3d.

Found in Qt 6.9 API review.

Change-Id: If3f9cb35d11a0262241a465626a25f6d7d2bbdb4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9860f6522919d154dd4f95ff6f6ae58d3e4c435e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 08:32:42 +00:00
Allan Sandfeld Jensen
11599cb379 Make -platform linux-clang-libc++ work with icecc
It usage of libc++ was never detected if the compiler was explicitly set
to a specific clang binary and clang wrapper.

Change-Id: I5fd3c84223cafedf06b34afe91d975e71c199e24
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 982fe396e5908a6f1089ba577ed6220d90eaaa95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Mårten Nordheim
2ce7e21766 Unicode tool: handle required QFile::open return
Fixing warnings/errors about QFile::open() return value not being
checked, and print the name of the file and the error message that
occurred.

Task-number: QTBUG-132902
Change-Id: I099b300b5fd4563334fa547ffa365ec3f68e08cf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e99d5c6268862e5773056a008c273e18bf5b4ef7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Mårten Nordheim
00ddc174b4 QUrl: sort idn whitelist
We look it up with a binary search, so it needs to be sorted.

Pick-to: 6.8 6.5
Change-Id: I0aa25e6ff9722372c0a09f2dce9f9c839fedf00e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 382a7d006b52faa08b84e56d97cc6c216925a43e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Mårten Nordheim
67500054d2 Unicode tool: print values using portable types
ssize_t is not universal; fails to compile in Windows.

Task-number: QTBUG-132902
Change-Id: I4b8f45cba32202329ac085c7caa0a8c19a11c621
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f7d0366207709ec0dc33f5d10d21b8f3c9d6534f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Mårten Nordheim
09b06a740d Unicode tool: use unsigned values for the bitfields
On MSVC the values stored end up as negative.

Task-number: QTBUG-132902
Pick-to: 6.8 6.5
Change-Id: I963c57c34479041911c1364a1100d04998bdfaed
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 62685375a2d71fa34015faac76f03e709e4217c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Christian Ehrlicher
2a3c016894 Windows11Style: don't create a QPen when not needed
Use QPainter::setPen(QColor) and QPainter::setBrush(QColor) overload
instead creating a temporary QPen/QBrush to gain advantaged of the newly
introduced QPen and QBrush assignment functions from
ab53500cfa11b988e7e4234583fa6eb5027b4c08

Change-Id: I3b8c4f7d669a08558cf6abcc77c23a4fdda99c02
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 82a5e8bdb788179d1323e76b725d57efaab0b217)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Assam Boudjelthia
d31a94a70a Android: fix Q_JNI_NATIVE_METHOD() with namespace builds
Prepend the Qt namespace to the JNI method under Q_JNI_NATIVE_METHOD.

Pick-to: 6.8
Fixes: QTBUG-132490
Change-Id: I73bb8119a0d760e8f7ce82e70ced2684bec76eb0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d1694476271346d13ac8ca3138328d295bf403b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:20 +00:00
Thiago Macieira
8c5736e68f QUrl: avoid going up from the drive path on Windows file URLs
On Windows, using a URL of "file:///c:/" as a base to be resolved with
"../" should not result in the Windows drive being removed.

[ChangeLog][QtCore][QUrl] Fixed a bug (regression from 6.7) where
resolving a base URL of an absolute file path containing a Windows drive
could result in said drive being removed (e.g., resolving "file:///c:/"
with "../" would result in "file:///").

Fixes: QTBUG-133402
Pick-to: 6.8
Change-Id: I58286b9c5e5d02363f0efffdb06f983b560340df
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 340c9d88ab353e201f117d64609fa5f7d2fa2b21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:20 +00:00
Thiago Macieira
86597d2891 QUrl: set the host to empty but present for "file" URLs
We set it when manipulating full URLs. If you're creating them from
parts, you may end up with one without a host. We will still fix that up
in QUrl::toString() ("manipulates full URL").

This allows the path normalization code to avoid accidentally creating a
URL with no host/authority and with a path that starts with double
slash.

[ChangeLog][QtCore][QUrl] Fixed a bug (regression from 6.7) where
QUrl::resolved() could create invalid URLs when the relative URI being
resolved contained a path with double slashes (e.g., combining
"scheme:a" with "..//b.txt")

Pick-to: 6.8
Fixes: QTBUG-133403
Change-Id: I3fe9d5fbd2efcaa66d66fffdc010e5a84066b641
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 7d05f5ed7d3472028e28a09eeda175bb1b1eeb00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:20 +00:00
Thiago Macieira
d37960b35a QTypeInfo: work around MSVC 2022 bug "isRelocatable: undeclared identifier"
Definitely a compiler bug because it passes for everything we threw at
the compiler in the CI but fails for a user. At least the workaround is
simple.

Fixes: QTBUG-133032
Pick-to: 6.8
Change-Id: Ie84590c466cf1d6f01bbfffd3ca1d6c262d77200
Reviewed-by: Irfan Omair <irfan.omair@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 0a5b37b706ee72c7d9042efcde244aa93a5ce9a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:20 +00:00
Vladimir Belyavsky
d35a1eb1ac CoreText: prevent colored glyphs (like emoji) to be clipped
To prevent colored glyphs (like emoji) from being cut off at the edges,
we can simply apply the solution from bbba71748438dc05d344bb9727f10b7f55a5d229
to colored glyphs as well (i.e. to glyphs with QFontEngine::Format_ARGB format).

Fixes: QTBUG-133297
Pick-to: 6.8
Change-Id: I5578e2d12f956d0635b662b3ecf714aa63474945
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 7cc0ea0b5a1dc1d9e1a9a8cc8639958e42adba3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:19 +00:00
Jaishree Vyas
d7ff69741b Doc: Make C++20 overview visible to the new sidebar
Added the link to the qtcore-toc.

Task-number: QTBUG-130085
Change-Id: I765e01aeda0bce694157bf15ff5a036f239168f5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 43cb7f93a4da2d57513acb3c4cbdd56c1eaf188f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:19 +00:00
Marc Mutz
7197992341 Long live qstdlibdetection.h!
I've been meaning to add this since at least 2012 (cf. commit message
of 9180d9aa8bfb9e9f66fad13f194398a98698eb77), this is as good a time
as any.

Detection taken from qcompare.h, except for
- libstdc++: using version macro instead of date one
- Dinkumware, which is taken from the above-mentioned commit (adjusted
  for the LIBCPP->CPPLIB typo),
- STLport/SGI, which are taken from stlport's _stlport_version.h,
- RogueWave, which is taken from Apache stdcxx's rw/_config.h, a fork
  of RogueWave, contributed to Apache by RogueWave themselves.

It looks like not all STLs provide a version macro, and those that do
vary a lot in granularity, so for the time being, just define these
macros to nothing and not to some form of version.

[ChangeLog][QtCore] Added Q_STL_ macros for stdlib detection (libc++,
libstdc++, MSSTL, Dinkumware, STLport, SGI, RogueWave). If your STL is
lacking, please file a bug report. Note that these macros are not
considered public API just yet.

Picking to all active branches, since not picking is more risky (code
that assumed these macros existed in older branches could silently
change behavior if they don't).

Fixes: QTBUG-132908
Fixes: QTBUG-132909
Pick-to: 6.8 6.5 6.2 5.15
Change-Id: I8f956d131292483b7727f11f69b460b12a06b583
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b6f825a857d0d2266ea89879f26703f86ddf669a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:19 +00:00
Ivan Solovev
69fa60518c Bump the deprecation version for WindowType::MaximizeUsingFullscreenGeometryHint
The replacement is new in 6.9, so the deprecation should be done in a
later Qt release.

Amends 90fe9874d22f0c4b809a3e493766ef852c72cc39.

Found in Qt 6.9 API review.

Change-Id: If68685f98928015163cd4aa0e65fed2c6578e429
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit b0364bc2633f322630028a13fe1143e222015cd1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:19 +00:00
Allan Sandfeld Jensen
f20166d2de Fix AVX512-FP16 build
Was missing explicit conversion from float to FastType when
FastType isn't float.

Pick-to: 6.8
Fixes: QTBUG-133430
Change-Id: I227558f6ecc1018158c88514dbb23bfe095ef77f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit d076420bb0740e0410a886fc2feb5fcf8b729f4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:18 +00:00
Thiago Macieira
d07a849e98 Fix detection of -fPIE code for QT_CONFIG(reduce_relocations)
Amends commit 19b7f854a274812d9c95fc7aaf134a12530c105f, which removed
the __PIE__ check because of the GCC version check that was alongside.
GCC and Clang define both __PIE__ and __PIC__ for -fPIE, so checking for
__PIC__'s presence isn't enough.

Drive-by amend the no-PIC #error message to also suggest
-DFEATURE_no_direct_extern_access=ON, which is more modern and produces
better code for executables too. Because of that, I've also changed the
reduce_relocations option to the CMake one, as there is no configure-
style equivalent for the modern option.

Pick-to: 6.8 6.5
Fixes: QTBUG-133101
Change-Id: I957b264eaee360fd964afffd60617964b26fe934
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 014e77801fa4b99cdb03330ccce1e212ac13a0af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:18 +00:00
Liang Qi
b33813534e xcb: call qGuiApp->exit() on xcb connection error
Fixes: QTBUG-130741
Pick-to: 6.8 6.5
Change-Id: I67eff8e58d4a4a8d18fb49699111f72ed9100480
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit facf2c17707ac4827e624fb6e9546278aef0c38d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 21:47:34 +00:00
Rym Bouabid
7a2b93fc78 ibus: Make address a QByteArray instead of a view in createConnection()
When "address" is a QBAV, it points to line(QBAV) which points to
lineArray(QBA), so its data will be overwitten after every read:
      while(file.readLineInto(&lineArray))

This amends f0aa391ef89a393221d77d5ad3c1616a4727f11a .

Fixes: QTBUG-133445
Change-Id: Id23e726327529c44e205c4c0720af0dad42c175b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 07eeb45d881bb0240e472167217912b08be44371)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 11:51:24 +00:00
Tor Arne Vestbø
c04a7aa2c6 macOS: Emit font dialog change when dialog is not active window
The NSFontPanel emits changeFont even when not the active window, and
applications are expected to update their views accordingly.

As the changeFont action message is sent through the responder chain we
were only picking up the changes when the font panel was active, thanks
to the NSWindow delegate we were installing on the panel.

But when the active window is one of our other windows, we were failing
to process the changeFont message in our QNSView.

We now handle the message by forwarding it to the font dialog delegate,
so that we enter the same code path as before, and emit the right
signals for QFontDialog and friends.

Pick-to: 6.8
Change-Id: I97427c73fe46f129ca11afa6b2c222bf0f0fb0af
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 3d42f31243ce52e517e09843b93f40b79925652f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 11:51:24 +00:00
Giuseppe D'Angelo
97880102dc QSqlQuery: complete the deprecation/removal of its copies
QSqlQuery has been made movable in Qt 6.2
(14f9f00fdb2dc428610c08e3d9d03e38e9602166). The pre-existing copy
operations have been deprecated, but not removed, in order to preserve
SC/BC.

This left us with two issues:

1) Whether or not to keep the deprecated copies in Qt 7. The answer is
no: the copy operations are impossible to implement in a way consistent
with value semantics (the state of the DB driver can't be copied in
general). Therefore, mark the related APIs as to-be-removed, and not
just deprecated.

2) While we no longer copy QSqlQuery from Qt code directly, QMetaType
still detects the presence of the copy constructor and extracts it,
triggering the deprecation warning.

Rather than unconditionally suppressing the warning (which will hide any
similar issue we might have in the future), add a local workaround that
raises a runtime warning if QSqlQuery is copied through QMetaType, while
not raising the deprecation warning when building Qt itself.

[ChangeLog][QtSql][QSqlQuery] Copying a QSqlQuery object via QMetaType
now raises a runtime warning. Note that copy operations for QSqlQuery
objects have already been deprecated since Qt 6.2, and are planned to be
removed in Qt 7.

Fixes: QTBUG-132752
Task-number: QTBUG-91766
Change-Id: I48714ad53ec706a5e4e055c45a1c05f372382940
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit f744cef06cf3a56591782f487c545b55b2a673fb)
2025-02-04 08:42:49 +00:00
Marc Mutz
4e475b5cc2 XCB: replace header guards with #pragma once
Following qtbase/1c8884fc277c5916a420a3c14de68547a391f9fc's making
syncqt error out when an installable header contains #pragma once, we
can now flip the coin and use #pragma once as a static assertion that
the given header is not going to be installed, making it easier to
understand which headers are "public", which ones are "private" and
which ones are "neither, since never installed".

Do this for the XCB platform support files.

In qxcbglintegration.h, the header guard was actually broken (had only
#ifndef and #endif, was missing the actual #define).

As a drive-by, normalize vertical whitespace.

Pick-to: 6.8 6.5
Change-Id: Iede0605c38cda7606edfc7155bd8bfc95990c5bc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 91f9ba2993a2652bcb349ce639aff67b5bfc8938)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 05:19:37 +00:00
Thiago Macieira
ae2502b4ad QLibraryInfo: speed up checking if ":/qt/etc/qt.conf" resource exists
Go straight for QResource, because this is run very early in Qt's
initialization, usually as a result of some debug message, via
QLoggingRegistry::initializeRules(). This bypasses the need to create
QResourceFileEnginePrivate, QResourceFileEngine, QFileInfoPrivate, and
QFileInfo, all of which would end up in this .isValid() call.

Additionally, I'm making it query in the C locale, which will also avoid
initializing the system & default QLocales. If a resource exists in any
language, the C locale query will find it.

Pick-to: 6.8
Task-number: QTBUG-133206
Change-Id: I434b498903d793c12d35fffd3e297bfdbdc1b6fe
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d59e640c868f3db2d661970f3d34a22013d49053)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 03:01:59 +00:00
Ahmad Samir
0ca8024da2 QDirListing: clarify the ExcludeSpecial flag API docs
Amends e583c3d5163a5512abac85e32359652e28a053f7.

Pick-to: 6.8
Change-Id: I2ed231990778d03384045bc417efc58a6019fc14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e5fbe88708103781ee8d60f5280ea1ad4bed21f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 02:47:39 +00:00
Christian Ehrlicher
c7f914c68c Widgets/styles: don't create a QPen when not needed
Use QPainter::setPen(QColor) overload instead creating a temporary QPen
to gain advantaged of the newly introduced QPen operator=(QColor)
function from ab53500cfa11b988e7e4234583fa6eb5027b4c08

Change-Id: Ib29a932a183b629f2c5f3ce32f4e00bd7ab24a03
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 678564291d8faa7689b4a65376b2c60118fc9936)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-03 05:13:25 +00:00
Eskil Abrahamsen Blomfeldt
b6557e4be8 Fix compilation with unofficial DirectWrite headers
Reportedly, some unofficial DirectWrite ports are missing the
default values to the arguments for IDWritePaintReader's
MoveToFirstChild() and MoveToNextSibling(), so we make this
explicit to work around the problem.

Fixes: QTBUG-133336
Change-Id: Ia9a01e371e7424508db0d5ad3c75037caaf16854
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cbce69ebd643bb4841de20f34c5b23bddbcde0c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:53:16 +00:00
Alexandru Croitor
9ffc3b0705 CMake: Wrap path in quotes to avoid issues with spaces in paths
Otherwise running the deployment script fails on macOS with something
like

CMake Error at
 .qt/deploy_qml_app_texteditorexample_32987d3e6e.cmake:1 (include):
  include called with invalid argument:
   2/build/.qt/QtDeploySupport.cmake

due to the following generated content:
  include(build/texteditor space 2/build/.qt/QtDeploySupport.cmake)

Pick-to: 6.8
Task-number: QTBUG-126827
Change-Id: I8f9923db8dc670a6efbd6f75c48da5dfd1af687d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 65f08c09713b6d167638c4e19ebafcac045fc1c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:53:05 +00:00
Robert Löhning
01b90c38e7 libinput: Fix developer build without xkbcommon
Before this fix, the build failed with:
error: unused variable 'REPEAT_DELAY' [-Werror,-Wunused-const-variable]
error: unused variable 'REPEAT_RATE' [-Werror,-Wunused-const-variable]

Pick-to: 6.8
Change-Id: I44a76e2270c1f5d8af6bd018869db5e30e40ecbb
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 42ea8c31fe459ac252144f89986891b241c3e9d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:52:51 +00:00
Cristian Le
9601b5fa5b Check for misspelled FEATURE_* variable
The feature names are normalized using `qt_feature_normalize_name`, but
a user might read `qt_feature` usage and not realize that they should
normalize the name in the `FEATURE_*` variable.

This change emits an error if it detects such invalid names.

Fixes: QTBUG-132464
Pick-to: 6.8
Change-Id: I33c7ab9f589c92e11e16d376660e8b6152339d12
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b71647d06970b2cc3b63b93c020eca8caf0a519f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:52:36 +00:00
Ivan Solovev
7e80af2bc2 QSharedPointer: document rvalue overloads of various cast methods
The patch provides two documentation snippets: for an arbitrary arg
and for \c {*this}. That is because qdoc does not support passing
a command (e.g. \c) as a part of the snippet's parameter.

Amends e95fb04202b3f786037c10942fd4e912644fd7d2.

Found in Qt 6.9 API review.

Change-Id: I4eed234d18e39f2fc0c30a647a423f3240e31d40
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 8511149d886e5aef2a065efffc336c7b25e6540e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:52:27 +00:00
Andreas Eliasson
c965151d4d Doc: Fix typo in in scope resolution operator
Fixes: QTBUG-132911
Pick-to: 6.8 6.7 6.5
Change-Id: Iaa7c4830abd273ccfe558e089da5072a83607f26
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit bc733ea787ad6993e945146a9d297d14cb6175ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:51:43 +00:00
Liang Qi
98065efdfa Fix dangling references - GCC 15
This amends 8a6750475410629741de0417c28f574c25c65338 and
18def77d27f88ce26b6af29fe56a80429fed555d.

Pick-to: 6.8
Change-Id: I31068527458da3d25211743fb64e2624039bd78b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9379b95b533216593d4d37c0cbf70f91d1ce037a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:26:07 +00:00
Marc Mutz
0ce4cdddb4 util/update_public_suffix_list.sh: use commit date, not wall clock
This is both more accurate and also more stable: The suffix-list
update usually takes several days to go through all branches; using
the commit date avoids using newer fetch dates in older branches.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: Ifefd7158e4104c7bbdfe6a2d8a505d8acf7275b4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit cbea57f80b43a969d2e15d53b759abb9924d52c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 00:09:42 +00:00
Christian Ehrlicher
7a9f724735 QMenu: Ignore disabled hotkey during hotkey search
When two actions in one menu have the same hotkey and the first action
is not enabled, the action search was selecting the first, disabled
action despite the fact that it could not be selected later on.

Pick-to: 6.8
Fixes: QTBUG-56952
Change-Id: I894ee09d9ccc7154ca506ef907924cd150ac6ed2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 13636f848da6932f9864bf9335d19b439b8387cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 23:06:46 +00:00
Assam Boudjelthia
44b706457e Android:CMake: add \cmakepropertysince to packaging type properties
QT_ANDROID_SYSTEM_LIBS_PREFIX and QT_ANDROID_NO_DEPLOY_QT_LIBS were
added in Qt 6.4, but they were missing \cmakepropertysince 6.4.

Pick-to: 6.8
Change-Id: Ife0f68e79d331f4923d1015431f5af65d80dca36
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 51474d795a4c801933f9444b73d536fb1c407e72)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 22:03:12 +00:00
Assam Boudjelthia
6f6c291beb Android:CMake: remove \preliminarycmakeproperty for non-preliminary cases
Those Android CMake properties have been carrying the documentation tag
of \preliminarycmakeproperty by mistake.

Pick-to: 6.8
Change-Id: I739fee2f078300427557a29b25e1898d57cf04d7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2abc4594791823f1e56d692df38ede69f83e45cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 22:03:05 +00:00
Marc Mutz
7dca077bb6 QObjectData: Return const QMetaObject* from dynamicMetaObject() already now
It's semi-private API (ie. undocumented) and for most platforms¹, the
change is a no-op, which is why the approach here is a bit different
than your usual REMOVED_SINCE:

Normally, when only the return value changes, we mark the new overload
as QT6_*_NEW_OVERLOAD to allow the two function to coexist and the old
function to call the new one.

But the extra argument backing QT6_*_NEW_OVERLOAD would change the
mangling of the function even on platforms that don't mangle the
return type (the majority), and we'd have to decorate all calls that
could possibly be seen by QtCore's removed_api.cpp TU with
QT6_CALL_NEW_OVERLOAD. The main user of the API is moc-generated code,
though, and so I didn't want to have to change moc's output, even
though, currently, nothing in removed_api.cpp includes moc-generated
code. But it may, at some point in time.

This means I needed to grasp the nettle and duplicate the (granted,
trivial) implementation. Even a private helper function would mean
(maintenance and runtime) overhead for "normal"¹ platforms, so I opted
not to go there, either.

¹ those that (rightfully) don't mangle the return type, ie. all except
  ... MSVC.

As a benefit, we catch the mistake of modifying the dynamic
QMetaObject under the object's radar already now.

[ChangeLog][Potentially Source-Incompatible Changes][QtCore][QObjectData] This
(undocumented) class' dynamicMetaObject() function now returns a const
QMetaObject* (was: non-const). The backwards-compatible fix is to
receive the result in a const QMetaObject* variable (or to use auto),
and applying a manual const_cast, if a non-const object pointer was
actually required. Modifying the meta object that was returned by this
function was never supported and may lead to problems elsewhere.

Amends 0b044e8b055f9c1d93b278ed69aba76f7c886cb1.

Change-Id: I4ebc43018a2a87433ab7a97554196842b97cf1ba
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2c212e15f8b9dc2578d93ac69a0f5826ea9de18f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 10:16:43 +00:00
Marc Mutz
d2c4f6df21 QDuplicateTracker: shed memory_resource on clear()
The pmr::monotonic_buffer_resource ("pmr::mbr") strategy can only
allocate buffers; deallocation is a no-op. I chose it for
QDuplicateTracker because the tool was only used one-off: build it,
then destroy it. There were no other operations.

That changed when 090c7e3262dce93df83c73a4a822761e5d9b4650 added
clear().

Calling pmr::unordered_set::clear() will deallocate the nodes (but not
the bucket array), but due to pmr::mbr, nothing is actually
deallocated, so memory that was freed by the container isn't actually
reused by it, later. IOW: repeated grow-clear-grow-clear cycles would
forever grow the monotonic_muffer_resource, using more and more memory
and thus appear to be leaking it.

This isn't exactly optimal behavior, so try to shed the pmr::mbr's
extra memory with a call to mbr::release().

Unfortunately, C++17 originally failed to nail down the semantics of
pmr::mbr::release(), prompting LWG 3120 in response to observed
implementation divergence. In particular, MSSTL, at the time of LWG
3120 filing, didn't appear to allow to allocate() after release(). In
our tests, it does allow it, it just never falls back to the original
(stack) buffer, and, looking at the implementation, it doesn't look
like it can do so anytime soon (it doesn't remember the buffer, and
everything is inline, so they would seem to need a BC break to fix it.

We tried to work-around the problem by hard-resetting 'res' by going
through a destroy-recreate cycle. pmr::mbr is neither copy- nor
move-constructible, so that blunt instrument is, unfortunately,
necessary (std::optional would be an alternative, but has overhead
that affects all platforms). This crashed, though, so just call
release() and handle MSSTL's failure to reuse the initial buffer as a
QoI issue.

For all platforms, before release(), we also need to make sure that
`set` no longer holds any references into it, and, since clear()
doesn't shed capacity, we need to use the C++11 version of the
swap-trick (swap is actually UB here, because the allocators differ):
move-assign a default-constructed set.

Amends 090c7e3262dce93df83c73a4a822761e5d9b4650.

Fixes: QTBUG-132945
Pick-to: 6.8 6.5 6.2
Change-Id: I4796806e427602255439dcb1518aa9b661c7933e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9f4325e67354ce6c4c98e7a206f17729b378dc04)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 10:16:43 +00:00
Marc Mutz
605a20b262 QSet: don't detach in remove()/removeIf() if nothing is being removed
QSet::remove() calls QHash::remove(), which unconditionally detaches,
so fixing the detach there, by pulling the isUnused() check to before
detach(), fixes it for both.

For removeIf(), the old code used begin()/end() for iteration,
detaching unconditionally, even if nothing was removed in the end.

In this case, fix by using cbegin()/cend(). That delays the detach()
until the first erase(), where it belongs. The end() iterator of QHash
(and therefore QSet) are stateless sentinels in all but name, so we can
continue to cache end(). Add a code comment to that effect.

Amends 62dad9be9e172597c56a970202299563aa04918e (for removeIf()) and
5b7c3e31b538376f2b4733bd868b5875b504cdb3 (for remove()).

[ChangeLog][QtCore][QSet] remove() and removeIf() no longer
unconditionally detach, but only if something is actually being
removed.

[ChangeLog][QtCore][QHash] remove() no longer unconditionally
detaches, but only if something is actually being removed.

Pick-to: 6.8 6.5
Task-number: QTBUG-106179
Fixes: QTBUG-132831
Change-Id: I807577eafa1be478b0a2da45cf8c44936d5e48ed
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 3a284dc19d1c77692f2faddedc674cc293d51a00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 10:16:43 +00:00
Liang Qi
dd927a4f3c tests: Skip tst_QClipboard for Ubuntu 24.04 GNOME/X11
Sometimes test causes kernel crash. Test is skipped until
gnome-shell 46.1 or newer is backported to Ubuntu 24.04 LTS.

See also https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/2095396

Task-number: QTBUG-132070
Pick-to: 6.8
Change-Id: Ia1c7f1737e225189b86cb2b2d2ff68a7cc1e838c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 1c0406ee17d5747f8e5b107db81949055aaa7f9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 10:16:43 +00:00
Marc Mutz
aefd124efa q17::uninitialized_value_construct: use C++17/20 semantics of voidify
While LWG 3870 changed the const/static_cast'ing for C++23, this is
q17, so use the C++17/20 semantics of casting away const- and
volatile-ness.

Found in API-review.

Amends 364ac13a79a8fff0447a62e9af5588db397c0bfd.

Change-Id: Ie11589cbc96b8c3c36deaa6101a897f527d92a46
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c05982fda39bbfa9fa3641c7e5938f204a8b1bf5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 07:12:16 +00:00
Marc Mutz
398c576037 QPen/QBrush: de-inline compare helper functions
These functions expose implementation details of their respective
class, so, seeing as the classes are pimpl'ed and their op==s are
out-of-line, too, these functions ought to be out-of-line, too.

De-inline them, by calling a private out-of-line helper function. This
way, they can remain unexported and "real" hidden friends (= with an
inline definition).

As drive-by:

- in QBrush/QColor: check the properties in the order of cheapness
  (style(), color(), transform()), and don't copy QTransform just to
  check isIdentity() (access the member directly).

- in QPen/QColor: avoid the QBrush copy (access the member
  directly). This also retroactively endorses the noexcept on this
  function.

- in QPen/PenStyle: amend the comment that says it's allocating with a
  `// ### optimize`

Amends f0186862e16128343705abd0de5994e8ca05a909.

Found in API-review.

Change-Id: Ibfd43b1f2200ef030d6739dad1bf026cc190606b
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d769ca41fc11e1af81e4cdf7cacb3884f98b108c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 07:12:15 +00:00
Thiago Macieira
042e713cb7 QTest: fix bug dereferencing nullptr in toString<std::nullptr_t>()
Amends commit 0756cc1eae5fd8981983319fef1d084762a67b8d.

The generic instantiation of this function had a std::nullptr_t *
parameter, but callers had special code to pass a nullptr there because
we never needed a value of a nullptr (it's always a null pointer). For
example, in compare_ptr_helper():

        auto lhsFormatter = Internal::pointerToString<QObject>;
        auto rhsFormatter = Internal::genericToString<std::nullptr_t>;
        return compare_helper(t1 == nullptr, "Compared QObject pointers are not the same",
                              const_cast<const QObject *>(t1), nullptr,
                              lhsFormatter, rhsFormatter, actual, expected, file, line);

But in debug mode, some compilers did emit a load from this memory
location, causing a crash. So we just specialize this function to avoid
such.

We had a test for this... except it was never reached because the
earlier QCOMPARE() had already failed. For the test, this amends
commit ae021882330abc5f6fbaadca290e6e5670c89028.

Fixes: QTBUG-133330
Pick-to: 6.8
Change-Id: I2cd3bb475788431c6a0dfffd28e730e8b613e033
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit e19b633c468123526660b40ae110f46090682c76)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 23:57:18 +00:00
Assam Boudjelthia
f3c839ecc4 Android: add note about using qt_add_android_permission()
Change-Id: Ie8d48ce1460b6f7fe4023f204be8fd2511cabe4d
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 91d86e4f7a58cc2f3071234e42848928a4aea45c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 23:14:53 +00:00
Assam Boudjelthia
e48aac4ec6 Android: add note on using custom AndroidManifest.xml for permissions
Setting permissions manually require the user to point to the manually
managed AndroidManifest.xml file.

Pick-to: 6.8
Change-Id: Iae289ad32a12f869a5a0ec0261bc3e771d94a15d
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 40e18c7c7e3afd8dacf22879ec1bc442ecbd9877)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 23:14:46 +00:00
Alexandru Croitor
3f2698ce36 coin: Enable git cloning
Cloning the git sources will:
- allow embedding the git sha1 into the SBOM generated by the build
system
- ease development process in CI VMs when investigating issues.

This will slightly slow down the CI build phase by a minute or two.

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTQAINFRA-6520
Change-Id: If554ed0fedca26ff77d04752288ee8497bc4b9ce
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 5717a4fd4a3fd2ba530a7eb4812ce2a5c34515cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 21:32:52 +00:00
Edward Welbourne
8c93587612 Rework QLocale::uiLanguages()'s order
On back-porting commit 7f9ee43de783105d8de0a0b614751eec639131f8 to
6.8, I worked out how to move the maximal version of each locale ID to
the front, while keeping it after a shorter ID that can't be derived
from it. Forward-port a refactored (and more systematic) version of
those changes now to dev (and thus 6.9) so that we get reasonable
compatibility between versions (albeit with 6.8 still lacking
truncated forms, since its QTranslator takes care of those).

This, however, brought to light a problem in the subsequent addition
and insertion of truncations. Since non-equivalent truncations of the
maximal version may (and often do) use the same script, they match
equivalents that are now later than the maximal one, which caused all
truncations to be appended, where some should be inserted just after
the equivalents. Furthermore, had the truncations of the maximal one
been inserted, they'd have appeared just after it, before some of its
equivalents, where it should be after. Reworked the handling of
truncations to take account of the fact that entries come in blocks of
equivalent forms; any truncations inserted instead of appended should
be inserted after this block, not between its members.

Adapt tests to match. As a "drive-by", shuffle some Punjabi tests so
that the comment that applies to two of them is followed by those two.

Task-number: QTBUG-131894
Change-Id: I67ea21cf279e8a3b2e8413c27ac0fa5dfabdaca7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b6122866962880251fa8a82856d1fb9db43900d6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 21:23:48 +00:00
Marc Mutz
6067b27071 QPainterStateGuard: also check for nullptr painter in save(), restore()
The ctor refuses to be called with a nullptr painter, but a moved-from
QPainterStateGuard object _will_ have a nullptr painter. An assert
gives a slightly nicer error message than "nullptr deref".

Extract Method verifyPainter() to not litter the executable with
string literals for every one of the these functions (some compilers
don't use the leeway extended to them by the standard to fold duplicate
string literals).

Found in API-review.

Amends ec3a5f4994a2bafc65fa8e01fb0861219580f622.

Change-Id: I562e6a0ff5a4c8ce86418b998ed78c501441b61a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 5c20f9aa5c31d30a2dccfc617e93c6d6ac0fc96c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 21:23:47 +00:00
Marc Mutz
a546662cd8 QtGuiTest: remove Q_NAMESPACE
There are no Q_ENUM/Q_FLAG/Q_INVOKABLEs defined in it, so drop
Q_NAMESPACE. We can always add it back in when something is added to
it that does require a meta object.

Found in API-review.

Amends 5ac4f04325a56d47812f528fe31ceb0d4932f664.

Change-Id: I8b197f2cd835d1fe4893f2e9608dcaf0ffd14cd9
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 530b2e1fc7d289c12507696137996a02bdbeb439)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 21:18:57 +00:00
Marc Mutz
9120bb9e03 tst_QSet: check whether QSet::removeIf() can modify elements
It can't, pfew. Was wondering for a moment, but of course, even the
QSet::iterator is really a const_iterator.

Pick-to: 6.8 6.5 6.2
Change-Id: I85caa64c1caca6d77569aa2ceb868a4aa0e5578d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Magdalena Stojek <magdalena.stojek@qt.io>
Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io>
(cherry picked from commit a4fd95c51a4347482d6d0a815657d0b5bdaf06db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 21:18:54 +00:00
Marc Mutz
ad014ed702 qpen_p.h: include what you need
In QtCreator, the file lit up like a Christmas tree from all the
undefined types :)

Amends the start of the public history.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: I558ad493a4848e6a28bd37a38f2432c5605e0f43
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 768ab2051765f3825903c449a2f0e2c07e665152)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 21:18:51 +00:00
Alexandru Croitor
004c87ced5 configure.bat: Use call when calling the helper cmake scripts
If an executable has a .bat or .cmd extension, and is executed without
a prepended 'call' command within a batch script, the parent batch
script execution will not continue once the child process has
finished.

Prepending call to the command ensures that the parent batch script
continues execution.

This changes ensures that configuration succeeds for the use case when
cmake is actually a batch script called cmake.bat or cmake.cmd.

We already use 'call' in qt-configure-module, so do it also in
configure.

Pick-to: 6.8
Change-Id: Ia42cb71787e88c850f1cbd1fcef5b6decbdeaabf
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 062a7dc4248904bed51dc87466ec29b407945950)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 21:18:49 +00:00
David Redondo
fb6b0e5c94 QDesktopUnixServices: Fix #endif comment
So it doesn't confuse me or anyone else again

Change-Id: I8ad5d4cb1b00e0edaffa90ed67e30246211e1a97
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 7fcfc3790512b6d467732119330ea886de2a72fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 19:47:38 +00:00
Marc Mutz
6143ae4012 Don't export ~QESDP<QFontVariableAxisPrivate>
It's not needed, cf. QTBUG-128656 and
qtgraphs/6ae7164a5432bc49d7e9688dfd79c20515dd9333.

Found in API-review.

Amends cc128d802c6d9c87a1e00a8a88d5e6590a7195f4.

Change-Id: I3860ea5ac3d17590b1134af40927387f19dea640
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ac5ab8ce32c6bd4122ecc690d30eade5c4f4bf2a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 01:00:37 +00:00
Giuseppe D'Angelo
e4502f3dc1 QProgressBar: prevent integer overflow
If `value` is INT_MAX and `lastPaintedValue` is -1 (the default), the
subtraction will overflow. Extend the arguments to 64 bits. The result
is only used for a double comparison anyhow.

Change-Id: Id4a5396c61da81932ac626b3102e583a74264df4
Pick-to: 6.8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 8e843ddba8de6b9dbe9851856fd4524af5d3c584)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 01:00:36 +00:00
Christian Ehrlicher
b5ff268a3b QMenu: Simplify check for SH_Menu_AllowActiveAndDisabled
The check for SH_Menu_AllowActiveAndDisabled is done in eight places.
Simplify it by added a helper function which checks if an action should
be considered (i.e. is not a separator, is enabled or
SH_Menu_AllowActiveAndDisabled is enabled).

Pick-to: 6.8
Task-number: QTBUG-56952
Change-Id: I65c6dc67b804dd4c5cf463767a525ec6f785bf1a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e0a44cd32ed3884fd665c112a9dfc2bc45a6597d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 01:00:36 +00:00
Giuseppe D'Angelo
df0d74dca4 QDateTime: prevent signed integer overflow
While the code checks for the possibility that leftMillis-rightMillis
may overflow, it fails to take into account that the result may be
minimal ("INT64_MIN", so to speak) and passes it to qAbs, triggering UB
in there. Since it's just a range check and we don't need the result to
be signed, use qUnsignedAbs.

Change-Id: I7f1a4bbc521fdc164ca20fedf0e995359a67ea4d
Pick-to: 6.8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 45e90b73c75b2c7997a0f8d750f9927f64e05a0e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-30 01:00:36 +00:00
Marc Mutz
6ba8e9875a QDuplicateTracker: don't value-initialize the stack buffer
The typical usage of a QDuplicateTracker should be to pass the
guesstimate for the number of entries as a constructor argument, or,
failing that, default-construct the object. In those cases, everything
is peachy:

   QDuplicateTracker<int> seen(n);
   QDuplicateTracker<int> seen;

But for users that subscribe to a AAA view and use

   auto seen = QDuplicateTracker<int>{};

or that emplace() a QDuplicateTracker in e.g. std::optional, we need
to make sure that value-initializing QDuplicateTracker doesn't
value-initialize the internal buffer (which can be several KiB in
size).

So don't = default the default ctor, but implement it as empty.

Amends f21a6d409ea0504c64cd72861fc16b6f3e080086.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: I930f40d2bb85b74d2216378d8b8ca854a53a49e4
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 15154fa4c5d216b1c943a3b37be24f5fb2e4fa73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 18:51:22 +00:00
Edward Welbourne
9df9412335 Update testlib's copy of Linux's perf_event_p.h header
This isn't strictly necessary, as it doesn't affect anything we use
the header for, but it brings us back in sync so future updates don't
involve as many changes to review. Document why we amend the upstream
SPDX identifier (to a non-deprecated equivalent).

[ChangeLog][Third-Party Code][QtTest] The perf_event_p.h from Linux is
updated to match Linux kernel 6.13.

Pick-to: 6.8
Task-number: QTBUG-132871
Change-Id: I101734b743f6689ca64054008455b98e4f6b827c
Reviewed-by: Lucie Gerard <lucie.gerard@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 019d2e5974326cac1803bb860f280c1b8fd104c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 18:51:22 +00:00
Edward Welbourne
8146816342 Skip zone naming with no CLDR data
In the git version of CLDR v46.1, Acre's metazone inherits a generic
long name. However, root provides no metazone data for it to inherit.
So we ended up with an empty entry for Acre in the QlocaleXML file.
Harmless, but easy to avoid, so avoid it.

Pick-to: 6.8
Task-number: QTBUG-132851
Change-Id: I392d0922bebff731632e729a4931caa02dc3a404
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit b60be8c14d9f39358d00ef06a8ea5562fba17d98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 18:51:22 +00:00
Joni Poikelin
54ed658919 android: Fix file dialog name filter matching for extensions with numbers
Pick-to: 6.8 6.5
Task-number: QTBUG-114957
Change-Id: I8e9ff3b9c7ad3fe8442caa49f6ad0bb6449bb9e9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit e445067507d8002b51d85e7c51a600525fead8b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 18:51:21 +00:00
Tinja Paavoseppä
e0529535ca Android: Update Activity reference to C++ when set
There already exists a method to do this, but seems at some point
calling it has been dropped. Add a call to update the native
reference whenever the reference in Java gets updated.

Task-number: QTBUG-130614
Change-Id: If9654b504c88340feff2432973f8f9f2eaffa272
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit acd331cd15785dda444b1a34f343a42c6b3c89fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 18:51:21 +00:00
Morten Sørvig
55148eb94d wasm: don't give native focus to non-focus windows
isActive() may return true if a (transient) parent window
is active (has focus).

Compare against QGuiApplication::focusWindow() instead.

Fixes: QTBUG-129233
Pick-to: 6.8
Change-Id: I834a5814a5db161bdea2ba3524d1010e0c0e3e6e
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
(cherry picked from commit 31762e2e704673057a292ac59977b501919f2450)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 14:04:33 +00:00
Giuseppe D'Angelo
b50f026c55 QTextStream: fix UB calls to qAbs() with minimal arguments
QTextStream's operator<<(number) uses qAbs to extract the "absolute
value" of number, and passes that and the number's sign to an internal
formatting function. However qAbs is unsuitable for the task, because it
will fail if `number` is minimal, as it returns the same type of
its input.

Since we can afford to change the type of the result, call the private
qUnsignedAbs() function instead.

Change-Id: Ib813a199503f2d07c78bb76862ab2e15d68d0ec2
Pick-to: 6.8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8f762b546fe6b2254029c4804a32d9ae6bbf4495)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 12:59:21 +00:00
Joni Poikelin
0479ef1c1c Fix crash cases where window container tries to touch destroyed window
Fixes: QTBUG-133289
Pick-to: 6.8 6.5
Change-Id: I4b5a6ab12c32133d633e1bf11567119d52c1cb5a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9940f3f280473856858afafc6a4a4feab48c653f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 11:30:03 +00:00
Jøger Hansegård
9f1893855b QTest: Reset repeat counter for each call to QTest::qRun()
This fix ensures that each call to QTest::qRun() runs all tests the
requested number of repetitions.

This fixes an issue where QTEST_QUICKCONTROLS_MAIN would only test the
first style, and skip remaining styles. The cause was that the repeat
counter was not reset between QTest::qRun() calls. Subsequent calls to
QTest::qRun() would therefore not run any tests.

Amends: 80a14c86b2739492d7f7fbdb1cbde1da85d1341d

Fixes: QTBUG-133207
Pick-to: 6.8 6.7
Change-Id: Idb164fd01ac0b8e04e5dd74c3625f2c343f742c5
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 07318c81a700b4d4a46c81ae2e4f17c6b1e501c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 11:30:03 +00:00
Christian Ehrlicher
1a6b177ec7 SQL/PSQL: use a QByteArray for preparedStmtId
... instead a QString as it gets converted to an utf-8 string anyway to
avoid this conversion.

Task-number: QTBUG-132303
Change-Id: I3fcf721f9fd0d1dd181af262663fddd532262ee3
Reviewed-by: Thierry Bastian <thierryb@filewave.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 892a020cc3ad7e3d5cdcb38d26091343e78695da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 08:17:04 +00:00
Thiago Macieira
d5c5f9f352 QSystemLocale: bail out if accessed post-destruction
There's little we can do, but a lot of content ends up in QLocale very
late in the execution. Let's at least not crash.

Task-number: QTBUG-133206
Pick-to: 6.8
Change-Id: I77d41141cb115147f9befffdd5e69dac19c96044
Reviewed-by: Albert Astals Cid <aacid@kde.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e32f28034ad2383393645777bcd96eab3f696076)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 08:17:02 +00:00
Giuseppe D'Angelo
ad867197cf QNumeric: add a private qUnsignedAbs
Checking qAbs preconditions reveals that several places into Qt are
calling it with minimal values, causing UB. Those places do not actually
need that the absolute value is of the same type as the parameter.
Therefore, introduce qUnsignedAbs, which is like qAbs() but whose return
type is always unsigned, and therefore can accept everything.

This function is private; I don't want to encourage users to rely on our
extension.

Aggressively cherry picking because this will be needed in subsequent
bugfixes.

Change-Id: I2047768a5fd35f12bf898ca8c2008813434edd8d
Pick-to: 6.8 6.5 6.2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 83c812e1322a2b004bc604be3e6f61fb83246eb0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 05:36:59 +00:00
Marc Mutz
176f9f6ce2 Give LegacyUncomparable::Unordered's value a symbolic name
We'll need it higher up in the file, but we don't want to/can't move
code around, so make -127 a symbolic constant.

Amends 39c7bf4631b401c681c24bb5a732a0359c8a6d7c, which, however,
merely moved the code around.

Pick-to: 6.8
Change-Id: Id6f2d51e5678b3bad7ae658cc3e38fd3909861d7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 57aabff91eed41fb7ba0cf67df4fe7767c6e0e43)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 05:21:26 +00:00
Marc Mutz
36f091f65d QBasicMutex::destroyInternal(): avoid clazy warning about returning void
Says Clazy:

   removed_api.cpp:1291:5: Returning a void expression [clazy-returning-void-expression]

Just drop the return keyword.

Amends bc080a909b8bb67c1fb23afca69682ba86cdf526.

Change-Id: Iccbc343f2dd72a7c75da5e703e8e0722a0c50f31
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 875aaa39a28dfe9c26f1416f3e16758540b17a27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-29 02:00:35 +00:00
Michael Weghorn
bd1cb1547f a11y atspi: Report app parent
While the application's a11y object doesn't have a parent
within Qt's a11y hierarchy, the AT-SPI registry/desktop is the
parent of all application objects.

Therefore, report that one instead of using a null path.

With that in place, querying the application parent
via Accerciser's IPython console now gives the expected
result:

    In [16]: acc.role
    Out[16]: <enum ATSPI_ROLE_APPLICATION of type Atspi.Role>
    In [17]: acc.parent
    Out[17]: <Atspi.Accessible object at 0x7fbebc3fc1c0 (AtspiAccessible at 0x139d6410)>
    In [18]: acc.parent.role
    Out[18]: <enum ATSPI_ROLE_DESKTOP_FRAME of type Atspi.Role>

While at it, also add a "m_" prefix for the
AtspiAdaptor::accessibilityRegistry member.

Fixes: QTBUG-132935
Change-Id: I0e174f73c837b233fe4d5788d1c375b404000025
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit befce757faa0b0abd2c1f4ec408c1a0932794b0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 22:47:27 +00:00
Friedemann Kleint
4924480944 Notepad example: Use theme icons
Pick-to: 6.8
Change-Id: Id915ecbf218d419b972ff97637673827facf84a2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ead6f79dc015aa8e7c152fac315d0426967c0c7e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 19:35:30 +00:00
Tim Blechmann
e00b3bfc86 Platform: unix - avoid modifying the environment
Modifying the process environment can cause crashes in application code
that accesses the environment via non-qt functions on worker threads.
When launching a process, we can avoid modifying the environment of the
caller by using QProcess with setEnvironment. The codepaths without
QProcess support is still prone to these issues and could potentially be
improved via execve

Task-number: QTBUG-129222
Pick-to: 6.8
Change-Id: I4e2d93abaa0e392b341041faaae0ffd11e225bcb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 673400679dca23840174c9882cea5b796b52b2f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 17:40:44 +00:00
Giuseppe D'Angelo
8ef6d4ede8 tst_QGestureRecognizer: do not leak the point device
QTest::createTouchDevice() passes ownership of the device to the caller,
so make sure to delete it.

Change-Id: I100d3de9eab8ec9f88ed3e0850ada9d988bd962e
Pick-to: 6.8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 28d0e658e297b5de52fb0cccaede08179c7f4b8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 16:25:58 +00:00
Giuseppe D'Angelo
8232c837b0 QDebug: do not trigger integer overflow when printing a QRect
QRect::width() and height() may overflow: they're only safe to call
when right-left+1 (or bottom-top+1) is representable by an `int`.
Therefore, avoiding calling them from QDebug, which is supposed to
"always work" (otherwise, it's not of great debugging help...).

QRectF does not have this issue as it stores the width directly.

Change-Id: I438dbacae42c17730afb92f05d16e3eebb161255
Pick-to: 6.8 6.5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0f336500a0add3e3a8bb31c5cc605e5e13e23833)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 16:12:57 +00:00
Volker Hilsheimer
abf6c88a86 JNI: Extract size check from fromContainer
Addresses header review comment.

Change-Id: I302ae22da197fa8c317f0a4749d15b07fb5d0078
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b5538a5a0ebf9bd9a155b857c385c764c30eabae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 16:12:56 +00:00
Thierry Bastian
779e5faf1d SQL/PSQL: slight improvement in code
added a details about code paths that cannot happen and added constexpr

Fixes: QTBUG-132303
Change-Id: I98340c5a1f275c00aafb3294cf8e5e8368126b76
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit e574cda7fc3f6be5a81489d8d9cdb859625d4e88)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 15:26:30 +00:00
Aurélien Brooke
d7736416e8 rhi: be more verbose in QRhiTexture::Format enum documentation
Add missing [since], explicit total size and fix spelling.

https://doc.qt.io/qt-6/10-qdoc-commands-tablesandlists.html#value

Change-Id: I6934944ef4be119ae2934b986c7840d4d1eeea67
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 61dbdbeb3141c392657a75476c1cf1474020583a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 11:37:31 +00:00
Kai Köhne
66ed40dfe4 Doc: Fix link to RFC 8259
Fixes qdoc warning
    corelib/doc/src/json.qdoc:22: (qdoc) warning: Can't link to 'RFC 8259'

Amends 65fda988e92e

Change-Id: I62c1cf05366cd13180d21d7b4cbf68c0c0f48e1d
Reviewed-by: Johannes Grunenberg <nerixdev@outlook.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a4d3a82244ab292c7a906fc19052e8b9d00b0f7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 11:37:31 +00:00
Piotr Wierciński
65a8c2e421 wasm: Update Emscripten to 3.1.70
Change-Id: Id502e6ffa6ee7ef3b000d8e43f112dfb882fe354
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 66b63668212aab585a84929765484393621651ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 11:37:31 +00:00
Thierry Bastian
79f96014d1 SQL/PSQL: Avoid copies of data in QByteArray when binding such a value
Fixes: QTBUG-132303
Change-Id: I84e822078d684850c5c0384338cfa4c01fe5007f
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit f346a6065d36cda4ceacce03962ba58a7cf91019)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 11:37:31 +00:00
Laszlo Agocs
33d74f3f58 rhi: gl: Honor deafultFbo from the QOpenGLContext better
The legacy infrastructure does not map very well to the modern one:
it turns out that, somewhat counterintuitively, targeting a
QRhiSwapChain for a QWindow may still mean rendering into a texture,
when using OpenGL on certain platforms.

For example, the Wayland platform plugin implements client-side
decorations by binding an FBO upon making a context current on a
surface for a (decorated) window, and it also makes
defaultFramebufferObject() on the context return the FBO id.

The expectation is that this is why errors such as
GL_INVALID_OPERATION are encountered in glDrawBuffers on Linux.

The QRhi GL backend's assumption that the QRhiRenderTarget being
a QRhiResource::SwapChainRenderTarget implies that the target
really is the color buffer(s) of a window surface is not in practice
sufficient on these platforms.

The bound FBO was already correct always (whatever defaultFbo reports),
but the code path hit was the wrong one. And there is different code
for MRT support (textures only) and stereo rendering (window surface
only).

Make sure defaultFbo() is queried before taking the decision which path
to hit.

Pick-to: 6.8
Fixes: QTBUG-122819
Fixes: QTBUG-132780
Change-Id: Iaaab57b031f430178ee4611a4f7a02c854010441
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 3869106cc5914fb4a8eda30ae1bd5f68dcee2fda)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 07:30:17 +00:00
Laszlo Agocs
b96994c9eb rhi: vulkan: Simplify frame sync
imageFence seems to have no purpose. And some of the
comments seem to be out of date / misleading.

More importantly, do the command buffer completion wait
before the acquireNextImage. Otherwise frame.imageSem
may have wait operations pending if the queueSubmit
did not get to wait on it yet. The expectation is that
this potential issue is what triggers the recent
validation layer releases' enhanced synchronization
checkers.

Pick-to: 6.8
Fixes: QTBUG-132808
Change-Id: Ib8e3884ccea343f5a839aa2ee17cd358fafeac69
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 24d62ffd720b5bec5d07b07b8d2c9dda7635f3c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 07:30:08 +00:00
Thiago Macieira
c4eacb70fd QFileSystemEngine/Darwin: remove use of clonefile() on Apple systems
Because we called this before opening the target file, we did not check
that the destination file engine is the QFSFileEngine, and therefore we
may have passed a path that referred to a Qt resource path. We still do
that on Windows, but Qt resource paths start with a ':' character and
that is not allowed on Windows, so the Win32 CopyFile() function fails.

Moreover, this function *can* clone directory trees, which we don't want
to happen because it doesn't happen on other OSes. Instead, fall back to
the fcopyfile() call in cloneFile(). It will still do cloning where
permitted.

This was added in commit db0064b767474a89bc72ea4374f477682983c5f4,
before the fcopyfile() in 974b3adf8a099ca95fc2eabfc434038ce73f62c8,
though both were for Qt 5.10.

[ChangeLog][QtCore][QFile] Fixed a bug on Apple systems that would cause
copy() to copy a directory if the QFile pointed to a directory and the
destination was in the same volume. Now copy()'s behavior is the same as
in other OSes: directories are never copied.

[ChangeLog][QtCore][QFile] Fixed a bug on Apple systems that allowed
copy() to create a file with the name that referred to a Qt resource
path, if one tried to copy to that path. Qt resource paths can't be
modified using QFile.

Change-Id: I996368f4c656ff10ff5efffd5b47c6ddde34fd10
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 45886e6a81016c5c9212fffb5c0a83fd2431223e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 05:29:13 +00:00
Eskil Abrahamsen Blomfeldt
8d791bfb30 Port Freetype engine to COLR paint graph renderer
Use the cross-platform renderer code in Freetype as well as
DirectWrite to share as much code as possible.

Change-Id: I643dced6b913138890b39eafc3984cca5ced0aae
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit d58ad990e227fecf5526df1a89736afc0c9268fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 01:34:33 +00:00
Eskil Abrahamsen Blomfeldt
0c4b517e6e DirectWrite: Implement support for COLRv1
This traverses the paint node graph and renders
the emoji through a generic renderer. This renderer
is largely based on the renderer in the FreeType
backend and will be used there as well in a follow-up
patch.

Fixes: QTBUG-113458
Change-Id: I44d17b0be8d85e38589edeb68793bf4ee4491eca
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 9f22a51987614ce51b3c12ced420bc4ca5b1ec61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 01:34:26 +00:00
Joerg Bornemann
e50ae83c8c CMake: Fix examples built as external projects
Usage of a private module needs a respective find_package call now.

Task-number: QTBUG-87776
Change-Id: I3a00a241c5e8637d28606c1f45a843b491c0a8bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 483768fb8ed18fe5911d96f990ddbc69858146bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:51 +00:00
Doris Verria
83226ed3d0 QWindowContainer: Improve docs to mention new change in behavior
Specify that since 6.8 tab focus can transfer in and out of the
embedded window if using a Qt Quick based window.

Pick-to: 6.8
Change-Id: I21d04457ee79497431f889e261f1cb6bd9fd39ee
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 059210b17e50fd7c45af4ca0631ddcf8dd7c67f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:50 +00:00
Thiago Macieira
bcc0e6124a QLocale: try to survive being created during application shut down
QLocale is very often accessed during global static destructors, so
let's try and survive if the default has already been destroyed. In that
case, we shall fall back to the C locale.

I've placed the call to systemData(), which updates the system locale,
before the initialization of defaultLocalePrivate, as the initialization
of the latter depends on the former.

Task-number: QTBUG-133206
Pick-to: 6.8
Change-Id: I48e29b45f9be4514336cfffdf5affa5631a956a3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Albert Astals Cid <aacid@kde.org>
(cherry picked from commit e0a1f491567f2495443babc5aa36a038260f96c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:50 +00:00
Eskil Abrahamsen Blomfeldt
4bff9e3582 DirectWrite: Support embedded PNGs in color fonts
This does some refactoring on the color font support in
the DirectWrite backend and introduces support for loading
embedded PNGs from the font.

This gives us support for CBDT and SBIX fonts, which are both
based on embedding image files.

[ChangeLog][Windows] Added support for color font formats with
embedded pixmaps in DirectWrite backend.

Task-number: QTBUG-113458
Change-Id: I695901b62600c37619c80aa915f60de13a4fca3f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 1b85143d217042876209794bf8d0361b7ce8834f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:50 +00:00
Morteza Jamshidi
34167f6622 Change window activation order if active window is moved
Active window should always be in front of the stack so bring it to the
front of the stack if it's not.

Pick-to: 6.8
Fixes: QTBUG-112758
Change-Id: Iff123d1e95f728f51b786106d83a429c111aa6a8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit e6e210c2406e8d4cfe67543871af5fe14a2bda82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:50 +00:00
Lucie Gérard
3e0276990d Make module ready for source SBOM checking
This includes:
- turning VERIFY_SOURCE_SBOM ON
- adding exception to the licenseRule.json files
- correcting the licensing given via REUSE.toml files
- renaming license files not located in LICENSES folder.
They need to be named LICENSE. to be ignored by reuse and
excluded from the source SBOM. The name are updated in the
corresponding qt_attribution.json

A lot of files are skipped during the license test,
but all are present in the source SBOM.
This is why  correction are needed before turning the
source SBOM check on.

[ChangeLog][Third-Party Code] Renaming the license files with prefix
LICENSE. to have them ignored by reuse tool.

Task-number: QTBUG-131434
Change-Id: Iab517215bb10a17357d2d2436bba8d3af76e5cd1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 7cb90e15631a9e6f12469a7ca8c070781c4aafc2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:50 +00:00
Lucie Gérard
01e5801cec Add calling license check on generated source SBOM
The license check is only called if VERIFY_SOURCE_SBOM is set to ON
in the module_config.yaml. This way, a module can turn on the check
only when ready.

The license check is done via a perl script. Since no perl is
available for Windows on ARM64, VERIFY_SOURCE_SBOM is set to OFF
in this case.

Task-number: QTBUG-131434
Change-Id: I183b7726928bbc925940330d39779a4ac2307254
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 153002f7d2904988efdd8abc68adff0f9927943b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:50 +00:00
Assam Boudjelthia
e60b493c2e Android: update to Gradle 8.12 and AGP 8.8.0
Update to latest versions for Gradle:
* Gradle 8.10 -> 8.12
* Android Gradle Plugin 8.6.0 -> 8.8.0.

[ChangeLog][Third-Party Code] Updated Gradle to 8.12 and AGP to 8.8.0.

Fixes: QTBUG-132852
Task-number: QTBUG-132851
Change-Id: I9445f0cd7347a6ee153a987ea28ab617b9cb6055
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Olli Vuolteenaho <olli.vuolteenaho@qt.io>
(cherry picked from commit 0e4f9ffa55c2b77fbe79e96362bc68a968982b48)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 17:44:41 +00:00
Kai Köhne
87dc466e29 Doc: Update external link to freedesktop.org trash specification
Old link gives a 404

Change-Id: I3e528a29a6ed2d0d97c3fcf1cf11c441a2882415
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
(cherry picked from commit ccc99bcf8bd48e6c01e5db7fd094dc064bbd72f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 17:44:40 +00:00
Giuseppe D'Angelo
cbdd2d7353 QRhiVulkan: disable -Wundef when including 3rd party headers
The header is -Wundef-unclean.

Change-Id: I30145f331ee1062961abaed14c7b79b84755abb9
Pick-to: 6.8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 349737c6a94a4628c262776b0b8a08bf24d46363)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 17:44:38 +00:00
Christian Ehrlicher
0f744e6b2b SQL/PSQL: call deallocatePreparedStmt() unconditionally
deallocatePreparedStmt() knows by itself when to call the psql cleanup
routines or not. No need to have this logic outside this function.

Task-number: QTBUG-132303
Change-Id: Ib1a5ba7b53c156f6a6b93f23a3ec8c851d7398fc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Thierry Bastian <thierryb@filewave.com>
(cherry picked from commit 9094ad18b0d909f7490dec3451ec7ef9c312f42a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 17:44:36 +00:00
Joerg Bornemann
7782f2ad14 CMake: Don't enforce find_package(Qt6FooPrivate) for Qt 6.9
Requiring users to do find_package(Qt6FooPrivate) to use private modules
turned out to be a too invasive change for Qt 6.9. We turn off this
behavior and restrict it to the dev branch.

[ChangeLog][CMake] The requirement to do find_package(Qt6FooPrivate) in
user projects was postponed to a later Qt version.

Task-number: QTBUG-87776
Change-Id: Ifbf676288587ae5fabe100bf3bd93b220ddbc5ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-01-27 18:33:03 +01:00
Alexandru Croitor
54cb92d58b CMake: Provide a way to find all available Qt module packages
A project might want to find_package all available (installed) Qt CMake
packages that contain qt modules.

A use case might be a qml app that needs to link to all of Qt, and
support showing qml files that can load any Qt qml module.

Add a new Qt6 COMPONENT called ALL_QT_MODULES.

It can be used like this:
  find_package(Qt6 COMPONENTS ALL_QT_MODULES).

The implementation will find all installed Qt modules by globbing over
all json files installed in $qt/modules dir, and treat the file names
as package names.

It will then tell Qt6 to find_package each of those packages.

Pick-to: 6.8
Change-Id: I89242307438576a0cbb3cdca80a9cb72818b6035
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit c7027880aa746a01362ac12491910479d7fc67e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 16:37:03 +00:00
Alexandru Croitor
31c8031847 CMake: Collect all known qml plugin targets into a directory variable
Just like we do with qt plugins, collect all found qml plugin targets
into two new directory scoped variables:
- QT_ALL_QML_PLUGINS_FOUND_VIA_FIND_PACKAGE
- QT_ALL_QML_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE

The plugin target names are derived from the Config.cmake file names,
based on the existing assumption that qt_internal_add_plugin always
uses the target name when generating the Config.cmake file.

Pick-to: 6.8
Change-Id: I78c76488e133fb3c0374cbc149425726077f6c31
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit bf83fffd13c176391d353080cd76bc68ae7ea184)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 16:36:57 +00:00
Alexandru Croitor
4661694382 CMake: Move qml plugin auto inclusion code into a separate macro
The code is moved into a macro without any modifications aside from
removing the escaping of variable evaluation and escaping of quotes.

It's kept as a macro similar to __qt_internal_include_plugin_packages,
because there might be calls to find_package() that set variables in
the current scope.

The reason for moving is easier maintenance (no more escaping).

Pick-to: 6.8
Change-Id: Ie6ddc26fe4ff8db0134f3542c2886f8b5d68dc51
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 47006aca44c16c78f00940574170640f19e9fb43)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 16:36:51 +00:00
Alexandru Croitor
93f52f7980 CMake: Set versioned variables with found modules, plugins, types
Introduce two new directory-scoped variables containing versioned
(prefixed with Qt6::) target names of qt modules and qt plugins found
as a result of finding Qt packages:
- QT_ALL_MODULES_VERSIONED_FOUND_VIA_FIND_PACKAGE
- QT_ALL_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE

To be consistent in the naming of the variables going forward,
deprecate the old QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE variable
in favor of a new QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE.
The difference is 'BY' vs 'VIA'.

The non-versioned variables are modified not to contain duplicates:
- QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE
- QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE

Also remove duplicates from the variable that collects all found qt
plugin types:
- QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE

A follow-up change will collect qml plugin targets.

This information can be useful to find out what Qt targets are
available in a project, for example to know what plugin targets or
types can be linked into another target, or which libraries can be
deployed.

Pick-to: 6.8
Change-Id: I4f158872f4a8f6ef6008f081270604f75b77ad9d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit f7b8ff71778bde94741402216269c2de2dda32c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 16:36:45 +00:00
Soheil Armin
74c455c8bb Android: Incorporate QAbstractItemModelTester into QtAIM CI Tests
QAbstractItemModelTester performs non-destructive tests on test models.
It helps with catching the most common errors in the test model.

Task-number: QTBUG-132880
Change-Id: I719f4223d84e66c1d94cbd0380bfdb77b07da7b6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b751a12f7af533049ff46c6a63bd12eb6082415a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 08:06:46 +00:00
Soheil Armin
d25e08afc2 Android: Make use of ItemDataRole in QtAIM tests
Previously we were using raw zero-based integer values
for roles in QtAbstractItemModel tests.

Roles starting from 0x0 to 0xFF are reserved for pre-defined roles
defined in Qt::ItemDataRole enum.

This change will change the base role value to Qt::UserRole.
It will later help us to use QAbstractItemModelTester as this
tester class expects certain types from pre-defined role values.

Task-number: QTBUG-132880
Change-Id: Ie19739cd7bf49829fe58f5ad53078942d47a433b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 967d9b8cf200163b25a3c1a3b3d79a107f9073b2)
2025-01-27 08:06:40 +00:00
Tor Arne Vestbø
abbbfa27bd Don't pass along expose events for destroying QWidgets
When closing a popup window on macOS, and the NSView needs display,
for example due to the frame geometry having changed, the system will
ask our NSView to display one last frame, via NSOrderOutAnimationProxyWindow
initWithSnapshotOfWindow.

If this happens during the close() that the QWidget destructor does,
we no longer have a QWidget subclass to handle the corresponding paint
event, so we'll end up flushing an empty frame, using that for the
animation transition instead of the last valid frame of the widget.

Worse, if the top level is using RHI to flush, the texture list
might be stale, as there is currently no plumbing for a widget to
tell QWidgetRepaintManager about it deleting a texture that was
previously picked up and placed in the QPlatformTextureList. When
this happens we end up crashing on dereferencing the stale texture.

To mitigate these issues we now skip the expose event if the widget
is already in ~QWidget. This potentially means the close animation
will use a stale frame, but we can live with that.

Pick-to: 6.8 6.5
Change-Id: Iabe1d97019923ee3a1a86039630095d00c966156
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9509434ecb4a11409d8c2bea9c010b40f8f7894d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-26 21:23:36 +00:00
Tor Arne Vestbø
ccbf28a56c Don't assume QDockWidgetGroupWindow has toolbars
As part of 3d99f90b50ab22ef5ab4433c57f9ee584a0a7cae we added logic
to look up the toolbar for a QMainWindowLayoutSeparatorHelper. In
the case of QDockWidgetGroupWindow the logic was broken, as it was
casting the layout's parentWidget(), the group window, to a QMainWindow,
instead of using the group window's parent.

However for QDockWidgetGroupWindow we shouldn't look for a toolbar
at all, as QDockWidgetGroupWindow can't have a toolbar. Using the
parent main window's toolbar is wrong, as mouse events for that
window will not affect mouse events for the group window, so the
bug in 3d99f90b50ab22ef5ab4433c57f9ee584a0a7cae is not triggered.

Fixes: QTBUG-132952
Pick-to: 6.8 6.5
Change-Id: Ic7845254e05bc358a39f79ec7622029d90173b45
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 81ed068a510421e6204193ec37448a628324543d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-26 21:23:31 +00:00
Timur Pocheptsov
2d819c7027 QTestLib: Add helper function to check for keychain access issues
To be used in network-related tests where we potentially are
using private/public keys and (on macOS) end-up with keychain
access blocking a test with dialogs requesting a permission
to access the keychain.

Task-number: QTBUG-132645
Pick-to: 6.8
Change-Id: Ide74633bf88b0453d5d8f8de56282c8cf8207380
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 13109ba350686cd8ce8e298db5d76d0e7c209bd1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:12 +00:00
Alexandru Croitor
940fc15ec1 CMake: Allow skipping some parts of SBOM generation
Makes it easier to debug diffs of SBOMs, due to lower amount of
content in generated files.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I5a1e8a9868cda199de4a7344b86a12f68fec31bf
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 3c516ffa8739a6d8729780138f07a6bea7cfea8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:12 +00:00
Alexandru Croitor
fe3b0212ea CMake: Add SUPPLIER as an option to SBOM packages
Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I22cae71dcc7582126320e17271a8c55bea1ad393
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2857d8d5eaaddde3e3cff916d5ad4b3c93a9b760)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:12 +00:00
Marc Mutz
760688cc75 tst_QUuid: fix -Wreturn-type in make_minimal(QUuid::Version)
The code relies on -Wswitch, but lacked the Q_UNREACHABLE_RETURN() at
the end that compiler and code readers need to understand that we don't
accept values other than those enumerated, even though an enum variable
could hold other values, too.

Since the function is constexpr, can't use that macro directly, but
need to copy the usual GCC 8 magic incantation.

Amends 171ff57be1b8fd1c1b33cffbffa389790f239b5c.

Pick-to: 6.8
Change-Id: I6c9dd0e4178211f57da61aa6df70f8036370f158
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 420ca3463ee8adf2d986af5802d8da4bb24ce14d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:12 +00:00
Alexandru Croitor
dcfd35f43b CMake: Add qt exported target name and package name into SBOM
Add them to the PackageComment field of the SBOM.
Can be useful to map back the SPDX Package to the CMake target or
package.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Icbbb90132038c489b55c4ee7a038aea593ce1ff6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0be13fb6994feade6777a17cc405d9b2f32f2aa3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:11 +00:00
Andreas Eliasson
83cd96307f Doc: Fix method docs for QOpenGLTexture::setWrapMode
The current method description seems like a copy-paste left-over.

Fixes: QTBUG-57209
Pick-to: 6.8 6.7 6.5 6.2 5.15
Change-Id: Ife9f9f7bc97d990f5d447208bd39c2d2b6a614fd
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 9182f60b455cead33c0f4fd4e452b210e2de0fca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:11 +00:00
Alexandru Croitor
db841d4afe CMake: Add a fake deterministic SBOM generation option
Replaces content like timestamps, version strings and checksums with
constant values to make the SBOM generation deterministic.
This is useful for reproducible builds, to allow cleaner inter-diffs
while developing new SBOM features.

Can be enabled by configuring with
-DQT_SBOM_FAKE_DETERMINISTIC_BUILD=ON

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Id0003bdd23fe57abd70213a2a108885861693242
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit d2dea0bc08036925cb93c226af19aeb896926309)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:11 +00:00
Alexandru Croitor
477972b3e0 CMake: Prepend underscore to qt_internal_sbom_set_default_option_value
Because it's in a Public cmake file.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: If3f92af848193cb824b88e93e17965ffed93cf2b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4be604c55e3cf493f883a7df484940c9a1244a97)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:11 +00:00
Wladimir Leuschner
6a6a1c0fe2 QWindows11Style: Reduce groove size of QSlider
Reduce the groove size of QSlider when using Windows11Style, so that the
minimum selectable value does appear so.

Fixes: QTBUG-133128
Pick-to: 6.8
Change-Id: I3e5a5378e2eace3920c06db8cb1198122c0937b5
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit dee731ae981eb4f41f4b00be80f75c7a0a5c0e11)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:10 +00:00
Alexandru Croitor
3d4501bea7 CMake: Remove qt executable SBOM generation stale code
We never ended up calling _qt_internal_finalize_sbom for generic Qt
repo executables, and we never passed an SBOM type, so this code never
worked.

Remove it to avoid confusion.
It might be re-added in the future.
This doesn't affect the SBOM generation for Qt tools and apps.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Iffde964efe2a6b70e6e0b64ec0803af5e84172fb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit f2472c2e6a5b93dfbda166582620c30ea8855edb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:10 +00:00
Alexandru Croitor
69b7c311f3 CMake: Fix SBOM inline comment
Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I53696003b144ad628169a345743e343cdfc022ae
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ffe972d72c3e577723b3a74eef098e381261c4d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:10 +00:00
Fabian Kosmale
6e35353c83 _qt_internal_process_resource: Properly escape XML
XML requires escaping for certain characters, and we need to consider
this when writing out qrc files (which use XML).

This commit introduces a helper function,
_qt_internal_escape_xml_characters, to take care of the escaping.
It uses regular expressions to process the input strings. We take care
to start with '&', as '&' needs to be escaped, too.

We minimize the amount of escaping we're doing (the exact rules
differing between attributes and text), to avoid unnecessary work that
needs to be done when configuring a project. This is achieved by a
SUBSET option which can be passed to _qt_internal_escape_xml_characters.

Pick-to: 6.8
Task-number: QTBUG-131916
Change-Id: Ic1bd0eedee0343c3d70b6954842e21b3c550b092
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit e4fbbdea05540723d4c4429d673d25efa3201d7a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:10 +00:00
Alexandru Croitor
7584fe901e CMake: Add a few more internal sbom helper functions
Add a few internal functions to allow
- getting the sbom project supplier
- project supplier url
- project namespace
- computing a project namespace
- computing a project file name
- getting a sanitized spdx id given a hint

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I0dc3df274eaf6882a6af021aabee75501b5083f8
Reviewed-by: Moss Heim <moss.heim@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit dbf44b61c11d63a4e3242a62c3be34ebf1f3f012)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:09 +00:00
Cristian Le
a1a77ea7d1 Forward find_package hints to auto/cmake
If the tests are built and run as standalone or non-prefix build and a
find hint was used, e.g. `Qt6_ROOT`, then this type hint should be
forwarded to the `ctest --build-and-test` otherwise the internal
package would fail when it tries to `find_package`.

Change-Id: If71852dd5124b8deeddd28ba835f1943d96ba2b8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 599ad25a65ddf3b3fb7dcdc7c446da070800e507)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:09 +00:00
Joerg Bornemann
e120fb78c9 CMake: Only load Qt6FooPrivate automatically when building Qt
[ChangeLog][CMake] CMake packages of public Qt modules don't provide the
targets of their private counterparts anymore. User projects must now
call find_package(Qt6 COMPONENTS FooPrivate) to make use of the
Qt6::FooPrivate target. User projects that rely on the old behavior can
set the CMake variable QT_FIND_PRIVATE_MODULES to ON.

For user projects, the warning message we know from QMake is displayed.
The warning can be disabled by setting the CMake variable
QT_NO_PRIVATE_MODULE_WARNING to ON.

Within Qt itself, find_package(Qt6Foo) will still
find_package(Qt6FooPrivate).

For static Qt builds, we need to wrap usage of private Qt modules in
$<BUILD_INTERFACE> or $<BUILD_LOCAL_INTERFACE> (if CMake's version is >=
3.26). Static builds with CMake < 3.26 will always load the private
modules if the Qt6FooConfig.cmake from Qt's build tree is loaded. This
is the case in non-prefix builds and (in the future) when building
examples as external project.

This amends commit fbbf4ace0188b9718b6d7808021c0b887fd52d9f.

Task-number: QTBUG-87776
Change-Id: I78e95248f2b3fa73c3005c61df2fe4f71ad8eeb8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ad7b94e163ac5c3959a7e38d7f48536be288a187)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:09 +00:00
Christian Ehrlicher
49260691b2 Windows11Style: fix drawing rounded corners in itemviews
When drawing an itemview item, the rounded corners (for current and
hovered item) were not properly drawn - the rounded corners of the
windows11 style were sometimes also visible where they should not be.
Fix it by using a clip rect and move the rounded corners out of the clip
rect on the appropriate places.

Task-nubmer: QTBUG-131585
Change-Id: I4eccc1e65768306a5511cda6e18db8f56fe1eff6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ed18ad9543ae4b30307bb178d1ee8b309062b9e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:09 +00:00
David Redondo
10c195b864 QOpenGlContext: Always unset current context in doneCurrent()
Otherwise when no other context is made current until thread exit, the
QGuiGLThreadContext destructor will try to call doneCurrent() on an
already deleted context.

Pick-to: 6.8
Change-Id: If55dd69a72b8ab4012780a449f6a02729dd0ed43
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit cd1686e55f706048286cbc962bbe02032c2396cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 11:45:08 +00:00
Aurélien Brooke
7fbc340561 rhi: vulkan: fix the pWaitDstStageMask parameter of vkQueueSubmit
It expects one mask per wait semaphore, where only one was given,
leading to an out-of-bound read.

Amends 202dd3cb39ab4408c44a8588b8d6fb9a1cc3a184.

Fixes: QTBUG-132356
Change-Id: I6f7d33eb4568d1577e09411f7be751c8dc520429
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit ff68e05bc3f8c98ccfc26b03ec68b183af9172f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 09:00:00 +00:00
Felix Lionardo
ef2200e327 QNX desktop support
Adds functionality to communicate with a desktop manager. This feature
is only enabled if "desktop" is added to the QT_QPA_PLATFORM environment
variable (e.g., "QT_QPA_PLATFORM=qnx:no-fullscreen:desktop").

Pick-to: 6.8
Change-Id: If98e0dda43692abce47f2d8f5f340bd7276ec901
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
(cherry picked from commit 70b1db9c0e0a53ec7e47ba296a534d38559c702f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 06:05:27 +00:00
Felix Lionardo
12f59b27e1 Disable incremental updates for raster windows on QNX
Incremental updates don't always work
due to a misinterpretation of the rectangles passed in by the upper
layers.

Pick-to: 6.8
Change-Id: Id30c97f80904209726b3aaf37c52b2e14ee2f187
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
(cherry picked from commit d0e64a36d2806ae2892cb34cb44ef63b2d56abd1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 06:05:27 +00:00
Thiago Macieira
a5f12c1ff9 Revert "QFlags: befriend the QDataStream serialization operators"
This reverts commits 729c0960b84183bcf9576f974cb5e3b3c3fdc6ef and
348b680ae56e92f061424a10c4baa726cf7f15d2. Friendship is not required.

The removal of the forward-declaration in qflags.h implied adding it
where it had been required but not present.

Change-Id: Ie17963f95bb5fa98fd75fffd7e6e5289b58f1960
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit c7a069870ae80f47b32479dc1f8f7161a3238201)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 06:05:26 +00:00
Bartlomiej Moskal
b579f48790 Android: Unblacklist testQuickSelectionWithMouse test from tst_QLineEdit
Test was failing on Android because of three issues:
  1. Mouse selection does not work well with Android, especially when
     predictive text is enabled. After changes in
     de5ae6917c819ff23f7d9c5742b50b15e0824877 commit, mouse selection on
     Android needs ImhNoPredictiveText to be set for correct handling.
  2. Test sends mouse press events on center position of the QLineEdit.
     On some devices, the text would sometimes end before this center
     position. To avoid this situation the width is set directly.
  3. Android expects the mouse click to be released before the next
     click. If it doesn't, the next selection won't work properly

This commit fixes all those issues and unblacklists
testQuickSelectionWithMouse test

Fixes: QTBUG-87417
Fixes: QTQAINFRA-6896
Pick-to: 6.8
Change-Id: Id19850446954196a077047e250ea24a91ae7255e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 1b02900ffe02980cb3e69c60ca415fd694cd773a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 03:21:11 +00:00
Assam Boudjelthia
1c32faa784 AndroidTestRunner: print failed build output when no --verbose is used
This helps with better debugging where in most cases the tests are run
without --verbose, but if there's a build error, it won't be clear what
went wrong, and only re-running with --verbose would give such details,
which is just annoying to deal with.

Change-Id: Icb8bcb8e5ba297d48b9e166c93523f25a21937b2
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 48dbc72c4467d120353dba46fdbc2f8ddc145629)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 03:21:06 +00:00
Assam Boudjelthia
bff859c2ed AndroidTestRunner: don't automatically print logcat unless its a crash
Print logcats only if it's explicitly requested with the respective
argument or if there was a crash, i.e. where we can't get the test's
exit code. Otherweise, in case of normal failure, we don't really need
to pollute the output.

Change-Id: Ic4e6db5d9fd6786bd28204a3ec87f63a7ec9764a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 256fd95a712384c6d5b8b1841ab9c749fca89970)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 03:21:05 +00:00
Thiago Macieira
266653fee4 QFile: use unbuffered mode for the file-copy data pumps
There's no need to have the QIODevice layer buffer the data and thus
allocate memory. In the case of QFile::copy(), it also improves the
error message output.

Previously:
"Cannot create /tmp/tmp/f for output: No space left on device"

Now:
"Failure to write block: No space left on device"

Change-Id: I537a2a79ead9d1d9ac2efffdd650702a4424bac6
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 8a720c162d500369810674930884e36cf2494d88)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-25 03:21:05 +00:00
Ahmad Samir
2a734e1971 Docs: fix qdoc enum's \value "since" syntax
Square brackets.
https://doc.qt.io/qt-6/10-qdoc-commands-tablesandlists.html#value

Change-Id: I1d9237461a4eafb72b28ae019c02ba72f82d0f17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9b44acfd26169d087224719b0813a146e7b731b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-24 22:12:06 +00:00
Wladimir Leuschner
acbfeca2b3 QWindows11Style: Default PE_IndicatorRadioButton to selected/unselected
In case there is no valid QStyleOption::styleObject, default the
PE_IndicatorRadioButton to the selected and unselected appearances.

Fixes: QTBUG-132906
Pick-to: 6.8
Change-Id: I5e9c13cb3384321e025e5af08ee3dab81feb07fe
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit b717945812b16f957421bc2a2b1c4220f8148e64)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-24 21:01:03 +00:00
Mate Barany
eac8f36080 Update CLDR to v46.1
[ChangeLog][Third-Party Code] Updated CLDR data, used by QLocale, to
v46.1.

Task-number: QTBUG-132851
Pick-to: 6.8
Change-Id: Id08d9337e11234d0ca428c7e435808be1b044f7c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 918566aeddbbf56f8539c44bcd45223d2fbab996)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-24 01:45:50 +00:00
Marc Mutz
1ec2f5df26 QTemporaryFile: add private API for an overwriting rename()
In many situations, it is desireable that QTemporaryFile::rename()
overwrites an existing file, such as when emulating QSaveFile because
one would like more control over the temp file (such as passing it to
a different process). The public API of QTemporaryFile did not allow
it, making the typical Unix mktemp + mv algorithm to avoid symlink
attacks unimplementable with public Qt API.

QSaveFile is not a 100% replacement, because it always follows
symlinks and places the temporary file beside the physical target
file, keeping the symlink intact, instead of placing the tmp file
beside the symlink and clobbering it, if the target happens to be one.

Extract Method QTemporaryFilePrivate::rename() and add a bool
overwrite parameter that causes the existing
QTemporaryFileEngine::renameOverwrite() to be called in lieu of
QTemporaryFileEngine::rename(). The non-atomic path via
QFile::rename() is not affected.

This makes the functionality available as private API, in case we need
it in older branches.

Task-number: QTBUG-132646
Pick-to: 6.8 6.5 5.15
Change-Id: I0d5ca96c0a1a557854582e1a565a3db0d8af2a95
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a01b14f1de59d378088a949bb21f3536832634c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 23:04:16 +00:00
Felix Lionardo
a50b3916a2 Add libfsnotify to the core library for QNX 8
QNX 8 moved the inotify API implementation to a separate library,
libfsnotify. Added qt_config_compile_test to verify inotify in libfsnotify

Pick-to: 6.8
Change-Id: I5906d8fd0f146dc9db8d9ae2d8c0053bff21b840
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2dfbfd5f9a800f40afd2a4e48a208a9f781fb0ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 23:04:16 +00:00
Alexandru Croitor
3f5df82334 CMake: Add an option to pass --showinternal to qdoc
This adds an SHOW_INTERNAL option to qt_internal_add_docs that
passes the --showinternal option to qdoc.

The option can also be set for all calls by setting either the CMake
variable QT_QDOC_SHOW_INTERNAL or the environment variable.

Pick-to: 6.8
Fixes: QTBUG-118176
Change-Id: If72c4072e10bc5f12b0431a5f8abea6ee1e2bd69
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0b7ff3d0a7be7b8df6184cde5ca33bb681790131)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 19:06:41 +00:00
Alexandru Croitor
98d5581e16 CMake: Add various option to pass extra args to qdoc execution
Calls to qt_internal_add_docs now accept the following options:
- QDOC_EXTRA_ARGS: Extra arguments to pass to qdoc
- QDOC_PREPARE_EXTRA_ARGS: Extra arguments to pass to qdoc prepare
  phase
- QDOC_GENERATE_EXTRA_ARGS: Extra arguments to pass to qdoc generate
  phase

In addition, the following cmake and environment variables can be set
to pass extra arguments to qdoc for all targets:
- QT_QDOC_EXTRA_ARGS
- QT_QDOC_PREPARE_EXTRA_ARGS
- QT_QDOC_GENERATE_EXTRA_ARGS

The cmake variables can also be set at directory-scope, before the
call to qt_internal_add_docs.

Pick-to: 6.8
Task-number: QTBUG-118176
Change-Id: I0e28f3b863d5ca4efd0256432130af1c9c965f9d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 948b2f601dd9c7f526497680c5c4928d2793c238)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 19:06:35 +00:00
Alexandru Croitor
a764da6902 CMake: Clean up and document qt_internal_add_docs
Change the option handling code to be similar to our other internal
functions.
Break too long lines.
Add a doc comment.
Add a message(DEBUG) for the case when qt_internal_add_docs is still
called with one argument.
Rename doc_project variable to qdoc_conf_path.

Pick-to: 6.8
Task-number: QTBUG-118176
Change-Id: I73167f1e72e2abcdb90722ecd6ee00f7636b8a5d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 2fd16b2acb726e597479bb30f42363075e3de56b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 19:06:29 +00:00
Thierry Bastian
f738fcb1f4 Add support for PostgreSQL prepared statements with pgBouncer
Since 2023, pgBouncer supports prepared statements but only when
prepared/executed/removed at the protocol level.
So to support this, You need to call the appropriate functions
from libpq.
it does not change the behavior otherwise. You can note that to free
statements, libpq only has the function in v17.
Prior versions of postgresql will still use DEALLOCATE.

Fixes: QTBUG-132303
Change-Id: I2456820bbea318e1715ae46617bf4d137815ca54
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit ca09bc8d7a96b95d40bec9638f63467a24dfc0c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:04 +00:00
Cristian Le
d45687f499 Make user tools symlinks relative
Fixes: QTBUG-132724
Pick-to: 6.8
Change-Id: I0f1d95ef6b66c81e2d12730eae3d5c0452a3a7a1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6a4df2ac243d54f36ad1c1b406803e6caa1be294)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:04 +00:00
Cristian Le
9db4c36a2f Export INSTALL_PUBLICBINDIR to QtBuildInternalsExtra.cmake
`INSTALL_PUBLICBINDIR` is only exported if it was defined by the user
when building QtBase. The conditional check aligns with the one used in
`qt_internal_generate_user_facing_tools_info`

Fixes: QTBUG-107016
Pick-to: 6.8
Change-Id: Id5c38555e1d22cb3c16d85261cb052c695b4de03
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a9964422360c637c7a46f85628a580448bb13bc1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:04 +00:00
Cristian Le
430779a287 Use _qt_internal_relative_path
Pick-to: 6.8
Change-Id: I1c4248bbf7e06536503224cbfceb57f41de019bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 1192f2c87778c90530553cc62e763afaa0b6456e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:03 +00:00
Joerg Bornemann
b8fa115b47 CMake: Remove transitory code from _qt_internal_find_qt_dependencies
...that tried to load Qt6Foo instead of Qt6FooPrivate. This might now
load the wrong package, since we've split CMake packages of public and
private Qt modules.

Enough time has passed, and we can assume that all
Qt6*Dependencies.cmake files have the _qt_package_name property set by
now.

Task-number: QTBUG-87776
Change-Id: Icf18872dd49b1e3a82b7327027f7d6e48b656b70
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ed7bc398d8f8f033a79e1adddf7874e9fdd961af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:03 +00:00
Cristian Le
54f5a61fbc Add _qt_internal_relative_path
This is a compatibility function for `cmake_path(RELATIVE_PATH)`.
For CMake<3.20 it uses `file(RELATIVE_PATH)` instead

Pick-to: 6.8
Change-Id: Ibf9ca221c1753bd99dcc1820bffaea28f9bfe5af
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 334acc2eb3ec0cba702780036c94abdac306864e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:03 +00:00
Liang Qi
9cb8a156fd QDesktopUnixServices: avoid to call virtual function in constructor
This amends 1969b1a90a79dad049694bd1540f8627d5f26875 .

Pick-to: 6.8 6.5
Change-Id: I1be4e229d531f8a91e1ad3133a5b62784d18bb41
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 225f8e069b8fabff849f2167acd2d9e4b7b94788)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:02 +00:00
Laszlo Agocs
6fe4ebce70 Drop a limitation for R8/RG8 formats for Mesa in hasOpenGLFeature
The mentioned version is from 2015.

Change-Id: I330bd8ec08ab815a85d3e4e5afc44f314ade2ef6
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 20b07bfa305153b8d828e133bb7dda838c2166c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 17:34:02 +00:00
Laszlo Agocs
2f632086e9 rhi: vulkan: Support initializing without a Vulkan instance given
Problem is, this has potential issues down the line. For example,
if one pops up a QQuickWindow afterwards, also with Vulkan, and
wants to do things like enabling the debug layer (QSG_RHI_DEBUG_LAYER
and similar), that will not work since the instance is already up.

In absence of better solutions, drop a warning as well and keep this
undocumented for now.

On the plus side, this allows applications to implement things like
enumerating adapters with Vulkan and then launching a QQuickWindow
with the selected adapter. With other APIs (D3D) this is a breeze,
but is impossible here due to the very unfortunate concept of Vulkan
instances, and handles such as a VkPhysicalDevice being tied to the
instance.

An application has no way of knowing what VkInstance Qt Quick will
create/use, unless the developer does the extra boilerplate to
provide their own, which is an overkill in this case. So offer some
way to make this work, even if there are some pitfalls.

Change-Id: I1fc11f90cd1bf3fdac945ed5a7221f596368d30e
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 3c338def89a4e03e3b47e624d83d83785c52037b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 12:56:14 +00:00
Laszlo Agocs
1efb618b9a QVulkanDefaultInstance: warn if setting flags has no effect
Change-Id: Ib939e56f0e8bc3e04725fb3660d30a8d3e13fad3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
(cherry picked from commit 4f5b1c75a9427c26df0bb92c92f3d8c6370a371a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 12:56:14 +00:00
Edward Welbourne
631fa1915e Amend QLocale::uiLanguages() order
Include each of an entry's truncations right after the entry if its
script (or, where absent, the one implied via likely subtag rules)
matches and there is no later entry that it should appear after. This
is a compromise between prefering strictly equivalent matches to
potentially incompatible ones and prefering candidates derived from
earlier entries in the original list. Defer to QLocaleSelector (see
QTBUG-112765) the addition of options to give the caller control over
how to make that compromise.

On picking to 6.9 (by hand, since initial pick failed for want of a
precursor I've now picked) I've decided to pick to 6.8, which shall
surely get conflicts, since we want to fix the same issue there.

Pick-to: 6.8
Fixes: QTBUG-131894
Change-Id: I8750f4f40530c94638853388f47fcae1008db8d5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cbf49f735e3cca85922a85d6548666816686db78)
2025-01-23 13:56:14 +01:00
Edward Welbourne
45c9a35d35 Include more pruned likely-equivalent entries in QLocale::uiLanguages
We were including, for each entry we got from CLDR or the system,
minimal and maximal additions from CLDR's likely-subtag rules, plus
versions with script omitted and possibly also territory added, when
likely-equivalent to the original. Include also the converse, with
territory omitted and possibly also script added when
likely-equivalent, so as to control order when these entries also show
up by truncation of others.

On picking to 6.9 (by hand, since initial pick failed for want of a
precursor I've now picked) I've decided to pick to 6.8, which shall
probably get conflicts, since we want to fix the same issue there.

Pick-to: 6.8
Task-number: QTBUG-131894
Change-Id: I363bfe31867be43807fe3b4942dafa186b8d2e94
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7f9ee43de783105d8de0a0b614751eec639131f8)
2025-01-23 13:56:13 +01:00
Edward Welbourne
e7cc3ccf1d Rework QLocale::uiLanguages() to be a bit more straigthforward
Skip duplicates as a separate step, to save some complications. Other
than that, achieve the same results by post-processing the list,
instead of trying to integrate the finding of fallbacks into the main
iteration. This makes the code easier to think about and cope with
further complications as we come to them.

Change-Id: If06eae5fd1e91e88b52b3d32ccaba8cbb8e3c8af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2c39365aad957aea7ca9c9c861665391edf7ef23)
2025-01-23 13:56:13 +01:00
Edward Welbourne
e149129954 QLocale::uiLanguages(): only QString-ify the locale names we do add
We can test whether the candidate is already in the list by exploiting
the comparison of QLatin1StringView with QString (and related
QStringList::compare() overload), so we don't need to convert the
QByteArray to QString unless we're actually going to add it.

(This does lead to the prior name being converted twice, but the
second of these is about to go away.)

Picked by hand since some later changes turn out to need it.

Change-Id: I8e47cbb4c9e44ad8ef13d04e930a4619845418ef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f8128f280999e21ba291c899ce669d77803b976c)
2025-01-23 13:56:13 +01:00
Ivan Solovev
1a3efe2249 QFlags: add QT_NO_DATASTREAM checks to datastream operator declaration
Amends 729c0960b84183bcf9576f974cb5e3b3c3fdc6ef.

Found in Qt 6.9 API review.

Change-Id: Ieb81fe000e61fef54a003f52789fa1475aac5239
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 348b680ae56e92f061424a10c4baa726cf7f15d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 12:56:12 +00:00
Ivan Solovev
d135c9ea00 Restore the docs for QFlags debug streaming operator
The unconstrained implementation was removed, so qdoc was not able to
find a proper function. Provide a fake definition that matches what
qdoc expects. In this case the users shouldn't really care about the
constraints that the actual implementation has.

Amends 0c707c6ebece18677deaccccdfec5d48c587106f.

Found in Qt 6.9 API review.

Change-Id: I6207b491fa94cc62d217af7dc7687923dc6971a4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b1509550436400ec9be608b5c760501d9b86912a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 12:56:12 +00:00
Ivan Solovev
b9c1d1f7a1 Fix SFINAE constraint in flags debug streaming operator
So that it allows overloading.
Also move the type T declaration into the function scope, as it
could never be used as a constraint anyway, and we do not want
users to pass custom type there.

Amends 0c707c6ebece18677deaccccdfec5d48c587106f.

Found in 6.9 API review.

Change-Id: I086d65bdef7be2f9e0e67e96cc8a9ac76eaa5b0f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f1d2d47f609cfb3c4cf9b2a86072613b3c9e0642)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 12:56:12 +00:00
Marc Mutz
faf10af206 Update public suffix list
Version 47264b57765919188b9f4144de8d95cf77e1b6dc, fetched on
2025-01-22.

[ChangeLog][Third-Party Code] Updated the public suffix list to upstream
SHA 47264b57765919188b9f4144de8d95cf77e1b6dc.

Pick-to: 6.8 6.5 6.2 5.15
Task-number: QTBUG-132851
Change-Id: Iba19f5006e8cb60505505c96a4e4649b075cae6e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 09fa335fb22122c42f057380e3d6f4d8944256d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 09:19:46 +00:00
Marc Mutz
94e4f3c532 util/update_public_suffix_list.sh: adapt to PURL addition to qt_attribution.json
Also add a comment to publicsuffix-list's entry that the update is
done by a script that should be updated whenever this file's contents
change.

Amends 36dca3c04f759449f74008a3e79021a179b0f35e.

Pick-to: 6.8 6.5
Change-Id: I1a0e51568e6d4300197c09f759ad3d82277a74d1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b9f74f9a0b97588fc07d75fa6a427f5c8d6a2c6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 09:19:42 +00:00
Marc Mutz
cd99c6aad5 tst_QSet: check whether remove/removeIf detach if nothing is removed
They do.

Task-number: QTBUG-132831
Pick-to: 6.8 6.5 6.2 5.15
Change-Id: Ia4e9de7e443d11af9675924718c551a06bc4b447
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit b80679a90f39106052f1b53f4073e679d5077a5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 08:25:47 +00:00
Christian Ehrlicher
da4e9b7637 QAbstractFileIconEngine: store pixmaps with correct key
QAbstractFileIconEngine stores the generated pixmap in a QPixmapCache
with the size as key. This is wrong as the size is multiplied by the
current devicePixelRatio so this has to be done also for the key.

Pick-to: 6.8
Change-Id: I6d8ceedc950d23abf9c4d79d92e86848b9508c9b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 83ff179f85559af880d28d7832d44f95c5ce9616)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 05:15:23 +00:00
Shawn Rutledge
a4dc60e9fc doc: Improve QTextTableFormat::setBorderCollapse and related docs
We changed the default in 6.8. It was documented in the changelog but
not in docs. Amends 09ea47f8113bdce437253b19a91f739aeef7a333

Pick-to: 6.8
Fixes: QTBUG-132173
Change-Id: I1b6bf69931ba12025cf95e80c12a5073a94af598
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 622133ace2533617f294b8d875b5eb749a78571b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 01:42:08 +00:00
Volker Hilsheimer
dac4298b72 JNI: remove noexcept from QJniArrayMutableIterator methods with preconditions
Change-Id: Ifdb0c09eec6a269a826ab80e443a11a7858a21b6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit ab89118b8f54e45c4132467a9018054f835777db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 00:29:00 +00:00
Thiago Macieira
b0fe7f3479 tst_QTcpServer: add missing const
So the array itself is also const.

Amends a94731c2ad85f9dd40050a780f67c911bf12668e.

Change-Id: Ic4d78d3d059dd47f776ffffdd0971b1aa35a69e9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8500e730406cf592d9eeffadab3c4f7e6a51da96)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-23 00:28:58 +00:00
Christian Ehrlicher
d10cba961b SQL/ODBC: escape values in connection string
The previous attempt to escape invalid characters for username/password
did not work for e.g. '}' or '{'. The msdn documentation is somewhat
inconsitent here but after testing it looks like putting the
username/password inside '{' and '}' no matter if needed or not is the
easiest way. We have to escape '}' by doubling it though.
No need to escape the DSN - testing on windows revealed that ';' is not
allowed in there and '\'' and '"' at the start of the DSN is perfectly
fine without any escaping.

Pick-to: 6.8
Fixes: QTBUG-122642
Change-Id: I04d007d343dd65eb0dbc0252518843eb43cd9ab8
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 38277a88f1dd69de6e031bc8313c8d5beadf6bd0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 16:13:35 +00:00
Christian Ehrlicher
b93a8dfdfe Windows11Style: don't set minimum width for QAbstractSpinBox
There is no need to set a minimum width for QAbstractSpinBox in
QWindows11Style::polish() as this might override the user preferences.
Also the minimum size handling is now properly done within
sizeFromContents().

Pick-to: 6.8
Change-Id: Ibc1fd7a6f862fc85e3739025b9de581aa235d74c
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit 2ec4c28470de115c16944653a5d4f6209452d56c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 16:13:34 +00:00
Christian Ehrlicher
1ac5e98077 Widgets: add enum values to QStyleOptionViewItem::ViewItemFeature
Add two new enum values:
IsDecoratedRootColumn: notifies the style that the current cell also
contains place for the tree column branch indicator so it can e.g.
properly draw rounded edges in a cell or complete row.
IsDecorationForRootColumn: the item contains the information to draw
the tree column branch indicator.

Task-number: QTBUG-131585
Change-Id: Iee2823fe3a227630f926d0448095a10fad2b0ba7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c917d16f4b9982425b51dfc4947792e36defde35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 16:13:33 +00:00
Edward Welbourne
9ed5d93c77 QtTest: Update valgrind (fatuously) to v3.24.0
Nothing has changed in the headers we use, aside from the version
number, since v3.23.0, so we may as well declare ourselves up to
date.

[ChangeLog][Third-Party Code][QtTest] Valgrind headers are up to date
with Valgrind v3.24.0.

Pick-to: 6.8
Task-number: QTBUG-132871
Change-Id: Ib2ad8d73e662535a014d241b46cc50214b45f50b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 549bab4150b4652bb8b6577c737e49ae03f6348f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 15:07:58 +00:00
Tuomas Vaarala
0d4c3c852a Remove quotation marks from objcopy call parameter for QNX
If the objcopy call parameter is in quotations marks it fails the call
and prevents separate debug info builds for QNX.

Fixes: QTBUG-132801
Pick-to: 6.8
Change-Id: Ifadf57f80eb5c354aedeb8985bc7a0c9b79dc62e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9261b68395df75dbb01539c547832d9cc35521d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 15:07:53 +00:00
Mitch Curtis
133838a7c7 Make iconbrowser manual test directly openable in Creator
This avoids the need to run qt-cmake-standalone-test and then import
the test, as described in QTCREATORBUG-25389.

Pick-to: 6.8
Change-Id: I010d6613debb2e34ef3809d2da78ca33ade4d602
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 742a0ed72f5264b0198d87df6c4e0657eaf48172)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 15:07:53 +00:00
Edward Welbourne
007c0a1854 Add a QDuplicateTracker<T>::contains()
When even some values I haven't seen may need to be left for later,
but values I have seen are definitely to be discarded, I need to know
if I've already processed them before doing the fiddly check for
whether to defer; but if I decide to defer, I haven't yet processed
and need the later check, to which I've deferred, to see the value as
still new, even though I did once ask about it before. So I need a way
to query without adding to the set.

Pick-to: 6.8 6.5
Change-Id: I712f1c400147210c149aeec6de1d15d2e095d6a9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 09b77a8d07276e0b5e5fec596f957f8fc4a78869)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 09:37:15 +00:00
Edward Welbourne
d1f0e924e9 Correct description of 3rd-party CPU cycle counters
Pick-to: 6.8
Task-number: QTBUG-132871
Change-Id: Ia0a467297393be72ff7d39b7333ad86e09057dff
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a419db7160f2070de9ae52e80dcfff05304d9229)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 09:36:54 +00:00
Edward Welbourne
72c674d253 QMimeType::comments(): skip locale-name-trimming
Pruning the part of a locale name after the first '_' should now be
redundant, as QLocale::uiLanguages() now includes the resulting
truncations. It may do so later in the sequence than the pruning used
here, where the pruned version either might be a bad choice (due to
being in a script incompatible with what we started on, e.g. pruning
pa_PK to pa, which uses a different script) or would also arise from
some later, more specific, entry (as when uiLanguages() is expanded
from {en_NL, en_150}, where checking en immediately after en_NL would
bypass the more specific en_150 when present).

Change-Id: I4c7c199ca16a8e4803843547c5a689cea11af1f2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9574e8cbef06b3b55d1f651b09d134aef7150aba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 09:36:38 +00:00
Ivan Solovev
8e4ca03733 qtformat_impl.h: do not include <version>
We intentionally include <version> in the most low-level Qt
header, so that all other headers could just assume that it
is always available.

In this case it is already available from qtconfiginclude.h,
which is included from qtconfigmacros.h.

Amends 20b6ebea84997ecd70d37640f68232c60cc7231f.

Found in Qt 6.9 API review.

Change-Id: I430c7392b5237ec582708e3ae1170eabc7c3a402
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9a3199fec2673e591811a4775ec8a00073c9f433)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 09:20:07 +00:00
Shitong Xu
3b5fcd4901 QFileDialog: the lastVisited not loaded correctly
Url passed from the QFileDialogArgs will never be invalid, it will
always be the value that user passed into or the lastVisited or the
working directory. And because of this, the fixes code of QTBUG-70798
will never be invoked, and the `lastVisited` will never be initialize if
nativedialog is in use.

I wrote an init function to initialize the `lastVisited` global
variable, to make sure the value will be loaded correctly

Fixes: QTBUG-70798
Pick-to: 6.8
Change-Id: Id05f63db7b4738e6317721741111882a565437e3
Reviewed-by: Xu Shitong <xushitong@uniontech.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 34f1b6b6d1dd7c37f2d71c0032ddc0c83360c11c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 02:25:17 +00:00
Liang Qi
7ab7d88e8a platforms: rename QGenericUnixServices to QDesktopUnixServices
The implementation follows XDG Desktop Portal mostly, and is for
desktop, not generic unix.

Task-number: QTBUG-130884
Change-Id: I88456abb37b8b23cfec00ee8eac8ffee9a65ed9f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3e29267df0e2f332290caad69e5bd5cfd61cf3da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 03:25:17 +01:00
Liang Qi
78da1f8d00 Use QPlatformServices instead of QGenericUnixServices on embedded
Including bsdfb/directfb/eglfs/integrity/linuxfb/vkkhrdisplay.

QGenericUnixServices is mainly for desktop usages which uses dbus
and xdg things.

Task-number: QTBUG-130884
Change-Id: I003ec780aa039610cb5c36cd67cabbf173d8f642
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f8d0e4798c0d2985dbe5f8515a8281c9109ef6c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 03:25:16 +01:00
Liang Qi
2a4604e59e QGenericUnixServices: avoid dbus calls on non xdg envs
Fixes: QTBUG-130884
Pick-to: 6.8 6.5
Change-Id: I2525293f776676cda63e61c3c5093045dbafcf38
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 1969b1a90a79dad049694bd1540f8627d5f26875)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 03:25:16 +01:00
Liang Qi
dcac89b5c7 qpa: lazily populate the services object except xcb
In order to optimize the footprint of QPA plugins, we avoid to
create QPlatformServices object in QPlatformIntegration constructor.
It benefits embedded platforms and others.

Task-number: QTBUG-130884
Pick-to: 6.8 6.5
Change-Id: I5c0d2616ace9fbc0e077eece32d8836b40fc83dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ff51ea5418d131248b07e327513b41dad1231f37)
Reviewed-by: Liang Qi <liang.qi@qt.io>
2025-01-22 03:25:16 +01:00
Marc Mutz
cebb2dd068 Short live q20::exchange()!
We have weaned ourselves off of qExchange(), which, however, has C++23
semantics (is constexpr and noexcept), while we only require C++17 atm.
At the same time, we have more and more uses of a constexpr exchange(),
iow: the C++20 extension.

We have the qNN namespaces for this, so let's use it: Add
q20::exchange(), with C++20 semantics (constexpr, not noexcept), and
use it to port the only remaining qExchange() user (since ported to
2×std::move() to make the header compatible with QT_NO_QEXCHANGE),
QScopedValueRollback.

No user requires the C++23 noexcept on the function (compilers will
figure it out, because the std::exchange is fully inline), and we
can't provide a q23::exchange() even if we needed to, because the
author of P2401 forgot to ask to update the value of
__cpp_lib_exchange_function...

Fixes: QTBUG-133038
Pick-to: 6.8
Change-Id: I003df445001d1c5ab02402119c5e5106aa156263
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b5ed7fb203335cef7b7b4f70f4130b07166cecf2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-22 02:25:16 +00:00
Thiago Macieira
c88a8c78bd tst_QProcess: remove duplicate DisableCrashLogger variable
Amends 90bc0ad41f9937f9cba801b3166635f6f55e0678.

Pick-to: 6.8
Change-Id: I3faad81a5748ed0942d4fffd93c82124fc18b751
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 08cd38078e11988530251240096b3686e26dd783)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 23:17:54 +00:00
Thiago Macieira
5dbe3ecde8 QMutex: improve codegen for non-futex lockInternal()
Amends commit ff9da1db0b0963f967f45ab430ec40a3051b70b4.

QDeadlineTimer's Forever constructor is constexpr inline, while the one
taking an integer is neither. In an LTO build, the compiler might have
realized that it's constant, but let's be sure.

Pick-to: 6.8
Change-Id: I2c07caec660e05efe695fffd6ac8ec3120258a96
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ef73a5f175f8d51a0bacbdd30cacbd3b6d151d36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 23:17:45 +00:00
Thiago Macieira
1290935fab QMutex: replace QT_MUTEX_LOCK_NOEXCEPT macro with constexpr trait
This says better what it is and I'll use the trait for the unlock
operation.

Change-Id: I46752ca2ee71297d77e5fffdddaa193b6c86dbbc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 85ebb9d52a413f205046f864a2823e3f0819ed9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 23:17:44 +00:00
Thiago Macieira
993c3fc35b QCoreApplication/Win: add a better way for ActiveQt to override qAppFileName
Right now, the DLLMain in qaxserverdll.cpp calls GetModuleFileName() on
the hInstance for the DLL and passes the path to QCoreApplication to
override the path. This adds a way for it to simply pass the hInstance
handle, which will automatically cause qAppFileName() &
QCoreApplication::applicationFilePath() return the DLL's path, which in
turn influences the default QCoreApplication::libraryPaths().

Change-Id: I3cc172288c54c3938566fffdfb62985000ce2e9c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 507024317fec0c1deeb62c8c2ba5a43af7d65f21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 23:17:30 +00:00
Thiago Macieira
2ed35fe889 tst_QMessageLogger: disable Android once and for all
The messages said "This test crashes on Android" bu tit appears the
problem is not a crash, but that the executable can't be executed. The
file appears to be present and yet execve() is producing ENOENT (No such
file or directory). That probably means it's the interpreter stored in
the ELF header's dynamic section that is not found.

Fixing that is SEP[1].

[1] https://en.wikipedia.org/wiki/Somebody_else%27s_problem

Change-Id: I3025825c5e00f47a5a40fffd53c47131db3676dc
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 40ad963e1a22dbf3eea96f6a17bf6cbb28294649)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 21:27:47 +00:00
Nicholas Bennett
d07c24d1ba Docs: Add that Qt Print Support is not available on Android
Created a list and added Android to the existing mention of iOS.

Fixes: QTBUG-132742
Pick-to: 6.8
Change-Id: I6e906980d28b54daf18c019eb9299a9d67daef3d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit afa34d5f3773dec4fb2a7d524100a6f7a307e3e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 20:17:00 +00:00
Giuseppe D'Angelo
b223437124 QEasingCurve: fix (de)serialization in QDataStream
The serialization code did stream out a function pointer as an integer,
and then tried to set it back -- effectively, it has *never* worked
since the beginning of public history, unless
serialization/deserialization were done within the same process.

While we cannot support streaming custom easing functions, we can
recover the non-custom functions from the type, which was also streamed
out; setType will take care of that, and we'll just ignore the
subsequent field in the stream.

If one tries to stream out a QEasingCurve with a custom curve, what do
we do? I've decided to just print a warning and stream _something_ out,
so I can keep some degree of behavioral compatibility and aggressively
cherrypick this patch.
AFAIK, there's no support for such a scenario in QDataStream: all
out-stream operators have a wide contract, and there's no Status flag
that meaningfully represents this case (and I doubt anyone checks QDS'
status while writing into it).

Change-Id: Ifa80cf3a9003cab074ddf112022c09b364497007
Fixes: QTBUG-132575
Pick-to: 6.8 6.5 6.2 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 78a46bf16b7061bfd77b7b3bcf392c28ee788bfc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 20:16:58 +00:00
Alexandru Croitor
858bb5df19 CMake: Build executables in single-config debug-and-release builds
If qtbase is configured with -debug-and-release -force-debug-info,
which maps to '-GNinja Multi-Config'
'-DCMAKE_CONFIGURATION_TYPES=RelWIthDebInfo;Debug'

and then qtopcua is configured with -GNinja -DCMAKE_BUILD_TYPE=Release
building the 'all' target would not build executables or tools.

That's because the targets have their EXCLUDE_FROM_ALL property set to
exclude any non-first multi-config, and Release doesn't match
RelWithDebInfo.

Such a scenario can happen for our multi-config windows builds, when
someone tries to build a repo not with qt-configure-module but rather
with cmake directly. They would then not specify the same build types
or generator, which can happen when opening in an IDE like Qt Creator.

Make sure to also check if the current generator is a multi-config
one, in addition to whether QT_FEATURE_debug_and_release is ON, before
adding the genex to the EXCLUDE_FROM_ALL property.

This allows building and installing executables and tools in such a
scenario, because in a single config build, the genex would not be
added, even if QT_FEATURE_debug_and_release is ON.

Pick-to: 6.8
Fixes: QTBUG-132609
Task-number: QTBUG-132338
Change-Id: Iaee1a0afb19df97ee1263dbaf27c8e29fc127831
Reviewed-by: Jannis Völker <jannis.voelker@basyskom.com>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit baddc0a1958c8ea9cb946465c93ecdd62bde9d3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 20:16:55 +00:00
Eskil Abrahamsen Blomfeldt
c2e528ef42 Update Harfbuzz to version 10.2.0
[ChangeLog][Third-Party Code] Upgraded Harfbuzz to version
10.2.0.

Pick-to: 6.8 6.5 5.15
Fixes: QTBUG-132855
Change-Id: I542c054ccdc311b17363456c693a2057c2e496c1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 308ee2738f24d5f01fc8914f071735ad91716947)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 19:21:39 +00:00
Friedemann Kleint
84ad506420 Standard dialogs example: Fix compilation with QT_NO_CAST_FROM_ASCII
Add missing tr(), use literals.

Pick-to: 6.8
Change-Id: I35387e29ce1b08f9df0ade5ee743b33561639f7a
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 3e1707d43068d43b078a2e626a0c46ff78da997b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 11:26:05 +00:00
Friedemann Kleint
82e7d1e56e Standard dialogs example: Fix some clang-tidy warnings
- Use auto * when initializing with new
- Initialize variables
- Fix static invocations
- Use per-class includes
- Minor cleanups

Pick-to: 6.8
Change-Id: I137bc7dfad63bc55a1b1bbc3f42d758bbfdb86ba
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit f388ca8841ad25cf79e5fdf8fa3e9d2f4de48ebc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 11:26:04 +00:00
Friedemann Kleint
a97091d699 uic: Write Palette/Gradient code with fully qualified enumerations
Task-number: PYSIDE-1735
Change-Id: Ica05108d8802f235fd067095072547c1461e7387
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit e90115b5f7dafb1d6acd347634b14e12b6ff88f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 08:24:01 +00:00
Shawn Rutledge
3bcc785d0c Avoid dangling d-pointer deref in QWidgetWindow::handleMouseEvent
If you drag-and-drop a OpenGLWidget in Designer, the main window gets
re-created when the OpenGLWidget is instantiated. So in general (in
rare cases), at the end of QWidgetWindow::handleMouseEvent() we might
have a different window, and therefore can't reliably call
QWindowPrivate::maybeSynthesizeContextMenuEvent() without checking for
a valid pointer.

Amends 84a5f50c7766c99f62b22bb4388137e0aa8dd13d

Fixes: QTBUG-132912
Change-Id: I7b220b4daceab988aadabf9427ef6b2d5624e00d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 1accd2421686b387daa115b3a46974fce0fdb118)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 19:48:29 +00:00
David Faure
cfe906856b Docs: remove \internal in the docs for encodeMetricF()
The documentation for QPaintDevice::PdmDevicePixelRatioF_EncodedA
refers to encodeMetricF() which was nowhere to be found in the
documentation because it was marked as internal.

Pick-to: 6.8
Change-Id: I37707bc641d359f367f77c958043b6dfa33d4dcb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3ff989acaf84405a472605140e4035b993380bce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 19:48:26 +00:00
Alexandru Croitor
5165a8bacc Remove unsupported linker script objc_namespace.sh
According to the discussion in QTBUG-132398, the script stopped
working in newer Xcode versions, and also didn't cover new
Objective-C language features.

Remove the script to avoid confusion.

Pick-to: 6.8
Fixes: QTBUG-132398
Change-Id: I37b96ac6a77af1fcc4221591cb1f6320fa9a024b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 6404714183b3fcf93ac27482c5a3193a4f93767d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 17:51:38 +00:00
Alexey Edelev
9521b51eef Replace qt_record_extra_qt_package_dependency with qt_register_target_dependencies
qt_register_target_dependencies does the same thing as
qt_record_extra_qt_package_dependency but in more convenient way.

Update the qt_register_target_dependencies signature and adjust naming,
it now accepts PUBLIC and PRIVATE multi-value arguments and called
qt_internal_register_target_dependencies.

Use it and deprecate qt_record_extra_qt_package_dependency.

Pick-to: 6.8 6.5
Change-Id: I0594cf699ec1e3af7210dd7450fa3f81c1f565ae
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 8272b747d3b91e15fda2b76326221a26fb2245d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 17:42:01 +00:00
Alexandru Croitor
b51ee7068c CMake: Use a unique resource identifier in simpletreemodel example
To avoid the following error:

 The custom command generating
    .rcc/qrc_editabletreemodel.cpp
  is attached to multiple targets:
    editabletreemodel
    editabletreemodel_tester
  but none of these is a common dependency of the other(s).  This is
  not allowed by the Xcode "new build system".

Pick-to: 6.8
Fixes: QTBUG-131631
Change-Id: I1c5d0702596a4f8f723d9080bc5304d6ad06853b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 9f593791988da197dbe956669b8a4647dc50124a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 17:42:01 +00:00
Mårten Nordheim
ce820174ee QFile::rename: error out if overwrite fails when changing case on case-insensitive filesystems
The generic copy-and-remove fallback will first open the original file
with a different case, truncate it, and then remove the original file.
Leaving us with no file at all.

Task-number: QTBUG-132785
Pick-to: 6.8 6.5
Change-Id: Ia5a41d26c1d6d6bdc231c71acf15bd2ea496c715
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2defca418788ab167fa1ce70e518c9250cb0909f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 14:06:09 +00:00
Eskil Abrahamsen Blomfeldt
e958f05aec Request actual font family request in final color font fail safe
When we're trying to resolve a font for color emojis, we will
prefer any color font over the selected font (since a normal
font may have monochrome glyphs for emoji characters and that's
not what we are after).

If there are no color fonts on the system at all, we need to do
a final match where we ignore whether the font is in color or
not and just return it anyway.

In this final pass we would find the first best match among the
fallbacks (typically the first one), but never actually check
the font that was requested in the first place. This was a
mistake. Unless it does not exist, we should just return the
requested font family.

Task-number: QTBUG-132377
Change-Id: Ie53a6bd665ebdaaca92bf0c33fabf5195e1aa5fe
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit b154af082c8679fa09f325735025d98df9a8dcff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 14:06:09 +00:00
Assam Boudjelthia
10b88f3f20 AndroidDeployQt: explitly constuct the qmlDomCommand args list
Construct the arguments list explicilty to QStringList to avoid calling
QProcess::splitCommand() and potentially splitting a path with spaces
that shouldn't, this also saves from having to deal with shell quotes.

Fixes: QTBUG-132891
Pick-to: 6.8
Change-Id: I48f6c219830269c507f146b654bcfa025f0e3203
Reviewed-by: Olli Vuolteenaho <olli.vuolteenaho@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Soheil Armin <soheil.armin@qt.io>
(cherry picked from commit a8d8fb83ccfed09dd35dbab22caceaff963a3415)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 14:06:09 +00:00
Eskil Abrahamsen Blomfeldt
87330d4bd7 FontConfig: Fix detection of color fonts
There were two mistakes in the code that intended to detect
if a specific font was a color font in the FontConfig database.

1. The "int n" parameter in FcPatternGet*() is not an array size,
but an index, so it should be 0 and not 1.

2. We need to add FC_COLOR to the list of properties in our pattern
when populating the database, otherwise we will just fail to match
it and none of the system fonts will be listed as color.

Fixes: QTBUG-132377
Change-Id: Ib3c112e8a354abacd05679c62283a1f1abfb40ee
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 2e1db6541777ee076195ff9e793e4e83afd81539)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 14:06:09 +00:00
Thiago Macieira
f9bdb80ef1 De-duplicate the disabling of crash dialogs in our unit tests
The code was duplicated in multiple places.

Pick-to: 6.8 6.5
Change-Id: If2ab30b7afbf6d2f99c9fffd999218802b734d5e
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit b119fee87d5579dc1c4bfc2f508b0e3a75d69fa3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 03:24:39 +00:00
Thiago Macieira
b69650be3e QThreadStorage: remove unused moc-skipping guards
QT_MOC_CPP is not the same as Q_MOC_RUN, which moc's preprocessor still
sets. It appears Qt 3's qmake set it when ALLMOC_HEADER was set... a
feature that doesn't appear in Qt 4 (but exists with cmake_automoc).

MOC_SKIP_{BEGIN,END} appears in Qt 3's moc, but not in Qt 4's. But they
weren't in qthreadstorage.h at the time, so I guess they were added in
the 4.0 development cycle when QThreadStorage changed, but before moc
was rewritten (which deleted the Qt historic repository's oldest file,
moc.l).

Change-Id: Ibfff778c9f4d17af006dfffd8545fb24b495ecdd
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit bec49144f809ef8c5c61099ce46241c16b20b180)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 02:52:26 +00:00
Ivan Solovev
2db67cb4b6 QtTypeTraits: fix order of the includes
Amends 08c6cc62c743e172fbf064ccaad1159b2a1fb850.

Found in Qt 6.9 API review.

Change-Id: I1ed29a913e34ecf093a98c2053c319f0edfb9135
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0d047ca713ac66fe8ba94194441cd2e98cb76698)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 13:40:22 +00:00
Volker Hilsheimer
afc00d2b9b Doc: fix linking issue in QHeaderView; reflow
QHeaderView has no resizeMode property, only a ResizeMode enum type that
is then used in the sectionResizeMode API.

Fix that reference, reflow the paragraph, and apply some light editing.

Amends 9e3a96189d9db8a458e65cd5078509afe7a160db

Change-Id: I240c3f64fd45c96f4d3ba95c2086a638468e137f
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
(cherry picked from commit 988a3cd95da4b5875c7116141f2b22acf3e20502)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 13:40:22 +00:00
Ivan Solovev
e4d59b698e Fix docs for new QDebug streaming operators of std containers
Added the missing function declarations to the #if Q_QDOC part of the
header. Also fixed a typo in the std::unordered_map docs.

Amends 850d4895be565931d18c92e5e2f9a33b7f26de6d,
0c96528e8d43ad4309bdca14b179a5045984655a,
a9fe57fefaac0cb047e4c02e0b8c8f8327e0a58c,
and a8c9a5617c72ad2e55bf497df6ff2c2e141cbdef.

Found in Qt 6.9 API review.

Change-Id: I792023b506e2afdbdca4bca3197887e50c98a788
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 256b56f581a66acde829a2f47b3d0f6ed464fb44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 13:40:22 +00:00
Ahmad Samir
55f8c072a3 tst_QUniqueHandle: silence GCC/Clang -Wself-move warnings
And remove NOLINT(clang-diagnostic-self-move), silencing the warning for
Clang seems to work for clang-tidy too (tested locally).

Amends 03bd9491491881529ad28cd6d672edfdda9a0065.

Pick-to: 6.8
Change-Id: Ibdf982a728f2c6150f2911173dc3c9246f3662b8
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6f0f39673f5ae9debd9ab59be60c32f00f40c41a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 13:40:22 +00:00
Allan Sandfeld Jensen
4d34eee362 Fix CMYK8888 on big-endian platforms
Pick-to: 6.8
Fixes: QTBUG-132875
Change-Id: If7e945607125a5ae5ce1f8323df27ab8481e329c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 7ad2083ec3cbc9dce949e83465973435d0aa992a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 13:40:22 +00:00
Thiago Macieira
7920772663 QMutex: mark the out-of-line, *Internal() methods Q_NEVER_INLINE
With LTO, I'm seeing GCC conclude that it's best to inline the
lockInternal() and unlockInternal() methods into the public ones and
then emit out-of-line copies for those. That's actually sub-optimal, so
force GCC not to do it.

Pick-to: 6.8
Change-Id: I88c29098757ea6e70c00fffde56989ec05b136bd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit cc4abefb1db3bdfee0d57ea528d55073a4498b4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 08:30:37 +00:00
Thiago Macieira
cad8c1e6a7 QCoreApplication: move the QRecursiveMutex into QCoreApplicationData
There's no need for it to be a global, if the data isn't either. I have
a vague recollection of the data also being globals back in the
day... (they used to be plain QStringList pointers).

Change-Id: Ie5f1a71d0b20a0195822fffd992101c94824a07f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit a314e4b98513d4b5cd89d05e74f93c2b16ebc168)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 08:30:36 +00:00
Thiago Macieira
a2792a934f Move the libraryPath tests from tst_QApplication to tst_QCoreApplication
Those aren't GUI tests. I suppose they've been in tst_QApplication since
Qt 2 or 3, when there was no QCore/GuiApplication yet, and were never
moved.

Change-Id: I30b3c1a309ba2c720210fffd045ebd0bcfa803fe
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 9fe44e4779cf421de7f33f867be8e55d291c16ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 08:30:36 +00:00
Thiago Macieira
62b1336c55 QJson: Remove QT_JSON_READONLY
moc (and thus the bootstrap library) has needed JSON output since Qt
5.15 (commit da284ef10e0ef80776b9fc9b7bb0e6dc8d71ba63 "Add support for
machine-readable JSON output to the MOC").

Change-Id: I4b8cf51c092eb35cc383fffd48d120f0cb2c56b0
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Johannes Grunenberg <nerixdev@outlook.de>
(cherry picked from commit 029bb47e12d63e186663714c3776d3654285496b)
2025-01-19 00:30:36 -08:00
Marc Mutz
2a5d850e48 Move the <version> include from qcompilerdetection.h to qtconfiginclude.h
The idea of b2ed29b8d9b33dcece83000aee28073dd27f1cd9 was to have the
contents of <version> (if it exists) available in all Qt headers.

Since we broke up qglobal.h into smaller pieces, qcompilerdetection.h
is no longer necessarily included by any given Qt header, which
thwards the original idea.

Try with qtconfiginclude.h, which exists since
61935786c30b0209811fa32f7a02f138da8570b2 (Qt 6.6).

For Qt 6.5, we'll need to add it separately to qtversionchecks.h and
qtconfigmacros.h, whence qtconfiginclude.h was extracted, as well as
keeping it in qcompilerdetection.h, which includes qtconfiginclude.h
only since 22029a76c37d8d670479d523684a84f7966ed434.

Amends the breaking of qglobal.h into smaller headers, without being
attributable to any one of the individual commits that made up the
change, or else amends b2ed29b8d9b33dcece83000aee28073dd27f1cd9.

Pick-to: 6.8 6.5
Task-number: QTBUG-108228
Change-Id: I909196bd767e8d9e016069f1a59994d40e646e59
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4771dc308785ed132198b2c9a3200b7eb26d683e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 05:57:53 +00:00
Jonas Kvinge
dc4f7e3ffa QXRenderGlyphCache: Add QColor parameter for QFontEngineFT::loadGlyphFor
Fixes build after commit 39df9e1858a4115bc19b6a4dee5d687c5ee00d21

Pick-to: 6.8
Change-Id: Ice151b27591470ae81e07953f50e1abf9244ea28
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 55a4c6e9fcb364a899da7dcb4e18f76158e38bb7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-19 02:23:45 +00:00
Alexey Edelev
09590ee995 Fix the unsupported Q_UNREACHABLE_RETURN statement in constexpr functions
GCC 8.x does not treat __builtin_unreachable() as constexpr and
disallows using the Q_UNREACHABLE_RETURN macro. Guard the statements
with the respective checks.

Amends b0b34c56a99130bfc9c82cb006653ce6b8f0516e

Pick-to: 6.8
Task-number: QTBUG-125285
Fixes: QTBUG-132804
Change-Id: I88cdbe3bae1a336edc255e3e93e8d948bde253da
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a57d5b1fd60b6b6848ef8ad9db237941229d7a23)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:52 +00:00
Tor Arne Vestbø
ee97f24ef4 macOS: Ignore stderr in tst_QProcess::terminateInChildProcessModifier
As we produce crash reporting via Swift on macOS 15 now.

Pick-to: 6.8
Change-Id: Iab4777b29bcaa66eff9d2f1de63072f5744d56df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit dbfc3c9c381aa1cc0ab3cf5b758b38fb4499cb39)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:50 +00:00
Soheil Armin
8d97598e9c Android: Handle dotted URI QML Modules in Java code gen
A QML module can have URI that include dot character.
In this change, we refactor the code generator to create
the same hierarchies as a Java package structure. Each
QML module URI will be appended to the base application
package name to form a package that represents the QML
module as a Java package. Then the generated code of each
QML component will be placed in a single file.

This change, also refactor how to generated code should
be written in the file, by buffering the generated code
to a QByteArray first, and then flushing it into the
target file. We also create a marker file inside the
directories of each module, so that we can entirely
remove the directory and all its files before generating
new code during the next build.

Fixes: QTBUG-125891
Fixes: QTBUG-125970
Fixes: QTBUG-125971
Pick-to: 6.8
Change-Id: Iebce6495d9d29af32c3f1f97274c252444d2864e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 68785b3e59c8a8f4a383051123b87af3d930ff18)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:47 +00:00
Soheil Armin
b141854d76 Android: Improve qmldir discovery of QML to Java codegen
Recursively find all qml modules, built by this project.
Later, the qmldir of these modules will be used to
generated to code.

The command line argument -i of qmldom tool had
to be replaced with -I. The -i was incorrect as it
expects the qmldir file while -I accepts a QML directory
to be included.

Fixes: QTBUG-125892
Fixes: QTBUG-125970
Pick-to: 6.8
Change-Id: I4099e488d3d7f4b79566e6ea19eca95f57f7c2fd
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 7ed88eb565d40b195aa868e67777872ef07a5ea2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:46 +00:00
Volker Hilsheimer
0246c56005 Fix doc warning
Amends 4d31372a869d6734258eb7c081375581b367759e.

Change-Id: I685a0687e8519f92602857a8259260e3b081864d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5c783083f5cab0af577fea4dd71e1b3f1e7f5f66)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:45 +00:00
Ivan Solovev
7a579851c2 Provide docs for std::array QDebug streaming operator
Amends b294927a1270f7d0c5aaf0bbe93b617ac995e149.

Found in Qt 6.9 API review.

Change-Id: Iab64d52c506030dd755d61edc376bb47865478ff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b9a5a7852caf5c1296776351efa1781dbce04bbf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:43 +00:00
Ivan Solovev
65e70cec0b QCommandLineParser: convert MessageType to enum class
Amends bad618606d64e943e3fa78e7d1dbc8e1fab55480.

Found in Qt 6.9 API review.

Change-Id: I424fc1f80e36343f1aef4b05c551579ec0f04eba
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9a1a828ae535645f98d0ba9fc7c0c429097a2ac4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:42 +00:00
Jaishree Vyas
423659af18 Doc: Add setModel(open) option to the documentation
Changed the Model Dialogs section adding open() function.

Task-number: QTBUG-127777
Pick-to: 6.8
Change-Id: If5086f4e2226c4d032fe1bcfbf2ef550803973c8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 40f7454c919501f3c984c8fe4eeb379b360d4789)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:40 +00:00
Christian Ehrlicher
d5c3460b41 SQLite: Update SQLite to v3.48.0
[ChangeLog][Third-Party Code] Updated SQLite to v3.48.0

Pick-to: 6.8 6.5 5.15
Fixes: QTBUG-132862
Change-Id: If22497590dededc7b0c6f5dcc8d6d909f1e032a2
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 952ec8db3a096ddb92e98e408dfe193168efa50a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 07:17:16 +00:00
Giuseppe D'Angelo
891c1815e8 QLoggingCategory: fix -Wundef
We want to test if QT_BUILDING_QT is defined, so use the right
construct.

Pick-to: 6.8
Task-number: QTBUG-132900
Change-Id: Iac26f70021a337a2c476618979b4b8eb180ffd3b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fc4aff1249ffbb7a1b34df8a3b06c17aacb22308)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 06:32:09 +00:00
Giuseppe D'Angelo
4f8e1bf151 QTestLog: use the right preprocessor test for C++ features
Use ifdef, not if, otherwise we trigger -Wundef if the feature
is unsupported.

Pick-to: 6.8
Task-number: QTBUG-132900
Change-Id: I8a779da59bf2c7add14ace6405faf19b7ca48c28
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f04dfa8666662ddefa52a0bd1c8a60be361e4c00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 06:32:09 +00:00
Shawn Rutledge
648dede46c QWindowPrivate::maybeSynthesizeContextMenuEvent: preserve spontaneity
Call QCoreApplication::forwardEvent() rather than sendEvent() to ensure
the QContextMenuEvent is spontaneous if the mouse event is.

Fixes: QTBUG-132873
Change-Id: I6198c2105210d2841f43ef81a9be0f917272846f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 97605760aec7bfe48a8642ba8677204efd9c46a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-18 06:32:09 +00:00
Volker Hilsheimer
15a1b718e6 JNI: handle narrowing before creating a new Java string
Emit a warning if the string we get is too large for Java, and cast
the size to jsize before calling JNI.

For consistency, replace the Q_ASSERT in QJniArray's size check to use
the same logic.

Addresses header review comment; code was not handling this case before
it got moved into the inline helper either.

Change-Id: I00d68509be8b5f7304dda2e824fa0ced0f8f8d48
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 9d35561f6f6be125369e6020ce95a73b4aa6b51f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 21:55:10 +00:00
Bartlomiej Moskal
fdf4738be3 Android: Unblacklist textMargin test from tst_QLineEdit
Older devices may have lower screen resolution. In this case, the
hardcoded width may not work as expected. For example, all text may
not fit in QLineEdit.
This was the reason why the tst_qlineedit::textMargin test failed on
some Android devices (especially x86 emulator with Android API 29).
When the left and right margins were set to 20, all tested text did
not fit in QLineEdit. When we clicked at the beginning of QLineEdit,
we clicked on the second character of the text. The cursor was moved
to position 1, which caused the test to fail.

This commit updates textMargin test to make sure that tested text will
fit in to the QLineEdit.

Task-number: QTBUG-87417
Fixes: QTQAINFRA-6897
Pick-to: 6.8
Change-Id: I35352ac1e6f975e72d5c9638f8520f8ddd1d56ae
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
(cherry picked from commit 0a017308cca154b6f906c6e143fb33fe109316bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 14:53:37 +00:00
Bartlomiej Moskal
4ae1b626ef Android: Unblacklist tst_QLineEdit selection tests
Using the left/right keyboard key will deselect the text but also
move the cursor. In this case, to be consistent with the test, the
cursor must return to the previous position. This allows to
unblacklist tests:
  - undo_keypressevents
  - leftKeyOnSelectedText

Task-number: QTBUG-87417
Fixes: QTQAINFRA-6890
Fixes: QTQAINFRA-6895
Pick-to: 6.8
Change-Id: I8a6d7cca332fe365ca820a67c23d9cd3fc36fc43
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 43f2fdc25cfd356292636ea1f8160cf62bab4018)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 14:53:37 +00:00
Eskil Abrahamsen Blomfeldt
5f98cc3ecd Add some additional debug output to font matching
The font matching process consists of multiple passes, so to help
us keep them apart, this adds some informative output to explain
where we are in the process.

Change-Id: I54f0712cc8600d2b1e1bf4b8688e2ae198e0453b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit d2c8c12183a7f085643ee2d1fa7cd1677256b148)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 11:23:54 +00:00
Eskil Abrahamsen Blomfeldt
41698bb5c1 FontConfig: Don't register hardcoded fonts as color fonts
This amends 16850709306589a2433c0038605d365a6b6bedad. The patch
aimed to pass false for the color font parameter, but got it in
the wrong position, so it passed false for the pixel size instead.

The registerFont() function is a real mess, and it should be cleaned
up, but this at least fixes the immediate bug.

Task-number: QTBUG-132821
Change-Id: Id54989960aa5f86d3c79423d004530bb6a4fa475
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 0107e05e50761dd29a3d968baa9f502ade41e064)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 11:23:54 +00:00
Eskil Abrahamsen Blomfeldt
5441057cc1 Freetype on Windows: Detect system color fonts
For populating the freetype font database on Windows, we're using
GDI, which does not support color fonts. Therefore we were
registering all system fonts as monochrome, which was okay, because
our Freetype backend did not actually support the color font format
used on Windows.

Since 29a1c57183958b3951db4e7ba9504918a3caa761 we now support COLR
fonts, so they should be added with the correct properties.

Since GDI does not provide this information, we create a temporary
freetype face from the font file when resolving the family during
matching.

Fixes: QTBUG-132255
Change-Id: Ib62632de7fe8d9dc533abe4ae2368090a382cca7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 81e596c24fc106439ce4135478a2d18d23fdbaac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 11:23:53 +00:00
Soheil Armin
bbcf5a4191 Android: Fix incorrect JNI call from QAndroidItemModelProxy::sibling()
The return type of the QtAbstractItemModel.sibling() method is
a QtModelIndex Java type.
The JNI call from QAndroidItemModelProxy::sibling() is using
<jobject> as return type of QJniObject::callMethod(). This will
result in a non-matching JVM function signature.

This change replaces jobject with JQtModelIndex as the QtJniType.

Pick-to: 6.8
Fixes: QTBUG-132841
Change-Id: If157858f1ed49e25c8fbdfb9bb5c1fc2b7052826
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 190c85b706ee80bc92d6419676dca0dbfa60587b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 11:23:53 +00:00
Alexei Cazacov
813ea954b3 Docs: Describe QTextFormat::TextUnderlineStyle property
This commit describes the QTextFormat::TextUnderlineStyle,
TextVerticalAlignment, and TextOutline properties and their allowed
values

Task-number: QTBUG-126954
Pick-to: 6.8
Change-Id: Ib961331d9a06edb2bedf0a6b93afebef0cd467cb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 0ec4447d7a535e1d593f3a5db94f0dcd98fe61ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 08:05:30 +00:00
Thiago Macieira
c804fc386b QMessagePattern: merge and improve %{time}-printing code
All modern compilers implement divisions and modulus via multiplications
and shift, so the codegen is practically the same (three multiplications
in total). But the new code allows more than 136 years of uptime (49710
days).

Drive-by fix indentation in nearby line.

Change-Id: Iea806bd7dfac1f852c66fffd41c2ac6660e7cc65
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 61924c622acc5afd1e01dd65702e09a063928c5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:36 +00:00
Thiago Macieira
715ae29080 QMessagePattern: replace Q{Elapsed,Deadline}Timer with std::chrono
There's nothing wrong with those two, but we don't need the middle men
to the monotonic clock. This also reduces the sizeof QMessagePattern by
one quint64 (QElapsedTimer is 16 bytes in Qt 6).

Change-Id: I0eb171f03ee8f3a7148bfffd5534a7f3daba3a01
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 9dc294143d8fab498268f88c176b1af16de9b2ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:35 +00:00
Thiago Macieira
5dc84d6a21 QCoreApplicationPrivate: move translation NSDM to improve packing
This way they aren't in the middle of a block of booleans.

Change-Id: Iba067f6f23db7c059cddfffdc27231dd09b6898e
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 4daed2877251b861ce9f7ee5a09dc035518e1d9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:35 +00:00
Thiago Macieira
dc1a5ac3e4 QMessagePattern: add Q_ASSERT to setDefaultPattern() and improve codegen
Amends commit e04f109456bbcb184963b8ed71944b958b35c201.

This function does not free the pointers stored in literals, so add a
couple of assertions to indicate that it's only safe to call from the
constructor. And that being the case, we can update the tokens
unique_ptr in two steps, which makes the compiler not attempt to call
delete[] on the previous pointer.

Change-Id: Ibe76a7df795e9c6d6191fffdf45e3b3ef6f0f344
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit b86bcf5c25d0072300a8b0a4b5cfe942cabf53ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:35 +00:00
Thiago Macieira
0b0d6b6d36 QCoreApplicationPrivate: make the type member 8 bits
So it packs better with the booleans around it.

Change-Id: I330164b99fcbbf9e9629fffd52bcbb38bec4ac0e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit ede95ef7e916ffb946878477938c304a5dc206d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:35 +00:00
Tinja Paavoseppä
2bebec177d Android: Quit hosting Context only when app is entirely Qt
When quitting Qt, only quit the hosting Activity or Service if it's
primarily a Qt app, i.e. Qt is in the driver's seat. When using QtQuick
for Android, i.e. Qt is just a View, we do not want to forcefully quit
Activities, that is up to the app code.

Task-number: QTBUG-123711
Pick-to: 6.8
Change-Id: Ib98700be8693c3d30a296998b863b0f224c9bf69
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 3bcf55daa597888fcf0997e7ce2edd1d4c730a2a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:34 +00:00
Tinja Paavoseppä
fbc78ff287 Android: Do not start Qt app if it has already been started
Call startQtApplication() in QtView even if the Qt libs
have already been loaded, to make sure the app gets started
also when the Activity is recreated. Check whether Qt app
is already running inside the method itself to avoid hanging up
because of trying to start it twice.

Task-number: QTBUG-123711
Pick-to: 6.8
Change-Id: I3b009e4c2f40af9f258ce32b7e181c3faa21c194
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit be33f2d3233fb787d5251ba7d0876962efe49075)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:34 +00:00
Tinja Paavoseppä
35e027fb62 Android: Create new QtThread when needed
When we quit Qt in an Android app, we also quit the Java thread created
to act as the Qt main thread. This works well for normal Qt for Android
apps, where the lifetime of the Qt part and the whole Android app is
essentially the same. However, in QtQuick for Android Qt can be just
a part of the entire app, and the lifecycles are not directly tied.
Hence, we might want to quit Qt when the part of the app that has it
is not active, and restart it when the Qt part of the app comes
active again, and for this we need to create a new QtThread.

Set the QtThread variable to null when it has been terminated,
and if it's required again, create a new instance.

Task-number: QTBUG-130610
Pick-to: 6.8
Change-Id: I430e195fd319a20c9627ed98d6f30858cebc49c4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 7c7b63f3e85436125baf2211bc5e10556736241b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:34 +00:00
Tinja Paavoseppä
41047e8b2c Android: Separate JNI initialization from JNI_OnLoad
Currently, we create references to Java classes and objects
in JNI_OnLoad. However, that is done only once, when the
Android QPA plugin is loaded, and in case we would like to stop
Qt entirely and then start it again, we want
to reinitialize all these things. Move these initializations to
a separate method, and call it before starting the Qt runtime and
app.

Remove the synchronization block guarder by m_mainActivityMutex
in QtNative.startApplication(), as it calls startQtAndroidPlugin()
which now will call activity() if the JNI needs to be
reinitialized, leading to a deadlock as that method is guarded
with the same object.

Task-number: QTBUG-130610
Pick-to: 6.8
Change-Id: I826dfb9b032a6c615f2408d484d1f4f0ea528d02
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
(cherry picked from commit 9f8e49360c33d5fb8e39322f3abe9544d38baae6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:34 +00:00
Marc Mutz
e54ece9dbb QSet: remove misleading bool comparison with 0
Q6Hash::remove() returns a bool, not an integer, like Q5Hash::remove() did.

Pick-to: 6.8 6.5
Change-Id: Ia2907c7a2a4177f9b5ad05ca1ef3b9a5baa8137a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 441a96ba16794dc8621219be705800480654e9e8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-17 01:43:30 +00:00
Ahmad Samir
e26acf0f27 Replace qdebug.h include with forward-declarations in private headers
Only one header so far.

Amends 731538fdd469452e721b568fcbd808b437332008.

Pick-to: 6.8 6.5
Change-Id: I7449b4f91d8b44f4efab71d4d0fe259022d847a4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 22ab256e37e34988bdd405782ad09bb3eed37bf3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 20:44:59 +00:00
Ahmad Samir
099fcbb56d Remove unused qdebug.h include from private headers
Change-Id: I03c951d03ab2410298878d0689c0d50bdd4eedf2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9a1260e3f9fecf3d47cf4f3ad658becd752562f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 20:44:55 +00:00
Liang Qi
a46cb99c69 widget: clear WA_OutsideWSRange when needed in QWidgetPrivate::create()
which follows the behavior in QWidgetPrivate::setGeometry_sys().

Pick-to: 6.8
Fixes: QTBUG-129698
Change-Id: Ia85e9470111eea9e3392cdf38c3da2db232ef065
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit def4f827da98d3027c86a8dae27811729767d36a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 20:43:43 +00:00
Volker Hilsheimer
ef2207ae48 API review: add revision and docs for QWindow::safeAreaMarginsChanged
Change-Id: Ie43915510449880bc5a054b9cea7fdd8f48db9b9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 4d31372a869d6734258eb7c081375581b367759e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 20:43:36 +00:00
Thiago Macieira
37dbdd9b58 QCoreApplicationPrivate: use std::unique_ptr for origArgv
Change-Id: Id03feb55d3c3899aa4fffffdc0b3ee7b0742f9e8
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 981c2e8b746a9fb41164e6911d1609119bf1c600)
2025-01-16 12:42:25 -08:00
Thiago Macieira
b9e8a966ea QCoreApplicationPrivate: use NSDMI to initialize the members
This removes the need for #if in the initialization list and the ugly
whitespace-before-punctuation syntax.

Change-Id: Id33ec83e574360f65c9bfffd22b8cb450156477b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit f68df05a77afd58d60a80b16bd062d0e9e6d42a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 20:42:18 +00:00
Ulf Hermann
a256dba802 Core: Remove duplicate QtPrivate namespace
The logging category macro already puts the logging category into the
QtPrivate namespace. There is no need to wrap it into another QtPrivate
namespace.

Fixes: QTBUG-132111
Change-Id: I99a7aa16662e3515c5f96d6736d47c1d0e45034c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4f05eac0a88959ff0faa4d6b194d9dd8eeb3f4b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 19:41:44 +00:00
Wladimir Leuschner
a2b68996b2 QWindows11Style: Make disabled menu item non-selectable
QWindows11Style inherits the stylehint policy for
SH_Menu_AllowActiveAndDisabled from QWindowsVistaStyle, although the
inactive selection is not visible. This patch makes disabled menu items
non-selectable.

Pick-to: 6.8
Change-Id: Ib59988cfad444f9f8203628d4b3e1f72d6775b46
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3f42d2baacf3d227a001e49d74ea97f7ab551ae1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 09:27:22 +00:00
Eskil Abrahamsen Blomfeldt
3780e0edc1 Support COLRv1 fonts in Freetype backend
COLRv1 fonts are not automatically rendered by Freetype, but
is currently gaining traction and the default emoji font on
Android 15 is in this format.

What we get from Freetype is a scene graph that we can render
ourselves. This patch implements a recursive renderer for the
graph.

One current limitations is that conical gradients are not fully
compliant with the spec. I have so far not been able to find
any fonts where conical gradients are used, so this is left
as a semi-supported feature for now. It's certainly not
needed for the Android emoji font.

Pick-to: 6.8
Fixes: QTBUG-130909
Fixes: QTBUG-131116
Change-Id: I2484743602ad16f01318ecd6de2b245b38a8f566
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 9e5887a5d4f2344aa5f62325be9d63ff3d8f18db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-16 06:50:44 +00:00
Christian Ehrlicher
ce1a9d8bc9 WindowsTheme: Draw icon overlay manually instead of relying on the api
Fix drawing the link overlay icon - we must not set the device pixel
ratio here as we don't know the exact value.
Also fix some styling issues introduced with the previous commit.

This amends fd7bc16e9fbdc63bd22ba90d0c20b36ccffd2bae.

Pick-to: 6.8
Task-number: QTBUG-131843
Change-Id: I382527d17e8187bfae7cf40f352e6f87965671a1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f4b64f9c12a6351008a08bfeb4540481edf9f1d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 16:24:37 +00:00
Isak Fyksen
842f433471 Replace QPair/qMakePair with std::pair in qtbase/gui
Task-number: QTBUG-115841
Change-Id: Iebd96760ff7b3d7674816553312ba8dc3229c86a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit caf22e481d41d09d608cf1c94dfb740c419d81db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 12:38:06 +00:00
Alexey Edelev
49bf0afdc7 Move qt_internal_sort_android_platforms to public android helpers
The function is used in semi-public API and should in
QtPublicAndroidHelpers.cmake.

Amends de40931eba2cf09a8c97c9a75c6d23c77748f44c

Change-Id: I3946ecb091584ac5406b3eb4d2024210398f26a3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b0dc47aa447beaf4ab4bad39edeae06275c48f74)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 12:38:01 +00:00
Isak Fyksen
2b2271bea3 Replace all QPair/qMakePair with std::pair in qtbase/widgets
As a drive-by replace QList::append and operator<< with emplace_back,
to avoid repeating value_type.

Task-number: QTBUG-115841
Pick-to: 6.8
Change-Id: I6fb790f959b41b0feb49e3a0f0b6b3631e24a232
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 71d114588d9312e89195a32357ec402fc22b062e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 12:37:49 +00:00
Topi Reinio
562e74e3b4 Doc: Modify \tabcontent..\endtabcontent macros
QDoc markup following the \tabcontent macro should start a new
paragraph. As HTML-specific macros are injected directly into
the output, QDoc's doc parser is not aware that the macro should
start a new paragraph.

Turn the macros into generic, non-format-specific macros,
expanding to \div and \enddiv commands that wrap the tab
content.

Pick-to: 6.8 6.5
Change-Id: Ie8313af391b1a38ef74592acac3198fef5b7b310
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 5c0b08a20dd14f7fd8632495aa911fe427f58f7f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 12:37:46 +00:00
Alexey Edelev
697b769360 Small _qt_internal_find_tool_dependencies optimization bit
Set __qt_${target}_find_package_args once per the
_qt_internal_find_tool_dependencies call. It doesn't make sense to call
set it in loop, since variable doesn't depend on loop parameters.

Pick-to: 6.8 6.5
Change-Id: Ia1024625b870364a1db8e07f61bf7ea6ab4e9f84
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 80932ed80b5ec809b42be63c8f719290da56f288)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 12:37:43 +00:00
Giuseppe D'Angelo
3fda22bd8a Tasktree: fix FTBFS due to unique_ptrs on forward-declared classes
Some classes have circular dependencies:

* RuntimeIteration depends on RuntimeTask
* RuntimeContainer depends on RuntimeIteration
* RuntimeTask depends on RuntimeContainer
* TaskTreePrivate depends on RuntimeTask
* RuntimeContainer depends on TaskTreePrivate

Although there are a few std::unique_ptr deployed, the code at the
moment does not fully solve the problem: the classes have an inline
destructor, and the dependency has only been forward declared, resulting
in a build error.

Make some destructors out-of-line, and define them (as defaulted) late
enough so that all the graph of classes has been seen, in order to fix
the build.

Pick-to: 6.8
Change-Id: If150b92154061e915ebac920806717d2288c0638
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 71e53405a309684e4adcb8669a5f3d04319ad767)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 12:37:32 +00:00
Cristian Le
1ae6883162 Fixup: Add *_check build targets for auto cmake tests
- `PARSE_ARGV` should have been 1.
- `module_includes` target needs to be unique
  See gerrit comment of previous change, and
https://gitlab.kitware.com/cmake/cmake/-/issues/26580

Amends: 8f2f4ad4688df4963982c489c80b84e115cda29d

Pick-to: 6.8
Task-number: QTBUG-98640
Change-Id: I82b85813f282ba1d5b4c938e59558e32647d4d86
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9f805b5bf7dc61a032a7ec79fd514c932103f1de)
2025-01-15 13:37:25 +01:00
Cristian Le
566db56dd3 Add *_check build targets for auto cmake tests
Similar `*_check` targets are created in `qt_internal_add_test`.
This change extends that implementation to auto cmake tests.

Note: These generated targets do not have additional dependencies, on
the build targets, unlike those generated by `qt_internal_add_test`.
You would need to (re-)run the build first separately and then run the
`*_check` target.

Fixes: QTBUG-98640
Pick-to: 6.8
Change-Id: I387f09570b6a4a345756133870c2eb9ef1cf3cf8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 8f2f4ad4688df4963982c489c80b84e115cda29d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 13:37:24 +01:00
Alexey Edelev
bead73f2f3 Fix restoring of CMake environment in _qt_internal_execute_proccess_in_qt_env
Use the correct variable name when restoring the environment.

Amends e388c1caeb1ccdb88b9a9801be9cd6328d8a7987

Task-number: QTBUG-128420
Pick-to: 6.8 6.5
Change-Id: I03ee3481a4638969edd75ce6ad233e8a94d5c563
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ccbec262c220cbe990a68611e39dca9662b71777)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 12:36:49 +00:00
Ahmad Samir
11f94598da Replace qdebug.h includes in public headers with forward-declarations
qdebug.h includes many Qt and STL headers, so if you include a Qt header
you get all those transitive includes, which may affect build time.

- Where appropriate use the printf-like syntax of qDebug() and co.,
  these don't need the QDebug streaming operators
- qfloat16 is used in an inline member function, so include it
  explicitly

[ChangeLog][Potentially Source Incompatible Changes] Various Qt public
headers don't include QDebug any more; if you need QDebug's streaming
you'll have to include it in your code.

Task-number: QTBUG-132439
Change-Id: I750587e17a3b38fa226cd3af8eaccc8da580f436
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 185cba6e95a006d2548f20599f84390e5a3ad653)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 11:28:28 +00:00
Michał Łoś
1a98e24d0c Skip QResourceEngine cleanupTestCase on VxWorks
COIN is using patched std::optional header for VxWorks, which is based
on 23.09 version of this system, and fixes few compilation and runtime
issues, unfortunately it introduced runtime error as well. This error
causes std::optional to not destroy contained object in destructor,
which is a source of fail in tst_QResourceEngine::cleanupTestCase().
This fail was quieted down using QEXPECT_FAIL for VxWorks, due to exact
reason being unknown at the time.

It was found out that unpatched version of std::optional header in
VxWorks 24.03 fixes most of issues found in 23.09, so there is no need
to use old header. Additionally it cleans contained object in destructor
properly, so this is the one that should be used. In order to use it,
COIN will need to refresh VxWorks images, but this in turn will fail
this test with XFAIL.

Replace QEXPECT_FAIL with QSKIP in tst_QResourceEngine::cleanupTestCase
for VxWorks, update comment accordngly.

Once unpatched optional version from VxWorks 24.03 will be used on COIN,
skip will be removed entirely.

Task-number: QTBUG-130069
Change-Id: Ib446d04b2fabb027dad7af909ac00b7b30e76b53
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a10acaca0887541207ad5607680d7864d317cf4b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 10:24:22 +00:00
Assam Boudjelthia
c465681a86 Android: use the correct ABI folder to load uncompressed libs
It's possible that the first ABI from Build.SUPPORTED_ABIS would return
an ABI that's not packaged in the APK, for example if an armeabi-v7a APK
is run under the device supporting arm64-v8a, in that case the returned
path would be that of an arm64-v8a while it's not actually packaged
inside the APK.

Fixes: QTBUG-132155
Change-Id: I0f311accee246fa2d1d0b8aaf424d034b4b2d04c
Reviewed-by: André Klitzing <aklitzing@gmail.com>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
(cherry picked from commit a5f80b4732d33dd36414a6ffbd49a9efc7c87a0a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 00:11:09 +00:00
Eirik Aavitsland
d968aacde1 Update bundled libpng to version 1.6.45
[ChangeLog][Third-Party Code] libpng was updated to version 1.6.45

Pick-to: 6.8 6.5 5.15
Change-Id: I8e3f7c889608e8071888239ed0b6003911d1a39f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit fd6f593c7ffb67566b8efbe1b657dd7824f3b9e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 22:56:24 +00:00
Edward Welbourne
ee65d651a4 Add tests that zh-TW now correctly prefers zh-TW over zh translation
The bug, QTBUG-121418, was actually fixed earlier by commit
84afaafc9c6968dd76fcadc5392065d340543521 (or, for 6.8, commit
8c40e8cf12bb931149367677c56816864265249c), but escaped our attention
at the time.

Fixes: QTBUG-121418
Pick-to: 6.8
Change-Id: Ie24eb172674189079aede7a39584ea760aac1b0c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 12f8ebf5cbdc9089564a93001926d20908bd1785)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 22:25:02 +00:00
Ahmad Samir
6d0f277a40 Every private header should include at least another private header
To get qversiontagging_p.h included. See:
https://codereview.qt-project.org/c/qt/qtbase/+/494388/comment/fed896c4_9e7cae6e/

Pick-to: 6.8 6.5
Change-Id: Ifcc7f9cb0ed57f1af9d3283309498546a81fbb17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 16fc1e07784e294cdd75bbab216c2479ae171221)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 17:57:56 +00:00
Giuseppe D'Angelo
c82464ea75 QShortcut: fix build under QT_NO_CONTEXTLESS_CONNECT
QShortcut has a constructor that takes a _parent_ object and a
function to invoke, and it will internally connect its activated()
signal to that function. This connection will not provide a
context object (the parent is not used to this purpose).

Given it's not clear what the context should be if any (the parent?
`this`?), I'm not at ease at just supplying "something" as the context.
Instead, hide the constructor if we're under QT_NO_CONTEXTLESS_CONNECT.
There's another constructor where the caller can supply a context.

Change-Id: I21befcc86eeb07e65eadee1222757ecc5bab1d2c
Pick-to: 6.8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ade3bb1c5224a9155a2a2f965fa70740aa9ec8a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 17:57:54 +00:00
Eskil Abrahamsen Blomfeldt
37c389c779 Implement COLRv0 support in Freetype engine
COLRv0 fonts are both scalable and in color, which was not
previously handled in the Freetype backend because it only
supported color fonts with embedded bitmaps. This patch
simply correctly detects the scalable color fonts and
render them through the same mechanism as other color
fonts.

[ChangeLog][Freetype] Added support for COLRv0 format color
fonts.

Pick-to: 6.8
Task-number: QTBUG-131116
Change-Id: I290e7525c24b4cf2ec872a366e5193f54712a3a4
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 39df9e1858a4115bc19b6a4dee5d687c5ee00d21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 14:16:58 +00:00
Giuseppe D'Angelo
72d0b8f709 QStringConverterBase: make it move-only
The class declares a protected destructor, which interferes with the
RO5. The only subclass in qtbase is move-only; QTextCodec (in
Core5Compat) is not even movable.
Make QStringConverterBase move-only as well.

Pick-to: 6.8
Change-Id: I20d16df79f7ad8e7e7a8af339954cfa2d1482e96
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit eb533c81b8aa55f89605bb1d091afe4df4db763c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 12:34:56 +00:00
Piotr Wiercinski
f7efdfac36 wasm tests: Add option to run Chrome in headless mode
Running Chrome in headless mode helps to circumvent
a lot of issues with GPU driver/Wayland interactions
that we encounter in CI.
Run Chrome in headless mode if corresponding environment
variable is set.

Change-Id: I1cf290f484054766e2b99d99045e7b39d5662210
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
(cherry picked from commit 213a2610d821b93429d6519dda11ab0e7b5cae84)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 12:34:54 +00:00
Ahmad Samir
92afa1eaf8 network/*/removed_api.cpp: include qdebug.h explicitly
Since the removed API uses QDebug. Requested in code review.

This is needed for a subsequent commit (removing qdebug.h from public
headers when possible), but I split out to its own commit to ease
backporting.

Pick-to: 6.8
Change-Id: I76980634b9ebbae7cf010d99f5095aa94a825824
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit c0fcb2db242a40cdcc2bbfd00332390b64cab439)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 12:34:52 +00:00
Jøger Hansegård
99d401220c Compare QUniqueHandles using comparesEqual and compareThreeWay
This fixes an issue where comparing pointers to object is only defined
if both pointers point into the same array.

Task-number: QTBUG-132507
Pick-to: 6.8
Change-Id: Ib7ccb30001add38ad25b62c848a01cd53566d8bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5dcdeeebbc08be8845cdb5a0e586b7a864b7f16f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-14 07:20:13 +00:00
Mate Barany
3fa33cf1f1 Update qtimezonelocale_data_p.h with correct CLDR v46 data
The data for the CLDR update was generated from an incorrect xnr.xml
that has contained an extra &lt; and hence the generated
qtimezonelocale_data_p.h is also incorrect.

Update qtimezonelocale_data_p.h with the correct CLDR v46 data.

Task-number: QTBUG-130877
Change-Id: Ibc87e137b1519be470704ed519c0988333625af5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 95abc38ba6e586c8e491593ebe4c4b4ee32a79e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 23:40:00 +00:00
Giuseppe D'Angelo
25296f86d6 QListSpecialMethods: honor RO5
This looks like another case of a base class with a protected, defaulted
destructor, which interferes with RO5. Explicitly redeclare the other
special member functions in order to suppress the warnings coming from
the deprecated copies.

Pick-to: 6.8
Change-Id: Icf8c8817ef001d0503683d071c4f004db64caa2d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit f6e99f347d243749af8d9beacd7c68852f0ff636)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 23:08:27 +00:00
Giuseppe D'Angelo
ac7ff59b6a function_ref_base: honor the RO5
I'm not entirely sure why function_ref_base declares its destructor. I
guess it's declared in order to make it protected, because the class is
non-polymorphic and inherited by function_ref, and one may want to avoid
slicing. On the other hand, function_ref_base is an implementation
detail, living in a `detail` namespace; so that sounds very unlikely.

In any case, the class is clearly meant to be copiable, so add back
(as protected) the missing special members.

Pick-to: 6.8 6.5
Change-Id: Ibf909e1746e65eecf8b8990839a6e4c9eb56ca13
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 74b875641f40b15a4a59a0c55cd79c251b49c05e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 23:08:21 +00:00
Marc Mutz
8c8dfce81e q(v)snprintf: fix a typo in the deprecation warning
Found in API review.

Amends afd0bb28fbac6d4c24c6785bff9c72bd56eaceb4.

Change-Id: I694dfc3f16ea90bca07a47c1d57ba1cf21b23f1a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8e75e1c1852fee22982cebe1f02cfeff4699aafe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 22:49:59 +00:00
Christian Ehrlicher
b7e0a7bfde Windows11Style: adjust size of flat buttons
Flat buttons were larger than normal buttons - therefore also add
marginsRemove(QMargins(2,2,2,2) for the flat case too.

Pick-to: 6.8
Task-number: QTBUG-132433
Change-Id: Id010d45bf85c5d7d09ff8db8bda44b1be7d85297
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit a930fb758d71ef6bf353e8fd8078de2335c32085)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 22:49:58 +00:00
Ahmad Samir
936992c404 Remove unused qdebug.h includes
Change-Id: I09ad5987bde71ca37c7869c4dd63fb4f41c707ea
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 8a2cb53b3710b333653bea5554713b84e3980fdc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 20:27:15 +00:00
Ahmad Samir
27f16490fa Include climits explicitly instead of relying on transitive includes
Pick-to: 6.8 6.5
Change-Id: Ib55b337aa6e0a93c7ac7ee9bf492784cc81808d7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 158f2c95c8b69f586bd1155fc5993bdb61f76e77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 20:27:15 +00:00
Tor Arne Vestbø
33b0661cc6 tst_Q*Application::runHelperTest(): Run test without activating app on macOS
As that will steal focus from tst_QApplication, which is needed for
subsequent tests.

Pick-to: 6.8
Change-Id: I5720c4a2bb45f98894616e01da10b9c40a2b6735
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8de8800670d2881c6dfe957d6a1c5d925417b85c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 20:27:15 +00:00
Piotr Wierciński
06ab82d945 wasm: Add helper for pluging preloads
Dynamic linking on WebAssembly involves preloading .so libraries
during startup of application. Normally, those plugin preload
lists are generating manually by user, which can be tedious.
Add a bash script which demonstrates how to call python
programs to generate preload lists.

Change-Id: I0a9869ad0d26606f8b33af2c38248cec3088dd0d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 010ed1788402bf98d9b98500fdb1f61c333cebe5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 20:27:15 +00:00
Tor Arne Vestbø
e50b0337e9 tst_Q*Application::runHelperTest(): Disable CFLog spam on macOS
Otherwise the "+[IMKClient subclass]: chose IMKClient_Legacy" log
spam will break the test.

Pick-to: 6.8
Change-Id: Iccfb46204394bbc1b084de4b1e7b2f1ea6b4f05b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f411ac4752b3ab77f6ce44f005af558ccf1dd503)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 20:27:14 +00:00
Ivan Solovev
652fe10689 Use [[noreturn]] on QCommandLineParser::showMessageAndExit()
... instead of Q_NORETURN, as the attribute should be unconditionally
available since C++11.

Amends bad618606d64e943e3fa78e7d1dbc8e1fab55480.

Found in Qt 6.9 API review.

Change-Id: Ia008acf0777867f551c7e1cc3423f29f8ed6fbed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8472004a895fa98e68f6f3ff134720904a00c150)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 20:27:14 +00:00
Edward Welbourne
cf9e8434eb Remove constexpr from a function that doesn't need it, and asserts
The call to q_assert() isn't constexpr, so can't happen in a constexpr
function. Most compilers shrug this off as they can see the code
actually is unreachable, but apparently debug builds on QNX can't work
that out. Since nothing actually needs the function to be constexpr,
remove that qualifier. In the process, move the offset-case, which is
also unreachable, to the end of the switch, closer to the unreachable
end of the function (since I failed to spot that there were two
unreachable parts at first).

Pick-to: 6.8
Fixes: QTBUG-132698
Change-Id: Ibdde7abd91d284e1c1af53e2b5e142fc234400a8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 2578d72a7cb9b784a00efb04df6a31496d92dcdc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 16:56:38 +00:00
Moss Heim
aa494a4de7 CMake: Fix typo in comment
Pick-to: 6.8
Change-Id: I6151bd27d5310ac153c7c2c8fbb97a9de68a4f01
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 21bd32b2cc8995d8624cd0fea6f6685827c741c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 15:38:58 +00:00
Volker Hilsheimer
e09afd3cc0 QFontVariableAxis: add debug stream support
Was missing from this new value type, and is quite useful for this type.

Addresses API review comment.

Change-Id: I07ea7ded7f963b2032c377f024bb88e9d54a4d5c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b562c36a9a7be5f62a8e79b93c9728381775f460)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 15:38:57 +00:00
Thiago Macieira
b7711eb94c Bootstrap: remove QSystemLibrary and QWinRegistryKey
They're unused.

Change-Id: I781690cca811cdbab757fffd30b64fccb197ef46
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 2d2cba103f1b0ed3151660aadd8c717c172207e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 15:04:36 +00:00
Soheil Armin
2b14b70b43 Android: Fix synchronization issue of QtAbstractItemModel and its proxy
Java methods of QtAbstractItemModel may get called from Qt GUI thread or
Java main thread. Situation is the same with internal proxy methods,
where they may directly or indirectly called from these two thread.
At the same time, a chain of calls may happen from these threads, so
some functions may get called indirectly from a single caller thread.

In this change, we are adding a map of QObject* to QRecursiveMutux
where the QObject is a QAbstractItemModel, either the proxy instance
or a reference to an underlaying QAbstractItemModel when the model
is implemented in C++.

Each call to any function locks the QRecursiveMutux instance associated
with the QAbstractItemModel instance. A connection from
QObject::destroyed to a lamda, helps to remove the map entry when
the model is destroyed.

Pick-to: 6.8
Fixes: QTBUG-127467
Change-Id: I18dcdc207e201b3883526648b4e672e5868ed8ab
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit bf76387507dde71063ebe484bce1e7d1b8e09bc2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 13:14:58 +00:00
Ivan Solovev
be31cbfce8 QThreadStorage: move includes to the top
The qthreadstorage.h header contains two implementations controlled by
the QT_CONFIG(thread) definition.

Commit 8553ffd8d147ecf6a713d12a360027b477dd59c8 changed the positions
of the namespace macros in the header, but didn't consider the fact
that we now include std and Qt headers inside QT_NAMESPACE in the
!QT_CONFIG(thread) case.

Fix it by moving all the includes to the top, and wrapping them in
the needed QT_CONFIG() checks. As a drive-by, drop the unused
type_traits include.

Found in Qt 6.9 API review, but picking down to 6.5, as that's what
the original commit did.

Note that 6.5 cherry-pick will require to replace <memory> with
QtCore/qscopedpointer.h because
6da1f72311b844b2232da3067ad6e1e24614e67c was never picked to that
branch.

Pick-to: 6.8 6.5
Change-Id: Ic9c5fe82df38a3bd64829c016de8dcbd9f060315
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4a6ef7fc6881c7b5ab0b9f6d51a2738ce86cca93)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 11:48:35 +00:00
Ivan Solovev
fb1d47b93e Do not export QFontVariableAxis wholesale
This is a non-polymorphic class, so explicitly export only the
out-of-line methods.

Amends cc128d802c6d9c87a1e00a8a88d5e6590a7195f4.

Found in Qt 6.9 API review.

Change-Id: I30af1121bce1ba9c57cb326cffb1375ac3b22195
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 5f7149e3590e3c2e829f5a843feebe357c42ca67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 11:48:33 +00:00
Wladimir Leuschner
840cf0a43a QWindows11Style: Increase QComboBoxSize and align subline
Increase the size of QComboBoxSize and align the subline for editable
QComboBoxes with the begin end end of the rounded corners.

Task-number: QTBUG-132261
Pick-to: 6.8
Change-Id: I235ec1ceb94a5e87f373b007ac31d0d8a83cf600
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 23c16c611cfeee55ce38e928989b346c697270b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 05:32:03 +00:00
Wladimir Leuschner
f8adee805b QWindows11Style: Decrease bottomline frame thickness for QToolButton
Decrease the bottom line frame thickness for QToolButton by using
fractional coordinates.

Task-number: QTBUG-132261
Pick-to: 6.8
Change-Id: I77a3acdd20c694dce38d809db9c3051949a98fa3
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 3e9baca7d2197bfc10d20de6f326e2749a8f781e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 05:31:45 +00:00
Marc Mutz
2c4756af80 QDebugStateSaver: port from QScopedPointer to unique_ptr
In preparation of adding QT_NO_SCOPED_POINTER, which would be rather
pointless for users if public headers continued to mention the type.

Pick-to: 6.8
Task-number: QTBUG-132213
Change-Id: Ib5a40a1b8defe1cfe858218bb25c422f900dfe6b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c5a4e3f790eb4157e33eac2402110f71a76a5418)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 00:43:44 +00:00
Marc Mutz
cddddd753c QSpan: don't detach Qt containers
When converting an implicitly-shared Qt container to QSpan, the QSpan
ctor would call .data(), which detaches said Qt container (if it's not
const). This is what must happen for mutable spans (QSpan<int>), but
is not necessary for non-mutable spans (QSpan<const int>).

Fix by copying the potential const from QSpan::element_type to the
Range object in the resp. QSpan ctor. This makes a QSpan over a const
element_type mark the range const before passing it to adl_data() (=
member-data()). For a non-const element_type, nothing changes.

[ChangeLog][QtCore][QSpan] No longer detaches implicitly-shared Qt
containers converted to QSpan<const T, N>. Note that std::span<const
T, N> will, however, detach such containers, so we recommend to use
std::as_const() with implcitly-shared Qt containers, as always.

Fixes: QTBUG-132133
Change-Id: I9fdae20994d2c900bc5b45b44db3901d10f8838a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 287234704b57e171c786ba8df0b93c49edb903c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 00:43:42 +00:00
Giuseppe D'Angelo
37a553a3a5 QException: honor the RO5
QException has an out-of-line destructor in order to pin its vtable.
But like any std::exception subclass it's meant to be (and effectively
is) copy-constructible and copy-assignable (cf. [exception]/2).
Add the missing copy operations, and the default constructor.

One may argue that this class should use some other approach since it
also has a polymorphic clone() -- for instance disable assignments and
make copy constructions protected -- but that ship has sailed.

This prevents a Clang warning about the deprecated copies in the
presence of a user-declared destructor.

Change-Id: I4d8613ade265ea85a5a7e97255b75b7fcf3e5a27
Pick-to: 6.8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 793309693aac24e7f88fc225408d92def638996e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-13 00:38:20 +00:00
Thiago Macieira
6ce164b3e0 QThread/Unix: move the pthread_key to a file-scope static
So that the pthread_key is destroyed much later than now, at QtCore
unload time instead of a bit earlier in exit(). That's important so it
runs later than the Q_DESTRUCTOR_FUNCTION for QLibraryStore
(qlibrary.cpp), which is what unloads plugins, whose unload-time
destructors may be attempting to quit() & wait() for their worker
threads.

I had to keep the destruction of the exiting thread's adopted thread
where it was: a function-local static's destructor. As noted in the
comment added by 1da7558bfd7626bcc40a214a90ae5027f32f6c7f, we need
QThreadData::cleanup() to run before the libraries start to unload
because we need to delete the event dispatcher.

Init priority 10 will place it after the QHash random seed and qsimd
initialization, on ELF systems and on Windows. On other systems (incl.
Apple ones), the order probably depends on the order of the files in the
CMakeLists.txt. I thought that would mean the destructor for thread/
would run before plugin/ but that apparently is not the case. But that's
fragile.

Amends 1da7558bfd7626bcc40a214a90ae5027f32f6c7f, which amended other
things...

Fixes: QTBUG-132697
Task-number: QTBUG-102984
Task-number: QTBUG-132381
Pick-to: 6.8
Change-Id: Id7263d6ffe7a5949cd84e35d942ad0e02df1b455
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 2f69a05bd0cd7ce63890f709ff3ed7a4f78acd70)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-12 17:40:00 +00:00
Thiago Macieira
ea6d467c05 tst_Q*Application: add tests for unusual qApp creations and exits
This commit adds one unusual creation and three more unusual exits:
* creation of the Q*Application in a thread (QTBUG-130895)
* exits using ::exit() instead of returning from main():
  * from the main thread's event loop
  * from an auxiliary thread
  * from inside an auxiliary thread's event loop

All of these exercise the moment the QAdoptedThread & QThreadData for
the main thread is destroyed, which are, respectively:
* thread exit time, running thread-specific destructors
* inside exit(), running atexit()-like callbacks (qthread_*.cpp)
* [tst_static_q*application] inside exit(), running static destructors
  (added in commit 1da7558bfd7626bcc40a214a90ae5027f32f6c7f)

Unlike the tst_static_q*application tests, the calls to ::exit() cannot
be a regular QtTest because that would cause the log output to be
incomplete. The threaded Q*Application could be a test of its own, but
since I needed to add the helper anyway, I chose to add the test there.

For the majority of the tests, the failure mode is going to be a crash
on exit.

Task-number: QTBUG-12673
Task-number: QTBUG-132429
Pick-to: 6.8
Change-Id: I1062ef500356bd97dd0cfffda4aeeda9afa138e8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit bfbd1a281dd00c47df315c06e895bf5d53cd8764)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-12 17:40:00 +00:00
Christian Ehrlicher
2bb83f6b16 QIcon: don't search for high-res svg icons
There is no need to search for high-res svg icons - a svg scalable by
design. Also the QSvgIconEngine does not support it.

Pick-to: 6.8
Change-Id: Ib76c887900ce77268e9c0253cb697b8de9e7f10e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c64774eef72411029f7c2fb611328f25b83ff8ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-12 09:05:44 +00:00
Tor Arne Vestbø
197a46313d coin: Ignore exit code of LastTest.log copy if COIN_CTEST_IGNORE_EXIT_CODE
If COIN_CTEST_IGNORE_EXIT_CODE is in effect and ctest aborts for some
reason (for example due to the workitem being cancelled) the ctest exit
code will be ignored, as expected, but we will not have a LastTest.log
to copy, which will fail the workitem unexpectedly.

We now match the ignoreExitCode of the LastTest.log copy with the ctest
run.

Change-Id: I9df0f863a42dd4cf25cee1694e85cb32058a4e5b
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 0e2067334d58787464a3554730042dba37413c6d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 14:02:54 +00:00
Marc Mutz
58221c1955 QTemporaryFile: fix incorrect info about duplicate placeholders
The docs said only the first placeholder would be considered; in fact,
it considers only the last.

Fix the docs and add a test (also for QTemporaryDir).

Amends b4bb4449aea7592afdb9b9134bb90c40fe29735a.

While 6.6 and earlier are unaffected by the incorrect documentation,
pick this to all active branches in order to verify the behavior is
the same everywhere.

Pick-to: 6.8 6.5 6.2 5.15
Fixes: QTBUG-132597
Change-Id: Ia7a37f714f834191b07420d31ca9024702b537cc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e7abbc7bf3ab06359b2847b1e1a46c38d8bc6581)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 08:48:30 +00:00
Alexandru Croitor
0cb2413219 CMake: Fix sbom git vars not being available in various scopes
Initially the git vars were assigned to the parent scope of the
_qt_internal_sbom_begin_project function, with the intent to set them
in the global scope. But the function was later wrapped in other
functions, so the variables stopped being accessible.

Instead of playing with recursive PARENT_SCOPEs, save the variables in
global properties like we do for other info, and use a new
_qt_internal_sbom_get_git_version_vars() function to query the vars in
the code that needs them.

This fixes generated purls to contain the git version and hashes.

Also add a new internal API wrapper macro called
qt_internal_sbom_get_git_version_vars to allow calling it
in other repos.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I061b34f418c1ecc1c66c8c01ef758d2f40611ede
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 41a92bf6f1486259ef25db775520cba647e1cc15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 08:48:30 +00:00
Alexandru Croitor
65b1756d01 CMake: Split SBOM implementation into separate files
The SBOM implementation got somewhat large. Split the code into
several new QtPublicSbomFooHelpers.cmake files, to make it more
manageable.

No code or behavior was changed.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ia0ca1792eec21d12c4bb4cabe63279e1f5c07e3d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 27d2b54b5d2bc5a69edc2de703b2ca34cb2637dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 08:48:29 +00:00
Christian Ehrlicher
3536eb32bf QStandardItem: correctly set model during insertRows()
When calling insertRows(), the model of the child items was not
correctly updated. insertRow() is behaving correctly.

Pick-to: 6.8
Fixes: QTBUG-131372
Change-Id: I8b6aef7ab97887c6eb46eb21b992d76e4d59b3a0
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 5bab8448feb2661f871e71d71a95afaffcb1656a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 08:48:29 +00:00
Marc Mutz
3660ff9ff8 tst_QSaveFile: QVERIFY the commit() return value in symlink() test
It's kinda is important to verify that commit() worked; all the
follow-up tests assume it, so wrap the calls in QVERIFY().

Amends 7e5e7eeaa1418d959906cdf9d717c984c9fc7a7e.

Pick-to: 6.8 6.5 5.15
Change-Id: I01185d65a5ec06ed122e59c43d9cdcc3a7157259
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 97fe38ff0d1e60f92c0bfa6fb3571a0433e60352)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 00:04:16 +00:00
Marc Mutz
b2dad9724d tst_QSaveFile: mark a QString const
To ensure we don't overwrite it in this quite long function.

Amends 7e5e7eeaa1418d959906cdf9d717c984c9fc7a7e.

Pick-to: 6.8 6.5 5.15
Change-Id: Ie5f81b50d2d66ba9e064810f8cbc1a7af298cc2b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 67a906b5564a1ccf03e547aa78fc6fd910d9cd15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 00:04:09 +00:00
Marc Mutz
ab9021e2d6 QSaveFile: mention that you need to setFileName() before open()
... in the descriptiong of the (QObject*) ctor.

Pick-to: 6.8 6.5 5.15
Change-Id: I1b8a788eff1fbb50134b51de7d9ee8f7cb2af785
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6397dac97962e40104e6a94bc147e093af8186e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-11 00:04:03 +00:00
Alexandru Croitor
3ee0cb32e0 CMake: Fix LINK_LIBRARIES not being properly processed for SBOM
There was a typo in the link_libraries variable name, where an upper
case 'L' was used instead of a lower case 'l'.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: I206a161107cf7510856ad8740dada88e12341e94
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2affe46b2543f7d2de1939e049a0d783b5a7dcfb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-10 17:30:19 +00:00
Alexandru Croitor
7d0b4be42d CMake: Fix purl variant list iteration
The correct syntax is IN LISTS, not IN_LIST.

Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ibf64e48ffcf0b061887b7b015096d588b14bce57
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 4c5d9a3ca339f36f10922f9b1d5849fca1f2bdc4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-10 17:30:19 +00:00
Tor Arne Vestbø
b07580da56 macOS: Completely disable lldb backtraces in QtTestLib on Apple Silicon
They result in lldb hanging, which was previously only a case when SIP
was enabled, but can now be reproduced on macOS 15 even with SIP disabled.

 https://github.com/llvm/llvm-project/issues/53254

Pick-to: 6.8
Change-Id: Ifa09f8cf22522b5a1028db1f250ebe9e1543cf9d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 50d5914f28b535790f8eca6210adad24fe76940b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-10 14:49:26 +00:00
Tor Arne Vestbø
b04935ed9f macOS: Enable crash reporting for tests via Swift
Swift 5.9 includes built in crash reporting, printing stack traces,
libraries, and registers to stdout/err.

https://www.swift.org/blog/swift-5.9-backtraces/

As (Core)Foundation is written in Swift nowadays, we get this feature
for free even in our "C++" apps, as we always link to CoreFoundation.

To enable the feature the binary needs the com.apple.security.get-task-allow
entitlement, so we add it for all our tests automatically.

The final piece is to run the tests with SWIFT_BACKTRACE=enable=yes,
but we'll do this in our CI provisioning, as setting it from within
testlib doesn't seem to work.

Pick-to: 6.8
Change-Id: I31090efee06460f45522093e17f900e76590b282
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9bebdc97f161cc58461530fa0171e0defc6cc1ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-10 14:49:24 +00:00
Ivan Solovev
0db648ba3b QMetaEnum::valueToKeys: fix REMOVED_SINCE version
Should be 6.9. The entries in removed_api.cpp are already added to the
correct place, just the macro in the public header used wrong version.

Amends d41b87e06742b491c4e36aeae32e03f85b078d69.

Change-Id: I88749dbeb070206c42feb4ffc504f260f8857823
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit da799c20d763b5534152dca52fef12fda875acc2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-10 14:17:26 +00:00
Ivan Solovev
5e84f22a0a [docs] Fix a typo in the QColorSpace class name
That prevented qdoc from generating the docs for the fromPrimaries()
function.

Amends bde2292247bf4849852355c0dcc71f97c9daace9.

Found in Qt 6.9 API review.

Change-Id: I2f5c57a4dc4a437798907c64fb657c9fda61e0df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e2756158dcf87fea757475d711ac9cda20f42152)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-10 10:47:34 +00:00
Christian Ehrlicher
c74f0ccf15 QTreeView: fix Private::intersectedRect()
Don't try to update the left and right boundaries when no valid idxRect
was found.
Also fix the early exit check - we can exit when the idxRect is
completely below *or* completely above the current viewport.

This amends 2f9c72028d2481f587f378a256654d0a362e3d44.

Pick-to: 6.8
Fixes: QTBUG-132670
Task-number: QTBUG-124173
Change-Id: I51f9e12c66268318e597facfbe4df74367d1089a
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 9d4b5fa017199627a42477a842a4e1ef349bb1ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 23:20:17 +00:00
Alexandru Croitor
2220e447ca CMake: Fix file path in checksum computation to allow spaces
Pick-to: 6.8
Task-number: QTBUG-122899
Change-Id: Ica5f830e6d7ca9d8acbc13ebec543ee3cf96b3fe
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 242e29332373d91e1ffff344e1733bd38094606e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:47 +00:00
Alexandru Croitor
fafb4f11ef CMake: Use the $<VERSION> placeholder in qt_attribution.json
For all CPE and PURL fields where it makes sense, to avoid
duplication.

Pick-to: 6.8
Task-number: QTBUG-132181
Change-Id: Icd1c5267e4e9b582eea28150ebd1b2cca3852229
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 82dc92cb1b94de12761f23ad6ec27feb2aca43cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:41 +00:00
Alexandru Croitor
21815ae5e5 CMake: Replace placeholders in CPE and PURL strings in SBOMs
Replace instances of $<VERSION> in CPE and PURL strings read from
qt_attribution.json files with the version of the package being
processed.

This avoids duplicating the version in qt_attribution.json files in 3
different fields Version, CPE, and PURL.

Pick-to: 6.8
Task-number: QTBUG-132181
Change-Id: I91af17c82dbb936739f4811bf86043e00ee49a78
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit bc3bbb51b7b48d3c4a44a432441938863582242c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:34 +00:00
Alexandru Croitor
a32359a101 CMake: Add internal functions to get various kinds of spdx ids
These can be useful when adding custom relationships to the generated
SBOM document.

Sample usages could be:

qt_internal_sbom_get_target_spdx_id(Svg svg_spdx_id)
qt_internal_sbom_get_project_spdx_id(project_spdx_id)
qt_internal_sbom_get_external_document_ref_spdx_id(
    "qt5compat" document_ref_spdx_id)

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-129901
Task-number: QTBUG-131377
Change-Id: Idbd5c8bffece50871f995805b619226e32957866
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 97ac4053137c7d0ff5ec71de22cf8c0c7af7006a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:28 +00:00
Alexandru Croitor
97775f43a1 CMake: Add way to convert JSON SPDX to tag/value SPDX document
Add a new qt_internal_sbom_generate_tag_value_spdx_document function
that takes an input SPDX JSON file and generates a tag/value SPDX
file. This is needed by WebEngine to convert the Chromium JSON file to
a tag/value SPDX file so we can reference it as an external document.

To ensure the external document is found, we now always add the
current sbom build directories as install prefixes. This was
previously done only for top-level builds.

To ensure the converted external document is referenced only after it
is converted, it needs to be converted before any targets mention
packages from within it.

A sample usage might be:

qt_internal_sbom_generate_tag_value_spdx_document(
    OPERATION_ID qt5compat
    INPUT_JSON_FILE_PATH "${external_sbom_file_path}"
    OUT_VAR_OUTPUT_FILE_NAME external_output_file_name
    OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH external_output_file_path
)

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-129901
Task-number: QTBUG-131377
Change-Id: I5d5397f788c8c7960b6fc233c2868244e5816e0b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit b8f5e5f554c0c8b340b532b998fed5ef2a87eefd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:21 +00:00
Alexandru Croitor
5a878ca693 CMake: Allow adding custom SBOM relationships to targets and projects
Add a new SBOM_RELATIONSHIPS option to qt_internal_extend_target and
friends that allows adding custom relationships to the current target.

Add a new function qt_internal_sbom_add_project_relationship that
allows adding custom relationships to the current project SBOM
document.

A sample usage might be:

qt_internal_sbom_get_project_spdx_id(project_spdx_id)
qt_internal_sbom_get_target_spdx_id(Svg svg_spdx_id)

qt_internal_extend_target(Svg
    SBOM_RELATIONSHIPS
        "${svg_spdx_id} DESCENDANT_OF ${project_spdx_id}"
)

qt_internal_sbom_add_project_relationship(
    RELATIONSHIPS
        "${svg_spdx_id} CONTAINS NOASSERTION"
        "${svg_spdx_id} DESCRIBES NOASSERTION"
        "${project_spdx_id} DESCRIBES NOASSERTION"
)

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-129901
Task-number: QTBUG-131377
Change-Id: Ie0119ca71b047c7515e1deaf84a5a67ea01b5274
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit d079fdd76cf3f44181c6099b845ba9b41892740e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:15 +00:00
Alexandru Croitor
a33ce2a2ca CMake: Fix project spdx id used in implicit relationships
We shouldn't be using the direct project name in spdx relationships,
but rather the sanitized name which is prefixed with
'SPDXRef-Package-', to ensure sbom validation succeeds.

Also we should default PROJECT_FOR_SPDX_ID to
"Package-${arg_PROJECT}" if it's not set.

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-129901
Task-number: QTBUG-131377
Change-Id: I354babcf4fea5f6efd9b32422dd8d3835ef50f15
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit f086e72b7e6332412a7c87bc435398a0e3dee305)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:08 +00:00
Alexandru Croitor
31237ffd5f CMake: Add API to allow referencing external packages in the SPDX SBOM
This change modifies the existing implementation of the
external references API to have better named options and better
behavior.
It also adds comments and exposes an internal API wrapper around the
existing implementation.
It's meant to be used by qtwebengine to reference the
Chromium-generated SBOM.

As a drive-by, it removes the previously unused RENAME option.

A sample usage could be:

qt_internal_sbom_get_external_document_ref_spdx_id(
    "qt5compat" document_ref_spdx_id)
qt_internal_sbom_add_external_reference(
    EXTERNAL_DOCUMENT_FILE_PATH "/path/to/qt5compat-6.8.1.spdx.json"
    EXTERNAL_DOCUMENT_SPDX_ID "${document_ref_spdx_id}"
)

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-129901
Task-number: QTBUG-131377
Change-Id: I13d0fe4d803449bec42f8b454c8131e4d727669a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Moss Heim <moss.heim@qt.io>
(cherry picked from commit 9a3998692c10964a919942147d8d8035e878b167)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:34:01 +00:00
Alexandru Croitor
419979e0dc CMake: Add API to include custom cmake files during SBOM generation
Allow including custom cmake files at predefined steps of the sbom
generation using the new internal
qt_internal_sbom_add_cmake_include_step API.

This covers pre-existing steps like BEGIN, END, POST_GENERATION, and
VERIFY, as well as two new steps, BEFORE_CHECKSUM and AFTER_CHECKSUM.

A sample usage of the new API could be:

set(step_path "${CMAKE_CURRENT_BINARY_DIR}/run_some_cmake.cmake")
file(WRITE "${step_path}"
    "
    # This is a CMake script to run some CMake code.
    message(STATUS \"Running some CMake code...\")
    message(STATUS \"Done running some CMake code.\")
    "
)

foreach(step IN ITEMS BEGIN END BEFORE_CHECKSUM
                      AFTER_CHECKSUM POST_GENERATION VERIFY)
    qt_internal_sbom_add_cmake_include_step(
        STEP "${step}"
        INCLUDE_PATH "${step_path}"
    )
endforeach()

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-129901
Task-number: QTBUG-131377
Change-Id: I6f9512bf3a3bc3ebeb7d21426e5a3833280e42a5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8c754dcbb139ba83f033b3b3fc1d9edb8a909811)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:33:55 +00:00
Alexandru Croitor
6ed0b578a8 CMake: Add SBOM support for translations, custom files and friends
This change introduces a new SBOM API to add info about various kinds
of files to a target SBOM package. The new function name is called
qt_internal_sbom_add_files().

The motivating case is including SBOM information for qt translation
files, resources (e.g. webengine data files) and any other kind of
custom files.

A sample call might look like:

qt_internal_sbom_add_files(Translations
    FILES "${qm_files}"
    SOURCE_FILES_ONE_PER_INPUT_FILE "${ts_files}"
    FILE_TYPE "QT_TRANSLATION"
    INSTALL_PATH "${INSTALL_TRANSLATIONSDIR}"
)

While the motivating case is Qt-specific, the function implementation
is being somewhat future proofed for the not-yet created public SBOM
API.

The new API supports adding files to any target that is backed by an
SBOM package, so all targets created by qt_internal_add_module()
and friends, as well as ones created by qt_internal_add_sbom().

It can be called multiple times for the same target, with a different
set of files, to e.g. assign a different license, or file type per
file set. Note that the file set doesn't have anything to do with
CMake's concept of file sets.
The function is also multi-config aware, and allows specifying
different install paths per config, as well as generator expressions
in file names. But the multi-config support is a bit wonky, and might
need some rethinking in the future.

Note that the custom files must be installed and available in the
specified qt install path, because the file contents will be
checksummed at install time and embedded into the sbom document.
Calling the new API does not do installation itself.

Implementation wise, the function call flow is
- project calls qt_internal_sbom_add_files() one or more times
- at finalization time, the _qt_internal_sbom_add_target finalizer is
  called for a target, which then calls
  _qt_internal_sbom_handle_target_custom_files()
- the latter calls _qt_internal_sbom_handle_target_custom_file_set()
  for each file set that was added to the target
- the latter calls _qt_internal_sbom_handle_multi_config_custom_file()
  for each input file in the file set, which ultimately calls
  _qt_internal_sbom_add_custom_file()

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-128320
Change-Id: Iafde26ebd68f4168b49e55fbc8ad1c251e98d4b0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit b085fe6ad9eee69791bc3c15bfeb7cc41245519a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:33:48 +00:00
Alexandru Croitor
04c3e5e5a7 CMake: Remove SBOM multi-config dead code
These variables were not used anywhere.

Pick-to: 6.8
Task-number: QTBUG-128893
Task-number: QTBUG-122899
Change-Id: If53b3fd8200971dcfde69cefa4df07b67d5669c5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 42a58d661947cbbe8c1c5f26cea2d92e25a54f46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:33:41 +00:00
Alexandru Croitor
6e74281ba3 CMake: Move SBOM project ops setup to run at project begin time
Previously Python and other sbom tooling was looked up at SBOM
project end time.
This was fine for the use cases we had so far, but it prevents
introducing new API that wants call the spdx tools before the end of
the project. Such API will be introduced in a follow up change.

Move the python interpreter, python dependency lookup and other sbom
tooling setup to happen at project begin time.

Pick-to: 6.8
Task-number: QTBUG-122899
Task-number: QTBUG-129901
Task-number: QTBUG-131377
Change-Id: Ic8884e378c0ffd9720ede26b0c61f4122f3bb9d9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2fa815341c68148ff00c6d16be017f80e4032ef1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 18:33:35 +00:00
Alexey Edelev
df5c9259af Split the tool dendencies lookup to Qt and 3rd party
Tool dependencies that are added using the
qt_record_extra_package_dependency function now are considered as
the third party dependencies. This allows using two different
approaches when looking for the dependencies of Qt tools.

All dependencies that are Qt tools now go to the path invented in
035fbd068b5a3fbc18b7868ecac9a6a6a2f6602c and use the
_qt_internal_find_tool_dependencies function which is designed to
look for Qt packages and uses CONFIG signature of find_package.

To look for the non-Qt modules we should use more generic find_package
signature and _qt_internal_find_third_party_dependencies fits perfecly
for these purpose.

Note that it's known issue that the
_qt_internal_find_third_party_dependencies command also may find
"target" tools when crosscompiling, but this commmit doesn't reinvent
it. We already have various places which make the scoped "host"
dependencies lookups to ensure that "host" tools look for the "host"
dependencies in build systems like yocto.

Ammends 035fbd068b5a3fbc18b7868ecac9a6a6a2f6602c

Task-number: QTBUG-132340
Fixes: QTBUG-132622
Fixes: QTBUG-132616
Pick-to: 6.8 6.5
Change-Id: I9effba3d405ceec720a8a2a332250619cd56f598
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f881e06dd44c377772dd3b99793ab7552c7cd64e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 10:58:45 +00:00
Even Oscar Andersen
887601bf0e Make QWasmScreen::allWindows return all (wasm) windows
It seems that findChildren does not return every window if called
at an inconvenient time.

This causes not all windows to be returned, and later the
QWasmCompositor will not detect a valid window to compose,
and therefor goes to disabled.

Fixes: QTBUG-132414
Change-Id: I6c872071751d5a2fbdeea36fb8f4c7e9677fd7d0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 5c5844cedb938c38ea595957b172c48a67c502fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 05:56:51 +00:00
Joerg Bornemann
83cb2ca344 CMake: Simplify Qt6FooPrivate -> Qt6Foo package dependency setup
This amends commit fbbf4ace0188b9718b6d7808021c0b887fd52d9f.

Remove the EXTRA_PACKAGE_DEPENDENCIES argument that was added in
mentioned commit, and use the qt_register_target_dependencies function
instead to add the package dependency Qt6FooPrivate -> Qt6Foo.

Task-number: QTBUG-87776
Change-Id: I08a48954576dc3c0b6fde809f90d2022201d7eb0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2d38af3125d18255007f7451f31e26e9c16af45a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 00:51:20 +00:00
Volker Hilsheimer
58113ca96e QFontIconEngine: implement actualSize correctly and fit pixmap to it
Some icon glyphs might not be square, and actualSize needs to return a
size that fits into, and maintains the aspect ratio of, the requested
size.

Compute the bounding rect of the text/glyph that would be rendered, and
scale it to fit into the requested size.

Use that to return a pixmap of the correct size.

As a drive-by, fix the cache-testing by comparing the
deviceIndependentSize of the stored pixmap with the size we want.

Change-Id: Ic6fd0f0e260b3e3946d032941d9b677463d5c145
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit be9682d372e0021ff112817dc146f5768ac6f28c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-09 00:51:20 +00:00
Marc Mutz
96c5792d5b QUuid: mark Version::UnixEpoch as since 6.9
... because it is.

Amends d89cef439f5c1a58aeff879a12d9a33292764b7f.

Change-Id: I82cfb386c058a0dda873022377ec91368c71e026
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4af8a20e8e0384d3de4af6c2b47a0783ba28bbc3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:27:36 +00:00
Volker Hilsheimer
59420d3a0b JNI: avoid detach attempt when populating an uninitialized QString
QString::data on a non-const string will needlessly try to detach.
Avoid that by accessing the raw data pointer.

Addresses header review comment.

Change-Id: I89b4d3451cda517e5c5ca08173510b3529ce73aa
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit bf2491acc74528004af8d5f4caf50e88fcb86f89)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:22:08 +00:00
Volker Hilsheimer
30e7ce0fc1 JNI: add missing qxptype_traits.h include to qjniobject.h
We use qxp::is_detected_v. Addresses header review comment.

Change-Id: I57bb2bb2158d82e2cd5e6df5885cde8aedb63b4f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 611914421d8dae7546842aa5097000ed135117db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:22:08 +00:00
Volker Hilsheimer
1ed487f1ac JNI: Simplify Traits specialization for QJniArrayMutableValueRef<T>
Just inherit from Traits<T>. Addresses header review comment.

Change-Id: If11df666a925a13e54e94b30e42316a6aa06bbc7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit c5c3730400d0f7bb1f1b93117f8ad5c1262ed695)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:22:07 +00:00
Joerg Bornemann
a090ecbdd1 CMake: Don't export 3rdparty dependency find_package calls
...of private modules in public modules. This isn't necessary anymore
since the Qt6FooPrivateDependencies.cmake files contain these 3rdparty
dependencies proper.

This reverts commit dae078e521c3932c66436cbdbfaf5294a1842901.
This amends commit fbbf4ace0188b9718b6d7808021c0b887fd52d9f.

Task-number: QTBUG-87776
Change-Id: I2c425d49fe7beb790abf9a94f089d43fde8b047e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit e7816586b612050adf0cd872b81d04b606ec2b54)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:22:07 +00:00
Volker Hilsheimer
087db1d000 JNI: fix declaration of QJniArray(Mutable)Iterator postfix operators
As per the standard at [1], the second parameter has to be int, while
difference_type is jint (which is also int, so no difference in
practice, esp for the already released QJniArrayIterator).

https://eel.is/c++draft/over.oper#over.inc-1.sentence-3

Addresses API review comment.

Change-Id: Idea11f83048b9b65548ec1ac8abc2586c6e61a27
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 291c5ec433131d43921e77f3b6565e89cc0b3420)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:22:07 +00:00
Ivan Solovev
b18c3ecdbd [docs] Add description of other C++20 features to the overview
Task-number: QTBUG-128837
Pick-to: 6.8
Change-Id: I07731cd75c97c16eb008a76727b2ae831c029284
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
(cherry picked from commit 82f6938d8ad66468576c52da7d85a2288f78af7e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:22:07 +00:00
Topi Reinio
85088954de Third party code attribution: Change Id to lower case
Each 3rd party license attribution is identified by a
unique Id key, which should be all lower case and without
spaces. See QUIP-7 for more info. about the
qt_attribution.json file format:
https://contribute.qt-project.org/quips/7.

Pick-to: 6.8
Change-Id: Iaa233a0e6180945e014b9a407bbd61df591f1dea
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 1926df8d57c2b6c600a5486b1939d96b21f7f812)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 20:22:06 +00:00
Alexandru Croitor
fa8effc7da Silence qcompare.h "zero as null pointer constant" warnings on macOS
When using qmake to build a user project on macOS, the Qt headers are
included with the -I option, rather than the -isystem option. This
means that the compiler will not silence warnings that are generated
while parsing Qt headers.

If the user project compiles their code with the
-Wzero-as-null-pointer-constant compiler option, this leads to
warnings like:

/QtCore.framework/Headers/qcompare.h:226:78:
 warning: zero as null pointer constant
     [-Wzero-as-null-pointer-constant]
  friend constexpr bool is_eq  (partial_ordering o) noexcept
  { return o == 0; }
                ^
                nullptr

Fixing qmake to use -isystem instead of -I is not trivial.
We already silence these warnings for gcc in the header file.
Do it for clang as well.

Amends bdd41f491c0f85ae0897a1c7372c5ecda62a5aab

Pick-to: 6.8
Fixes: QTBUG-132581
Change-Id: I7883248b7be548580a03333e76620ac10f57733a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 0711eb60716b53dc86cacb2fc19b72aa4ffee3d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 17:23:58 +00:00
Ahmad Samir
69277b9ed9 tst_Q{Chrono,}Timer: fix typo in CMakelists.txt
Spotted by Thiago in code review.

Amends bd764cc1ca578759f16fbe292fbe14a243b7d263 and
9cf47946fc872ed95f1b3a766658dd5076a5d473.

Pick-to: 6.8
Change-Id: I01b04d2c80c62158917e6f190418053edc0a0fe5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4073a75959e00722271b8784cb8cb2ee40756ff6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 16:57:15 +00:00
Volker Hilsheimer
103aa5afb2 JNI: replace va_arg helper with variadic template
Android 15 (at least) seems to have changed how float arguments are
passed to native functions, breaking our (conceptually correct) code for
processing the va_arg list into a list of static argument types of the
function implementation.

To fix this, we have to move away from using a va_arg function, and
register a function with statically typed arguments instead.

Use a template function that we instantiate with variadic arguments
deduced from the actual function, using a factory-helper that generates
a JNINativeMethod struct with that template instantiation as the
function pointer. Move all of that into a struct where we can also
declare the signature string as compile-time constant without cluttering
the namespace with static objects.

We can now remove the helpers that took care of type promotion in va_arg
functions, and of the tuple-construction from a va_list.

As a drive-by, don't cast function pointers to void *; it's strictly
speaking undefined behavior in C and should have generated a compiler
warning, if not a hard error [1]. We must initialize the
JNINativeMethod::fnPtr member with the address of the function pointer
instead.

[1] https://port70.net/~nsz/c/c11/n1570.html#6.3.2.3p8

Also, declare the native method as the JNICALL calling convention. That
is only defined on Windows, so makes no difference in practice, but it's
the correct thing to do anyway.

Fixes: QTBUG-132410
Pick-to: 6.8
Change-Id: I190b95fcbcd07cf99c6765fa426c3c351f91994a
Reviewed-by: Volker Krause <vkrause@kde.org>
(cherry picked from commit e91a17873ee4ae58d369b8eb70029cf895b31d03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 03:05:46 +00:00
Christian Ehrlicher
37effa5dd3 Windows11Style: Misc cleanup for drawControl(CE_ItemViewItem)
Cleanup CE_ItemViewItem branch in drawControl():
 - use local rect instead rect, vopt->rect or option->rect for
   consistency
 - move out viewItemPosition comparisons into local booleans
 - fix coding style
 - merge two QPainter::drawLine() calls into one

Pick-to: 6.8
Task-number: QTBUG-131585
Change-Id: I7cd2f96a2a733a55d5e7fb5956c59bd043317cb2
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit 44edab7c84be101025dc6f9a74f87944ea3a22e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 03:05:43 +00:00
Giuseppe D'Angelo
1426bd170b QBitmap: undeprecate the QBitmap(QSize) constructor
There is no reason why the QBitmap(int w,int h) constructor is not
deprecated, and the one taking a QSize is. Since there's no deprecation
marker in the source code, I'm assuming this is just a documentation
issue.

Amends 111115bf8862b7cd1197c2ef8a4b475c882776d4.

Change-Id: I700de1821ab23ce85e793734c7048d1b2031ce9d
Pick-to: 6.8 6.5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7f7605c22f0e1847612e9e283eead75a1ace409e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 03:05:41 +00:00
Volker Krause
e342a52613 Expand tst_qjniobject to cover float arguments in JNI native methods
Demonstrates the problem described in the bug report on Android
15/x86_64. QEXPECT_FAIL the relevant test cases until the next
commit fixes the problem.

Task-number: QTBUG-132410
Pick-to: 6.8
Change-Id: I065fd29282ef42ed75a2ed8177ded183c92aa6e3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 749367da8c3309c98b3285836c2bd8abcd7274b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 03:05:40 +00:00
Axel Spoerl
8b7bf25f7f QtGuiTest namespace: Export symbols
Export functions in the namespace explicitly, to enable usage outside
Qt.

Change-Id: I1d3ea8f043b83cc38a9c6f4ff372e7bb37f2b0cc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 31e1a79120e1ef9b681b45b2d2c3a7dfef752b8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 03:05:37 +00:00
Volker Hilsheimer
6a6ce2474e JNI: fix JNI warning from local reference mixup
When making an object array, we use a LocalFrame to get access to the
conversion routine, but manage the frame of local references manually in
chunks of 100 objects. If any of the conversion routines uses the
LocalFrame's implicit frame management, then we push and pop frames out
of order.

Disable the frame's implicit frame management, and only use our chunk
management.

Amends 37638c84efaf2810ad49da0b987f19287d8c4ad6.

Pick-to: 6.8
Change-Id: I93be77ffc8750bb90fd7daed8c273169b03a29e4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit fe6222b7561faa52f12a961d7c5417e364cf0236)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 03:05:35 +00:00
Thiago Macieira
b39b3551b7 QStandardPaths: use qTokenizer
Avoids allocating memory for the array.

Change-Id: I425235b948609e5f0ffcfffd0f93375a224e5bcb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 403a47cfd571c9954e91234084c6994901939326)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 02:49:40 +00:00
Shawn Rutledge
96fe113608 doc: Fix description of QSizeF::fromCGSize
Change-Id: I22c3c5a50d624dc1f6a46aa5f1630c08267c4925
Pick-to: 6.8 6.5 5.15
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 9d6614d74cda8eae886f72a688271cdcd3ddcddd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 02:49:40 +00:00
Thiago Macieira
875ccc41f4 tst_QSaveFile: add a test for attempting to overwrite a dir
This is not the same as the 'directory' test below, which tests that we
can't open() a QSaveFile on something that already is a directory. For
this one, the target file did not exist when we open()ed, but has become
a directory since then.

Change-Id: I92d13f103693d375e742fffdd74053dd1b86d81f
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit f4ff7c40588a4515504e22266d15816ca8616cba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 02:49:40 +00:00
Thiago Macieira
765aa27aa3 QMessagePattern: "precompile" the default pattern
So we don't have to parse it on first use if it isn't set. This should
be a small performance gain for everyone who uses the default, which is
usually the majority of people.

Change-Id: I10c471715457dcfa3a1dfffd2768ce605e4f7e30
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit e04f109456bbcb184963b8ed71944b958b35c201)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-08 02:49:39 +00:00
Mårten Nordheim
9a1edf52d4 tst_Http2: Test SETTINGS_HEADER_TABLE_SIZE handling
This somewhat duplicates some other tests, namely the QHttp2Connection
one, but tst_http2 is our only coverage of the HTTP/2 code prior to 6.8.

This change adds a test where the server sets the
SETTINGS_HEADER_TABLE_SIZE to 0, effectively disabling the dynamic
table. We, in an earlier patch, makes the HPack table error out if
a new header entry is about to be added if the table has not been
resized below a changed 'max'. So, we take advantage of that here and
set the new 'max' capacity without resizing the table, or updating
dynamic capacity causing it to fail if the client doesn't send the
expected Dynamic Table Size Update.

Task-number: QTBUG-132277
Pick-to: 6.8 6.5
Change-Id: I1ca8ca7828d5b83606e7adbcfc13c154fa1e3cab
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit f7c3acd27ff48b24f99086be206acbe7e00e3208)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 22:33:06 +00:00
Assam Boudjelthia
aae66d7518 Android: fix warnings about Class raw type usage
Using Class<?> fixes the warning.

Pick-to: 6.8
Change-Id: Ia65aa78509c41d041970631dc21c8dd72459e674
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit f342f27a0cc6c82f9503c0002b6fd32cb3ada3c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 22:33:06 +00:00
Jøger Hansegård
11abd87046 Implement QUniqueHandle move assignment using MOVE_AND_SWAP macro
This removes boilerplate and the extra complication of std::addressof.

Task-number: QTBUG-132507
Pick-to: 6.8
Change-Id: I07091ec0ac526975cf55361a9811fad77eb152c2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 30ae70a110ee2460744e4fb78bae29b75effbf72)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 22:33:06 +00:00
Assam Boudjelthia
a892eb50d3 Android: add android test runner docs to the build
Amends 5735d7ac861fe99a71d8044977e5f487c401ca12.

Pick-to: 6.8
Task-number: QTBUG-84330
Change-Id: Ie78f88cf84376c08e44d887b09d116845882788b
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 1fb369211e3e477de8531485a33241d5d99b7a21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 22:33:06 +00:00
Assam Boudjelthia
e3feb85abc Android: pass safe area margins to relevant windows only
Instead of passing the safe area margins to all windows
or top windows, we can instead call the listener for
setOnApplyWindowInsetsListener() on specific QtWindow
and have it pass the windowId with the callback to C++.
What was missing before was that the listner was not reset
after removing the window and also, we don't need to
necessarily require a window matching the id to be found,
so that if no window is found we can assume that the callback
is not valid.

Task-number: QTBUG-131519
Change-Id: Idd411e407ac8f5992aa6684ece70329198de1bc2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit d7860d445d462dae853358c8b956fa6b1b6a2fc7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 22:33:06 +00:00
Jøger Hansegård
bded4bd5fc Require that the handle type used with QUniqueHandle is quite noexcept
QUniqueHandle is intended for handle types or opaque pointers that are
no-throw constructible, copyable, and assignable, and has nothrow
comparison and relation operators. This patch ensures that this holds
true, and makes most of the QUniqueHandle noexcept specifiers valid.

This will make it easier to implement the comparison and relation
operators in terms of the Qt comparison framework.

Task-number: QTBUG-132507
Pick-to: 6.8
Change-Id: Id9fc3fac72a2337541e49c3b4613b8fd082796af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 49f1877bbbb8f96d81144861558bdcc81e758a58)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 22:33:06 +00:00
Mårten Nordheim
55dc2af21d QHttp2Connection: Fix handling of MAX_HEADER_TABLE_SIZE setting
We need to, following the RFC, send a Dynamic Table Size Update using
HPack once we have acknowledged the setting as long as the new size is
smaller, or if we decide to use the new, larger size.

It's further complicated by the fact that we need to send this update on
the next 'field block' (anything with headers in it), and we may have
multiple SETTING frames come in, and we need to then acknowledge the
_smallest_ one as well as the _final_ one. This is so the decoder on the
peer's side can know that we have set the smallest size, and trimmed our
tables thusly, before going to the larger size.

This could, for example, be used to clear the table.

Task-number: QTBUG-132277
Pick-to: 6.8
Change-Id: I2b886e125f2c197bc3d42aa0b2bbd308ed2a687c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 57f44d6d882e09f1560f86816fac6ca8d06264fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 22:33:05 +00:00
Peter Kling
40608d0a37 CMake: fix absolute paths w/o suffix in pri/prl files
In the update from 6.7.2 to 6.7.3, commit `ea0f00d5d` changed how linker
flags like `ws2_32` are treated when generating pri/prl files.
Specifically, before the commit a flag like `ws2_32` was left
untouched. The above commit changed it such that such flags are
converted to `-lws2_32` (seemingly in order to better support FFmpeg,
according to the commit message). However, this change also affects
absolute paths if the file has no extension. That is, after the above
mentioned commit, an absolute path linker flag to, say, a dylib on macOS
without a suffix will result in prepending the `-l` flag. This will
result in errors during link time.

An example where this caused problems can be found in the nixpkgs PR
draft #367206 (https://github.com/NixOS/nixpkgs/pull/367206).

This adds a small check to ensure that `-l` is not prepended if the
linker flag is an absolute path without a suffix.

Change-Id: I2c7ce3aac6624e1a27c59af233e3da2c1ae7ba60
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 714ae22b84553271a2809c393dd1a5a90089cc19)
2025-01-07 18:14:42 +00:00
Tor Arne Vestbø
b5c3a3fe73 Add change-notification signal to QInputDevice::capabilities property
On some platforms the capabilities of a device can change at runtime,
and we don't want to model this as a "new device" appearing in place
of the old one.

We already made the capabilities property non-CONSTANT, but let's add
a NOTIFY as well for completeness.

I considered making the capabilities member protected, but
QXcbConnection's xi2 handling relies on modifying the caps
as part of creating the device.

Fixes: QTBUG-132281
Change-Id: Ic345475b179f4562cdd39ecf51c7d6738ad47a74
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit d74079873bbbff8701ec9b254647624775ced27a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 13:17:09 +00:00
Marc Mutz
79bd27a82b CompactContinuation: make sure what is being deleted by runObj
A lambda creates a struct with a function-call operator. So use of
'this' in a lambda body is always a bit ambiguous (the outer object?
Or the lambda itself? even though C++ defines it unabiguously to the
former).

Use a named capture variable instead of 'this' to make it obvious what
is being deleted.

Amends 699162c6fa6121cc496338f1d8d6e1b4287f7760.

Change-Id: I48d82d788d495bac43c6adb114dfdd95a8dd0d1f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 21811161c9109c28da70b7bb9b28df33fa9b7766)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 13:17:09 +00:00
David Faure
2a121a9506 Fix wrong value for 'noon' in tst_bench_qdatetime
12 hours corresponds to 43,200 seconds, not 43,200 milliseconds.
Amends commit 3febcd6286a3cd22db4f294e7f31a94c07c51fb0

Pick-to: 6.8 6.5
Change-Id: I2eb3abcab18cd87d51ae70b5fbaeac71a8fcd0a8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0e2656f9371f92db3bb95ee5ba52c44a91e5ce68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 13:17:09 +00:00
Marc Mutz
1b09c46051 CompactContinuation: make type member const
Because it can be.

Helps readers understand that the type of a continuation doesn't
change once constructed.

Amends 699162c6fa6121cc496338f1d8d6e1b4287f7760.

Change-Id: I43848204cfd8584e6e55d7fbca1b22d30b391e50
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9dadca4d4e6058299f9d50ae28fd734717d7fdc5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 13:17:09 +00:00
Christian Ehrlicher
bf535c4c66 Windows11 style: fix drawing horizontal progressbar in rtl mode
The progressbar content calculation assumes that
subElementRect(SE_ProgressBarContents) returns a rect at 0/0 which is
not the case for progressbars in rtl mode. Fix it by moving the topLeft
edge to 0/0 and translating the painter accordingly

Pick-to: 6.8
Task-number: QTBUG-132459
Change-Id: I614589c9094b0da3c02867b45570d4dfdca61a18
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 314a5b972646a4f2ef9c1f49ddfd335f546336ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 13:17:09 +00:00
Christian Ehrlicher
5ff8c2eb00 Windows11Style: enable mouse tracking for QTableView
Mouse tracking is needed for windows 11 style since it is using
QStyle::State_MouseOver to draw the cells.

Pick-to: 6.8
Fixes: QTBUG-129242
Change-Id: Ib79ac5a8c14ac8c70365e87120f80b4e4ee4c5b9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 85333b3d8cb89bf58c6c6c0db7c3db5c95b4cbfc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 13:17:08 +00:00
Volker Hilsheimer
11b9657b08 JNI: don't access null jobject
When Java calls a native function that expects a QString with a null
String object, then we get a nullptr jstring. We must not try to convert
that to a QString.

Add the necessary checks at the call-site of the toQString helper, and
an assert to the helper itself. Add test case.

Change-Id: If5c55c702bdb3f89ac45fdf3912af2ac295f5e5c
Reviewed-by: Volker Krause <vkrause@kde.org>
(cherry picked from commit db6a9834d2b109e81cc73ef3c64d0c420237e9dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 13:17:08 +00:00
Thiago Macieira
6dc19b55fc QThread/Unix: revert to pthread destruction instead of thread_local
Amends 65093a84c2b94b1543fd4593bc45d491951d28d4, which changed how we
destroyed the main thread's QThreadData. This merges the call to
destroy_current_thread_data() for both types of Unix systems: those with
broken thread_local destructors and those with working ones. It turns
out that the function got called too early for us in those working
systems (see updated comment).

The clean up of the QThreadData is split into two different mechanisms:
 * for any auxiliary thread, when it exits, PThread will call back to
   destroy_current_thread_data()
 * for the thread that called ::exit(), PThread won't, but ::exit() will
   invoke set_thread_data()::TlsKey's destructor

This is different from the situation that existed prior to commit
65093a84c2b94b1543fd4593bc45d491951d28d4: first, there's no code in
qcoreapplication.cpp for this (all in qthread_unix.cpp). Second one may
call ::exit() from any thread, whether that is the thread that called
main(), the thread Qt thinks is theMainThread, or any other.

This commit moves the tst_QCoreApplication check for no extant objects
to a new test. I've chosen to add a new test instead of running a helper
binary via QProcess because we do have a couple of !QT_CONFIG(process)
platforms in the CI, and this is too important.

Credit to OSS-Fuzz for finding this, though it is not itself a fuzzying
problem (all tests of a given structure were crashing on exit).

Fixes: QTBUG-132381
Task-number: QTBUG-130895
Task-number: QTBUG-129927
Task-number: QTBUG-129846
Task-number: QTBUG-130341
Task-number: QTBUG-117996
Pick-to: 6.8
Change-Id: Ie294dce7263b4189f89ffffd9155ec71d31b89d9
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 1da7558bfd7626bcc40a214a90ae5027f32f6c7f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 03:46:12 +00:00
Thiago Macieira
60eaa42a25 Revert "Add categorized logging of delete later machinery"
This reverts commit c3a2b9f35a9a12ff3c6f5f0d11844de161b47c2a.

Unfortunately, some of the log messages happen WAY too late at process
exit time, when QtCore is unloading. In particular, the worst offender
is the one in QThreadPrivate::finish(), which is called after the last
QObject in the thread that called ::exit() was getting destroyed. This
implies we have Static (De)Initialization Order Fiascos happening (the
logging recurses into qlocale.cpp and the defaultLocalePrivate global
static has already been destroyed).

I need to revert this commit in order to fix QThreadData destruction.
The functionality is welcome back in QtCore once the fixes are in, so
long as whoever does it fixes the issues we're seeing in the CI (and I
can't reproduce on my development machine). I've created QTBUG-132429 to
track the reversal and see if the functionality can be brought back in.

Task-number: QTBUG-120124
Task-number: QTBUG-132429
Pick-to: 6.8
Change-Id: Iecf8f14529c7a2bb2185fffdfd328066098826b1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 357351b7ab8ab2eee865d2449ffcca9c9f502fd3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-07 03:46:07 +00:00
Friedemann Kleint
7f78908b44 Mime type browser example: Add translator loader code
Enable testing translations.

Task-number: QTBUG-127004
Pick-to: 6.8
Change-Id: Ie83092b4db5bcf516834cf0b5b564a67d7ab6227
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8778a493606c8733d72db1c09fff5e4bf1f13cc0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 18:08:10 +00:00
Mate Barany
9413c19cc1 Update CLDR to v46
New languages added with v46
- Kara-Kalpak
- Swampy Cree

Several new Chinese-language locales have been added, including one
using Latin script, which invalidated some prior QLocale tests, which
have been adjusted to fit.

Some obsolete time-zone identifiers are now treated as deprecated
aliases. These have lost their AnyTerritory association, implying
changes to QTimeZone tests.

Many redundant likely sub-tag rules for unspecified language have been
dropped, in favor of simpler rules.

[ChangeLog][Third-Party Code] Updated CLDR data, used by QLocale, to
v46.

Task-number: QTBUG-130877
Pick-to: 6.8
Change-Id: I92cf210422c7759dd829a7ca2f845d20e263d25b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e316276b76b9c3768ca4e19a04d03308ef21fe12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 17:56:36 +00:00
Mårten Nordheim
2101e91465 HPack: test and fix Dynamic Table Size Update
Expose some new API to make it easier to test too.
Will be used in follow-up patches for a http2 bugfix.

The setMaxDynamicTableSize() method no longer sets capacity or evicts
entries. This can then be used to set the new maximum size which we will
accept later when we receive a Dynamic Table Size Update.

This flow makes sense with both encoder and decoder. The decoder would
usually be set by us when we send our SETTINGS frame, and then the
Dynamic Table Size Update would be sent by the peer.
For the encoder we would set the maximum size when we receive the
SETTINGS frame, and then we must defer the actual resizing until we
can send the Dynamic Table Size Update ourselves, usually along with the
next HEADERS frame.

Pick-to: 6.8 6.5
Task-number: QTBUG-132277
Change-Id: I959f5006eb09427d130735efe136da8c04453fa2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit be477819ac17850632bca6ce59ee2c8ef11191cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 17:56:33 +00:00
Jan Moeller
a306131977 Check for valid QAccessibleInterface before invoking action
To avoid illegal access, the change ensures that the QAccessibleInterface
is non-null and valid before accessing its QAccessibleActionInterface.

The check for the validity was also added to existing code which
previously only checked for the QAccessibleInterface not being null.

Fixes: QTBUG-132059
Pick-to: 6.8
Change-Id: I69fc4f9bb052ded8f188032d324666d0c00b9c3c
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 279c891ddf0ad10dd86c8fc836ce385df57593c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 17:44:48 +00:00
Morteza Jamshidi
59861df8ce Draw icon overlay manually instead of relying on the api
Even with SHGSI_LINKOVERLAY flag set, loaded Icon with
SHDefExtractIcon doesn't have any overlay, so we draw
it manually.

Pick-to: 6.8
Fixes: QTBUG-131843
Change-Id: Iae4c2da12104a361b9a8cf05c78adcdb698f1f82
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit fd7bc16e9fbdc63bd22ba90d0c20b36ccffd2bae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 17:44:48 +00:00
Richard Moe Gustavsen
9db6df1a56 iOS: remove registered undo/redo actions upon qiostextresponder dealloc
QIOSTextResponder add actions to its own NSUndoManager. But
we need to remove those actions again when the responder is
deallocated, otherwise it can lead to a crash in UIKit when
swiping between apps.

Fixes: QTBUG-123843
Pick-to: 6.8 6.5 6.2
Change-Id: I404751bc50692a960e568ff2eb0f1754da0cec31
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 42f29da7a5b6c6969c169e9a868696a968ca930d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 17:44:48 +00:00
Morteza Jamshidi
6d8afaac84 Windows: Add Key_Backtab as possible key combination for Shift+Tab
In windows Backtab key event always comes as "Shift+Backtab".
So in order for Backtab key to be recognized as a shortcut sequence,
we also consider Backtab without shift modifier a possibility.

Fixes: QTBUG-94890
Change-Id: I20a7b404b57d8df5bea23765257a178f2e098ed0
Pick-to: 6.8
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 4d9f99c4ea70cdae58c80e1bfdbabefe3abb455f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 17:09:27 +00:00
Jøger Hansegård
64c5043a40 Add missing noexcept specifiers for QUniqueHandle handle traits
Handle traits should be simple, and not require exceptions. Note that
we should not make calls to fclose() or close() noexcept, because these
are POSIX cancellation points.

Pick-to: 6.8
Change-Id: I8bbf573b1346eafd52c6080dbb024f8b3bc89359
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a80d1bf2716b1ba404799d6a09003b145b73b079)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 14:03:25 +00:00
Kaloyan Chehlarski
0ce8e1db2b Fixup minimum MSVC version check when configuring Qt
The message displayed to the user says they need "at least Visual Studio
2019", but in reality the minimum is now 2022.

Amends 9a409295c7cfe74b4fb6b1892f4ff86d4f3c23f3

Pick-to: 6.8
Change-Id: Idaedd72d114b994fddd2ba7574fb7a45ca0a3e85
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 652250295c7f9812b49c522ab2fbe518ac9690e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 14:03:25 +00:00
Alexandru Croitor
0e14e9042d CMake: Handle DESTDIR for SBOM doc references in top-level builds
When installing a top-level build using the DESTDIR env var mechanism,
the SBOM generation process could not find the qtbase sbom document,
while generating the qtshadertools document.

Make sure to prepend the DESTDIR env var to the install-time install
prefix, when looking for external SBOM documents.

Pick-to: 6.8
Fixes: QTBUG-132188
Change-Id: I1cdb75842fc552b43d982f05444b5ddc1fe58595
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit f2ce68d8f31f4c90471183d66075bd6fd5955d6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 14:03:25 +00:00
Ivan Solovev
7b356f0f31 QtConcurrent: fix support for callables with deduced return type
Commit 6ebe3d0f0806069f906522dfe9b81baa3f3478de introduced extra
SFINAE checks on the template conditions.
However, it broke the case of using callables with deduced return
type, because SFINAE does not work for such conditions and treated
as a hard error instead.

Fix by explicitly providing all template parameters, so that compiler
could figure a better overload on its own.

Only QtConcurrent::blockingMapped() seems to be affected, but add
unit-tests to check all other methods as well.

Fixes: QTBUG-130766
Pick-to: 6.8 6.5
Change-Id: I1ddbe712d8ce04ac96ba13841cb569d728cfb943
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
(cherry picked from commit f73765682e7c8f1e0e78b7464deec57c7f2669ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 14:03:25 +00:00
Jøger Hansegård
33f37ff637 Test that reset() and move assignment handles self-assignment
Calling reset() with the owned handle should maintain ownership and not
leak resources. Move assignment should also handle self-assignment
without leaks. The new tests verifies that this holds true.

Task-number: QTBUG-132507
Pick-to: 6.8
Change-Id: Icdfa4d67b06b71a74e810593e57449b51982c98c
Reviewed-by: Tim Blechmann <tim.blechmann@qt.io>
(cherry picked from commit 03bd9491491881529ad28cd6d672edfdda9a0065)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 14:03:25 +00:00
Tim Blechmann
cffb015be5 gui: link with OpenGL framework
qopengl.h pulls in headers from the OpenGL framework on macos when
opengl is enabled. We should therefore also link the OpenGL framework.

fixes linker error in libqcocoa:
Undefined symbols for architecture x86_64:
  "_glGetIntegerv", referenced from:
QCocoaGLContext::updateSurfaceFormat() in
libqcocoa.a(qcocoaglcontext.mm.o)
  "_glGetString", referenced from:
QCocoaGLContext::updateSurfaceFormat() in
libqcocoa.a(qcocoaglcontext.mm.o)

Change-Id: I02d2c80e2652da0cf16eaca7ab161cf711599dc2
Pick-to: 6.8 6.5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 6f41c1652f73e1d79d6a4a91d009671a1e285b15)
2025-01-06 11:05:34 +00:00
Jøger Hansegård
8adfacca61 Add missing noexcept specifiers for QUniqueHandle handle traits
Handle traits should be simple, and not require exceptions. This patch
will allow us to improve the noexcept correctness of QUniqueHandle.

Pick-to: 6.8
Change-Id: I84d92818a2fcea5b98e09c0b7dc08b251751396c
Reviewed-by: Tim Blechmann <tim.blechmann@qt.io>
(cherry picked from commit 3c57c7357422bdfda60f56901a7590b258915b6b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-05 16:32:11 +00:00
Juha Vuolle
ee432b6431 Rename Gui test utility's factor() to scaleFactor()
This makes it more clear which 'factor' the function is about.
The function internally calls a pre-existing 'factor()' function,
but since that is a static method of QHighDpiScaling, there the
meaning of 'factor' is more clear from the call context:
QHighDpiScaling::factor(window).

Resulted from API review.

Amends: 5ac4f04325a56d47812f528fe31ceb0d4932f664

Task-number: QTBUG-132090
Change-Id: I869bc05116d334b53b23a46aa2bb788432f250de
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f9376703c92e957c7334a2ff42a801237f53c8bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-05 16:02:25 +00:00
Lars Schmertmann
850ed0222f Android: Fix freeze on start when the activity was destroyed before
This can be tested by enabling "Don't keep activities" in the developer
options. With this option Android will immediately destroy the activity
when it is moved to the background. In this case registerBackends will
be called the first time before the BackendRegister was created. Because
m_backendsRegistered was set to true even if it failed, the final call has
no effect. So we need to ensure to set m_backendsRegistered only if a
BackendRegister is available.

Fixes: QTBUG-132085
Pick-to: 6.8
Change-Id: I2ea1c0e0737c982594ceb06cbaf540399c45e3f4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 9903242ecab82c1ed72dcaf90e90a171c942a84a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-05 11:46:17 +00:00
Jøger Hansegård
b72c4988fb Implement QUniqueHandle::release() using std::exchange
This does not change the behavior of release() but gives more
compact code.

Task-number: QTBUG-132507
Pick-to: 6.8
Change-Id: I5b34c80409ca0e9e9a5e9aee9ef7bc80017610af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ec0c62385e0df00f42bc9fb5e117cb8b994cfc96)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 16:05:55 +00:00
Alexandru Croitor
cdc8811492 CMake: Error out when xcode / SDK version check fail in Qt 6.8+
Starting with Qt 6.8+ we should error out if the minimum sdk / Xcode
version requirements are not met.

An opt out is added for cmake build tests, otherwise all the tests
that use private cmake api will fail to configure when run on older
Xcode or SDK versions in the CI.
We do this by checking for a new QT_INTERNAL_IS_CMAKE_BUILD_TEST
variable.
We do the check inside
_qt_internal_check_apple_sdk_and_xcode_versions
instead of passing
a QT_FORCE_WARN_APPLE_SDK_AND_XCODE_CHECK variable to the test
configuration, because not all cmake build tests use private api, so
this way the list of projects that get the opt out is more
constrained.

Pick-to: 6.8
Task-number: QTBUG-119490
Change-Id: I1284616c91341848a9cf6406fbf35750707d1227
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a13bfec63df2cf206e354ab56fc017a1f0eb8f6d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 16:05:51 +00:00
Jøger Hansegård
5653829bf8 Make QUniqueHandle::reset() default to invalid handle
Having a defaulted argument to QUniqueHandle::reset() gives a convenient
way of releasing ownership without assigning a new handle, and makes
the QUniqueHandle API more similar to std::unique_ptr.

Task-number: QTBUG-132507
Pick-to: 6.8
Change-Id: I842d4545d7cc2da8fe2df08280d0d816ed4be7fd
Reviewed-by: Tim Blechmann <tim.blechmann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 248ac4128fe86150532ff7146d0459abb5260946)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 16:05:49 +00:00
Alexey Edelev
2378455647 Unset the temporary variables in Dependencies scripts
Unset the temporary variables to avoid littering the scope.

Pick-to: 6.8
Change-Id: Ibd6b2896113a9fcd9eae7bc202dc0dc8c7a9f9bd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 96bb0db5afbab2c5cc32a6b19abc74497c839f5a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 15:59:40 +00:00
Alexey Edelev
d83081c78e Assume that the Qt Plugin package is FOUND by default
Set the <package>_FOUND variable to TRUE by default, so the follow
logic that need to change the flag only need to take care about
setting it to FALSE if something exceptional occurred.

Amends 8d0283ad2cae3d8fbd4b1b7ee5c6454f7fcc079c

Pick-to: 6.8 6.5
Change-Id: Idd4407ea77e81703b5fa8cc5efa8c52b53d401ae
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 13608241793f6671500868c9ce96468f604f651e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 15:59:38 +00:00
Alexey Edelev
b942110a4a Adopt the Qt dependencies lookup mechanism for tools dependencies
The existing lookup mechanism doesn't consider Qt path when looking for
the Qt Tool package dependencies. In good scenario this leads to the
missing Qt Tool package, in worst case scenario the Tool package could
be found by alternative search path and attempt using the invalid
tools.

Use the lookup functionality we have for Qt modules when looking for
dependencies of the Qt tools. This will look the tools in Qt search
paths first and only then attempt looking elsewhere, considering the
QT_HOST_PATH.

Pick-to: 6.8 6.5
Fixes: QTBUG-132340
Change-Id: I570c03037f2a92922d2546a4f5fde1bc17a7f812
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 035fbd068b5a3fbc18b7868ecac9a6a6a2f6602c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 15:59:34 +00:00
Alexey Edelev
ee533138d8 Use the 'call' command when generating the command scripts
cmd.exe has a huge problem when running the batch scripts locating
by paths contaning spaces and more the one set of quotes in arguments.
This can be worked around by using the 'call' command as the test
command runner.

Fixes: QTBUG-132258
Pick-to: 6.8 6.5
Change-Id: I9b6fb0f8bccf44456e4cb9b79f3c6bd3f9fe4678
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 10a3859809fc0b6e1edd6cbb93e409f0513a9bbe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 15:59:31 +00:00
Marc Mutz
c35cb5fe9a QRhiWidget: mark (Private&, parent, flags) ctor explicit
Found in API-review.

Amends 8386dfee05d35057836f93d182ef96674a6fd11e.

Change-Id: I5ad063b17356f75084655f1af353ba34a5deb4bf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit be8391e56dc76f88058b432b015711cd7bce9c35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 14:16:08 +00:00
Marc Mutz
ffb442db62 qpropertytesthelper_p.h: port from QScopedPointer to std::optional
It's more efficient (doesn't need to allocate the QSignalSpies on the
heap) and makes the header fit for the upcoming QT_NO_SCOPED_POINTER.

VxWorks seems to have a problem with its std::optional implementation,
though:

   QWARN  : tst_QAbstractAnimation::stateBinding() Trying to construct an instance of an invalid type, type id: -2125884168
   QWARN  : tst_QAbstractAnimation::stateBinding() Trying to construct an instance of an invalid type, type id: -2125884172
   QWARN  : tst_QAbstractAnimation::stateBinding() Trying to construct an instance of an invalid type, type id: -2125884024
   Received signal 11 (SIGSEGV), code 2, for address 0x0000000d

So write a small optional-like wrapper around std::unique_ptr for that
platform.

Amends 930e59b798d9e3d08e17440980d33a08fb411cbe.

Pick-to: 6.8 6.5
Task-number: QTBUG-132213
Change-Id: Icf85678d616bc96c7d74b982d0b919ea3f13265a
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 7bd47fb70881e7240c027cd2844866c99f8f096d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-03 10:38:12 +00:00
Shawn Rutledge
5ead2a3d63 Fix QTransform::quadToQuad() to work with QRectF
A typical usage for mapping a 4-point polygon to a rectangle might be

  QTransform transform;
  bool ok = QTransform::quadToQuad(polygon, polygon->boundingRect(),
                                   transform);

It works because the QPolygonF(QRectF) ctor is implicitly called on
the second argument; but that ctor turns it into a 5-point polygon.
So it should be legal for QTransform functions to work with 5-point
closed paths.

Fixes: QTBUG-21329
Change-Id: Iae249012e14b8a3e8d3b0dfa35da8f9759359832
Pick-to: 6.8 6.5 5.15
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 48b1af941c50ab28cc92f9ea65a8a74a32eaf2bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 19:39:17 +00:00
Alexandru Croitor
ff596bfac8 Revert "CMake: Temporarily allow using any version in Qt's CI"
We updated the minimum CMake version used in CI for Qt 6.9+ to 3.22.
Enforce the minimum CMake version in CI to avoid regressions.

This reverts commit 5803af38aab09b7e47230a494e14654031d024e7.

Task-number: QTBUG-131169
Change-Id: Ifc91644dd26e465be44bfa7cfe6f99e295a174a9
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit dcd057a31b54de637a5ca8bb8a5d46e753d3066a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 19:19:27 +00:00
Aurélien Brooke
076a818f74 rhi: vulkan: fix crash when making readbacks in consecutive frames
When requesting a readback every frame, the readback activeFrameSlot
alternates between 0 and 1. Suppose we are in currentFrame 1, and
process a list of readbacks of slots [1, 0]. First, we skip the readback
of slot 0 since it does not match the currentFrame 1. The list thus
remains [1, 0]. Then, we process the readback of slot 1, and call
activeTextureReadbacks.removeLast(). This removes the readback of slot
0, while in reality we processed the readback of slot 1. The
activeTextureReadbacks is now [1], containing a readback for which we
called vmaDestroyBuffer(), leading to a crash ("double-free" attempt) in
Vulkan on the next function call.

To fix this, remove the readback that is actually processed (index i)
instead of the last one. Since we iterate backwards, indices remain
valid.

Pick-to: 6.8
Change-Id: Idd4296de45167edd0a9da345dcc1c3b6ac71a6d6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 73405890b8911dd1a58120665ce63a38281c6ce4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 19:19:27 +00:00
Michał Łoś
f13ef41580 VxWorks: Enable video device discovery
Video devices should be discovered by VxWorks properly.

Pick-to: 6.8
Task-number: QTBUG-115777
Change-Id: Ib6719fc9480827aed296343e0b91286ae8408c8a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit fbd7c7c45af8102090cf9e606ade565e5357a220)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 19:19:27 +00:00
Marc Mutz
7aadf25ccd QThreadStorage: replace QScoped- with std::unique_ptr
This only affects the !QT_CONFIG(thread) case and requires the rewrite
of the old-style static cleanup() deleter protocol into the modern
operator()() one.

As a drive-by, mark the deleter noexcept, like destructors are
supposed to be.

Pick-to: 6.8
Task-number: QTBUG-132213
Change-Id: I8839865880647d76b77eb9a3f2858067db86234e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6da1f72311b844b2232da3067ad6e1e24614e67c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 19:19:27 +00:00
Marc Mutz
77de3d45d3 Remove QT_NO_CAST_FROM_ASCII from QT_ENABLE_STRICT_MODE_UP_TO
QT_NO_CAST_FROM_ASCII is a policy setting, not a strictness
setting. The other components of QT_ENABLE_STRICT_MODE_UP_TO all deal
with clearly undesirable APIs, which QString(const char*) cannot be
said to be.

Keeping it in QT_ENABLE_STRICT_MODE_UP_TO would seriously impede the
use of strict mode in Qt itself (cf. QTBUG-132327).

Amends 3a6c8e02b6d1b0574da52b0087092d0c74aa92c1.

[ChangeLog][QtCore][QT_ENABLE_STRICT_MODE_UP_TO] No longer includes
QT_NO_CAST_FROM_ASCII. If you wish to continue using
QT_NO_CAST_FROM_ASCII, you need to define it in addition to
QT_ENABLE_STRICT_MODE_UP_TO. The reason for this change is that, while
everything else in strict mode should eventually become the default,
we're not proposing to remove the ability to construct a QString from
a const char*. QT_NO_CAST_FROM_BYTEARRAY and QT_NO_CAST_TO_ASCII
remain enabled in strict mode, though.

Task-number: QTBUG-132327
Pick-to: 6.8
Change-Id: I36b850833b1de79a47de975ca28d3591a0a0e089
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit f9163ae7a8167daded0798654d99a2e3a5aaa2b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 15:23:07 +00:00
Ivan Solovev
90fab1e4e9 Fix QtFuture::when{All,Any}() overload resolution
Both whenAll() and whenAny() have two overloads:
* an overload taking two input iterators, e.g.
  whenAll(IntpuIt begin, InputIt end)
* an overload taking an arbitrary number of future objects, e.g.
  whenAll(Futures &&... futures)

The public APIs are properly constrained, but internally they call
QtPrivate::when*Impl() template functions, that have the same two
overloads, but do not have any constraints.

As a result, passing exactly two QFuture<T>{} objects was leading to
the compiler picking the Impl overload that takes a pair of iterators.

Fix it by applying a subset of constraints from the public API to
the private implementation as well.

Amends 102f7d31c469a546f52c930a047bd294fb198186 which was introduced
for Qt 6.3, so picking down to Qt 6.5.

Fixes: QTBUG-131959
Pick-to: 6.8 6.5
Change-Id: Ide29ac9a494d07870e92957c40c1f614e56825f8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8aef5b0d8fd57684abe39c88af8c14d8882ef07b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 13:58:28 +00:00
Ivan Solovev
73b8c83ec7 Do not duplicate JsonFormat enum
The enum already exists in QJsonDocument, so there is no reason to
introduce a new one in QJsonValue.

Instead, use the fact that we only need to forward-declare QJsonValue
in QJsonDocument's header, include the latter into qjsonvalue.h, and
use a type alias.

For Qt 7, pre-program moving of the enum into QJsonValue and using
an alias in QJsonDocument.

Amends ac73079dee5f0260528a5c217a82cb0beafb0a56.

Found in Qt 6.9 API review.

[ChangeLog][QtCore][Potentially Source-Incompatible Changes] The
QJsonDocument header no longer includes QJsonValue.
The backward-compatible fix is to include all needed headers
explicitly and to not rely on the transitive includes.

Change-Id: I7c5219a239149e4a87d4780c4277d111983ad0f4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3cb87d891bb040f73fb68b6c5e7e82518f603c59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 12:07:32 +00:00
Joerg Bornemann
523f711295 CMake: Yield error if VCPKG_ROOT variable is missing
...and vcpkg usage was requested.

The user got no further feedback why vcpkg wasn't used despite passing
the -vcpkg configure argument.

Pick-to: 6.8
Change-Id: Ib43c2045f093c3887a63406e37f37bdd681341cd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit fecae6ab1b1aa36f43b5cd87b229de4df37e44ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 10:25:22 +00:00
Marc Mutz
c806d2bbbc sqlbrowser example: use = default on empty dtors
Idiomatic C++11 code.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited the issue from older code.

Pick-to: 6.8
Change-Id: Iba1fb9874bd93b4a560c33e3ecf62ecaa96d8bda
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 19564e033cf65a0a67680285d1cbcc85c9437aaf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:54 +00:00
Marc Mutz
101fedb17f sqlbrowser example: fix ugly margin around ConnectionWidget
When a layout is used to arrange the children of a non-top-level
custom widget, the layout's contentsMargins need to be manually set to
zero to avoid extra empty space around the widgets, misaligning it
w.r.t. its siblings.

Add the necessary call.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited the missing margin adjustment from older code.

Pick-to: 6.8
Change-Id: Icd1945a4f2b1635f031e50758ec2f1ec9313ae27
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 15524d1623a1400e4de15e57408e37020d394986)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:48 +00:00
Marc Mutz
cc1af8409a sqlbrowser example: use explicit / override
Examples should show idiomatic use of Qt and C++, so mark the custom
widget constructors in this example as explicit and their destructors
are override.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited the missing explicit from older code.

Pick-to: 6.8
Change-Id: I5b5b49f69330c6f139345bed7264c85a36c36e9b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e0e9a5627376e04aba1b2ca2591554851d7de240)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:42 +00:00
Marc Mutz
88600c3096 sqlbrowser example: use unique_ptr to hold m_ui
The old code used manual memory mangement (raw new/delete) to
(de)allocate the Ui struct. This is so 80s.

Use an owning smart pointer to manage the memory. Ordinarily, this
would have been QScopedPointer, but seeing as that doesn't have a
create() method to hide the raw new, use std::unique_ptr and
std::make_unique() instead.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e.

Pick-to: 6.8
Change-Id: Icabb9154eb38630855e14094b958af0214516f6b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0da2c2c4ef2219967db87021eece2a60b6e207af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:35 +00:00
Marc Mutz
02f05bdb5f sqlbrowser example: use idiomatic Qt [3/3]: use form-layout
The old code used a grid layout inside the QGroupBox, but the design
with labels in the first and edit-widgets in the second column lends
itself to a QFormLayout, which adapts the alignment of the widgets to
the platform style, so use that.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited all of the above from even older code.

Pick-to: 6.8
Change-Id: I528f0ce9d8cb7a997fbfabcdca887c059f571b38
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9c099ef942216d01261c26b60e3727a2a467f12a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:29 +00:00
Marc Mutz
8dbd0828e9 sqlbrowser example: use idiomatic Qt [2/3]: use button-box / override accept()
- The old code used two QPushButtons in a QHBoxLayout to provide
  Ok/Cancel buttons. This hard-codes the positions and text (and
  icons) of these buttons, instead of adapting to the platform style.

  The new code simply uses QDialogButtonBox, which is designed for
  this purpose.

- Also, the old code connected the Ok button's clicked() signal to a
  custom slot that then called QDialog::accept(). This means that the
  code in the custom slot is not executed when the dialog is accepted
  by other means (e.g. return press in one of the line edits
  ("auto-default"), though I'm not sure here).

  The new code uses the idiomatic Qt way of overriding
  QDialog::accept() instead, and connects the button-box's accepted()
  signal to it. This is done in the .ui file, so it already works in
  Designer preview.

- Finally, the old code made a manual connection from the Cancel
  button to QDialog::reject().

  The new code uses the Qt idiom of connecting in the .ui file
  directly, using QDialogButtonBox::rejected() as the signal.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited all of the above from even older code.

Pick-to: 6.8
Change-Id: I83afd6156a0811e0c0f99f2480625ea6b69ff78b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3419c299369ac1da94ba5710aaf5f5f65c38c33c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:23 +00:00
Marc Mutz
f2b88b3225 sqlbrowser example: use idiomatic Qt [1/3]: disabling group-box
The old code connected to the wrong signal and therefore had to write
a custom slot to perform the disabling of the group-box.

The new code simply connects the QCheckBox::toggled(bool) signal to
the directly-compatible QWidget::setDisabled(bool) slot, removing the
need for a custom slot.

Also move the connection into the .ui file, so it works already when
checking the form in QtDesigner.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however, only
inherited the issues from older code.

Pick-to: 6.8
Change-Id: Ia834f92de270bb7b18981273188f6e5b6cd457a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 53826d1cde26f825d1983476c6697f72130e351f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:17 +00:00
Thiago Macieira
381dca29ff Replace qgetenv() calls converted to QString with qEnvironmentVariable()
It's slightly more efficient.

Change-Id: Id5ac04fc27eee108c8e5fffd786c3d5f793a0a9d
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit db34e27f7f6ade54bfae59e5eed14c05ac508a49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-01 19:55:21 +00:00
Thiago Macieira
36d260014f qEnvironmentVariable: avoid a temporary QByteArray
Because we don't need one. I guess I was just lazy.

Amends b12fd1fa9d0b64e3cb66fa68c85392dbde8e175b ("Long live
qEnvironmentVariable()").

Pick-to: 6.8
Change-Id: I5b9141c5a32f9d784e0bfffdc3e4d742790aebdd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ce95c26034cc5b3ae8094c1521221e5b2f13ecfa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-01 16:46:29 +00:00
Ahmad Samir
01edc916d2 moc: fix GCC -Wextra-semi colon after member function definitions
As pointed out by Thiago the QT_DECLARE_METATYPE calls are redundant, so
remove them.

Task-number: QTBUG-132101
Pick-to: 6.8
Change-Id: I73800e70d3f270fb87941d4e053aa7ac5ed1841c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3bb4c4949fed9ccf8653151c78d5130b8db00716)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-31 23:59:24 +00:00
Ahmad Samir
5171b7f488 src/plugins/*: fix GCC -Wextra-semi colon after member func definition
Pick-to: 6.8
Task-number: QTBUG-132101
Change-Id: I947fdb66df9b6d86c60139046166395e4ae42127
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 997abb0520cdfbde60e0fe4fdb133e15e24ce871)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-31 23:09:12 +00:00
Ahmad Samir
cc369ad07f QCryptographicHash: hashInto(): check the buffer size earlier
We can use hashLengthInternal() to check if the buffer is big enough.
This matches what the QCH::hash() method does, it also has an assert
that `result.size() == ba.size()`, so we can assume this works with
OpenSSL's EVP_MD_get_size() in EVP::finalizeUnchecked().

Amends c70c81b371993ca865d523bb5f37eac4eb8a972b.

Pick-to: 6.8
Change-Id: I64935f3d590ab243b361a0b764f011c388820e32
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b83e825fab16f83f86149ead78efb6ec3d2fa16d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-31 23:09:11 +00:00
Marc Mutz
11f485ea68 tst_QImage: fix discarded QFile::open() results
Wrap them in QVERIFY(), as usual.

Found by QFile::open()-turned-nodiscard-come-6.10.

Amends e673e5a257569eaa816c6acd31dd754efd9f8c75 and
25c96d547b4563cbfedcec6093d68116148d8599.

Pick-to: 6.8
Change-Id: Id39e5d9e500b524af8443cb57916a12f98bd7c23
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cf6ae9a90106a3557a8df1e0d2567b02a4ef6ded)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-31 19:03:28 +00:00
Marc Mutz
c970909437 tst_Q(Gui)EventLoop: Unbreak UBSan build
The tests peek into QEventLoopPrivate, which means that a UBSan build
needs access to QEventLoopPrivate's type_info, for which we need to
export the class.

Amends 3af20bd8eb8c75017c5d6d138d7c42914ee5bee3, which fixed the weak
vtable that, presumably, made this test work before.

Pick-to: 6.8
Change-Id: I4104ba95093fa240c5ef7d9d5bf287c1652333f0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8bf54385319df958ea88f9998e7690d4c35e354d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-31 10:13:04 +00:00
Marc Mutz
5cd16659ff Port QtCore from QScoped- to std::unique_ptr [1/2]: private uses
This patch series is in preparation of enabling QT_NO_SCOPED_POINTER
when building QtCore, a prerequisite for enabling this opt-out in leaf
modules.

This first part of the patch series ports objects whose use cannot
"leak" into other modules, e.g. because they are in .cpp files or are
private members and is thus SC (and, as demonstrated by various static
assertions we put into the source code over the years, BC).

The second patch will deal with objects in protected and public APIs,
and thus might be QUIP-6 SiC Type A.

Task-number: QTBUG-132213
Change-Id: If4967f6e563a4e7d74550fad4c6d354fad1beef5
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 63f1c6fcbab5f36809ffc96ac5ff6cb9e01e70bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-31 10:12:58 +00:00
Marc Mutz
3ea877a844 QLibraryInfo: de-pessimize prefixFromAppDirHelper()
The local appDir variable was only used to hold the return value of
another function call. But hardly any compiler will be able to look
through the QString atomic ref-counting to turn the non-Darwin code
paths into the tail-calls that they ought to be.

Remove the variable and return the result immediately. This removes
the move-assignment and dtor calls in the two changed lines and lets
RVO kick in, turning these calls into tail-calls on non-Darwin
platforms.

Amends 4ac872639ed0dd3ae6627e05bdda821f7d128500.

Pick-to: 6.8 6.5
Change-Id: Ieeefbd52fc983ab7aebcff6419965b206f374935
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit e57113feac183abd1f5bfcfb633a33e1387b2d3e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-31 10:12:56 +00:00
Toni Saario
60a264ed50 Coin: Tweak VxWorks testrunner
Add crash handling to avoid waiting until 10min timeout on each crash.
Force restart on each crash by killing emulator.

Make health check more robust to allow it to work even when emulator is
down. This is done via wait in separate process which cannot be done
with normal timeout command, as input to pipe that is not being read
by emulator will block forever.

Change-Id: I86c3c86f936cc96d57b38983da48d1d73162399d
Reviewed-by: Simo Fält <simo.falt@qt.io>
(cherry picked from commit 918cbe7601b07fa6db7973ff9a4f76208dae8f22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-30 11:31:47 +00:00
Samuli Piippo
884c338355 egldevice: allow DRM device path to be overridden
The backend-provided DRM device might not be the right one,
so allow kms config to override it.

Pick-to: 6.8
Task-number: QTBUG-131887
Change-Id: Ied744ae7015eae64f4556f1528e0dbe8ae69d206
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
(cherry picked from commit c3bbbb22b8bc920e4937cf640fd1d2df3b0f9205)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-30 11:31:47 +00:00
Friedemann Kleint
b06125aa51 uic: Generate fully qualified enumerations for QFormLayout
This is required for Python.

Task-number: PYSIDE-1735
Change-Id: I92108009dd23565adaa2ee77300059cb197a89c5
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
(cherry picked from commit 11d6200d8ad88459a499550b30f5c22f1657719b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-30 04:04:22 +00:00
Ahmad Samir
bbf78c9636 tst_QCryptographicHash: split 4GiB tests to a separate unit test
With those tests split, tst_QCryptographicHash takes about 4ms.
When FEATURE_openssl_hash is enabled those tests take about 15s on
their own, but when openssl_hash is disabled they take about 2 minutes.
That makes running the tests locally a bit of a hassle when hacking
code ... test ... hack ... test.

This is with a debug build, GCC, `-O0 -g` flags.

Change-Id: I8b8f5d1954feb1f9eb8115e27635610a41b42f47
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fff217824b532da7306af1ac755581e76e098a27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-29 23:22:56 +00:00
Christian Ehrlicher
6790d8d716 QCommandLinkButton: fix drawing high-dpi icons
QCommandLinkButton was using QIcon::pixmap() without specifying the
current device pixel ratio. Switch to QIcon::paint() to not have to
fiddle around with the dpr at all here.
As a drive-by remove a useless QPainter::save/restore call.

Pick-to: 6.8
Change-Id: I7e2492a09b28cb8a4f4cc60454733e0054fe1e9b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 785fb89e0aafc25a435d28ff05bf0dc05385b372)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-29 19:35:04 +00:00
Thiago Macieira
d39c493390 3rdparty: patch BLAKE2 sources to not export anything in static builds
This could cause conflicts with other users of these algorithms, notably
libb2 itself. Though if you're using libb2, you shouldn't be using the
un-optimized copy inside QtCore...

I've updated the SHA1 of the last commit in the repository, but there
were no changes to our sources.

[ChangeLog][Third-Party Code] Fixed a bug that caused the BLAKE2 symbols
to be visible from QtCore in a static build. If you need to use the
BLAKE2 hashing algorithm in your own code, either use QCryptographicHash
or import libb2 into your build environment. Using libb2 remains the
recommended solution for all systems, especially those for which it has
optimized (vectorized) implementations.

Fixes: QTBUG-132347
Pick-to: 6.8
Change-Id: I48003b58cef0d8bcc720fffdd89b0f151fd102e3
Reviewed-by: Linus Jahn <lnj@kaidan.im>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b884fbf10237547e809745f528978942faf0e5f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-29 11:40:51 +00:00
Marc Mutz
b79b2edde8 QLibraryInfo: port from manual memory management to unique_ptr
It's safer and clearer.

Also standardize on unique_ptr instead of QScopedPointer, because the
latter is not supposed to be movable, so the assignment in
QLibrarySettings::load() would not compile.

As a drive-by, scope a variable tighter (in an if condition).

Task-number: QTBUG-132213
Pick-to: 6.8
Change-Id: Iecdd910af4d06dbd03d2daf3ccf99dd4822f04ac
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit aa1f2064801b39a26a718703817e197a3e31447e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-29 11:40:51 +00:00
Christian Ehrlicher
e23933e868 QStyleSheetStyle: Honor box settings for QSpinBox
The previous patch to not modify the CT_SpinBox by QStyleSheet when
nothing was added for QStylesheet also removed the additional margins &
paddings handling for the size calculation. This patch re-adds this.

This amends 96adebed606cdbc73c73778917d777dc04c6e93e.

Pick-to: 6.8
Task-number: QTBUG-130642
Fixes: QTBUG-132431
Change-Id: Iff1f0febeca90d3154e61fd80e4b359bc7766b84
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b2cc8824ec2cdeb6e053a2ff92d7d5b71f8d0ee5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-29 03:54:57 +00:00
Christian Ehrlicher
314c91d94e Widgets: pass dpr to QIcon::pixmap()
Change the remaining calls to QIcon::pixmap() to pass a valid
devicePixelRatio parameter.

Change-Id: I0e71e20c8109e296446e9e13cddba31d53c05df9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit efc318e05a2288f3fe62d9d7b2b892906e9263e0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-29 03:54:57 +00:00
Christian Ehrlicher
fba5f806e6 QCommandLinkButton: reload icon on style change
Different styles provide different icons for SP_CommandLink so reload
the icon on every style change.

Pick-to: 6.8
Change-Id: I2d8bd706d4c1bca89b91c90f1bb90a796b38e0d3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d4c518b210ad56cb51c17e6e1b4a81b0deb7253c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-29 03:54:57 +00:00
Volker Hilsheimer
843e2e1309 JNI: don't pass jobject by reference
And definitely not by non-const reference.

Discovered during upcoming fixes for native function registration.

Task-number: QTBUG-132410
Pick-to: 6.8
Change-Id: I0ce8519f5a1f9f3caffefc53e6d93b52509bc439
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1b84970b90c36771bf266f8612dba9585341795a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-28 19:19:03 +00:00
Marc Mutz
5e6fa3dbc5 QTest::toString(QCbor-type): port from const char* to unique_ptr<char[]>
This is more robust and lessens the impedance mismatch as seen by the
old code using std::unique_ptr<char[]>(expr).get().

The new code isn't impedance-mismatch-free, either
(UP{qstrdup(qba.data())}), but short of writing a small string class
whose internal buffer can be release()ed to comply with the archaic
QTest::toString() new[]'ed const char* return value, there's not much
we can do about it atm.

Also separate the internal from the "public" stuff in
QCborValueFormatter by adding private: and public: sections.

Pick-to: 6.8
Change-Id: I09a2ad1a75bb9eab3d01f2b5b60afc2d762da384
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d9264ee65d6f24e1008b08494b1472a54ac01940)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-26 17:23:30 +00:00
Thiago Macieira
8fdcda4dac Replace qTerminate() with std::terminate() and mark it for removal
It was used by the QT_TERMINATE_ON_EXCEPTION macro, introduced in 2012,
to support pre-C++11 noexcept semantics. That macro was removed for Qt
6.8 in commit 9b2ae564a59656d9cf49b141e70f5958b4fb79a4. This commit
amends that removing the definition of qTerminate() immediately in Qt
6.9 (it was an \internal function).

Change-Id: I9682121c04fafb3676b0fffd9f5ac999e7603c84
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit b8f84fd1e2af38ece89d60619bf93e7af34433ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-26 17:23:30 +00:00
Thiago Macieira
09d44fdef3 QSaveFile: make it so flush() errors imply commit() failed
QSaveFile records past write errors in writeData(), but often the
QFileDevice::writeData() calls it places will succeed because the data
is only being buffered. Instead, the failures are noticed only by
flush(), whose actions do not affect QSaveFilePrivate::writeError.

[ChangeLog][QtCore][QSaveFile] Fixed a bug that caused commit() to
return true and overwrite its intended target file even though it failed
to flush buffered data to the storage, which could cause data loss. This
issue can be worked around by calling flush() first and only calling
commit() if that returns success.

[ChangeLog][QtCore][QSaveFile] Fixed a bug that caused commit() to
return true even after a cancelWriting() call had been placed, if
writing directly to the target file (that is, only with
setDirectWriteFallback() set to true). Note that the state of the file
does not change under those conditions, only the value returned by the
function.

Drive-by clarify a comment from 6bf1674f1e51fd8b08783035cda7493ecd63b44
(Qt 4.6 "Don't drop errors from flush on QFile::close") which had me
chasing the wrong lead.

Fixes: QTBUG-132332
Pick-to: 6.8 6.5 5.15
Change-Id: I427df6fd02132d02be91fffd175579c35b9c06cc
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 92373d353cf090faa03cbc8aca505d1784b10b54)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-26 17:23:29 +00:00
Lars Schmertmann
e6434a71eb Avoid unused variable warning in qfilesystemmodel.cpp
2135:5: warning: unused variable 'q' [-Wunused-variable]
    2135 |     Q_Q(QFileSystemModel);
         |     ^~~~~~~~~~~~~~~~~~~~~

The variable is only required for the feature filesystemwatcher.

Pick-to: 6.8
Change-Id: I5da48f94118179ec20fec7da7169b7f22cec17fe
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 46dddcb213eb5080b8f759633a1b025d86f55e36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-26 16:35:11 +00:00
Marc Mutz
353d22756f Fix a performance regression in QDataStream
Commit e176dd78fd2f253eb2625585b2bd90b5713e5984 replaced a `new
char[n]` with a std::make_unique<char[]>(n), probably on this author's
insistence.

But the two are not equivalent: make_unique() value-initializes, even
arrays, even of built-in type, which means that each buffer resize
writes each byte twice: first nulling out the whole buffer as part of
value-initialization, then in the memcpy() and any following read()s.

For buffers of several MiB, or even GiB in size, this is very costly.

Fix by adding and using a backport of C++20
make_unique_for_overwrite(), which performs the equivalent of the old
code (ie. default-, not value-initialization).

Also add q20::is_(un)bounded_array, which are needed for the
implementation of q20::make_unique_for_overwrite().

Amends e176dd78fd2f253eb2625585b2bd90b5713e5984.

Pick-to: 6.8 6.5
Change-Id: I8865c7369e522ec475df122e3d00d6aba3b24561
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1a9f8cc0df33195df959cee2e355dde4cbacd754)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-24 23:42:09 +00:00
Marc Mutz
aff082764a tst_QSpan: check QList<int> -> QSpan<const int> doesn't detach the former
It does.

While std::span, does, too, and so users should be using
std::as_const(), it's quite simple to avoid for QSpan, so we'll fix it
in QSpan. This patch adds the reproducer.

Task-number: QTBUG-132133
Pick-to: 6.8
Change-Id: I2e416fb7344830cd5e0d945cce61491cd6f4a7a5
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 05b9a4b2deefd586356e1f36d84372b06e74cfe3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-24 22:24:05 +00:00
Mike Chen
b6108318c2 QFactoryLoader: load extraSearchPath first
Since `QT_QPA_PLATFORM_PLUGIN_PATH` or `-platformpluginpath`
 specifies the path to platform plugins, `extraSearchPath`
 should be loaded first.

Pick-to: 6.8
Change-Id: I2e62fbf2021250ca864c669a7bbd7d56acd67d1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 457580936ddebc73e8a24fc8af0d342084b3a0b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-23 04:08:12 +00:00
Marc Mutz
7b5dbe165d QDecompressHelper: fix compilation with GCC 9
GCC 9 doesn't accept [[unlikely]] between the (condition) and the
compound-statement of an if, in both C++17 and C++20 modes:

  qdecompresshelper.cpp: In member function ‘qsizetype QDecompressHelper::readZLib(char*, qsizetype)’:
  qcompilerdetection.h:1048:31: error: attributes at the beginning of statement are ignored [-Werror=attributes]
   1048 | #    define Q_UNLIKELY_BRANCH [[unlikely]]
        |                               ^~~~~~~~~~~~
  qdecompresshelper.cpp:597:54: note: in expansion of macro ‘Q_UNLIKELY_BRANCH’
    597 |         if (ret == Z_DATA_ERROR && !triedRawDeflate) Q_UNLIKELY_BRANCH {
        |                                                      ^~~~~~~~~~~~~~~~~

See also https://stackoverflow.com/questions/51797959/how-to-use-c20s-likely-unlikely-attribute-in-if-else-statement

Put it into the compound-statement instead, then GCC 9 accepts it. The
two are equivalent, because [[likely]] marks a path, and there is no
selection statement between the two positions.

Amends 5ae84d0afbd3690a2c003d06d920566a5d56dc8c.

Change-Id: Iac1970219c98a1c26e450dfe6bad6583e4d32c29
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7a7804d4b454021d68d1d5138d134ef62abfcdb3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-22 16:28:52 +00:00
Marc Mutz
fc29f57a17 q23type_traits.h: use is_scoped_enum_v from std
We don't like surprises in qNN, so use the real is_scoped_enum_v from
std instead of adding the _v version outselves, even in C++20.

Amends 03a7be37806a32e9a8ac963b309812d6b8f125f6 and
63a8f657c2236829f16016602d9c0098b089d35e.

Change-Id: I7f9149678b95f7a59643152abf5a627e226cc058
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 40501ffbb441ce48733b3733b7ab781c7db8cca8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-22 13:50:51 +00:00
Christian Ehrlicher
4354d7797e QDrawUtil: use QPainterStateGuard
Replace the internal PainterStateGuard class with the now public
QPainterStateGuard.

Change-Id: I9c072ce6e45ddfe2d0a8aba789311193788dee5a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 204df603ef43be921e0eecae4d4af0ae6026787f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-22 09:19:05 +00:00
Christian Ehrlicher
6f7b8ada85 QCommonStyle: use QPainterStateGuard
Replace the internal QPainterStateSaver class with the now public
QPainterStateGuard.

Change-Id: I56285cb469cec43071320e87ac378674fd99c06b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7690b6260eac12958c97d642421e27680ca57496)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-22 09:19:04 +00:00
Wladimir Leuschner
4eaaf89db5 QWindows11Style: Adjust Subline for QLineEdit to fit rounded corners
Reduce the size of the subline for QLineEdit to fit the begin and end of
the rounded frame corner.

Task-number: QTBUG-132261
Pick-to: 6.8
Change-Id: I879f30c2bdc6601fef4738aeec71d7ab7bcee22c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 5e656b9ea3c192f389b7e4f7aa2ae6b010cec306)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-22 09:19:03 +00:00
Wladimir Leuschner
4c2f439001 QWindows11Style: Align QSpinBox rect to match QLineEdits rect
The content rects for QSpinBoxes were smaller than QLineEdits rects for
UI elements that should have the same size. This patch increases the
content rect for QSpinBoxes.

Task-number: QTBUG-132261
Pick-to: 6.8
Change-Id: I59e752b719399c5845ab3ef81c6e271deda16273
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit a53e095882551caf3684a1f6a205b6c7d76a8913)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-22 09:19:02 +00:00
Alexey Edelev
8f1438b1a8 Avoid creating Plugin targets if the dependencies are missing
The plugin lookup mechanism doesn't handle the situation, when the
plugin is available but it's private dependency(static plugin case)
is missing. In this case we currently silently bypass the dependency
lookup and create targets. So users see the confusing message about
missing linked target, like:

   Qt6QSQLiteDriverPluginTargets.cmake:61 (set_target_properties):
   The link interface of target "Qt6::QSQLiteDriverPlugin" contains:
     SQLite::SQLite3
   but the target was not found.  Possible reasons include:
     * There is a typo in the target name.
     * A find_package call is missing for an IMPORTED target.
     * An ALIAS target is missing.

This indeed should be handled properly and we should omit creating
targets especially if users don't really use the plugin directly.

Also if dependencies are not satisfied it looks logically to set
the <plugin>_FOUND to false as this will be yet another indicator
for user that the plugin is not found.

Task-number: QTBUG-132244
Pick-to: 6.8 6.5
Change-Id: I8685163df0dee3a728c724901f69780569ffcad5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8d0283ad2cae3d8fbd4b1b7ee5c6454f7fcc079c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-21 04:51:58 +00:00
Eskil Abrahamsen Blomfeldt
610ee0c504 Don't include bearing of mid-string characters in max width
When calculating the maximum width of a text layout, we
would add the text width of each substring *after* we had
added the negative right bearing of the last character to it.
But the bearing of the last character in a wrapped substring
does not actually add to the maximum width unless it is the
last character of the *whole* string.

Prior to 250117086ff15bba79df8f0e15ee66192edc9ea9 this was
not noticed, because the last glyph in the substring would
typically be a space and the space does not have any
bearings (when doing wrapping on individual characters it
could still happen). After the change, the previous glyph
for which we get the right bearing will be the last
non-whitespace glyph. If this happened to have a negative
right bearing, we would add this to the max width and
end up with a larger max width than we should.

This caused a test failure in tst_qquicktext.

This test prefers the text width without the bearing (i.e.
the *advance* of the substring) unless the line is manually
wrapped or it is the last line of the layout.

Pick-to: 6.8
Change-Id: Iba1a5ad48d575683672400f0572dfa683a0f2d9c
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit c08a92307d6d9fa9d9d9a1f301e3f2a65374e99a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-21 04:51:43 +00:00
Tor Arne Vestbø
e266949979 Apple: Use automatic rendering mode for icon engine
When requesting symbol icons the OS automatically chooses a rendering
mode per icon. Most icons use the monochrome rendering mode by default,
but some of them use the hierarchical.

We don't want to override this choice by always using hierarchical,
as that doesn't match the look of most icons in the system and may
be surprising to the user.

We still want to support tinted icons, based on the QPalette. For
iOS this is easy via [UIImage withTintColor:] but for macOS we
have to do an extra render pass. Unfortunately we can't use
configurationWithPaletteColors with a single color, as for the
hierarchical icons this will produce a different looking icon
than if we tint the entire icon.

[ChangeLog][macOS/iOS] The Apple icon engine, used for theme
icons on macOS and iOS, will now use the default rendering
mode for icons, typically monochrome, instead of always
using hierarchical icons.

Pick-to: 6.8
Change-Id: I9e66d848222e8ed0f7f20897454f27446bf0fd81
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9f392c09a1d30e48494b4df0e2f5f531c7e4ec4b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:18 +00:00
Mårten Nordheim
b91edac40d tst_QHttp2Connection: make settings exchange wait for acknowledgement
Is needed when sending more SETTINGS frames during the test later

Task-number: QTBUG-132277
Pick-to: 6.8
Change-Id: I24b2a5d1b2e7aecd8687db5b24f37233df3b91dd
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 6e7a15f5c50a94216bcf35241ec008e6c419ba18)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:18 +00:00
Toni Saario
7ce68e59fd Increase VxWorks stack size
Increases to around 16MB with the format change.
Required by some tests.

Change-Id: Ia41436b4269220f84271b614ea6f2b96ca605c32
Reviewed-by: Simo Fält <simo.falt@qt.io>
(cherry picked from commit 75d87caef70ff79b4db04834d28daa1905f0d5a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:18 +00:00
Juha Vuolle
651b515074 Change QImage::mirrored() deprecation from Qt 6.10 to Qt 6.13
The deprecations aren't urgent, and allowing more time for users to
adapt is appropriate. In addition, also suppress the deprecation
warnings when compiling the related autotest.

Resulted from API-review.

Amends: 577946c1f05aaaa2a3f9682001aeb4144386b26b

Task-number: QTBUG-132090
Change-Id: Ia0c07ab510a9a9c8722892fcd94f58f6ec287059
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 0aa07ce77237dacc58de5939d5a239fb8997da7a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:17 +00:00
Christian Ehrlicher
1319dcf472 QWindows11Style: Adjust position of MDI subwindow icon
The y position for the MDI subwindow icon was not calculated correctly
so the icon was not painted vertically centered.

Pick-to: 6.8
Task-number: QTBUG-130673
Change-Id: I5f9023820a4e4b4288017869ac4088fe2669ce50
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6e29a94b547fbafa69e97ac02aeb33edad63f2ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:17 +00:00
Marc Mutz
9cd2e3ffef qtesttostring.h: standardize on unique_ptr<[]>
... instead of QScopedArrayPointer.

Less Qt code (which we're supposed to test with this library) and more
consistent with the tuple implementation.

Also makes the header clean w.r.t. upcoming QT_NO_SCOPED_POINTER.

Pick-to: 6.8
Task-number: QTBUG-132213
Change-Id: I3705b8db89e909e3f1e37ad6a31aaba6f9af899a
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f405925829ca37af47ecbb291bdb8a95a606e024)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:17 +00:00
Christian Ehrlicher
ecc31955f1 QWindows11Style: adjust text rect for CC_TitleBar
The adjustment for the textrect was wrong - the bottomRight point must
be moved by -1/-1, not 1/1.

Pick-to: 6.8
Task-number: QTBUG-130673
Change-Id: I6c099fdd9a03188e7a5c7852b1912ed9b2801f7a
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2c85e5d22215f24bd46d07a1183393e52702493f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:17 +00:00
Christian Ehrlicher
f349040b39 QDrawUtil: Cleanup qDrawPlainRoundedRect/qDrawPlainRect
Fix the style and use PainterStateGuard instead own save/restore
functionality because PainterStateGuard is already available and used in
those functions.

Pick-to: 6.8
Task-number: QTBUG-132187
Change-Id: Ie454b6cffe03444d88f13d15adb19a7e7783a493
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1fb86f1f84bb56dab60bc15604c09a14157d6f10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:17 +00:00
Volker Hilsheimer
319b31a5a2 QTestLib: Remove logging category declaration from public header
The lcQtGuiTest category is only used in qtestsupport_gui.cpp, so
declare it there as a static logging category.

Addresses header-review comment, amends
5ac4f04325a56d47812f528fe31ceb0d4932f664.

Task-number: QTBUG-132090
Change-Id: I5b2a93822a698f55c52c1be87ebf8a689f49e2a3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit b957dfc6e06deed64e20e8eee5d2164250b28b95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 15:38:16 +00:00
Thiago Macieira
1596b5855c QDebug: constrain the new Standard Library op<<
So they be SFINAE-ruled out when either the key or (for associative
containers) value types don't provide their debug-streaming operators
either.

Amends 850d4895be565931d18c92e5e2f9a33b7f26de6d,
0c96528e8d43ad4309bdca14b179a5045984655a,
a9fe57fefaac0cb047e4c02e0b8c8f8327e0a58c.

Fixes: QTBUG-132104
Task-number: QTBUG-130290
Change-Id: I1d6703b1fdf6cfd03799fffd33191d8028ecc123
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 8f958a6e2dcff5bb9b01442a19f5605f357c6e7e)
2024-12-20 08:17:40 -03:00
Christian Ehrlicher
7ab2885594 QSqlQueryModel: add new function to refresh the model data
This function re-executes the query used by QSqlQueryModel and refreshes
the data from the database. The query must not use bound values as these
values are not preserved.

[ChangeLog][QtSql][QSqlQueryModel] Added refresh() to refresh the model
data from the database.

Task-number: QTBUG-123603
Change-Id: I3f1d779e07b88565abe825c31cfc4d7d1b2312c4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1bd883dbc15c4016f78d421afac2ac9f31ec4874)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 11:17:40 +00:00
Christian Ehrlicher
fc29afbe1a QSqlDriver: return the connection name of the assoicated QSqlDatabase
A QSqlDriver instance is directly bound to a QSqlDatabase object. But
there was no way to get the QSqlDatabase out of a QSqlQuery/QSqlDriver.
Fix it by storing the connection name also in the driver during
creation and add a getter for it.

[ChangeLog][QtSql][QSqlDriver] Added connectionName() which returns the
connection name of the associated QSqlDatabase instance.

Task-number: QTBUG-123603
Change-Id: If78b85413cf6ca965ff6bf9f3600cb54169b5569
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5b07e3de3fe5335d9338c65ca40cfe656a389167)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 11:17:39 +00:00
Eskil Abrahamsen Blomfeldt
ed1032975e Include right bearing in width of layouts wrapping on spaces
When we're calculating the width of the layout, we include the
right bearing of the last character in the text line if it is
negative (i.e. it exceeds the advance width). We do this by
storing the last glyph that has been verified to fit in the
line, so that we can retrieve its right bearing when we find
a break.

However, when we were wrapping on spaces this previous glyph
would always be a space, and the right bearing would
subsequently be 0. But then the trailing spaces would be
trimmed and the right bearing of the actual last glyph
would not be recorded and never added to the text width.

This caused a failure in tst_qquicktext on Windows with both
DirectWrite and Freetype: This was purely unlucky, because
the metrics of the Tahoma font happened to be such that the
right bearing on the 'k' was enough to cause a line to
overflow. Since we didn't account for it when setting the
width, we ended up with unexpected line breaks, causing the
test to fail.

This did not happen with GDI, since it rounded the right
bearing of the character down to 0 (which was actually
visible in the layout, in that the k was painted a fraction
of a pixel outside the text layout's width).

In addition, QTBUG-130313 was causing us to pick a different
font when resolving the non-existent font requested by the test,
so therefore the bug was not found immediately when moving to
DirectWrite as the default but only when QTBUG-130313 was fixed.

We fix this by
  1. When adding a chunk of whitespace, we record the previous
     non-whitespace glyph that has been verified to fit.
  2. When adding a chunk of non-whitespace, we only record the
     previous glyph verified to fit *if* it is not whitespace.
	 Otherwise we keep whatever we recorded before adding the
	 spaces.

Pick-to: 6.8
Fixes: QTBUG-132075
Change-Id: I8d9a2f3197068f5f93520d217a6bb89633644e95
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 250117086ff15bba79df8f0e15ee66192edc9ea9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 07:24:35 +00:00
Eskil Abrahamsen Blomfeldt
51ed0b024b doc: Clarify usage of QFontMetricsF instead of QFontMetrics
A common source of issues is that people do not consider that
fonts can have fractional metrics and use QFontMetrics for UI
purposes, causing bounds and eliding to be inaccurate.

This is not very surprising, since the class name sounds very
much like what you should prefer by default and the docs
didn't even contain links to the QFontMetricsF class.

It might make sense to deprecate the class, since it really
does not serve any useful purpose, but for now we at least
document the issue up-front so that users can easily find
the alternative.

Pick-to: 6.8 6.5
Task-number: QTBUG-132102
Change-Id: I69756c561e5dee448a9d0a7d85af1a9b15ff1ae3
Reviewed-by: Nodir Temirkhodjaev <nodir.temir@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9a6036dea2cfe0cec555a503445aed93fed3d985)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 07:24:18 +00:00
Yuhang Zhao
d1c0eb2291 Windows theme: don't refresh anything unless theme really changed
Refreshing the global theme may be expensive for large scale applications, and even if Windows sent corresponding message,
it may be triggered by many reasons, not just the system theme,
so no matter what we'd better add an extra check.

Change-Id: I70847aa54fb4af37c81855a62330a4bce31ff104
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 9b924a4907a4a2b27ee52e807fd419caf219f655)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 07:24:11 +00:00
Ivan Solovev
b2bb9ef0f1 Refactor hasCompareThreeWay check
Use structs derived from std::false_type and std::true_type instead
of boolean constants. This allows us to make use of std::conjunction_v
and std::disjunciton_v in the conditions, thus making use of
short-circuit evaluation and saving unnecessary template
instantiations.

Still keep the constexpr bool *_v constant for the cases when we need
a signle check only.

Amends 678e9f614bc5a05d2ff16cf916397998e7cdfca1.

Pick-to: 6.8
Change-Id: If2ab48ef910e97f241f5922d4108a271bc532f3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8784ea16a6bc66ac481d5cbf2dd1ece2d57a836b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 07:23:29 +00:00
Tim Blechmann
9e22277d28 Cocoa: emit config error when using 15.0 as deployment target
QCocoaScreen uses removed APIs, which cause the code no fail compilation
with CMAKE_OSX_DEPLOYMENT_TARGET=15.0.
Adding a compile-time check to detect this early.

Task-number: QTBUG-128900
Pick-to: 6.8 6.5
Change-Id: I7eeb60f5769af6b1622efd1e0637e85a038b7930
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit b6f3695a80f5abfbcfb0ebb5b03358b8e7bbbaf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 07:23:12 +00:00
Topi Reinio
3b4a7d4881 Doc: Set trademarks page in global configuration
The new \tm command appends a trademark symbol and links to the
trademark documentation page if `navigation.trademarkspage` variable
is set. As we have such a page in qtdoc repository, set the variable
in the global configuration. This works as all Qt module docs have a
dependency to the `qtdoc` documentation set.

Pick-to: 6.8
Task-number: QTBUG-124393
Change-Id: Iabc6e7e5afe5114eac79947f0feb512458f1c4da
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 429f565017f7213a91eb0cf43966b2148e0bb651)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-20 07:23:04 +00:00
Volker Hilsheimer
43ab4d5c7b QPainterStateGuard: make movable, add test coverage
There's no real reason not to be able to move a state guard.

Since a moved-from QPainterStateGuard must not have a restore-
level count, we have to implement the move-constructor explicily.
Add a test case, which verifies that we don't end up with an
un-balanced save/restore count, and that verifies that we would
trigger the Q_ASSERT if we do.

Address comment from header review,
amends 9ecf47a8a8d11227ecf192246d7df7c2c4dc9105.

Task-number: QTBUG-132090
Change-Id: I1db135bf48c0fa0a7bac4fdae7b7263c356b5eb6
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit ec3a5f4994a2bafc65fa8e01fb0861219580f622)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 22:31:05 +00:00
Thiago Macieira
55a46ec005 QCommandLineParser: include the positional arguments' sizes in --help
We were mostly ignoring them because it looks like most people's options
were longer than their positional arguments. The rest must have just
accepted the enforced wrapping.

But if you have very short options like single-letter only ones or none
at all, the positional argument wrapping is unnecessarily short.

[ChangeLog][QtCore][QCommandLineParser] Made it so the positional
argument descriptions are taken into account in the aligning of text for
helpText().

Pick-to: 6.8
Fixes: QTBUG-131716
Change-Id: Ib1eee62c7cf4462f6a26fffdec233ba849ebf158
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 8928b0fbb9ca4caf9b63a32b3d2a73a6da096755)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 20:42:53 +00:00
Assam Boudjelthia
f10b13e469 Android: document androidtestrunner tool
Add documentation and usage of androidtestrunner tool.

Pick-to: 6.8
Fixes: QTBUG-84330
Change-Id: I03aa67ebf0ba807f20595547f2598d905080a878
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 5735d7ac861fe99a71d8044977e5f487c401ca12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 20:10:38 +00:00
Tor Arne Vestbø
5051e2b97b Extend blacklisting of tst_QWidget::showMinimizedKeepsFocus to macOS 15
It's flaky on all version.

Pick-to: 6.8
Change-Id: I01b2f0877efc100578c55d69e9f9ed65c02b2aab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1ce019815ba62245fd8ae6e8fb5e47f77621c3be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 20:10:38 +00:00
Ahmad Samir
d5cff9be0e QDecompressHelper: add comment for translators in readBrotli()
Spotted by Friedemann Kleint in code review.

Amends 763c47e055376bf6dbd4cd8fe1603b88aa3b72f0.

Change-Id: I3092c51964c167da30b6d1400ab2ba1e2f4df829
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d983a402a5c7106935439c95d08eaadbf0b26b60)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 20:10:38 +00:00
Eirik Aavitsland
a994bc80fe Update bundled libjpeg-turbo to version 3.1.0
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 3.1.0

Pick-to: 6.8 6.5 5.15
Change-Id: I321ae095b4ed826ceb940cbf13a63ec1a836acb3
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 1a5afe625be1ed936d2fc4da98ed1c8fa574ee7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 20:10:37 +00:00
Joerg Bornemann
8c3e5bcd21 Rename qscopedpointer.cpp -> qscopedpointer.qdoc
It only contains qdoc blocks and wasn't even listed in SOURCES.

Also changed the license to be in line with QUIP-18.

Pick-to: 6.8 6.5
Change-Id: I2c90300ddfd47c3f693dc84cb86f326fa185dd84
Reviewed-by: Lucie Gerard <lucie.gerard@qt.io>
(cherry picked from commit 1cdf813e221b5aa133bc85cb928e329ef1dea896)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 12:54:39 +00:00
Joerg Bornemann
9834571282 CMake: Split off private module config packages
[ChangeLog][CMake] Private Qt modules have been split off into separate
Qt6FooPrivate CMake config packages. A call to find_package(Qt6Foo) will
now implicitly find_package(Qt6FooPrivate). It's not an error if
Qt6FooPrivate isn't available as it may be the case on certain Linux
distros that split their Qt module packages into private and public
parts.

For every public module Qt6Foo that has an associated Qt6FooPrivate
module, create a separate Qt6FooPrivate CMake config package.

Let Qt6FooPrivate find Qt6Foo. This is a required dependency.

Let Qt6Foo find Qt6FooPrivate if it's available. A message of log level
VERBOSE is issued if Qt6FooPrivate is not found.

Implementation notes: In QtModuleConfig.cmake.in, we pull in the private
module. This is not part of the *Dependencies.cmake file, because

1. The Qt6FooPrivate package references the Qt6::Foo target, therefore
it must be available. And Qt6FooDependencies.cmake is loaded before
creating targets.

2. The dependency needs to be optional, and we don't have facilities for
optional dependencies in Qt6FooDependencies yet.

3. We'd have to avoid recursion, because of the Qt6FooPrivate -> Qt6Foo
dependency.

Fixes: QTBUG-87776
Change-Id: I8f23f07da7ca76486f87b759e197174c11e13534
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit fbbf4ace0188b9718b6d7808021c0b887fd52d9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 11:11:45 +00:00
Marc Mutz
072f2a2241 QXmlStreamReader: use QOffsetStringArray::viewAt()
This auto-computes the string's length without a NUL-byte scan, and
also fixes a GCC 14 unity-build C++23 warning:

  In function ‘constexpr qsizetype QtPrivate::lengthHelperPointer(const Char*) [with Char = char]’,
    inlined from ‘constexpr qsizetype QtPrivate::lengthHelperPointer(const Char*) [with Char = char]’ at qbytearrayview.h:69:28,
    inlined from ‘constexpr QLatin1String::QLatin1String(const char*)’ at qlatin1stringview.h:52:62,
    inlined from ‘constexpr QLatin1StringView contextString(QXmlStreamReaderPrivate::XmlContext)’ at qxmlstream.cpp:814:90,
    inlined from ‘void QXmlStreamReaderPrivate::checkToken()’ at qxmlstream.cpp:4018:85:
  qbytearrayview.h:77:16: warning: ‘strlen’ argument missing terminating nul [-Wstringop-overread]
     77 |     while (data[i] != Char(0))
        |            ~~~~^
  In file included from unity_0_cxx.cxx:412:
  qxmlstream.cpp: In member function ‘void QXmlStreamReaderPrivate::checkToken()’:
  qxmlstream.cpp:769:23: note: referenced argument declared here
    769 | static constexpr auto QXmlStreamReader_XmlContextString = qOffsetStringArray(
        |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Amends c4301be7d5f94852e1b17f2c2989d5ca807855d4, which was picked to
5.15, but didn't use QOffsetStringArray there (and unity-builds exist
only since 6.5), so only picking to 6.5.

Pick-to: 6.8 6.5
Change-Id: Ib50369aed6e8248fb88f43c7569c8a435c2b152e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 44366d07dca047f096d1366c43ba549c97150074)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 11:11:43 +00:00
Marc Mutz
da9ff584d1 Protect QT_ENABLE_STRICT_MODE_UP_TO against predefined individual opt-outs [6.9]
Since some of the Qt opt-outs are defined project-wide by the
buildsystem these days (e.g. QT_NO_QSNPRINF, ...), a module that
attempts to use QT_ENABLE_STRICT_MODE_UP_TO will hit warnings
regarding re-definition of these macros (definition on the compiler
command line, redefinition by qtconfigmacros.h).

To fix, guard the #define QT_NO_FOO's with #ifndef QT_NO_FOO.

Amends bd7d54249e3f2b6a9dd6b759c892d7c97d26c0aa (which was also picked
to 6.8).

Pick-to: 6.8
Change-Id: I88276c9ed01edde1495105cf5bd1e07b1fd244f4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 752de4a0aabc305af16251a55edf247e043b1b18)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 10:44:24 +00:00
Marc Mutz
d328e8eaaf Protect QT_ENABLE_STRICT_MODE_UP_TO against predefined individual opt-outs [6.8]
Since some of the Qt opt-outs are defined project-wide by the
buildsystem these days (e.g. QT_NO_FOREACH, QT_NO_JAVA_STYLE_ITERATOR,
...), a module that attempts to use QT_ENABLE_STRICT_MODE_UP_TO will
hit warnings regarding re-definition of these macros (definition on
the compiler command line, redefinition by qtconfigmacros.h).

To fix, guard the #define QT_NO_FOO's with #ifndef QT_NO_FOO.

Amends 3a6c8e02b6d1b0574da52b0087092d0c74aa92c1.

Pick-to: 6.8
Change-Id: I457457d1e60dbd9362b987157ba089adc67d1d6b
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 0f416cbaaba46ddb039bbf33e1d70dbe80821d57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 10:44:17 +00:00
Marc Mutz
6eb41440cd QTextStream: port from QScopedPointer to unique_ptr
In preparation of adding QT_NO_SCOPED_PONTER, which would be rather
pointless for users if public headers continued to mention the type.

Pick-to: 6.8
Task-number: QTBUG-132213
Change-Id: I6539e83158ab34e4fa4bd22b6d0ac5629a3b6db9
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b815c6f7fd71086c97fe6e9aa9472154be5fcc57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-19 10:44:15 +00:00
Robert Löhning
e63884c593 QRadialGradient: Fix crash on huge x values
Credit to OSS-Fuzz

Fixes: QTBUG-130992
Pick-to: 6.8
Change-Id: Iefaa6964966f6828bc23a603f085d283189f1a3b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 42bd879e2bc6e0d8370d320cca17df36ea68d570)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-12-18 22:08:02 +01:00
Christian Ehrlicher
3c0f08ab70 QBoxLayout: don't crash on passing invalid index
Passing an invalid index gives an assertion in debug mode and crashes in
release mode due to an out-of-bounds access. Fix it by appending the
given widget (same as passing a negative index which is documented).

Pick-to: 6.8 6.5 6.2
Fixes: QTBUG-130275
Change-Id: Id0c245e185acc36e5d07cea1d22619bb0e9eee07
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 0f9062ec71021c256dba7ee8498f036d7aac0821)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 20:17:36 +00:00
Christian Ehrlicher
72f48d0840 Windows11Style: Fix horizontal scrollbar arrows in rtl mode
The arrows for horizontal scrollbars must be swapped in rtl mode.

Pick-to: 6.8
Change-Id: I517fcea19837a6438edc261e066930218b71ce28
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 02920ef05a980d9bb670e1f8a4b84e0b6cef13c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 20:17:36 +00:00
Mårten Nordheim
ab667d881d Schannel: chop off garbage bytes if encryption fails
Because they would break communication (or loop infinitely) otherwise
since we use the presence of bytes in the returned buffer to know if
there is still something we need to transmit.

Amends 4e60a6b556d91ab797aebb7422666a685a726755

Change-Id: If72c1a142d4567f69d78177250b0218c5ca999fd
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 1efcc0df6adab11e7239f5f12a13766a58e2c1ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 20:17:36 +00:00
Topi Reinio
5fa520a77c Doc: Fix usage instructions for the \youtube macro
The example configuration included a space character that caused a
syntax error parsing the .qdocconf.

Replace the hardcoded qhp `QtDoc` project name with a placeholder.

Pick-to: 6.8
Change-Id: Iadf3a50e030f02182016ed9832f4f59d29f82c57
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 4051ec3356bded10cd7ac66dc1149259bc48d36b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 20:17:36 +00:00
Shawn Rutledge
019feea9b1 Always send QContextMenuEvent after the contextMenuEventType event
Both widgets and Qt Quick Controls are unable to avoid accepting the
right-click events (press and/or release) in at least some cases.
In the Windows UI pattern of allowing the user to select something by
pressing (and maybe dragging) with the right button and then getting
a QContextMenuEvent afterwards, it's sensible for the code that does
the selection to accept the mouse events, because that code is only
concerned with selection, not the context menu. And in Controls,
Pane is accepting all mouse events just to prevent propagation to
other controls underneath. (That might not be so great, but we don't
have a better way yet.) In legacy Qt Quick, accepting the event results
in an exclusive grab; so in fact, Pane gets the grab, so we can't use
that either, as a way to distinguish "stop propagation" from "this item
is handling it completely, nothing more needs to be done". So it
doesn't make sense for QWindowPrivate::maybeSynthesizeContextMenuEvent
to check the grabber either.

Amends 357c64a99607456133bfabf86d6b67162717cb29 and
84a5f50c7766c99f62b22bb4388137e0aa8dd13d

Task-number: QTBUG-67331
Task-number: QTBUG-93486
Task-number: QTBUG-132066
Fixes: QTBUG-132073
Change-Id: I822cada05cfef27afe6a44faf170585f027061f7
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 70c61b12efe9d1faf24063b63cf5a69414d45cea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 20:17:35 +00:00
Lars Schmertmann
835475873b Avoid linter warning "AndroidGradlePluginVersion"
This is a Qt dependency that the user cannot influence.
We did this in  cfefce57a4ff446305cd1f839e7c5203bac7a6c5
with "GradleDependency"  before. It is a Qt dependency
that the user cannot influence.

Pick-to: 6.8 6.5
Change-Id: I01ef84eab7ab743d5ea9eb15208ef9c567dd2a43
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit ab2a0438ef8b6cc2c73ab0f33d353d00c6599cd9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 15:40:50 +00:00
Alexey Edelev
abfaf5189c Remove _qt_internal_find_dependencies
Clean up the dead code according to TODO statement.

Pick-to: 6.8
Change-Id: I9bdf10067d3a1324d584cebc51cf4555f00f717a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 64435289027d53c9dace16eaa38087369fee6c4c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 14:13:05 +00:00
Mårten Nordheim
2aaaf7cf12 QThread: Link to QThreadPool::(set)serviceLevel
QThreadPool's functions already links to the QThread ones, but they didn't
link back.

From the API review.

Change-Id: I02853d8110806f735b748d022a1cfaea5a72d603
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit bbcf47a07d3ec138016d4f997c9b4849598c2f10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 14:13:03 +00:00
Mårten Nordheim
0a4ff045f1 Http2: Ignore RST frames on already-closed streams
Some http servers like to send RST frames whenever they send their response.
The stream is already closed at that point so it's a little weird, but the
RFC doesn't disallow it, so we'll just ignore the frames.

Fixes: QTBUG-132124
Change-Id: Ic26e249437b739830935e2f3feec572687579b21
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 2c71fdf043ca94d1c567f169d51245e2702bec19)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 14:13:01 +00:00
Marc Mutz
aac98b795d QDebug: make std::optional stream operator SCARY
Piggy-back on the recently-added, type-erased, std::tuple stream
operator to handle std::optional the same way.

While std::optional doesn't support the Tuple Protocol, and we
therefore can't use putTuple() directly, we can still use
putTupleImplImpl() if we set up its arguments manually.

[ChangeLog][Potentially Source-Incompatible Changes][QDebug] The
std::optional streaming operator is now a member of QDebug, not a free
function. This breaks users that rely on the exact definition of the
operator (e.g. `operator<<(d, opt)`). A backwards-compatible fix is to
call the operator with infix notation (d << opt) only, and to avoid
const QDebug objects.

Change-Id: Ib040d65953ca9d3892aee5bdb597d6d30a9694b1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 08320bfe2b7387d6f488d405dddf9d3aba6434ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-18 10:05:26 +00:00
Marc Mutz
94928669c1 QByteArrayView: add a ctor for arrays of unknown bounds
This appears to not have worked, ever, so add it as a new feature, for
view API symmetry, not as a bug-fix.

The new constructor is available for all compatible byte types,
because it is more like the (ptr) constructor (which is available for
all compatible byte types) than the known-size-array constructor
(which is only available for char).

This does not affect QB/QBV overload sets, since they could exist
ambiguity-free only if one of them is a Q_WEAK_OVERLOAD.

The GHS compiler doesn't like the CanConvert static_asserts, so
comment them out for it. The functionality itself is tested by
the fromArrayWithUnknownSize test.

[ChangeLog][QtCore][QByteArrayView] Made construction from arrays of
unknown size compile. Such arrays will use the const Byte*
constructor, determining the size of the array at runtime.

Task-number: QTBUG-112746
Change-Id: I201033656f123b09644e5de447cd5d7b038e5154
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 54d47f8390cb85c5b0f0ac050b5aa5a934d798b0)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-12-18 08:07:37 +01:00
Friedemann Kleint
6cd5ea15ef Use QPainterStateGuard in examples
Complements 9ecf47a8a8d11227ecf192246d7df7c2c4dc9105.

Change-Id: I65456f8fd34bf9d316b72c4286e1b15789309f7c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 1dc15c11db88f96a916258acea80a86bfa7c87cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 21:18:54 +00:00
Volker Hilsheimer
3339990b4b QPainterStateGuard: make InitialState enum scoped
Address comment from header review,
amends 9ecf47a8a8d11227ecf192246d7df7c2c4dc9105.

Task-number: QTBUG-132090
Change-Id: Idddca104b93ee23f4bac8621f1087a0ae7a1fe24
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit ec011141b8d17a2edc58e0d5b6ebb0f1632fff90)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 21:18:54 +00:00
Christian Ehrlicher
0dd2561d54 QStyleSheetStyle: Fix resetting fonts for subwidgets
When a compound widget is styled with a font through a property and the
default styling has no font settings, the font was not reset to the
parent font but left it the styled state.
Fix it by not resolving the current font when the style rule has no font
settings - use the parent font directly instead.

Fixes: QTBUG-131685
Pick-to: 6.8
Change-Id: I8e79423cfeff24143cd051b282503c4565125b4d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5731fe051e48e7a256ef31ae93cfb89ce8d871cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 21:18:54 +00:00
Volker Hilsheimer
a8b8a6fd6d QPainterStateGuard: document that restore() asserts when already at 0
Address comment from header review, amends
9ecf47a8a8d11227ecf192246d7df7c2c4dc9105.

Task-number: QTBUG-132090
Change-Id: Ie6eed6f83fcdde0f90514b6016a65905505073e0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 8ae4e3efdf80b658f8de19b13bfbea68e1dbd875)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 18:20:00 +00:00
Wladimir Leuschner
ad16cd816a WindowsQPA: Draw custom titlebar with QPainter
- Draw custom titlebars that are requested by setting the
  Qt::ExpandedClientAreaHint with QPainter instead of GdiPlus.
- Draw the application icon, in case it was set, for the custom titlebar
- Add DPI awareness to the custom titlebar

Change-Id: I276e7d8948e5a436f1835d96b59756b7237f63d2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 438aa1524ee99fd636dc02a7181857ade71bb101)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 15:14:12 +00:00
Timur Pocheptsov
c39a944e74 Revert "qnsview_drag: only ignore key modifier while dragging 'within the application'"
This reverts commit 4332cb313469de1525afe3cddd792d7bc7e08a14.
The original idea of distinguishing between context (outside/within application)
is not working anymore - it's always outside (except the moment when
a mouse pressed inside the window, which is immediately followed by
'outside application' context). So in fact we never ignore key
modifiers.

Fixes: QTBUG-132091
Pick-to: 6.8
Change-Id: I560a48ccf8f8ee1a55f812be6af18b1dd7e25c78
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7740ac36d27740ff9204cc2626f58620b7e214cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 14:16:23 +00:00
Ivan Solovev
cc2213ab27 Change QCommandLineParser::showMessageAndExit() argument order
Looking at other similar Qt APIs, the type argument usually comes first.
The typical related examples can be QMessageBox() constructor taking
QIcon as a first parameter, and qFormatLogMessage() function, taking
message type as a first parameter.

This patch changes the order of arguments, so that MessageType enum
comes as a first argument.

Amends bad618606d64e943e3fa78e7d1dbc8e1fab55480.

Found in Qt 6.9 API review.

Change-Id: Ibbdef755a8676a2c556fe7f1c95009ad51320b98
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 56114f4d1ed6ec26ff59a596caf09f5b4e0f5d68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 14:16:23 +00:00
Ivan Solovev
e69e53de8e Add docs to the new QCommandLineParser::MessageType enum
As a drive-by: move the \since command in the showMessageAndExit() docs
to the right place.

Amends bad618606d64e943e3fa78e7d1dbc8e1fab55480.

Change-Id: I4e6e6d63929029879867624e4007941edfca9cd9
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 6692beace9bb5f461d71935e500e1c6ccfa97fd1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 14:16:23 +00:00
Bartlomiej Moskal
6e3d2ad44f Android: Fix for multi-ABI build in androiddeployqt
7499fd0229d63f969bf6ca58d3b764b96395bed2 commit cleans up the localLibs
to not add dependencies to the libs.xml file as they will not be
satisfied.

Mentioned change created a regression with multi-ABI build. It happens
because in qtDependencies[ARCH] container, some libs just have different
atchitecture prefix.

This commit remove architecture prefix when checking libs in
qtDependencies container.

Fixes: QTBUG-131707
Pick-to: 6.8
Change-Id: Iae54779bfa4bd143ec35353604724d8ec4e35ef2
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit e59308c5119caac5d4f1024c7d8147e9887cb246)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 14:16:23 +00:00
Ivan Solovev
7c332839e0 Specify an underlying type for QCommandLineParser::MessageType
And also add a trailing comma to the last element of the enum to
minimize future diffs.

Amends bad618606d64e943e3fa78e7d1dbc8e1fab55480.

Found in Qt 6.9 API review.

Change-Id: I1a30c344967005c9abc73e59980e56626e09cd7c
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 14cc2591ac06dbcee01c2b110e014db2993d7a1e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 14:16:23 +00:00
Tor Arne Vestbø
9610a7cbdc QCocoaDrag: Only update m_lastView when it actually changes
The underlying QObjCWeakPointer used to track the view requires
a bit of bookkeeping, so avoid updating its value unless the
view actually changes.

Pick-to: 6.8
Change-Id: I6a1aeaf0e6e0eb221d55de00c8f30259832e58fa
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2e80e74f37980f62bb915983e61d6734fb416bcd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 14:16:23 +00:00
Tor Arne Vestbø
c8ae8244b4 QObjCWeakPointer: Clear existing associated object on assignment
If the existing m_object is the same as the incoming object the
call to objc_setAssociatedObject in trackObjectLifetime will
release the existing WeakPointerLifetimeTracker after assigning
a new one, which means we'd clear the QObjCWeakPointer's object.

We now reset the state up front.

Fixes: QTBUG-132256
Pick-to: 6.8
Change-Id: If2c08840d465ae6d190c87a4720a537fe9caa8dc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 92012333d112dbdf2926117ec3bb123bd30ed9fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 14:16:22 +00:00
Christian Ehrlicher
9b2e444811 QAbstractItemView: use 'int' as datatype for updateThreshold
... to sync it with the rest of the api.
This amends ff339819925ab550c48b53d9baaba43e5adebfaa.

Task-number: QTBUG-124173
Change-Id: I0ed4681bf7d3717f84a7e888affb0c8cae877c35
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 15a1ae90f5b6da3ffd50acda63ddd33ca14227f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 10:52:59 +00:00
Marc Mutz
ee69826054 qthreadstorage.h: fix position of namespace macros
The file contains two implementations of the class template, one for
QT_CONFIG(thread) and one for without. Both are in the QT_NAMESPACE,
but each provided their own QT_{BEGIN,END}_NAMESPACE macro pair.

This is unneeded and may throw off scripts which use the macros as
insertion positions (like includemocs, which, however, operates on
.cpp files, not headers).

To fix, move the namespace macro pair to be around the #if
QT_CONFIG(thread) block.

Pick-to: 6.8 6.5
Change-Id: I56c1f9a4ef7df0fba54c72d8a213fa92573b826c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8553ffd8d147ecf6a713d12a360027b477dd59c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 10:08:46 +00:00
Yuhang Zhao
3c0986a34c Windows: Fix title bar size calculation
The title bar calculation is terribly wrong and was
missed during review.

Change-Id: I0c7a860e747465e6a5e4d8aa5415a9701cf170fd
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit f6af3a581642170f0f4fe0d0563851715e045391)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 07:58:48 +00:00
Marc Mutz
9e86f73f82 QStringView: refuse construction from QStringRef
When QStringRef was moved out of QtCore, it was also incorrectly
removed from the if_compatible_container constraint, causing
QStringView{sr} to still match the general container QStringView ctor
overload, which doesn't preserve null'ness if data() doesn't return
null. By refusing to provide a constructor from QStringRef, we force
the compiler to use QStringRef's implicit conversion operators
instead.

This transitively affects QAnyStringView in the same way.

The tests can, naturally, only be in qt5compat, so define a macro to
communicate to tst_QStringRef whether it compiles against a fixed
QtCore or not.

Fixes: QTBUG-122797
Fixes: QTBUG-122798
Pick-to: 6.8 6.5
Change-Id: I64b75a8e421d2b6185615e3288ce3ad7fd8f15f9
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit a0e65398483729259cf58781949133c6055fdc7c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 20:44:29 +00:00
Volker Hilsheimer
cdfd686714 QSqlQueryModel test: don't copy a QSqlQuery
Move the query into the model, and use a local scope to make sure that
we don't use the moved-from query later.

Change-Id: I9d216e770733af8b0771280276dba0775209a802
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Dheerendra Purohit <dheerendra@pthinks.com>
(cherry picked from commit af760da54190d96b315ea8edeec00c86871af0d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 20:18:13 +00:00
Tor Arne Vestbø
78051d03ca Document that QPlatformTheme::standardPixmap should always be a 1x pixmap
This reverts 59bbfb17db563d7e62b9f3158dab3cc6e7e68acd and
c853054910552f5fef04797222dde0d29a0c340d, as that approach
was causing issues for QCommonStyle::iconFromWindowsTheme,
for example in situations where the system has a 1x and 2.5x
screen, and the user requests a 16x16 pixmap or icon via
QStyle::standardPixmap or QStyle::standardIcon. In that
situation our smallest pixmap is 40x40, and we need to
downscale, causing blurred results on a 1x screen.

Change-Id: Ifa6e15d37d15954df689253c32eaa779885c567b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d884abaf8bdc1be74ee52306948c0be1986d738d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 20:13:30 +00:00
Christian Ehrlicher
eab71ff6b0 Windows11Style: adjust subline color in editable widgets in dark mode
The color of the subline in editable widgets was black in light and dark
mode. Fix it to use white in dark mode to make it visible. Move it out
into own helper function since it's used in at least three places.

Pick-to: 6.8
Task-nubmer: QTBUG-131585
Fixes: QTBUG-131586
Change-Id: Icca2b142a1ce0c3d7f722baa6d3635bae5950e1c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 66d42b62b6f01205cf1db72e56ecb5166554e373)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 20:13:28 +00:00
Christian Ehrlicher
07ad8c8444 QStyleOptionViewItem: document 'widget' and 'locale' member
These two members were added during Qt4 times but never documented.

Pick-to: 6.8 6.5
Change-Id: Ife4abfc6d8883f4c26ce5b95d5c0cfd3adcbd6bf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
(cherry picked from commit a90d9f4823bd6baf4cb660a942c2b1695441dbbd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 19:37:58 +00:00
Eskil Abrahamsen Blomfeldt
501f78855e Fix DirectWrite subpixel antialiasing on BGR screens
On monitors where the subpixel arrangement is blue, green, red,
our DirectWrite rendering would give the wrong subppixel
antialiasing, causing color fringes on text.

Like we do with Freetype, we determine subpixel arrangement of the
primary screen and use this as the default.

Pick-to: 6.8
Change-Id: I9ce7025449106a2376bd0ed02ce07b59c79438bd
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit d5cef74d8d71458500f979c0d31a7241b3fef9db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 19:37:56 +00:00
Eskil Abrahamsen Blomfeldt
bfb80b7b45 Support variation selector when emoji segmenter is disabled
This amends cb2633468413d8c2a9e28d4c4a10b25e90dd3116.

The patch excluded the ad hoc parsing of variation selector
except when Qt was built without the emoji segmenter. The
reasoning being that the emoji parsing handles this correctly
now.

However, when setting the QT_DISABLE_EMOJI_SEGMENTER variable
in the environment, this is supposed to work as a fail safe
which gives you the original behavior, in case there are
regressions. Therefore, the variation selector handling needs
to be run also when this environment variable is set.

Change-Id: I2669d29016a552775461aad13e50459baecdc26f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit aaf7437db3a520ab14220a46cf9427cb9a8d915c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 19:37:55 +00:00
Eskil Abrahamsen Blomfeldt
f5e2166bbd DirectWrite: Remove ad hoc font resolution through GDI
In b8612eaa2a17e12e31ee28141cff1fb43e54c00e, we added a fail safe
where failure to find the font name through DirectWrite would
try loading it through GDI instead and if that was successful we
would register the family with the database after all.

However, the code assumed that CreateFontIndirect() would return
NULL if the font did not exist. It does not do this, but instead
selecting the HFONT on the HDC will give us a suitable alternative
instead. The result would be that any missing font family would
be registered with the font database through this mechanism, even
if it really didn't exist.

This code was added in an early version of the patch, however,
and it should not actually be needed anymore, since we in later
versions of the same patch also added logic to populate the
GDI-compatible family names
(DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES etc.). This should
take care of backwards compatibility with the GDI names for fonts.

Since the code has been reported to cause problems on some systems,
it's safest to just remove this hack.

Pick-to: 6.8
Task-number: QTBUG-130313
Change-Id: I7eca893d17796d9cac07391b7b947d28dd7cd920
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 355f54f7d5dd300c73bf203f12e24305d0e227c1)
2024-12-16 15:24:24 +01:00
Andy Shaw
9988cd2469 SQLite: Fix attrition file to have right version number
Pick-to: 6.8 6.5 5.15
Change-Id: I9fea5c8d19209c44b16916645e600735de929d80
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 311ac55f118dc88add297853318cd0cfd7c1c0d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-16 07:13:13 +00:00
Assam Boudjelthia
440dcaca27 Android: handle quotes in hard-coded namespace in build.gradle
Remove quotes from the namespace values if they're set
directly to build.gradle.

Fixes: QTBUG-132150
Pick-to: 6.8
Change-Id: I7f5e132c2600bf5079850c99dc500b1dff7e6a96
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 60f78212379ba2b4a7a9bfadc5088a60309e923c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 18:29:03 +00:00
Magdalena Stojek
7ab145a9ef Output both global and local data tags in benchmark result header
Modified QPlainTestLogger::printBenchmarkResultsHeader() to
concatenate and display both global and local data tags, in
the benchmark result header, in the format `global:local`.
If only one tag is available, it is printed alone.

Pick-to: 6.8 6.5
Fixes: QTBUG-127522
Change-Id: Ic9f3c712ef3f6858aad2546b80d8867ce860b644
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit 95f02adf756d1ae485f39a060c6f23a5af3f64ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 18:04:39 +00:00
Michael Weghorn
b5ba125fa0 QMenu: Accept accelerators typed on keypad
Add Qt::KeypadModifier (and the combination with Qt::AltModifier) to the
modifiers that may be set in a key event in order to trigger a menu
action via its accelerator.

Otherwise, an action that has a number set as the accelerator (e.g.
using text "&1 Exit"), cannot be triggered by typing the corresponding
number on the keypad.

Fixes: QTBUG-73390
Pick-to: 6.8
Change-Id: I0fa63b0c5f23823c61e159fcc72f7245215f8aae
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ca4334bc966c7e5f9997f98b83afe37eb8b1d3ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 17:20:11 +00:00
Christian Ehrlicher
c437c6a4f6 Style: pass widget to styleHint() where appropriate
QStyle::styleHint() take the QWidget as optional third parameter. Add
this to calls to styleHint() where appropriate.

Fixes: QTBUG-2501
Pick-to: 6.8
Change-Id: Id4e4158cc889236064f2f618495608736607d457
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit aa341ecca816e3503a834ffde0ec6cb817139427)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:46:27 +00:00
Thiago Macieira
ff303c5cd9 QMutex/FreeBSD: mark the functions as noexcept as it always has futex
See qfutex_freebsd_p.h.

Pick-to: 6.8
Change-Id: I7e7bbb8387ae2e7b0c39fffd65c7b03e3a65a853
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit c1bc98da02f0f9335e10f45cc5df4c7e3afcee31)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:35 +00:00
Fabian Kosmale
510f8005bc moc: Always indentify as moc
External tools might rely on the output of "moc --version" to identify
moc, and, depending on how robust their parsing is, could break if the
reported name does not equal "moc".

Explicitly set the application name to moc, so that even if the moc
binary gets renamed and invoked via a symlink, it will still correctly
identify itself.

This might help with both binaries from the Qt Company's installer, as
well as with distros which rename moc to moc6.

Pick-to: 6.8 6.5
Task-number: QLS-1605
Change-Id: Id85e2ffa17d445213da0b37e7bd038d7b68e2c2a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 47be32b761ea6e1f2c1bfa9dd9eb38846ce2fd45)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:35 +00:00
Thiago Macieira
e9509291ae QSharedMemorySystemV: fix shm vs sem typo
Fixes: QTBUG-132053
Pick-to: 6.8
Change-Id: Ia4f2bdc8edff91020f13fffd79261a9feaf2f496
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 902058e750e67bbfb166db576c538b7add9be08f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:35 +00:00
Thiago Macieira
7664b826db QMetaType: remove the temporary QMetaTypeTypeFlags compatibility
Amends 44876fb45e702c2554fca98ed19af57feb1c0511.

Change-Id: I5ea354bcb6847e996081fffd012130562999d5c4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e48fe10e541c6dec9db4226f8ad02728de7b0e02)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:34 +00:00
Ivan Solovev
8bd0625f54 [docs] Add QSpan details to overview of C++20 features
Document that QSpan exists because we cannot use std::span, and
explicitly point to the differences between QSpan and std::span.

Task-number: QTBUG-128837
Pick-to: 6.8
Change-Id: I54f406e3306ee1da136107323887f0c87f94ff9b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 083ebfa1a5cb16b0b62ae5b5855a602b2f9ba818)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:34 +00:00
Eirik Aavitsland
4d009678ce Fix in-place conversion of certain QImage formats
In the copying/transcription of the generic converter to the generic
in-place converter, a test for Format_RGB32 destination format was
mistakenly replaced with test of source format. The result was that a
suboptimal pixel store function was selected, and the resulting image
data could end up with non-0xff in the unused alpha field.

Task-number: QTBUG-132051
Pick-to: 6.8
Change-Id: If3ebf5fdd7ab6e377c8ad479ea38ce665f922b7c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 0ace5ba0357b1614b47cb38a16f4afb2fe8e62db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:34 +00:00
Edward Welbourne
e2a0ef30da Fix assertion failure on parsing Feb 29 in a non-leap year
If there's no way to resolve an actual date with the data parsed, then
the date-text given is invalid, so don't try to fix it up.

Pick-to: 6.8 6.5
Fixes: QTBUG-132115
Change-Id: Ic6821bd01394d4dba1be1d25806c372800f8176b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 72519aeb237a4085aeb6290b0b4088c690fad106)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:34 +00:00
Mårten Nordheim
d53feb3da2 QHash: fix small performance regression when detaching with resize
There are two QHashPrivate::Data constructors (and two overloads of
::detached()). Initially the Data ctor that takes a new size always
assumed a resize was happening, and any place where there _may_ be a
resize we would usually detach then rehash.

In an effort to avoid the detach+rehash and instead call detach(d, size)
without the performance overhead of rehashing the call to
reallocationHelper() in this overload of the ctor was changed to verify
that a rehash was actually needed. This had the unfortunate side-effect
of making the compiler no longer inline the reallocationHelper()
function, and it no longer expanded the if-expression with the constant
so it was doing a tight copy-loop with a potential branch in the middle.

In this patch we revert that and make the bool a template argument to
highlight that it should be a constant for better performance (but also
leaving a comment.) Also mark it Q_ALWAYS_INLINE, it has two uses and
they both take advantage of the inlining + expanding the expression.

In theory this might have had an impact on QHash::reserve() calls,
though this code is only relevant when reserve() would cause growth so
the performance regression would hopefully be small compared to all the
other work that would also be needed.

Reverts 45c137d797a85c694897e8b1c5099abacc16e2f5

Pick-to: 6.8
Change-Id: I0d2076a9ded8ca816c54d6ce42d472a23bcbc9fd
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6c8b6acc894e47a37c4fb443316d9c40d35a144c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:33 +00:00
Edward Welbourne
7baf9d06b5 Fix typos in qstring.cpp (noticed while reviewing other changes)
Pick-to: 6.8
Change-Id: Ief8a9c429b5cdf424e0c3a57d15b1fcb4fdc963c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5d5c8d277af77cba069b805074551254c0f0d9c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:33 +00:00
Mårten Nordheim
9d7fabb6c2 QHash: call the different detached() overloads depending on resize
Instead of using just the detached() overload taking a new size, call
the two un-sized one when not resizing. The unsized overload is faster
because it is inlining the reallocationHelper() function and expanding
a branch by way of a constant.

And drop the call to rehash in the !isDetached case, if we enter this
branch we willfully 'attach' the detach guard to keep the key and values
alive.

Follow-up change will fix the sized detach() to use a constant again.

Amends d9ad2251d9fff85a18ce5afc62bcb1230cd2820d

Change-Id: Ia1640766b898610d12b5df20d83cefe5ca2d4c36
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ac2b0b958e97c41b38c42c0789d91de724d567ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 16:40:33 +00:00
Marc Mutz
51bfc9da41 Q{Any,Utf8}StringView: fix construction from arrays of unknown size
Like QStringView's, these classes' documentation promised
is_constructible<View,Char[]>, but failed to deliver, because neither
the (const Pointer&) nor the (const Container &) compile for arrays of
unkonwn bounds, and the (const Char*) one is just a QDoc fake.

Apply the same fix as for QStringView: Add a ctor specifically for
arrays of unknown bound, delegating to the (ptr) overload.

The GHS compiler doesn't like the CanConvert static_asserts, so
comment them out for it. The functionality itself is tested by
the from*ArrayWithUnknownSize tests.

[ChangeLog][QtCore][QUtf8StringView/QAnyStringView] Made construction
from arrays of unknown size compile. Such arrays will use the const
Char* constructor, determining the size of the array at runtime.

Pick-to: 6.8 6.5
Fixes: QTBUG-112746
Change-Id: I7acdcae3c5bdf80a0bed673e621d53ef34a92a1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 734bd05d0a6d37d6488cf8d1b2b9f79b9329d966)
2024-12-13 14:31:08 +01:00
Marc Mutz
1f0dc7635e QLatin1StringView: put qstringfwd.h in control of Q_L1S_VIEW_IS_PRIMARY
Less duplication, matches what we do for q_no_char8_t namespaces, too.

Amends 94addad4dd1c89df9c6820d34b9a90424456c492.

Pick-to: 6.8 6.5
Change-Id: I5d98babcb66d1196d3aed31c33289a1b11212a3d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 2d2ee569421338dbc07a479a7df2531bd37f0ebe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 11:27:53 +00:00
Marc Mutz
137da0326a QStringView: use qstringfwd.h
... instead of fwd-declaring a bunch of stuff manually.

Also move the fake QDoc decalaration of a "class QUtf8StringView"
over.

Pick-to: 6.8 6.5
Change-Id: I80bc3240d69f69602c127fc0e8fe694dd46765f1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 8404c21152ed3e28f8e00d683a494a8e1e25a69a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 11:27:47 +00:00
Ulf Hermann
60d28c8c7c Android: Fix some warnings
Use a static logging category where possible, and check the return value
of QFile::open.

Change-Id: Ieda9f7874d1b88d9bfeb593243eb867d0c274e9f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit e0ef713a2c6a74fe574481e98f0a582819418ed0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 11:27:42 +00:00
Marc Mutz
e076767bfd qstringfwd.h: don't include qglobal.h
qstringfwd.h is supposed to be a lean header, dragging in all of
qglobal.h perverts the purpose.

This also helps with certain circular-dependency issues that
appeared when attempting to use this header in other low-level
headers.

Amends abe3b4c9b947de5e55085b37840e0d1d6f3aae42.

[ChangeLog][Potentially Source-Incompatible Changes][QtCore] The
qstringfwd.h header no longer includes qglobal.h. A
backwards-compatible fix is to include qglobal.h yourself instead of
relying on the transitive include.

Pick-to: 6.8 6.5
Change-Id: I1726fccfd13b3a058abaf800c1bbf02c320143a4
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 5def8ff180c67f288bdc6e3c05b96940aeae37c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 11:27:41 +00:00
Kai Köhne
c76b845d90 Doc: Fix links to QIODeviceBase:: flags
Pick-to: 6.8
Task-number: QTBUG-131484
Change-Id: Iee545986d4fb4765086fecce6532092d4b691ae8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d3dad28a51743bb408dee1cf997646a89eb6693b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 09:10:52 +00:00
Kai Köhne
604dcc714a Doc: Improve QTemporaryFile::open() descriptions
Explain the behavior of open() in detail, including the edge
cases (reopening a file). Fix links to QIODeviceBase::OpenMode
flags. Use explicit links to make linking more robust. Use
the same parameter name 'mode' as in the base class.

Pick-to: 6.8
Task-number: QTBUG-131484
Change-Id: I5d01b3bb48a7a439b93c144e6d38482607de8d33
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit adaf1fb107ceb7003313ceb67605f986b74763b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 09:10:46 +00:00
Kai Köhne
b70e61788f Doc: Improve QProcess setStandardOutputFile description
Fix links to OpenMode flags. While at it, make links explicit so
that future changes breaking implicit linking will cause errors.

Pick-to: 6.8
Task-number: QTBUG-131484
Change-Id: I20b80014eadcbcba6ebebab1ff4db4c345dd434a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4e85a4f401118f2f7330b673e45b4a0399825ef3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 09:10:39 +00:00
Kai Köhne
5d2f40a14b Doc: Improve QBuffer::open description
Explain the method, instead of just linking to the base method.

Call the argument 'mode' instead of 'flags', like it is done in
the base class.

Force the mentioned QIODeviceBase flags to be links. Use fully
qualified name for the first flag mentioned, but use the short form
for the rest to improve readability.

Pick-to: 6.8
Task-number: QTBUG-131484
Change-Id: I8e9668ffc095ec261e2be54a2dcf16a32e4cb441
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 334460407b7cde1cdab5cfe5abe00175893749c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 09:10:33 +00:00
Kai Köhne
eb44663eaa Doc: Improve QFile::open description
Force the mentioned QIODeviceBase flags to be links. Use fully
qualified name for the first flag mentioned, but use the short form for
the rest to improve readability.

Mark true and false to be written in code style.

Task-number: QTBUG-131484
Pick-to: 6.8
Change-Id: Iebb0f9c6df382327bc5980e9e06c11deb6658291
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 647bee67150dedbd2a9fd2ddcd265d535e8fd8cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-13 09:10:27 +00:00
Marc Mutz
83e18b6540 qstringfwd.h: add missing QString fwd decl
qstringfwd.h should probably fwd declare QString, too :o

Amends abe3b4c9b947de5e55085b37840e0d1d6f3aae42.

Pick-to: 6.8 6.5
Change-Id: I80558c92d1144ead0aade410a8b1810713fed701
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit bc4105c843f666eaeaaa44b5a1f897ffa5824ec7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 20:10:54 +00:00
Marc Mutz
df2f31b9bf qsocketnotifier.cpp: un-break -unity-build
qsocketnotifier.cpp is using a #define to activate a second overload
of QSocketNotifier's activated() signal.

In unity-builds, this overload becomes visible to other TUs and breaks
new-style connect()s¹. In PCH builds, the define comes too late (the
qsocketnotifier.h header was already included by the pch header,
without the define).

Fix by adding qsocketnotifier.cpp to NO_PCH_SOURCES (thereby to
NO_UNITY_BUILD_SOURCES, too).

¹ and the signal's use of QPrivateSignal makes disambiguation by
  qOverload(), or assignment to a function pointer, impossible.

Amends 487dd80bce9c6006f349ccb09222e1c308200f0a(!).

Pick-to: 6.8 6.5 5.15
Change-Id: I40ca3b90f7ecc3116ae78dc952583efa299bcedb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit a38cebfe23674bb459eed6bbbcac965ebf2b6075)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 20:07:29 +00:00
Marc Mutz
e8605372ba qsettings.cpp: really un-break -unity-build
The use of Space was still ambiguous. Says GCC 14:

  qsettings.cpp: In static member function ‘static bool QConfFileSettingsPrivate::readIniLine(QByteArrayView, qsizetype&, qsizetype&, qsizetype&, qsizetype&)’:
  qsettings.cpp:1564:82: error: reference to ‘Space’ is ambiguous
   1564 |     while (lineStart < dataLen && (charTraits[uint(uchar(data.at(lineStart)))] & Space))
        |                                                                                  ^~~~~
  In file included from unity_0_cxx.cxx:277:
  qjsonparser.cpp:217:5: note: candidates are: ‘<unnamed enum> Space’
    217 |     Space = 0x20,
        |     ^~~~~
  qsettings.cpp:1523:8: note:                 ‘SettingsImpl::<unnamed enum> SettingsImpl::Space’
   1523 | enum { Space = 0x1, Special = 0x2 };
        |        ^~~~~
  qsettings.cpp:1605:71: error: reference to ‘Space’ is ambiguous
   1605 |                 while (i < dataLen && charTraits[uchar(data.at(i))] & Space)
        |                                                                       ^~~~~
  qjsonparser.cpp:217:5: note: candidates are: ‘<unnamed enum> Space’
    217 |     Space = 0x20,
        |     ^~~~~
  qsettings.cpp:1523:8: note:                 ‘SettingsImpl::<unnamed enum> SettingsImpl::Space’
   1523 | enum { Space = 0x1, Special = 0x2 };
        |        ^~~~~

Fix by making Space and Special local aliases (contexpr variables)
instead of importing the whole SettingsImpl namespace.

Amends 4ff65f0e5615b1132ec13c6eeba3647162d8dd0f.

Pick-to: 6.8 6.5
Change-Id: I9e8f2422885121fb02938261fbae6231e62ae46d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 057defe283f1db5fa9dfb1d8183b94d441c3707b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 20:07:22 +00:00
Marc Mutz
00f6df326f qresource.cpp: fix -unity-build
GCC 14 complains:

  In file included from unity_0_cxx.cxx:121:
  qresource.cpp:283:7: error: ‘QResourcePrivate’ has a field ‘QList<{anonymous}::QResourceRoot*> QResourcePrivate::related’ whose type has internal linkage [-Werror=subobject-linkage]
    283 | class QResourcePrivate {
        |       ^~~~~~~~~~~~~~~~

(Hot-)fix by adding qresource.cpp to NO_UNITY_BUILD_SOURCES.

Amends fe6dda9bb9310878b408b2421f60acb7135bd8ba.

Pick-to: 6.8
Task-number: QTBUG-132114
Change-Id: Ic414d1cf9e4dad94d4263b3657d31df896c4e417
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 57fab6a1c2df8f52b25f6db4017bb3acfa8e0526)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 20:07:16 +00:00
Marc Mutz
06a209384a tst_QString: extend arg() tests with enums w/o explicit underlying_type
The QtDeclarative code causing QTBUG-131906 hits UB, because it tries
to store -666 in an enum {A, B}, which has a valid range of [0,1],
therefore its underlying_type is uint, yet, as per [conv.prom]/3¹,
integer-promotes to _int_ instead, so in Qt 6.8 would cause the
arg(int) overload to be called, outputting -666, while in Qt 6.9, it's
treated (correctly) as an unsigned value, outputting -666's two's
complement, a positive value.

Add a version of the scenario that does not cause UB.

¹ Thanks to Ahmad Samir for digging up the pertinent legalese.

Task-number: QTBUG-131906
Pick-to: 6.8 6.5
Change-Id: Iba1a04de523a0b4cd1c87deea40c643cf16df14f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e64fd05fecae291c9d7358d2e47d7170995af256)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 20:07:12 +00:00
Thiago Macieira
b143215c54 QString: update docs to prefer "UTF-32" over "UCS-4"
They are now the same, but the name UTF-32 is preferred over UCS-4.

The original ISO-10646 UCS-4 encoding was allowed to use all 31-bit code
units, from 0 to 0x7FFFFFFF[1] including those above 0x10FFFF, which
correspond to UTF-8's five- and six-byte sequences. Unicode doesn't
allow that and restricts the UTF to the range possible in UTF-16.

Renaming the functions is left as an exercise for the reader.

[1] https://en.wikipedia.org/wiki/UTF-32#History

Pick-to: 6.8
Change-Id: I2f29db62b974cb689585fffd9a6434ae252a7651
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 973d0c4c5160200c188f81da5df064510315f22d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 19:38:25 +00:00
Marc Mutz
31e3012296 tst_QStringView: verify that char16_t[] args aren't ambiguous for QS/QSV overloads
They are not.

Pick-to: 6.8
Task-number: QTBUG-112746
Change-Id: I2a20d68543f5914690acbcb4f214b1d98681de6a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 67990c16a6b631c1d809d1ad656fc941293b3f83)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 19:38:23 +00:00
Thiago Macieira
bb91219b26 QString::fromUcs4: use std::char_traits or wcslen() to find the size
... when the user passes size = -1. std::char_traits<char32_t>::length()
doesn't appear to be an any better implementation than our simple loop,
but maybe some compiler will optimize it.

wcslen() is usually optimized in the C libraries, even for Unix
platforms that hardly ever use it (it's used as a fallback in qustrlen()
for non-x86 Windows systems).

Pick-to: 6.8
Change-Id: Ia143270869a3a7cf5754fffdc17e500fc454397b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit b98cf4fc4afaf55145c34ba06d61fec38fadc25d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 19:38:19 +00:00
Marc Mutz
2dfc0cb6f6 QStringView: fix construction from arrays of unknown size
The original idea (8b5aa7b6c40d70a7ec15b3ea485f28a142fb247c) of the
separation of array and pointer ctors was to determine string literal
sizes at compile-time in C++11's limited constexpr semantics.

But when the scanning for NUL characters was added to the array ctor
in 107ff4c1d6b5da2cb11c65b2bd9106817f7fdb02, the distinction between
the two ctors became meaningless, because we were able to assume
post-C++11 constexpr to make the Char(0) scan a compile-time action.

Finally, 9e1dc1e8a9fda1a7576cc6377c8a36decff631eb removed the array
ctor in favor of the generic Container ctor. I didn't check whether
the old code handled arrays of unknown size, as in

    extern const char16_t str[];
    QStringView sv = str;
    ~~~
    const char16_t str[] = "str";

but std::size() (and therefore if_compatible_container) surely bails
on such arrays, and if_compatible_pointer also SFINAEs out. As a
consequence, such arrays cannot be used to construct QStringViews atm.

Fix by adding a new constructor for arrays of unknown size, delegating
to the existing pointer overload.

The GHS compiler doesn't like the CanConvert static_asserts, so
comment them out for it. The functionality itself is tested by
the from*ArrayWithUnknownSize tests.

[ChangeLog][QtCore][QStringView] Made construction from arrays of
unknown size compile. Such arrays will use the const Char*
constructor, determining the size of the array at runtime.

Pick-to: 6.8 6.5
Task-number: QTBUG-112746
Change-Id: Ifdb217350d93d38f081c99f14661975491d32076
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 56faffd92bf0ac459a921ec043a6f3b3dba51acc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 19:38:16 +00:00
Ulf Hermann
2a512fd901 Use inline namespaces rather than "using" for logging categories
Amends commit fa4bd30caa079a3b1e5eac1bb4f17365f456b8f9.

Fixes: QTBUG-132111
Change-Id: Iad7969a1841b8cea162e4b0e6624d02313618ef1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 529ebb31702e8465a9ba42f4c56c749cb7bf7b75)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 19:38:16 +00:00
Marc Mutz
443bdb9620 tst_QAnyStringView: complete Char[] CanConvert sets
Other view tests test Char[N] and const Char[N] separately. Do the
same here.

For many Char types, the array CanConvert test was missing
completely. Add them.

Pick-to: 6.8 6.5
Change-Id: I1d0b6de394d548554a547f190e74cb8cead6ecd4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 0bbbbfc78beb2393ceea0de0fa85942f71d0a2ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 18:21:54 +00:00
Ahmad Samir
149150ab47 QtSql: fix GCC -Wextra-semi warnings after member function definitions
Pick-to: 6.8
Change-Id: I5b65f543d7a36386181e493d8b9ce0267132d686
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 291c762802a2f5e1edb6bd9a842663ca5689323a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 18:21:51 +00:00
Marc Mutz
29e2695676 tst_QStringApiSymmetry: test QByteArray(weak)/QByteArrayView overloading
Adding it here since this test case already has all the infrastructure
for the overload test.

Pick-to: 6.8 6.5
Change-Id: I2d7fff9d2d82fed3db2446690a354f939c9a37fc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 140dac92f2a8ee1f54843f69be4026900a049ee7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 18:21:48 +00:00
Ahmad Samir
dbaef86144 Fix GCC -Wextra-semi warnings with Q* macros
Namely, Q_ENUM, Q_DECLAR_FLAGS, Q_FLAG, Q_DECLARE_EQUALITY_COMPARABLE.

The sanitize-commit (from qtrepotools repo) git hook already warns about
these.

Pick-to: 6.8
Change-Id: If53f446c7c19856c4a5be1e0b0156e1892871dae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 8d3601dfe8e6a89cbf0ab0ff8089e232f52c21d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 18:21:44 +00:00
Marc Mutz
9bcbeea2ad tst_QByteArrayView: check conversion from various QSpans
This is supposed to work, so check it.

Pick-to: 6.8
Change-Id: I201033656f123b09644e5de447cd5d7b038e5155
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 8a3ffe7044249bcfb5185bd87a9713685d48de7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 18:21:41 +00:00
Ivan Solovev
7044c32963 Fix docs for QSet (in)equality operators
The missing '&' prevented qdoc from generating the docs.

Amends f9f3bf79dccbfcabbd5c59c39f9f018d71b7549f.

Change-Id: I1d8d7a4e2f4c46c4c365cb5a5e38877837881c45
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 03389d47902347e858bbafc990de3ab988c07acf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 18:21:39 +00:00
Ahmad Samir
8472fc2573 Fix GCC -Wextra-semi after member function definitions
Fixes: QTBUG-132101
Pick-to: 6.8
Change-Id: Ia2e13bdaf11c639c5590639717b5d31140352c44
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6b951f6c0c09b7d7b473a3951e7b6cec41dbec73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 18:21:37 +00:00
Volker Hilsheimer
3de6c570fb QFontIconEngine: if we can't find the named glyph, try ligatures
Use QTextLayout to layout and shape the text, which will respect
ligatures. Many icon fonts might not name their icons, but have a
replacement ligature for the actual icon name replacing the text with
the respective glyph.

So if for the name of the icon we get a single glyph run with a single
glyph in it, use that to render the icon.

Change-Id: If0e5c528c3ac4cccdbb7df5fb7fd32ca232f2a66
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit d10e9174fecb91b5c366d57aeb19e6410522a807)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 14:28:37 +00:00
Volker Hilsheimer
8b4a8b1e10 QFontIconEngine: always initialize with a non-merging font
The icon engine needs to be able to rely on glyph indices belonging to
the correct font, and we generally don't want the overhead of iterating
through potential fallbacks if a named glyph or unicode code point
wasn't found in the font.

Assert in the QFontIconEngine constructor that the font we get has the
NoFontMerging strategy bit set.

Amends 2af58490b3d33aab8d08610939fe2b7cab4c469c.

Change-Id: Ib38324aebbeda956c8dd053969d6cf08f7ef3c35
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 9d47233d2cbbae1aa32240688fcc7a8c08c585d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 14:28:34 +00:00
Tatiana Borisova
609d34d702 [QDomNodePrivate] delete unnecessary pointer check from the statement
- prev pointer never can be null here, so the check can be deleted.

Ammends 948599e7b71f59fd9c9c0f7f3d1987ec93a23490

Pick-to: 6.8
Change-Id: Ie194f5f0432f6da5f6471328193112c970f623b6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d991572a45b2bbdcd43e59586f88487837a2927c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 14:27:27 +00:00
Eirik Aavitsland
49cf61f641 QWidget::mapTo()/mapFrom(): Do not crash if parent argument is invalid
These functions iterate through the parent hierarchy until the widget
given as argument is found. If never found, the code would assert (in
debug mode) or just silently crash (in release mode).

No need to bring down the entire application just because some widget
coordinate calculation is off. Instead, just emit a qWarning and
return cleanly.

Task-number: QTBUG-132072
Pick-to: 6.8
Change-Id: I4d13f46037cdcf855f76e040f941a8a7050ab12b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 73221d263823d50e525858d613ce93769698454a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 14:27:25 +00:00
Piotr Wierciński
80e581d91b wasm: Link with FETCH library only for MAIN_MODULE
For dynamic linking only the main module should
link with libraries like "FETCH".
When side modules are linking to libraries as well,
it leads to linking errors.

Change-Id: I83e37add867f1ce2cbcab4801f49266a288a9ceb
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit b7419557b1b0cc1a87aa91131329b65aee44ec34)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-12 13:17:02 +00:00
Tor Arne Vestbø
b3c60bd11f iOS: Iterate accessible interface to find window
Many subclasses of QAccessibleInterface implement window(), but
some don't, and the documentation states that the backend (us)
will traverse ancestors until it finds one with a window.

We were not doing that for iOS, which caused a crash for
QAccessibleTabButton, which doesn't have a window.

In case we ever hit the code path where we can't find a
window we also skip adding the nil element to the array
in createAccessibleElement, as that causes an exception.

Amends 7a512d1267442e646bb7942291197b2b03f4d1cd

Pick-to: 6.8 6.5
Change-Id: I9b758423956e845a01b014022f4d3ab6306be94e
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 6689921b9da3780676a416324eafcac98ab211a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-11 10:49:23 +00:00
Shawn Rutledge
8a7ee8d522 Widgets: ignore unhandled right mouse button presses
In many places this was already done; but there was some old code
remaining where mousePressEvent() simply returned without ignoring the
unhandled event.

Task-number: QTBUG-93486
Task-number: QTBUG-132066
Change-Id: I4a876980b7ef88ee478fa8cfd9f68b5be5b217a2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a1175255150d27d50f9690d5f8685b31269d9fa1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-11 09:33:35 +00:00
Ivan Solovev
d0a3db5d93 [doc] Clean-up QSpan docs
QSpan docs use \target commands together with the section headers, to
simplify linking to certain parts of the docs. This approach has its
own drawbacks, though, because the \target link is rendered as-is.
This patch improves usage of the \target commands, making the links
look better.
It does the following changes:
* Moves the \target commands before the related \section2 commands, so
  that the section header is visible when following the \target's link.
* Replaces the \target links with the actual section names in the \sa
  and other places of the docs where the links do not have the custom
  text, because otherwise the target names are actually visible in the
  docs instead of the section headers.

Amends 03e78e5d624d9752d76c7448d58c9d9d15a4dc18,
70dc8d3103fade380caec96f7531432cd8e8adb6, and
ef5ac956c755daa9ea84dabfa1314d104e5c62e4.

Pick-to: 6.8
Change-Id: I045824683f342079e33e89e3ee6f8e2e27a0acf5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 10c844f0533daf657a1cbbbb96651e20e5d603ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-11 00:51:17 +00:00
Marc Mutz
67adc2227d tst_QStringView: add missing CanConvert from char16_t/wchar_t arrays
QChar[N] and ushort[N] are being checked, it's unclear why char16_t[N]
and wchar_t[N] were missing.

Add them.

Pick-to: 6.8 6.5 5.15
Change-Id: I9a2df2a75886b950e8c2bdec843e3e693e536f86
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 89401858696d63b8a13c945d5db63856a3b6f5ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-11 00:06:27 +00:00
Marc Mutz
0c054f6844 Confirm QLatin1StringView can be constructed over arrays of unknown bounds
It can (unlike the other views).

Pick-to: 6.8 6.5 5.15
Task-number: QTBUG-112746
Change-Id: Id976429611c53f1c707de1d989c454507b8f4773
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 01f0305dc6f751d3eb4d1681a2f8f9f3165b547c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-11 00:06:21 +00:00
Shawn Rutledge
f329dd4e16 QWidgetWindow: send QContextMenuEvent even after accepted mouse press
It would be more consistent if we could rely on the accepted state of
the original QMouseEvent to decide whether to follow up with a
QContextMenuEvent; but not all Qt widgets call ignore() on unhandled
mouse events, both in Qt and in external libraries and applications
(including some from KDE). So we should at least wait until Qt 7 to
make this a requirement. It seems sensible to move the check into
QWindow::event() rather than trying to distinguish the window type in
maybeSynthesizeContextMenuEvent(). We merely output a categorized log
message to indicate when the legacy behavior is in effect.

Amends 84a5f50c7766c99f62b22bb4388137e0aa8dd13d

[ChangeLog][QtWidgets] If your QWidget subclass depends on receiving
QContextMenuEvent, and also handles mouse events directly, we
recommend that you call ignore() on unhandled mouse events (such as
right-button events). In Qt 7, we plan to stop sending
QContextMenuEvent if the triggering mouse event is accepted.

Fixes: QTBUG-132066
Change-Id: I454813dab4c387112f161fc28a0ee94570013afa
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 357c64a99607456133bfabf86d6b67162717cb29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-10 23:51:13 +00:00
Christian Ehrlicher
75cb14deb8 SQLite: Update SQLite to v3.47.2
[ChangeLog][Third-Party Code] Updated SQLite to v3.47.2

Pick-to: 6.8 6.5 5.15
Change-Id: I3f40198db02c7f9599189ec2a0001f1c294616c8
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit f3d5bdf4bcfe26a17b1b3de07a345586c37263c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-10 19:58:41 +00:00
Dheerendra Purohit
a77b11c548 QToolBar: Update implicit icon size if style changes
Add logic in QToolBar::changeEvent() to update icon size set via
stylesheet.

Fixes: QTBUG-45949
Pick-to: 6.8
Change-Id: I7fce830a969af8774116f0229153668252b55598
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 18733355689fc3ea336631b9c5ff17e3e983fb28)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-10 17:26:03 +00:00
Lars Schmertmann
43f4706ee8 Android: Fix typo in the documentation of the default log pattern
Pick-to: 6.8 6.5
Task-number: QTBUG-94708
Change-Id: I845f193f1b98219be205b8615f817f3315f4d149
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 3bec93738ea88b6f2f50f1b5eeb2237f6f43c0b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-10 17:26:03 +00:00
Marc Mutz
5c3fd55beb QSpan: document slice() and chop()
Needed to use a weird combination of \c and \a here, as qdoc on
one hand insists that all parameters be documented, and OTOH doesn't
support \a within \c.

Writing anything else than the equivalent code in \c to appease qdoc
would be childish. Equivalent code is the best-possible documentation,
as it leaves no question unanswered.

Task-number: QTBUG-131672
Change-Id: I512872360b7eb212001723f2ba12d4c6eac0b6b0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 0afe31fa51a26d12be21c1b9c6e886abb9775441)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-10 17:26:02 +00:00
Edward Welbourne
66da88f428 Fix typo in QTZ constructor docs
There is no fromSecondsAfterUtc(), I was thinking of
fromSecondsAheadOfUtc().

Pick-to: 6.8 6.5
Fixes: QTBUG-131913
Change-Id: I6a89a27d678d23043819b93d5e4120d01002da4a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 2bdce97480ed66f0e8e9528fbc8f4f9c3d8487bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-10 17:26:02 +00:00
Yuhang Zhao
7c3723b2a9 Minor improvements of windows style
1. Make some global constants constexpr.
2. Make some file-scope global constants static.
3. Use QStringLiteral instead of plain const char*
4. Add "u" to QStringLiteral's content.

Pick-to: 6.8
Change-Id: Icbc105366ba40e970b256fe3da41231a6fb5064b
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit ad06099b93d79a954d133d6822517d4d0a10adbc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-10 08:26:00 +00:00
Wladimir Leuschner
1a737083f1 QWindows11Style: Override alternate base color in darkmode
The alternate base color in darkmode was wrongly set to the accent color
instead of a lighter color. This patch overrides the alternate base
color for the QWindows11Style.

Fixes: QTBUG-131976
Pick-to: 6.8
Change-Id: Ie8f50b0042ca7bf746224275abc0cd255df7a4ad
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 79aa4269bcbbedef8206d79318c199df7c8a3c9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-09 21:54:52 +00:00
Allan Sandfeld Jensen
901731ad78 Add primary RGB color points getter
[ChangeLog][QtGui][QColorSpace] Added primary points getter and setter

Change-Id: Ia4e412b3e63584cf88fa632e5c1d47618d07ebf1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit bde2292247bf4849852355c0dcc71f97c9daace9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-09 19:46:45 +00:00
1861 changed files with 343455 additions and 252238 deletions

View File

@ -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.9.0")
set(QT_REPO_MODULE_VERSION "6.9.1")
set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
set(QT_COPYRIGHT "Copyright (C) The Qt Company Ltd. and other contributors.")

4
.gitreview Normal file
View File

@ -0,0 +1,4 @@
[gerrit]
host=codereview.qt-project.org
project=qt/qtbase
defaultbranch=dev

View File

@ -24,9 +24,13 @@ project(QtBase
VERSION "${QT_REPO_MODULE_VERSION}"
DESCRIPTION "Qt Base Libraries"
HOMEPAGE_URL "https://qt.io/"
LANGUAGES CXX C ASM
LANGUAGES CXX C
)
if(UNIX AND NOT ANDROID)
enable_language(ASM)
endif()
set(QT_BUILD_EXTRA_IDE_FILE_PATTERNS bin/* libexec/*)
qt_internal_qtbase_build_repo()

View File

@ -24,9 +24,9 @@ SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GPL-3.0-only"
path = ["bin/*", "coin/**","libexec/*","**_clang-format", "**.cmake", "**.conf", "**.cmake.in",
"**.prf", "libexec/qt-internal-configure-*", "config.tests/.qmake.conf",
"**.pro", "**.pri", "**.yaml", "cmake/**.in", "cmake/ios/LaunchScreen.storyboard",
"cmake/**md", "**.yml", "**.dynlist",
"cmake/**md", "**.yml", "**.dynlist", "cmake/**.plist",
"src/corelib/global/qconfig.cpp.in", "src/corelib/Qt6CoreConfigureFileTemplate.in",
"**.cfg"]
"**.cfg", "**/Makefile", "**/CMakeLists.txt", "**.qrc", ".tag"]
precedence = "closest"
comment = "build system"
SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
@ -39,29 +39,42 @@ SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
SPDX-License-Identifier = "CC0-1.0"
[[annotations]]
path = [".tag", "**/.gitattributes", "**.gitignore"]
path = ["**/.gitattributes", "**.gitignore", "**.gitreview"]
precedence = "closest"
SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
SPDX-License-Identifier = "BSD-3-Clause"
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause"
[[annotations]]
path = ["**/snippets/**", "**/doc/**/images/**", "examples/**"]
path = ["**/snippets/**", "examples/**", "src/tools/qlalr/examples/**"]
comment = "this must be after the build system table because example and snippets take precedence over build system"
precedence = "closest"
SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause"
[[annotations]]
path = ["tests/manual/examples/**", "**/snippets/**"]
precedence = "closest"
SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause"
[[annotations]]
path = ["**/README*", "src/plugins/**/README*", "examples/**/README*", "tests/**/README*",
"src/widgets/doc/snippets/common-table-model/README", "cmake/README.md",
"lib/README", "coin/instructions/README.md", "src/3rdparty/README",
"**.qdocconf", "**.qdocinc", "config_help.txt",
"doc/global/template/style/*"]
"doc/global/template/style/*", "**/doc/**/images/**"]
comment = "documentation"
precedence = "closest"
SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"
[[annotations]]
path = ["src/gui/doc/snippets/textdocument-images/images.qrc"]
precedence = "closest"
comment = "falls under **/doc/**/images/**, which is wrong"
SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause"
[[annotations]]
path = ["src/assets/icons/**.png", "src/assets/icons/**.svg", "src/android/**.xml",
"src/gui/**.xml",
@ -73,6 +86,13 @@ precedence = "closest"
SPDX-FileCopyrightText = "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"
[[annotations]]
path = ["tests/auto/tools/rcc/data/legal/legal.qrc"]
precedence = "override"
comment = "license in file not referring to the file itself"
SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
SPDX-License-Identifier = "BSD-3-Clause"
[[annotations]]
path = ["**/qt_attribution.json"]
precedence = "override"
@ -83,7 +103,7 @@ SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-on
path = ["**.toml", "licenseRule.json"]
precedence = "override"
SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd."
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"
SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR BSD-3-Clause"
[[annotations]]
path = ["**LICENSE*", "cmake/3rdparty/**/COPYING-CMAKE-SCRIPTS"]

View File

@ -0,0 +1,45 @@
From cbda7ce74d74539ce0baef4a36198081dfb0265c Mon Sep 17 00:00:00 2001
From: Marc Mutz <marc.mutz@qt.io>
Date: Fri, 14 Mar 2025 18:29:20 +0100
Subject: [PATCH] ECMEnableSanitizers.cmake: fix GCC's "note: variable tracking
size limit exceeded" when using asan
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Set the max-vartrack-size parameter to 0 (= unlimited) to avoid GCC's
"note: variable tracking size limit exceeded with
-fvar-tracking-assignments, retrying without" message you get when you
compile with asan sometimes.
This is reported¹ to speed up compilation, not slow it down.
¹ https://stackoverflow.com/a/75704837/134841
---
modules/ECMEnableSanitizers.cmake | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/modules/ECMEnableSanitizers.cmake b/modules/ECMEnableSanitizers.cmake
index 07db1c80..45236e6d 100644
--- a/modules/ECMEnableSanitizers.cmake
+++ b/modules/ECMEnableSanitizers.cmake
@@ -117,6 +117,16 @@ macro (enable_sanitizer_flags sanitize_option)
set(XSAN_COMPILE_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls")
set(XSAN_LINKER_FLAGS "asan")
endif()
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ # fixes "note: variable tracking size limit exceeded with
+ # -fvar-tracking-assignments, retrying without" (which is
+ # another way of saying "I'll go ahead and compile this
+ # thing _twice_") by making it unlimited
+ # Reference:
+ # https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
+ # -> max-vartrack-size
+ string(APPEND XSAN_COMPILE_FLAGS " --param=max-vartrack-size=0")
+ endif ()
elseif (${sanitize_option} MATCHES "thread")
check_compiler_version("4.8" "3.1" "99.99")
set(XSAN_COMPILE_FLAGS "-fsanitize=thread")
--
2.25.1

View File

@ -0,0 +1,42 @@
From 8907023584ea0936893269aee890af5995746af5 Mon Sep 17 00:00:00 2001
From: Marc Mutz <marc.mutz@qt.io>
Date: Mon, 17 Mar 2025 10:15:03 +0100
Subject: [PATCH] ECMEnableSanitizers.cmake: replace tabs with spaces
Amends cbda7ce74d74539ce0baef4a36198081dfb0265c.
---
modules/ECMEnableSanitizers.cmake | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/modules/ECMEnableSanitizers.cmake b/modules/ECMEnableSanitizers.cmake
index 45236e6d..8686384d 100644
--- a/modules/ECMEnableSanitizers.cmake
+++ b/modules/ECMEnableSanitizers.cmake
@@ -118,15 +118,15 @@ macro (enable_sanitizer_flags sanitize_option)
set(XSAN_LINKER_FLAGS "asan")
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
- # fixes "note: variable tracking size limit exceeded with
- # -fvar-tracking-assignments, retrying without" (which is
- # another way of saying "I'll go ahead and compile this
- # thing _twice_") by making it unlimited
- # Reference:
- # https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
- # -> max-vartrack-size
- string(APPEND XSAN_COMPILE_FLAGS " --param=max-vartrack-size=0")
- endif ()
+ # fixes "note: variable tracking size limit exceeded with
+ # -fvar-tracking-assignments, retrying without" (which is
+ # another way of saying "I'll go ahead and compile this
+ # thing _twice_") by making it unlimited
+ # Reference:
+ # https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
+ # -> max-vartrack-size
+ string(APPEND XSAN_COMPILE_FLAGS " --param=max-vartrack-size=0")
+ endif ()
elseif (${sanitize_option} MATCHES "thread")
check_compiler_version("4.8" "3.1" "99.99")
set(XSAN_COMPILE_FLAGS "-fsanitize=thread")
--
2.25.1

View File

@ -120,7 +120,7 @@ list(APPEND CMAKE_REQUIRED_LIBRARIES "${EGL_LIBRARY}")
list(APPEND CMAKE_REQUIRED_INCLUDES "${EGL_INCLUDE_DIR}")
list(APPEND CMAKE_REQUIRED_DEFINITIONS "${EGL_DEFINITIONS}")
find_package(PlatformGraphics)
find_package(PlatformGraphics QUIET)
if(TARGET PlatformGraphics::PlatformGraphics)
platform_graphics_extend_check_cxx_source_required_variables()
endif()

View File

@ -118,6 +118,16 @@ macro (enable_sanitizer_flags sanitize_option)
set(XSAN_COMPILE_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls")
set(XSAN_LINKER_FLAGS "asan")
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
# fixes "note: variable tracking size limit exceeded with
# -fvar-tracking-assignments, retrying without" (which is
# another way of saying "I'll go ahead and compile this
# thing _twice_") by making it unlimited
# Reference:
# https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
# -> max-vartrack-size
string(APPEND XSAN_COMPILE_FLAGS " --param=max-vartrack-size=0")
endif ()
elseif (${sanitize_option} MATCHES "thread")
check_compiler_version("4.8" "3.1" "99.99")
set(XSAN_COMPILE_FLAGS "-fsanitize=thread")

View File

@ -21,7 +21,7 @@ else()
set(_includes "${CMAKE_REQUIRED_INCLUDES}")
list(APPEND CMAKE_REQUIRED_INCLUDES "${GLESv2_INCLUDE_DIR}")
find_package(PlatformGraphics)
find_package(PlatformGraphics QUIET)
if(TARGET PlatformGraphics::PlatformGraphics)
platform_graphics_extend_check_cxx_source_required_variables()
endif()

View File

@ -25,13 +25,22 @@ if(LIBRESOLV)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBRESOLV}")
endif()
cmake_policy(PUSH)
if(POLICY CMP0067)
cmake_policy(SET CMP0067 NEW)
endif()
if(DEFINED CMAKE_CXX_STANDARD)
set(_WrapResolv_CMAKE_CXX_STANDARD_back ${CMAKE_CXX_STANDARD})
endif()
set(CMAKE_CXX_STANDARD 11)
check_cxx_source_compiles("
#include <netinet/in.h>
#include <resolv.h>
int main(int, char **argv)
{
res_state statep = 0;
res_state statep = {};
int n = res_nmkquery(statep, 0, argv[1], 0, 0, NULL, 0, NULL, NULL, 0);
n = res_nsend(statep, NULL, 0, NULL, 0);
n = dn_expand(NULL, NULL, NULL, NULL, 0);
@ -39,6 +48,14 @@ int main(int, char **argv)
}
" HAVE_LIBRESOLV_FUNCTIONS)
if(DEFINED _WrapResolv_CMAKE_CXX_STANDARD_back)
set(CMAKE_CXX_STANDARD ${_WrapResolv_CMAKE_CXX_STANDARD_back})
unset(_WrapResolv_CMAKE_CXX_STANDARD_back)
else()
unset(CMAKE_CXX_STANDARD)
endif()
cmake_policy(POP)
cmake_pop_check_state()
if(HAVE_LIBRESOLV_FUNCTIONS)

View File

@ -9,6 +9,6 @@ $<1: >
Name: @pkgconfig_name@
Description: @pkgconfig_description@
Version: @PROJECT_VERSION@
Libs: $<$<NOT:@is_interface_library@>:-L${libdir} -l@pkgconfig_file@> @link_options@
Libs: @link_options@
Cflags: @include_dirs@ @compile_defs@
Requires: $<JOIN:$<REMOVE_DUPLICATES:@target_requires@>, >

View File

@ -227,7 +227,7 @@ function(qt_internal_add_3rdparty_library target)
qt_autogen_tools_initial_setup(${target})
endif()
if(NOT DEFINED arg_EXCEPTIONS)
if(NOT arg_EXCEPTIONS)
qt_internal_set_exceptions_flags("${target}" "DEFAULT")
else()
qt_internal_set_exceptions_flags("${target}" "${arg_EXCEPTIONS}")
@ -379,7 +379,7 @@ function(qt_internal_add_3rdparty_library target)
${__qt_internal_sbom_multi_args}
)
_qt_internal_extend_sbom(${target} ${sbom_args})
qt_internal_extend_qt_entity_sbom(${target} ${sbom_args})
endif()
qt_add_list_file_finalizer(qt_internal_finalize_3rdparty_library ${target})

View File

@ -154,7 +154,7 @@ function(qt_internal_add_app target)
${__qt_internal_sbom_multi_args}
)
_qt_internal_extend_sbom(${target} ${sbom_args})
qt_internal_extend_qt_entity_sbom(${target} ${sbom_args})
endif()
qt_add_list_file_finalizer(qt_internal_finalize_app ${target})

View File

@ -152,7 +152,12 @@ function(qt_auto_detect_android)
endfunction()
function(qt_auto_detect_vcpkg)
if(QT_USE_VCPKG AND DEFINED ENV{VCPKG_ROOT})
if(QT_USE_VCPKG)
if(NOT DEFINED ENV{VCPKG_ROOT})
message(FATAL_ERROR
"Usage of vcpkg was requested but the environment variable VCPKG_ROOT is not set."
)
endif()
set(vcpkg_toolchain_file "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
get_filename_component(vcpkg_toolchain_file "${vcpkg_toolchain_file}" ABSOLUTE)
@ -269,6 +274,9 @@ function(qt_auto_detect_apple)
endif()
endif()
_qt_internal_get_apple_sdk_path(apple_sdk_path)
set(QT_APPLE_SDK_PATH "${apple_sdk_path}" CACHE STRING "Darwin SDK path.")
_qt_internal_get_apple_sdk_version(apple_sdk_version)
set(QT_MAC_SDK_VERSION "${apple_sdk_version}" CACHE STRING "Darwin SDK version.")

View File

@ -123,10 +123,7 @@ function(qt_manual_moc result)
set(dep "${QT_CMAKE_EXPORT_NAMESPACE}::${dep}")
endif()
get_target_property(alias_dep ${dep} ALIASED_TARGET)
if(alias_dep)
set(dep ${alias_dep})
endif()
_qt_internal_dealias_target(dep)
get_target_property(loc ${dep} IMPORTED_LOCATION)
string(REGEX REPLACE "(.*)/Qt[^/]+\\.framework.*" "\\1" loc "${loc}")
@ -214,3 +211,50 @@ function(qt_make_output_file infile prefix suffix source_dir binary_dir result)
file(MAKE_DIRECTORY "${outpath}")
set("${result}" "${outpath}/${prefix}${outfilename}${suffix}" PARENT_SCOPE)
endfunction()
# Work around AUTOGEN issue when a library is added as a dependency more than once, and the autogen
# library dependency results in being discarded. To mitigate that, add all autogen dependencies
# manually, based on the passed in dependencies.
# CMake 4.0+ has a fix, so we don't need the extra logic.
# See https://gitlab.kitware.com/cmake/cmake/-/issues/26700
function(qt_internal_work_around_autogen_discarded_dependencies target)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.0
OR QT_NO_AUTOGEN_DISCARDED_DEPENDENCIES_WORKAROUND)
return()
endif()
set(libraries ${ARGN})
set(final_libraries "")
foreach(lib IN LISTS libraries)
# Skip non-target dependencies.
if(NOT TARGET "${lib}")
continue()
endif()
# Resolve alias targets, because AUTOGEN_TARGET_DEPENDS doesn't seem to handle them.
_qt_internal_dealias_target(lib)
# Skip imported targets, they don't have sync_headers targets.
get_target_property(imported "${lib}" IMPORTED)
if(imported)
continue()
endif()
# Resolve Qt private modules to their public counterparts.
get_target_property(is_private_module "${lib}" _qt_is_private_module)
get_target_property(public_module_target "${lib}" _qt_public_module_target_name)
if(is_private_module AND public_module_target)
set(lib "${public_module_target}")
endif()
# Another TARGET check, just in case.
if(TARGET "${lib}")
list(APPEND final_libraries "${lib}")
endif()
endforeach()
if(final_libraries)
set_property(TARGET ${target} APPEND PROPERTY AUTOGEN_TARGET_DEPENDS "${final_libraries}")
endif()
endfunction()

View File

@ -187,7 +187,7 @@ function(qt_run_config_test_architecture)
list(APPEND QT_BASE_CONFIGURE_TESTS_VARS_TO_EXPORT TEST_buildAbi)
set(QT_BASE_CONFIGURE_TESTS_VARS_TO_EXPORT ${QT_BASE_CONFIGURE_TESTS_VARS_TO_EXPORT} CACHE INTERNAL "Test variables that should be exported")
list(JOIN _sub_architecture " " subarch_summary)
list(JOIN sub_architecture_${first_arch} " " subarch_summary)
set_property(GLOBAL PROPERTY qt_configure_subarch_summary "${subarch_summary}")
endfunction()
@ -274,6 +274,7 @@ function(qt_internal_print_cmake_darwin_info)
endif()
message(STATUS "CMAKE_OSX_ARCHITECTURES: \"${CMAKE_OSX_ARCHITECTURES}\"${default_osx_arch}")
message(STATUS "CMAKE_OSX_SYSROOT: \"$CACHE{CMAKE_OSX_SYSROOT}\" / \"${CMAKE_OSX_SYSROOT}\"")
message(STATUS "QT_APPLE_SDK_PATH: \"${QT_APPLE_SDK_PATH}\"")
message(STATUS "CMAKE_OSX_DEPLOYMENT_TARGET: \"${CMAKE_OSX_DEPLOYMENT_TARGET}\"")
message(STATUS "QT_MAC_SDK_VERSION: \"${QT_MAC_SDK_VERSION}\"")
message(STATUS "QT_MAC_XCODE_VERSION: \"${QT_MAC_XCODE_VERSION}\"")

View File

@ -258,14 +258,24 @@ qt_copy_or_install(DIRECTORY
)
# Install qt-internal-strip and qt-internal-ninja files.
set(__qt_internal_strip_wrappers
set(__qt_internal_strip_wrapper_programs
libexec/qt-internal-strip.in
libexec/qt-internal-strip.bat.in
libexec/qt-internal-ninja.in
)
set(__qt_internal_strip_wrapper_files
libexec/qt-internal-strip.bat.in
libexec/qt-internal-ninja.bat.in
)
set(__qt_internal_strip_wrappers
${__qt_internal_strip_wrapper_programs}
${__qt_internal_strip_wrapper_files}
)
qt_copy_or_install(PROGRAMS
${__qt_internal_strip_wrappers}
${__qt_internal_strip_wrapper_programs}
DESTINATION "${__GlobalConfig_install_dir}/libexec"
)
qt_copy_or_install(FILES
${__qt_internal_strip_wrapper_files}
DESTINATION "${__GlobalConfig_install_dir}/libexec"
)
if(QT_WILL_INSTALL)
@ -366,7 +376,15 @@ if(APPLE)
DESTINATION "${__GlobalConfig_build_dir}/${platform_shortname}"
)
if(IOS)
if(MACOS)
# Test entitlements
qt_copy_or_install(FILES "cmake/${platform_shortname}/test.entitlements.plist"
DESTINATION "${__GlobalConfig_install_dir}/${platform_shortname}"
)
file(COPY "cmake/${platform_shortname}/test.entitlements.plist"
DESTINATION "${__GlobalConfig_build_dir}/${platform_shortname}"
)
elseif(IOS)
qt_copy_or_install(FILES "cmake/ios/LaunchScreen.storyboard"
DESTINATION "${__GlobalConfig_install_dir}/ios"
)
@ -378,9 +396,23 @@ if(APPLE)
elseif(WASM)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/util/wasm/wasmtestrunner/qt-wasmtestrunner.py"
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt-wasmtestrunner.py" @ONLY)
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt-wasmtestrunner.py"
DESTINATION "${INSTALL_LIBEXECDIR}")
if(QT_FEATURE_shared)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/util/wasm/preload/preload_qml_imports.py"
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/preload_qml_imports.py" COPYONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/util/wasm/preload/preload_qt_plugins.py"
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/preload_qt_plugins.py" COPYONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/util/wasm/preload/generate_default_preloads.sh.in"
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/generate_default_preloads.sh.in" COPYONLY)
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/preload_qml_imports.py"
DESTINATION "${INSTALL_LIBEXECDIR}")
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/preload_qt_plugins.py"
DESTINATION "${INSTALL_LIBEXECDIR}")
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/generate_default_preloads.sh.in"
DESTINATION "${INSTALL_LIBEXECDIR}")
endif()
endif()
# Install CI support files to libexec.

View File

@ -246,6 +246,7 @@ function(qt_internal_get_qt_build_private_files_to_install out_var)
QtGenerateLibPri.cmake
QtGenerateVersionScript.cmake
QtModuleConfig.cmake.in
QtModuleConfigPrivate.cmake.in
QtModuleDependencies.cmake.in
QtModuleHeadersCheck.cmake
QtModuleToolsConfig.cmake.in
@ -292,8 +293,18 @@ function(qt_internal_get_qt_build_public_helpers out_var)
QtPublicGitHelpers
QtPublicPluginHelpers
QtPublicPluginHelpers_v2
QtPublicSbomAttributionHelpers
QtPublicSbomCpeHelpers
QtPublicSbomDepHelpers
QtPublicSbomFileHelpers
QtPublicSbomGenerationHelpers
QtPublicSbomHelpers
QtPublicSbomLicenseHelpers
QtPublicSbomOpsHelpers
QtPublicSbomPurlHelpers
QtPublicSbomPythonHelpers
QtPublicSbomQtEntityHelpers
QtPublicSbomSystemDepHelpers
QtPublicTargetHelpers
QtPublicTestHelpers
QtPublicToolHelpers
@ -350,7 +361,8 @@ endfunction()
macro(qt_internal_setup_find_host_info_package)
_qt_internal_determine_if_host_info_package_needed(__qt_build_requires_host_info_package)
_qt_internal_find_host_info_package("${__qt_build_requires_host_info_package}")
_qt_internal_find_host_info_package("${__qt_build_requires_host_info_package}"
${INSTALL_CMAKE_NAMESPACE})
endmacro()
macro(qt_internal_setup_poor_mans_scope_finalizer)
@ -478,4 +490,3 @@ macro(qt_internal_setup_build_and_global_variables)
qt_internal_detect_dirty_features()
endmacro()

View File

@ -28,7 +28,7 @@ endif()
# Get the project name base on test directory name
get_filename_component(project_name "${absolute_project_path}" NAME)
project(${project_name} VERSION 6.0.0 LANGUAGES C CXX ASM)
project(${project_name} VERSION 6.0.0 LANGUAGES C CXX)
find_package(Qt6 REQUIRED COMPONENTS BuildInternals Core)

View File

@ -344,17 +344,9 @@ endfunction()
macro(qt_internal_setup_sbom)
qt_internal_compute_sbom_default(_qt_generate_sbom_default)
option(QT_GENERATE_SBOM "Generate SBOM documents in SPDX v2.3 tag:value format."
"${_qt_generate_sbom_default}")
option(QT_SBOM_GENERATE_JSON
"Generate SBOM documents in SPDX v2.3 JSON format if dependencies are available" ON)
option(QT_SBOM_REQUIRE_GENERATE_JSON
"Error out if JSON SBOM generation dependencies are not found." OFF)
option(QT_SBOM_VERIFY "Verify generated SBOM documents." ON)
option(QT_SBOM_REQUIRE_VERIFY
"Error out if SBOM verification dependencies are not found." OFF)
_qt_internal_setup_sbom(
GENERATE_SBOM_DEFAULT "${_qt_generate_sbom_default}"
)
endmacro()
macro(qt_internal_setup_build_examples)

View File

@ -202,6 +202,15 @@ macro(qt_internal_setup_configure_install_paths)
"Module description files directory")
qt_configure_process_path(INSTALL_SBOMDIR "${INSTALL_ARCHDATADIR}/sbom"
"SBOM [PREFIX/sbom]")
# INSTALL_PUBLICBINDIR is processed only if it is not empty
# See usage in qt_internal_generate_user_facing_tools_info
if(NOT "${INSTALL_PUBLICBINDIR}" STREQUAL "")
# A default value is not needed because it is always manually defined
# but as per the documentation it is typically `bin`
qt_configure_process_path(INSTALL_PUBLICBINDIR "bin"
"Symlinked user-facing executables")
endif()
endmacro()
macro(qt_internal_set_cmake_install_libdir)

View File

@ -178,6 +178,10 @@ function(qt_internal_configure_qt)
-skip qtactiveqt,qtimageformats,qtlanguageserver,qtsvg
--
-DWARNINGS_ARE_ERRORS=OFF
# When 6.x.y version bumps are not merged in DAG-dependency order, this avoids
# blocking integrations due to mismatch of qtools package version and any of its
# dependencies.
-DQT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING=ON
--log-level STATUS
--fresh
-GNinja

View File

@ -1,52 +1,24 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# The common implementation of qt_configure_file functionality.
macro(qt_configure_file_impl)
if(NOT arg_OUTPUT)
message(FATAL_ERROR "No output file provided to qt_configure_file.")
endif()
# We use this check for the cases when the specified CONTENT is empty. The value of arg_CONTENT
# is undefined, but we still want to create a file with empty content.
if(NOT "CONTENT" IN_LIST arg_KEYWORDS_MISSING_VALUES)
if(arg_INPUT)
message(WARNING "Both CONTENT and INPUT are specified. CONTENT will be used to generate"
" output")
endif()
set(template_name "QtFileConfigure.txt.in")
# When building qtbase, use the source template file.
# Otherwise use the installed file (basically wherever Qt6 package is found).
# This should work for non-prefix and superbuilds as well.
if(QtBase_SOURCE_DIR)
set(input_file "${QtBase_SOURCE_DIR}/cmake/${template_name}")
else()
set(input_file "${_qt_6_config_cmake_dir}/${template_name}")
endif()
set(__qt_file_configure_content "${arg_CONTENT}")
elseif(arg_INPUT)
set(input_file "${arg_INPUT}")
else()
message(FATAL_ERROR "No input value provided to qt_configure_file.")
endif()
configure_file("${input_file}" "${arg_OUTPUT}" @ONLY)
endmacro()
# qt_configure_file(OUTPUT output-file <INPUT input-file | CONTENT content>)
# input-file is relative to ${CMAKE_CURRENT_SOURCE_DIR}
# output-file is relative to ${CMAKE_CURRENT_BINARY_DIR}
#
# This function is similar to file(GENERATE OUTPUT) except it writes the content
# to the file at configure time, rather than at generate time.
#
# TODO: Once we require 3.18+, this can use file(CONFIGURE) in its implementation,
# or maybe its usage can be replaced by file(CONFIGURE). Until then, it uses
# configure_file() with a generic input file as source, when used with the CONTENT
# signature.
# This function is the universal replacement for file(CONFIGURE CMake command.
function(qt_configure_file)
cmake_parse_arguments(PARSE_ARGV 0 arg "" "OUTPUT;INPUT;CONTENT" "")
qt_configure_file_impl()
if("CONTENT" IN_LIST ARGV)
if(arg_INPUT)
message(WARNING "Both CONTENT and INPUT are specified. CONTENT will be used to generate"
" output")
endif()
_qt_internal_configure_file(CONFIGURE OUTPUT "${arg_OUTPUT}" CONTENT "${arg_CONTENT}")
elseif(arg_INPUT)
_qt_internal_configure_file(CONFIGURE OUTPUT "${arg_OUTPUT}" INPUT "${arg_INPUT}")
else()
message(FATAL_ERROR "No input value provided to _qt_internal_configure_file.")
endif()
endfunction()
# A version of cmake_parse_arguments that makes sure all arguments are processed and errors out

View File

@ -169,9 +169,8 @@ function(qt_internal_force_allow_unsuitable_cmake_version_for_building_qt out_va
# Temporarily allow any version when building in Qt's CI, so we can decouple the provisioning
# of the minimum CMake version from the bump of the minimum CMake version.
# The COIN_UNIQUE_JOB_ID env var is set in Qt's CI for both build and test work items.
# Current state is that this check is enabled.
# TODO: Disable it once provisioning is merged.
set(allow_any_version_in_ci TRUE)
# Current state is that this check is disabled.
set(allow_any_version_in_ci FALSE)
if(allow_any_version_in_ci AND DEFINED ENV{COIN_UNIQUE_JOB_ID})
set(allow_any_version TRUE)

View File

@ -105,7 +105,7 @@ if(MSVC)
if(NOT CLANG)
# -Ob3 was introduced in Visual Studio 2019 version 16.0
# However clang-cl can't recognize it.
string(APPEND QT_CFLAGS_OPTIMIZE " -Ob3 ")
string(APPEND QT_CFLAGS_OPTIMIZE " -Ob3")
endif()
set(QT_CFLAGS_OPTIMIZE_DEBUG "-Od")
set(QT_CFLAGS_OPTIMIZE_SIZE "-O1")

View File

@ -39,9 +39,15 @@ if(TARGET @INSTALL_CMAKE_NAMESPACE@::PlatformCommonInternal)
if(NOT _qt_platform_internal_common_target)
set(_qt_platform_internal_common_target @INSTALL_CMAKE_NAMESPACE@::PlatformCommonInternal)
endif()
set(_qt_internal_clang_msvc_frontend FALSE)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
set(_qt_internal_clang_msvc_frontend TRUE)
endif()
set_target_properties(${_qt_platform_internal_common_target}
PROPERTIES
_qt_internal_cmake_generator "${CMAKE_GENERATOR}"
_qt_internal_clang_msvc_frontend "${_qt_internal_clang_msvc_frontend}"
)
unset(_qt_platform_internal_common_target)
endif()
@ -128,7 +134,12 @@ if(QT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES)
set(__qt_use_no_default_path_for_qt_packages "")
endif()
foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
set(__qt_umbrella_find_components ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
__qt_internal_handle_find_all_qt_module_packages(__qt_umbrella_find_components
COMPONENTS ${__qt_umbrella_find_components}
)
foreach(module ${__qt_umbrella_find_components})
if(NOT "${QT_HOST_PATH}" STREQUAL ""
AND "${module}" MATCHES "Tools$"
AND NOT "${module}" MATCHES "UiTools$"
@ -139,7 +150,7 @@ foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
# But don't match QtShaderTools and QtTools which are cross-compiled target package names.
# Allow opt out just in case.
get_filename_component(__qt_find_package_host_qt_path
"${Qt@PROJECT_VERSION_MAJOR@HostInfo_DIR}/.." ABSOLUTE)
"${@INSTALL_CMAKE_NAMESPACE@HostInfo_DIR}/.." ABSOLUTE)
set(__qt_backup_cmake_prefix_path "${CMAKE_PREFIX_PATH}")
set(__qt_backup_cmake_find_root_path "${CMAKE_FIND_ROOT_PATH}")
list(PREPEND CMAKE_PREFIX_PATH "${__qt_find_package_host_qt_path}"

View File

@ -17,7 +17,8 @@ _qt_internal_setup_qt_host_path(
"${__qt_platform_requires_host_info_package}"
"${__qt_platform_initial_qt_host_path}"
"${__qt_platform_initial_qt_host_path_cmake_dir}")
_qt_internal_find_host_info_package(${__qt_platform_requires_host_info_package})
_qt_internal_find_host_info_package(${__qt_platform_requires_host_info_package}
@INSTALL_CMAKE_NAMESPACE@)
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
set(__qt_third_party_deps "@third_party_deps@")

View File

@ -79,4 +79,9 @@ function(qt_create_qdbusxml2cpp_command target infile)
"${header_file_full}"
"${source_file_full}"
)
set_source_files_properties(
"${header_file_full}"
"${source_file_full}"
PROPERTIES
_qt_syncqt_exclude_from_docs TRUE)
endfunction()

View File

@ -16,6 +16,43 @@ function(qt_internal_add_doc_tool_dependency doc_target tool_name)
endif()
endfunction()
# Adds custom build and install targets to generate documentation for a documentation project
# identified by a cmake target and a path to a .qdocconf file.
#
# Creates custom targets of the form:
# - generate_docs_${target}
# - prepare_docs_${target}
# - html_docs_${target}
# - install_html_docs_${target}
# - etc.
#
# The first two arguments to the function should be <target> <path-to-qdocconf>.
#
# Additional options are:
# INDEX_DIRECTORIES - a list of index directories to pass to qdoc.
#
# DEFINES - extra environment variable assignments of the form ENV_VAR=VALUE, which should be set
# during qdoc execution.
#
# QDOC_EXTRA_ARGS - extra command-line arguments to pass to qdoc in both prepare and generate
# phases.
#
# QDOC_PREPARE_EXTRA_ARGS - extra command-line arguments to pass to qdoc in the prepare phase.
#
# QDOC_GENERATE_EXTRA_ARGS - extra command-line arguments to pass to qdoc in the generate phase.
#
# SHOW_INTERNAL - if set, the --showinternal option is passed to qdoc.
#
# Additional environment variables considered:
# QT_INSTALL_DOCS - directory path where the qt docs were expected to be installed, used for
# linking to other built docs. If not set, defaults to the qtbase or qt5 build directory, or the
# install directory extracted from the BuildInternals package.
#
# QT_QDOC_EXTRA_ARGS, QT_QDOC_PREPARE_EXTRA_ARGS, QT_QDOC_GENERATE_EXTRA_ARGS - same as the options
# but can be set as either environment or cmake variables.
#
# QT_QDOC_SHOW_INTERNAL - same as the option but can be set as either an environment or
# cmake variable.
function(qt_internal_add_docs)
if(NOT QT_BUILD_DOCS)
return()
@ -23,39 +60,67 @@ function(qt_internal_add_docs)
if(${ARGC} EQUAL 1)
# Function called from old generated CMakeLists.txt that was missing the target parameter
if(QT_FEATURE_developer_build)
message(AUTHOR_WARNING
"qt_internal_add_docs called with old signature. Skipping doc generation.")
endif()
return()
endif()
set(error_msg "qt_add_docs called with wrong number of arguments. ")
list(APPEND error_msg
"Should be qt_add_docs\(target_name qdocconf "
"\[INDEX_DIRECTORIES EXTRA_INDEX_DIRS_LIST_TO_ENABLE_QDOC_RESOLVE_LINKS\]\)")
if(NOT ${ARGC} GREATER_EQUAL 2)
message(FATAL_ERROR ${error_msg})
return()
message(FATAL_ERROR
"qt_internal_add_docs called with a wrong number of arguments. "
"The call should be qt_internal_add_docs\(<target> <path-to-qdocconf> [other-options])"
)
endif()
set(target ${ARGV0})
set(doc_project ${ARGV1})
set(qdoc_conf_path ${ARGV1})
set(opt_args
SHOW_INTERNAL
)
set(single_args "")
set(multi_args
INDEX_DIRECTORIES
DEFINES
QDOC_EXTRA_ARGS
QDOC_PREPARE_EXTRA_ARGS
QDOC_GENERATE_EXTRA_ARGS
)
cmake_parse_arguments(PARSE_ARGV 2 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(qdoc_extra_args "")
# Check if there are more than 2 arguments and pass them
# as extra --indexdir arguments to qdoc in prepare and
# The INDEX_DIRECTORIES key should enable passing a list of index
# directories as extra command-line arguments to qdoc, in prepare and
# generate phases.
if (${ARGC} GREATER 2)
# The INDEX_DIRECTORIES key should enable passing a list of index
# directories as extra command-line arguments to qdoc.
set(qdocExtraArgs "INDEX_DIRECTORIES;DEFINES")
cmake_parse_arguments(PARSE_ARGV 2 arg "" "" "${qdocExtraArgs}")
if(arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR ${error_msg})
return()
endif()
if(arg_INDEX_DIRECTORIES)
foreach(index_directory ${arg_INDEX_DIRECTORIES})
list(APPEND qdoc_extra_args "--indexdir" ${index_directory})
endforeach()
endif()
if(arg_INDEX_DIRECTORIES)
foreach(index_directory ${arg_INDEX_DIRECTORIES})
list(APPEND qdoc_extra_args "--indexdir" ${index_directory})
endforeach()
endif()
set(show_internal_env FALSE)
if(DEFINED ENV{QT_QDOC_SHOW_INTERNAL})
set(show_internal_env $ENV{QT_QDOC_SHOW_INTERNAL})
endif()
if(arg_SHOW_INTERNAL OR QT_QDOC_SHOW_INTERNAL OR show_internal_env)
list(APPEND qdoc_extra_args "--showinternal")
endif()
if(arg_QDOC_EXTRA_ARGS)
list(APPEND qdoc_extra_args ${arg_QDOC_EXTRA_ARGS})
endif()
if(QT_QDOC_EXTRA_ARGS)
list(APPEND qdoc_extra_args ${QT_QDOC_EXTRA_ARGS})
endif()
if(DEFINED ENV{QT_QDOC_EXTRA_ARGS})
list(APPEND qdoc_extra_args $ENV{QT_QDOC_EXTRA_ARGS})
endif()
# If a target is not built (which can happen for tools when crosscompiling), we shouldn't try
# to generate docs.
@ -77,7 +142,8 @@ function(qt_internal_add_docs)
set(doc_tools_libexec "${QtBase_BINARY_DIR}/${INSTALL_LIBEXECDIR}")
else()
set(doc_tools_bin "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
set(doc_tools_libexec "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_LIBEXECDIR}")
set(doc_tools_libexec
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_LIBEXECDIR}")
endif()
if(CMAKE_HOST_WIN32)
@ -121,15 +187,18 @@ function(qt_internal_add_docs)
set(include_path_args "")
endif()
get_filename_component(doc_target "${doc_project}" NAME_WLE)
get_filename_component(doc_target "${qdoc_conf_path}" NAME_WLE)
if (QT_WILL_INSTALL)
set(qdoc_output_dir "${CMAKE_BINARY_DIR}/${INSTALL_DOCDIR}/${doc_target}")
set(qdoc_qch_output_dir "${CMAKE_BINARY_DIR}/${INSTALL_DOCDIR}")
set(index_dir "${CMAKE_BINARY_DIR}/${INSTALL_DOCDIR}")
else()
set(qdoc_output_dir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}/${doc_target}")
set(qdoc_qch_output_dir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
set(index_dir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
set(qdoc_output_dir
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}/${doc_target}")
set(qdoc_qch_output_dir
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
set(index_dir
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
endif()
# qtattributionsscanner
@ -144,7 +213,7 @@ function(qt_internal_add_docs)
# prepare docs target
set(prepare_qdoc_args
-outputdir "${qdoc_output_dir}"
"${target_source_dir}/${doc_project}"
"${target_source_dir}/${qdoc_conf_path}"
-prepare
-indexdir "${index_dir}"
-no-link-errors
@ -157,6 +226,18 @@ function(qt_internal_add_docs)
)
endif()
if(arg_QDOC_PREPARE_EXTRA_ARGS)
list(APPEND prepare_qdoc_args ${arg_QDOC_PREPARE_EXTRA_ARGS})
endif()
if(QT_QDOC_PREPARE_EXTRA_ARGS)
list(APPEND prepare_qdoc_args ${QT_QDOC_PREPARE_EXTRA_ARGS})
endif()
if(DEFINED ENV{QT_QDOC_PREPARE_EXTRA_ARGS})
list(APPEND prepare_qdoc_args $ENV{QT_QDOC_PREPARE_EXTRA_ARGS})
endif()
if(DEFINED ENV{QT_INSTALL_DOCS})
if(NOT EXISTS "$ENV{QT_INSTALL_DOCS}")
message(FATAL_ERROR
@ -167,7 +248,8 @@ function(qt_internal_add_docs)
elseif(QT_SUPERBUILD OR "${PROJECT_NAME}" STREQUAL "QtBase")
set(qt_install_docs_env "${QtBase_BINARY_DIR}/${INSTALL_DOCDIR}")
else()
set(qt_install_docs_env "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
set(qt_install_docs_env
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
endif()
set(qdoc_env_args
@ -198,7 +280,7 @@ function(qt_internal_add_docs)
# generate docs target
set(generate_qdoc_args
-outputdir "${qdoc_output_dir}"
"${target_source_dir}/${doc_project}"
"${target_source_dir}/${qdoc_conf_path}"
-generate
-indexdir "${index_dir}"
"${include_path_args}"
@ -210,6 +292,18 @@ function(qt_internal_add_docs)
)
endif()
if(arg_QDOC_GENERATE_EXTRA_ARGS)
list(APPEND generate_qdoc_args ${arg_QDOC_GENERATE_EXTRA_ARGS})
endif()
if(QT_QDOC_GENERATE_EXTRA_ARGS)
list(APPEND generate_qdoc_args ${QT_QDOC_GENERATE_EXTRA_ARGS})
endif()
if(DEFINED ENV{QT_QDOC_GENERATE_EXTRA_ARGS})
list(APPEND generate_qdoc_args $ENV{QT_QDOC_GENERATE_EXTRA_ARGS})
endif()
foreach(target_prefix generate_top_level_docs generate_repo_docs generate_docs)
set(depends_arg "")
if(tool_dependencies_enabled)

View File

@ -71,7 +71,12 @@ function(qt_internal_add_executable name)
endif()
endif()
if(arg_QT_APP AND QT_FEATURE_debug_and_release AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0")
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
if(arg_QT_APP
AND QT_FEATURE_debug_and_release
AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0"
AND is_multi_config
)
set_property(TARGET "${name}"
PROPERTY EXCLUDE_FROM_ALL "$<NOT:$<CONFIG:${QT_MULTI_CONFIG_FIRST_CONFIG}>>")
endif()
@ -183,7 +188,7 @@ function(qt_internal_add_executable name)
MACOSX_BUNDLE "${arg_GUI}"
)
if(NOT DEFINED arg_EXCEPTIONS)
if(NOT arg_EXCEPTIONS)
qt_internal_set_exceptions_flags("${name}" "DEFAULT")
else()
qt_internal_set_exceptions_flags("${name}" "${arg_EXCEPTIONS}")
@ -252,23 +257,6 @@ function(qt_internal_add_executable name)
qt_internal_install_pdb_files(${name} "${arg_INSTALL_DIRECTORY}")
endif()
if(QT_GENERATE_SBOM)
set(sbom_args "")
_qt_internal_forward_function_args(
FORWARD_APPEND
FORWARD_PREFIX arg
FORWARD_OUT_VAR sbom_args
FORWARD_OPTIONS
${__qt_internal_sbom_optional_args}
FORWARD_SINGLE
${__qt_internal_sbom_single_args}
FORWARD_MULTI
${__qt_internal_sbom_multi_args}
)
_qt_internal_extend_sbom(${name} ${sbom_args})
endif()
qt_add_list_file_finalizer(qt_internal_finalize_executable "${name}")
endfunction()

View File

@ -353,6 +353,15 @@ function(qt_feature_check_and_save_user_provided_value
set("FEATURE_${feature}" "${result}" CACHE BOOL "${label}")
endif()
# Check for potential typo
get_property(original_name GLOBAL PROPERTY "QT_FEATURE_ORIGINAL_NAME_${feature}")
if(NOT original_name STREQUAL feature AND DEFINED "FEATURE_${original_name}")
unset("FEATURE_${original_name}" CACHE)
qt_configure_add_report_error(
"FEATURE_${original_name} does not exist. Consider using: FEATURE_${feature}"
)
endif()
set("${resultVar}" "${result}" PARENT_SCOPE)
endfunction()

View File

@ -162,10 +162,7 @@ macro(qt_find_package)
foreach(qt_find_package_target_name ${arg_PROVIDED_TARGETS})
if(TARGET ${qt_find_package_target_name})
# Allow usage of aliased targets by setting properties on the actual target
get_target_property(aliased_target ${qt_find_package_target_name} ALIASED_TARGET)
if(aliased_target)
set(qt_find_package_target_name ${aliased_target})
endif()
_qt_internal_dealias_target(qt_find_package_target_name)
if("${qt_find_package_target_name}" MATCHES "${QT_CMAKE_EXPORT_NAMESPACE}::"
AND QT_FEATURE_developer_build
@ -387,6 +384,8 @@ endfunction()
# dep_target_name = EntryPointPrivate
# This is just a convenience function that deals with Qt targets and their associated packages
# instead of raw package names.
#
# Deprecated since 6.9.
function(qt_record_extra_qt_package_dependency main_target_name dep_target_name
dep_package_version)
# EntryPointPrivate -> Qt6EntryPointPrivate.
@ -571,17 +570,26 @@ function(qt_internal_get_package_name_of_target target package_name_out_var)
set(${package_name_out_var} "${package_name}" PARENT_SCOPE)
endfunction()
# This function stores the list of Qt targets a library depend on,
# along with their version info, for usage in ${target}Depends.cmake file
function(qt_register_target_dependencies target public_libs private_libs)
# This function collects the list of Qt targets a library depend on,
# along with their version info, for usage in ${target}Dependencies.cmake file
# Multi-value Arguments:
# PUBLIC
# public dependencies
# PRIVATE
# private dependencies
function(qt_internal_register_target_dependencies target)
cmake_parse_arguments(PARSE_ARGV 1 arg "" "" "PUBLIC;PRIVATE")
get_target_property(target_deps "${target}" _qt_target_deps)
if(NOT target_deps)
set(target_deps "")
endif()
get_target_property(target_type ${target} TYPE)
set(lib_list ${public_libs})
set(lib_list "")
if(arg_PUBLIC)
set(lib_list "${arg_PUBLIC}")
endif()
get_target_property(target_type ${target} TYPE)
set(target_is_shared FALSE)
set(target_is_static FALSE)
if(target_type STREQUAL "SHARED_LIBRARY")
@ -595,8 +603,8 @@ function(qt_register_target_dependencies target public_libs private_libs)
#
# Private static library dependencies will become $<LINK_ONLY:> dependencies in
# INTERFACE_LINK_LIBRARIES.
if(target_is_static)
list(APPEND lib_list ${private_libs})
if(target_is_static AND arg_PRIVATE)
list(APPEND lib_list ${arg_PRIVATE})
endif()
foreach(lib IN LISTS lib_list)
@ -622,8 +630,8 @@ function(qt_register_target_dependencies target public_libs private_libs)
# See QTBUG-86533 for some details.
# We filter out static libraries and common platform targets, but include both SHARED and
# INTERFACE libraries. INTERFACE libraries in most cases will be FooPrivate libraries.
if(target_is_shared AND private_libs)
foreach(lib IN LISTS private_libs)
if(target_is_shared AND arg_PRIVATE)
foreach(lib IN LISTS arg_PRIVATE)
set(lib_namespaced "${lib}")
if("${lib}" MATCHES "^Qt::(.*)")
set(lib "${CMAKE_MATCH_1}")

View File

@ -465,21 +465,21 @@ endfunction()
function(qt_internal_print_optimization_flags_values_helper languages configs target_link_types)
foreach(lang ${languages})
set(flag_var_name "CMAKE_${lang}_FLAGS")
message(STATUS "${flag_var_name}: ${${flag_var_name}}")
message(STATUS "${flag_var_name}: '${${flag_var_name}}'")
foreach(config ${configs})
set(flag_var_name "CMAKE_${lang}_FLAGS_${config}")
message(STATUS "${flag_var_name}: ${${flag_var_name}}")
message(STATUS "${flag_var_name}: '${${flag_var_name}}'")
endforeach()
endforeach()
foreach(t ${target_link_types})
set(flag_var_name "CMAKE_${t}_LINKER_FLAGS")
message(STATUS "${flag_var_name}: ${${flag_var_name}}")
message(STATUS "${flag_var_name}: '${${flag_var_name}}'")
foreach(config ${configs})
set(flag_var_name "CMAKE_${t}_LINKER_FLAGS_${config}")
message(STATUS "${flag_var_name}: ${${flag_var_name}}")
message(STATUS "${flag_var_name}: '${${flag_var_name}}'")
endforeach()
endforeach()
endfunction()
@ -713,6 +713,356 @@ function(qt_internal_remove_compiler_flags flags)
endforeach()
endfunction()
# Add a series of compile options as generator expressions
#
# Each condition and compiler requirement are glued by $<AND:> genex.
#
# Synopsis
#
# qt_internal_add_compiler_dependent_flags(<target> <INTERFACE|PUBLIC|PRIVATE>
# COMPILERS <compiler> ...
# [ CONDITIONS <condition> ... ]
# OPTIONS <items> ...
# [ CONDITIONS <condition> ...
# OPTIONS <items> ... ]
# [ COMPILERS ... ]
#
# [LANGUAGES <lang> ...]
# [COMMON_CONDITIONS <condition_genex> ...]
# )
#
# Example
# qt_internal_add_compiler_dependent_flags(tgt PUBLIC
# COMPILERS ALL
# OPTIONS -Werror
# CONDITIONS $<TARGET_PROPERTY:foo> OR $<TARGET_PROPERTY:bar>
# OPTIONS -bar -baz
# COMPILERS GNU
# CONDITIONS VERSION_GREATER_EQUAL 10
# OPTIONS -baz
# )
#
# Is equivalent to:
#
# target_compile_options(tgt PUBLIC
# $<$<AND:$<COMPILE_LANGUAGE:CXX>>:-Werror>
# $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<OR:$<TARGET_PROPERTY:foo>,$<TARGET_PROPERTY:bar>>>:-bar;-baz>
# $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:GNU>,$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,10>>:-baz>
# )
#
# Arguments
#
# `<target>`
# Equivalent to `target_compile_options(<target>)`.
#
# `<INTERFACE|PUBLIC|PRIVATE>`
# Equivalent to `target_compile_options(<INTERFACE|PUBLIC|PRIVATE>)`.
#
# Unlike `target_compile_options`, only one set of target scope is implemented.
#
# `COMPILERS`
# Starts a new set of compiler specific set of options gated by `$<${lang}_COMPILER_ID>`.
# See `LANGUAGES` for how `${lang}` is determined.
#
# Can be any value defined in `CMAKE_<LANG>_COMPILER_ID`, or one of the following shortcuts
# - `ALL`: drops the compiler specific condition
# - `CLANG`: `Clang` and `IntelLLVM` (does not include `AppleClang`)
#
# At least one `COMPILERS` set *must* be defined.
#
# `CONDITIONS`
# Starts a new set of `<condition>` gated options.
#
# `<condition>` can be one of:
# - `VERSION_* <version>`: Equivalent to `$<VERSION_*:$<${lang}_COMPILER_VERSION:>,<version>>`
# See `LANGUAGES` for how `${lang}` is determined.
# - Any genex matching regex: `\$<.*>`
#
# You can use `AND` and `OR` as well as parenthesis `()` to join multiple `<condition>`.
#
# If no `<condition>` is added, the current set only checks for compiler condition and the
# `COMMON_CONDITIONS`.
#
# `OPTIONS`
# Starts the list of compiler options for the current set of `COMPILERS` and `CONDITIONS`
#
# Equivalent to `target_compile_options(<items>)`.
#
# At least one `COMPILERS` set *must* be defined.
#
# `LANGUAGES`
# Language conditions applied to all options.
#
# - If no `LANGUAGES` is passed `$<CXX_COMPILER_*>` is used to compute compiler-dependent
# variables such as `$<CXX_COMPILER_VERSION>`
# - If exactly 1 `LANGUAGES` is passed, this language is used in `$<${lang}_COMPILER_>` like
# variables
#
# `COMMON_CONDITIONS`
# Additional genex conditions to include for all compiler flags.
function(qt_internal_add_compiler_dependent_flags target target_scope)
# We cannot use `cmake_parse_arguments` to parse all the other arguments. We use a special
# parsing for that with the remaining `arg_UNPARSED_ARGUMENTS`
set(option_args "")
set(single_args "")
set(multi_args
LANGUAGES
COMMON_CONDITIONS
)
cmake_parse_arguments(PARSE_ARGV 2 arg
"${option_args}" "${single_args}" "${multi_args}"
)
# For debugging purposes we save the original list of arg_UNPARSED_ARGUMENTS
set(arg_UNPARSED_ARGUMENTS_original ${arg_UNPARSED_ARGUMENTS})
# Set the language for the compiler checks
set(lang CXX)
list(LENGTH arg_LANGUAGES arg_LANGUAGES_length)
if(arg_LANGUAGES_length EQUAL 1)
set(lang ${arg_LANGUAGES})
endif()
# Always add a language genex
set(lang_ex "$<COMPILE_LANGUAGE:${lang}>")
if(arg_LANGUAGES_length GREATER 1)
list(JOIN arg_LANGUAGES "," arg_LANGUAGES_comma_list)
set(lang_ex "$<COMPILE_LANGUAGE:${arg_LANGUAGES_comma_list}>")
endif()
# Helper debugging function
function(_qt_internal_add_compiler_dependent_flags_error msg)
# If you are hitting such a function, something must have gone wrong with
# `qt_internal_add_compiler_flags` implementation.
message(FATAL_ERROR
"${msg}\n"
" curr_arg = ${curr_arg}\n"
" arg_UNPARSED_ARGUMENTS = ${arg_UNPARSED_ARGUMENTS}\n"
" arg_UNPARSED_ARGUMENTS_original = ${arg_UNPARSED_ARGUMENTS_original}"
)
endfunction()
# Helper function finalizing each keyword set
# COMPILERS
function(_qt_internal_add_compiler_dependent_flags_do_COMPILERS)
set(compiler_ex "")
if(NOT curr_COMPILERS)
_qt_internal_add_compiler_dependent_flags_error(
"COMPILERS set cannot be empty"
)
endif()
# If ALL compilers is passed, we can ignore the compiler check
if(NOT "ALL" IN_LIST curr_COMPILERS)
# Check for other aliases
if("CLANG" IN_LIST curr_COMPILERS)
list(REMOVE_ITEM curr_COMPILERS CLANG)
list(APPEND curr_COMPILERS Clang IntelLLVM)
endif()
# Create compiler genex
list(REMOVE_DUPLICATES curr_COMPILERS)
list(JOIN curr_COMPILERS "," compilers)
set(compiler_ex "$<${lang}_COMPILER_ID:${compilers}>" PARENT_SCOPE)
endif()
endfunction()
# CONDITIONS
function(_qt_internal_add_compiler_dependent_flags_do_CONDITIONS)
function(_qt_internal_add_compiler_dependent_flags_do_CONDITIONS_end_stack
stack_in stack_out
)
# Resolve the current stack into a genex list
set(stack_conditions_ex)
set(prev_glue_word)
set(glue_word)
list(POP_FRONT ${stack_in} stack_conditions_ex)
while(${stack_in})
list(POP_FRONT ${stack_in} glue_word)
if(NOT (glue_word STREQUAL "AND" OR glue_word STREQUAL "OR"))
_qt_internal_add_compiler_dependent_flags_error(
"Expected AND/OR glue word, instead got: ${glue_word}"
)
endif()
list(POP_FRONT ${stack_in} next_condition)
if(NOT next_condition)
_qt_internal_add_compiler_dependent_flags_error(
"No other condition provided after ${glue_word}"
)
endif()
if(prev_glue_word STREQUAL glue_word)
# If the glue words are the same, we just add to current genex $<${glue_word}:>
# First trim the last `>` character
string(LENGTH "${stack_conditions_ex}" stack_conditions_ex_length)
math(EXPR stack_conditions_ex_length "${stack_conditions_ex_length} - 1")
string(SUBSTRING "${stack_conditions_ex}" 0 ${stack_conditions_ex_length}
stack_conditions_ex
)
set(stack_conditions_ex "${stack_conditions_ex},${next_condition}>")
else()
# Otherwise create a new $<${glue_word}:>
set(stack_conditions_ex
"$<${glue_word}:${stack_conditions_ex},${next_condition}>"
)
endif()
set(prev_glue_word "${glue_word}")
endwhile()
if(NOT stack_conditions_ex)
_qt_internal_add_compiler_dependent_flags_error(
"Empty parenthesis stack"
)
endif()
# Add the current
list(APPEND ${stack_out} "${stack_conditions_ex}")
set(${stack_out} "${${stack_out}}" PARENT_SCOPE)
endfunction()
set(conditions_ex "")
set(stack_level 0)
set(stack_0)
while(curr_CONDITIONS)
list(POP_FRONT curr_CONDITIONS condition_kw)
# Parenthesis evaluation
if(condition_kw MATCHES "^\\((.*)")
# Start a new stack
math(EXPR stack_level "${stack_level} + 1")
set(stack_${stack_level})
# Check if the parenthesis was glued to another keyword
# Resolve the remaining keyword in the next loop
if(CMAKE_MATCH_1)
list(PREPEND curr_CONDITIONS "${CMAKE_MATCH_1}")
endif()
continue()
elseif(condition_kw MATCHES "(.*)\\)$")
# Check if the parenthesis was glued to another keyword
# Separate them and evaluate each one individually
if(CMAKE_MATCH_1)
set(condition_kw "${CMAKE_MATCH_1}")
list(PREPEND curr_CONDITIONS "${CMAKE_MATCH_1}" ")")
endif()
# Finalize the current stack making it a genex for the next loop
set(curr_stack stack_${stack_level})
math(EXPR stack_level "${stack_level} - 1")
set(prev_stack stack_${stack_level})
_qt_internal_add_compiler_dependent_flags_do_CONDITIONS_end_stack(
${curr_stack} ${prev_stack}
)
if(stack_level LESS 0)
_qt_internal_add_compiler_dependent_flags_error(
"Unbalanced parenthesis."
)
endif()
continue()
endif()
# Glue word evaluation
if(condition_kw STREQUAL "AND" OR condition_kw STREQUAL "OR")
# Insert the operator
list(APPEND stack_${stack_level} "${condition_kw}")
continue()
endif()
# Main condition keyword evaluation
if(condition_kw MATCHES "^VERSION_.*")
# Shortcut for VERSION_* keyword
list(POP_FRONT curr_CONDITIONS version)
list(APPEND stack_${stack_level}
"$<${condition_kw}:$<${lang}_COMPILER_VERSION>,${version}>"
)
continue()
elseif(condition_kw MATCHES "^\\$<.*>$")
# genex expression are added as-is
list(APPEND stack_${stack_level} "${condition_kw}")
continue()
else()
# All other unrecognized forms we do not know how to deal with
_qt_internal_add_compiler_dependent_flags_error(
"Unrecognized condition form: ${condition_kw}"
)
endif()
endwhile()
# Finalize the top-level stack and put it in `conditions_ex`
if(NOT stack_level EQUAL 0)
_qt_internal_add_compiler_dependent_flags_error(
"Unbalanced parenthesis."
)
endif()
_qt_internal_add_compiler_dependent_flags_do_CONDITIONS_end_stack(stack_0 conditions_ex)
set(conditions_ex "${conditions_ex}" PARENT_SCOPE)
endfunction()
# OPTIONS
function(_qt_internal_add_compiler_dependent_flags_do_OPTIONS)
# Check for required keywords
foreach(required_keyword IN ITEMS OPTIONS COMPILERS)
if(curr_${required_keyword} STREQUAL "MISSING")
_qt_internal_add_compiler_dependent_flags_error(
"${required_keyword} keyword was not passed"
)
endif()
endforeach()
# Only handle the current set if the OPTIONS did not evaluate to empty, otherwise
# it is considered a no-op
if(curr_OPTIONS)
# No need to check the length of `all_conditions_ex` because `lang_ex` is
# always defined.
list(JOIN curr_OPTIONS ";" options)
# Combine all conditions in an `AND` statement
set(all_conditions_ex "")
list(APPEND all_conditions_ex
${arg_COMMON_CONDITIONS}
${lang_ex}
${compiler_ex}
${conditions_ex}
)
list(JOIN all_conditions_ex "," all_conditions_ex)
list(APPEND flags
"$<$<AND:${all_conditions_ex}>:${options}>"
)
endif()
# Reset all loop variables
# curr_COMPILERS is inherited from the last loop
set(curr_CONDITIONS "" PARENT_SCOPE)
set(curr_OPTIONS "MISSING" PARENT_SCOPE)
set(conditions_ex "" PARENT_SCOPE)
set(flags "${flags}" PARENT_SCOPE)
endfunction()
# Set initial loop variables
set(compiler_ex "")
set(conditions_ex "")
set(flags "")
# We set (REQUIRED) curr_* loop variables to a special keyword MISSING to identify when
# the keyword was not passed
set(curr_COMPILERS "MISSING")
set(curr_CONDITIONS "")
set(curr_OPTIONS "MISSING")
set(curr_keyword "")
# Parse the remaining arguments
while(arg_UNPARSED_ARGUMENTS)
list(POP_FRONT arg_UNPARSED_ARGUMENTS curr_arg)
# Check for separator keywords
if(curr_arg MATCHES "^(COMPILERS|CONDITIONS|OPTIONS)$")
# Resolve the previous keyword set
# Implicitly we skip the initial loop where curr_keyword == ""
if(curr_keyword STREQUAL "COMPILERS")
_qt_internal_add_compiler_dependent_flags_do_COMPILERS()
elseif(curr_keyword STREQUAL "CONDITIONS")
_qt_internal_add_compiler_dependent_flags_do_CONDITIONS()
elseif(curr_keyword STREQUAL "OPTIONS")
_qt_internal_add_compiler_dependent_flags_do_OPTIONS()
endif()
# Set the new keyword to accumulate the current `curr_*` variable
set(curr_keyword "${curr_arg}")
set(curr_${curr_keyword} "")
continue()
endif()
# If no separator keyword is passed, add the current values to `curr_*` loop variable
# and move on to the next loop
if(NOT curr_keyword)
_qt_internal_add_compiler_dependent_flags_error(
"No keyword was passed: COMPILERS/CONDITIONS/OPTIONS"
)
endif()
list(APPEND curr_${curr_keyword} "${curr_arg}")
endwhile()
# finalize the last set
_qt_internal_add_compiler_dependent_flags_do_OPTIONS()
# Finally add all of the flags to `target_compile_options`
target_compile_options("${target}" ${target_scope} ${flags})
endfunction()
# Adds compiler flags for the given CONFIGS in the calling scope. Can also update the cache
# if asked to do so. The flag variables are always updated in the calling scope, even if they
# did not exist beforehand.

View File

@ -38,6 +38,7 @@ macro(qt_find_apple_system_frameworks)
qt_internal_find_apple_system_framework(FWEventKit EventKit)
qt_internal_find_apple_system_framework(FWHealthKit HealthKit)
qt_internal_find_apple_system_framework(FWUniformTypeIdentifiers UniformTypeIdentifiers)
qt_internal_find_apple_system_framework(FWOpenGL OpenGL)
endif()
endmacro()
@ -169,7 +170,7 @@ function(qt_internal_generate_fake_framework_header target)
file(GENERATE OUTPUT "${fake_header}" CONTENT "// ignore this file\n"
CONDITION "$<CONFIG:${main_config}>")
target_sources(${target} PRIVATE "${fake_header}")
set_source_files_properties("${fake_header}" PROPERTIES GENERATED ON)
_qt_internal_set_source_file_generated(SOURCES "${fake_header}")
set_property(TARGET ${target} APPEND PROPERTY PUBLIC_HEADER "${fake_header}")
endfunction()

View File

@ -10,7 +10,8 @@ function(qt_get_library_name_without_prefix_and_suffix out_var file_path)
if(NOT file_path MATCHES "^-") # not a linker flag
get_filename_component(basename "${file_path}" NAME_WE)
get_filename_component(ext "${file_path}" EXT)
if(NOT ext) # seems like a library name without prefix and suffix
if(NOT ext AND NOT IS_ABSOLUTE "${file_path}")
# seems like a library name without prefix and suffix
set(${out_var} "${file_path}" PARENT_SCOPE)
return()
endif()

View File

@ -93,12 +93,11 @@ handle_type(cpp EXTENSIONS .c .cc .cpp .cxx .h .hh .hxx .hpp MODULES Core TEMPLA
handle_type(qml EXTENSIONS .qml .js .mjs MODULES Gui Qml Quick TEMPLATE
"\n\nqt_add_qml_module(${project_name}
URI ${project_name}
OUTPUT_DIRECTORY qml
VERSION 1.0
RESOURCE_PREFIX /qt/qml
QML_FILES
@files@
)"
)
set_property(TARGET ${project_name} PROPERTY RUNTIME_OUTPUT_NAME \"${project_name}app\")
"
)
handle_type(ui EXTENSIONS .ui MODULES Gui Widgets DEPENDS cpp TEMPLATE
@ -162,7 +161,7 @@ set(content
project(${project_name} LANGUAGES CXX)
find_package(Qt6 REQUIRED COMPONENTS ${packages_string})
qt_standard_project_setup()"
qt_standard_project_setup(REQUIRES 6.8)"
)
set(has_useful_sources FALSE)

View File

@ -14,3 +14,4 @@ set(QT@PROJECT_VERSION_MAJOR@_INSTALL_PLUGINS "@INSTALL_PLUGINSDIR@")
set(QT@PROJECT_VERSION_MAJOR@_INSTALL_QML "@INSTALL_QMLDIR@")
set(QT@PROJECT_VERSION_MAJOR@_INSTALL_TESTS "@INSTALL_TESTSDIR@")
set(QT@PROJECT_VERSION_MAJOR@_INSTALL_TRANSLATIONS "@INSTALL_TRANSLATIONSDIR@")
set(QT@PROJECT_VERSION_MAJOR@_INSTALL_DESCRIPTIONSDIR "@INSTALL_DESCRIPTIONSDIR@")

View File

@ -3,85 +3,124 @@
function(qt_internal_set_warnings_are_errors_flags target target_scope)
set(flags "")
if (CLANG AND NOT MSVC)
list(APPEND flags -Werror -Wno-error=\#warnings -Wno-error=deprecated-declarations)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") # as in: not AppleClang
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "10.0.0")
# We do mixed enum arithmetic all over the place:
list(APPEND flags -Wno-error=deprecated-enum-enum-conversion)
endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "14.0.0")
# Clang 14 introduced these two but we are not clean for it.
list(APPEND flags -Wno-error=deprecated-copy-with-user-provided-copy)
list(APPEND flags -Wno-error=unused-but-set-variable)
endif()
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# using GCC
list(APPEND flags -Werror -Wno-error=cpp -Wno-error=deprecated-declarations)
# GCC prints this bogus warning, after it has inlined a lot of code
# error: assuming signed overflow does not occur when assuming that (X + c) < X is always false
list(APPEND flags -Wno-error=strict-overflow)
# GCC 7 includes -Wimplicit-fallthrough in -Wextra, but Qt is not yet free of implicit fallthroughs.
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0.0")
list(APPEND flags -Wno-error=implicit-fallthrough)
endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "9.0.0")
# GCC 9 introduced these but we are not clean for it.
list(APPEND flags -Wno-error=deprecated-copy -Wno-error=redundant-move -Wno-error=init-list-lifetime)
# GCC 9 introduced -Wformat-overflow in -Wall, but it is buggy:
list(APPEND flags -Wno-error=format-overflow)
endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "10.0.0")
# GCC 10 has a number of bugs in -Wstringop-overflow. Do not make them an error.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101134
list(APPEND flags -Wno-error=stringop-overflow)
endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11.0.0")
# Ditto
list(APPEND flags -Wno-error=stringop-overread)
# We do mixed enum arithmetic all over the place:
list(APPEND flags -Wno-error=deprecated-enum-enum-conversion -Wno-error=deprecated-enum-float-conversion)
endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11.0.0" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.2.0")
# GCC 11.1 has a regression in the integrated preprocessor, so disable it as a workaround (QTBUG-93360)
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
# This in turn triggers a fallthrough warning in cborparser.c, so we disable this warning.
list(APPEND flags -no-integrated-cpp -Wno-implicit-fallthrough)
endif()
# Work-around for bug https://code.google.com/p/android/issues/detail?id=58135
if (ANDROID)
list(APPEND flags -Wno-error=literal-suffix)
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# Only enable for versions of MSVC that are known to work
# 1941 is Visual Studio 2022 version 17.11
if(MSVC_VERSION LESS_EQUAL 1941)
list(APPEND flags /WX)
endif()
endif()
set(warnings_are_errors_enabled_genex
"$<NOT:$<BOOL:$<TARGET_PROPERTY:QT_SKIP_WARNINGS_ARE_ERRORS>>>")
# Gate everything by the target property
set(common_conditions "$<NOT:$<BOOL:$<TARGET_PROPERTY:QT_SKIP_WARNINGS_ARE_ERRORS>>>")
# Apparently qmake only adds -Werror to CXX and OBJCXX files, not C files. We have to do the
# same otherwise MinGW builds break when building 3rdparty\md4c\md4c.c (and probably on other
# platforms too).
set(cxx_only_genex "$<OR:$<COMPILE_LANGUAGE:CXX>,$<COMPILE_LANGUAGE:OBJCXX>>")
set(final_condition_genex "$<AND:${warnings_are_errors_enabled_genex},${cxx_only_genex}>")
set(flags_generator_expression "$<${final_condition_genex}:${flags}>")
target_compile_options("${target}" ${target_scope} "${flags_generator_expression}")
set(language_args LANGUAGES CXX OBJCXX)
# This property is set to True only if we are using Clang and frontend is MSVC
# Currently we do not set any error flags
set(clang_msvc_frontend_args
"$<NOT:$<BOOL:$<TARGET_PROPERTY:Qt6::PlatformCommonInternal,_qt_internal_clang_msvc_frontend>>>"
)
if(GCC OR CLANG OR WIN32)
# Note: the if check is included to mimic the previous selective gating. These need to
# balance reducing unnecessary compile flags that are evaluated by the genex, and making
# sure the developer has appropriate Werror flags enabled when building a module with
# different environment
qt_internal_add_compiler_dependent_flags("${target}" ${target_scope}
COMPILERS CLANG AppleClang
OPTIONS
-Werror -Wno-error=\#warnings -Wno-error=deprecated-declarations
COMPILERS CLANG
CONDITIONS VERSION_GREATER_EQUAL 10
OPTIONS
# We do mixed enum arithmetic all over the place:
-Wno-error=deprecated-enum-enum-conversion
CONDITIONS VERSION_GREATER_EQUAL 14
OPTIONS
# Clang 14 introduced these two but we are not clean for it.
-Wno-error=deprecated-copy-with-user-provided-copy
-Wno-error=unused-but-set-variable
COMMON_CONDITIONS
${common_conditions}
${clang_msvc_frontend_args}
${language_args}
)
qt_internal_add_compiler_dependent_flags("${target}" ${target_scope}
COMPILERS GNU
OPTIONS
-Werror -Wno-error=cpp -Wno-error=deprecated-declarations
# GCC prints this bogus warning, after it has inlined a lot of code
# error: assuming signed overflow does not occur when assuming that (X + c) < X
# is always false
-Wno-error=strict-overflow
CONDITIONS VERSION_GREATER_EQUAL 7
OPTIONS
# GCC 7 includes -Wimplicit-fallthrough in -Wextra, but Qt is not yet free of
# implicit fallthroughs.
-Wno-error=implicit-fallthrough
CONDITIONS VERSION_GREATER_EQUAL 9
OPTIONS
# GCC 9 introduced these but we are not clean for it.
-Wno-error=deprecated-copy
-Wno-error=redundant-move
-Wno-error=init-list-lifetime
# GCC 9 introduced -Wformat-overflow in -Wall, but it is buggy:
-Wno-error=format-overflow
CONDITIONS VERSION_GREATER_EQUAL 10
OPTIONS
# GCC 10 has a number of bugs in -Wstringop-overflow. Do not make them an error.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101134
-Wno-error=stringop-overflow
CONDITIONS VERSION_GREATER_EQUAL 11
OPTIONS
# Ditto
-Wno-error=stringop-overread
# We do mixed enum arithmetic all over the place:
-Wno-error=deprecated-enum-enum-conversion
-Wno-error=deprecated-enum-float-conversion
CONDITIONS VERSION_GREATER_EQUAL 11.0 AND VERSION_LESS 11.2
OPTIONS
# GCC 11.1 has a regression in the integrated preprocessor, so disable it as a
# workaround (QTBUG-93360)
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
# This in turn triggers a fallthrough warning in cborparser.c, so we disable
# this warning.
-no-integrated-cpp -Wno-implicit-fallthrough
CONDITIONS VERSION_LESS 15.1
AND $<BOOL:${QT_FEATURE_sanitize_thread}>
AND $<BOOL:${BUILD_WITH_PCH}>
OPTIONS
# GCC < 15 raises a TSAN warning from Qt's own PCHs, despite the warning
# being suppressed (QTBUG-134415)
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64117
-Wno-error=tsan
COMMON_CONDITIONS
${common_conditions}
${language_args}
)
endif()
# Other options are gated at compile time that are not likely to change between different build
# environments of other modules.
if(ANDROID)
qt_internal_add_compiler_dependent_flags("${target}" ${target_scope}
COMPILERS GNU
CONDITIONS $<PLATFORM_ID:ANDROID>
OPTIONS
# Work-around for bug https://code.google.com/p/android/issues/detail?id=58135
-Wno-error=literal-suffix
COMMON_CONDITIONS
${common_conditions}
${language_args}
)
endif()
if(WIN32)
qt_internal_add_compiler_dependent_flags("${target}" ${target_scope}
COMPILERS MSVC
# Only enable for versions of MSVC that are known to work
# 1941 is Visual Studio 2022 version 17.11
CONDITIONS VERSION_LESS_EQUAL 17.11
OPTIONS
/WX
COMMON_CONDITIONS
${common_conditions}
${language_args}
)
endif()
endfunction()
# The function adds a global 'definition' to the platform internal targets and the target
@ -97,7 +136,7 @@ endfunction()
# APP - set the definition for all Qt applications
# TODO: Add a tests specific platform target and the definition scope for it.
function(qt_internal_add_global_definition definition)
set(optional_args)
set(optional_args "")
set(single_value_args VALUE)
set(multi_value_args SCOPE)
cmake_parse_arguments(arg
@ -310,6 +349,16 @@ if (MSVC AND NOT CLANG)
)
endif()
set(_qt_internal_clang_msvc_frontend False)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
set(_qt_internal_clang_msvc_frontend True)
endif()
set_target_properties(PlatformCommonInternal
PROPERTIES
_qt_internal_clang_msvc_frontend "${_qt_internal_clang_msvc_frontend}"
)
if(MINGW)
target_compile_options(PlatformCommonInternal INTERFACE -Wa,-mbig-obj)
endif()

View File

@ -29,10 +29,67 @@ endif()
if (NOT QT_NO_CREATE_TARGETS AND @INSTALL_CMAKE_NAMESPACE@@target@_FOUND)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@AdditionalTargetInfo.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@AdditionalTargetInfo.cmake"
OPTIONAL)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@ExtraProperties.cmake"
OPTIONAL)
endif()
# Find the private module counterpart.
# For now, always load the private module. In a future Qt version we plan to require users to
# find_package the private module explicitly.
set(__qt_@target@_always_load_private_module ON)
set(__qt_@target@_save_QT_NO_PRIVATE_MODULE_WARNING ${QT_NO_PRIVATE_MODULE_WARNING})
set(QT_NO_PRIVATE_MODULE_WARNING ON)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@-build.cmake" OPTIONAL)
if (@INSTALL_CMAKE_NAMESPACE@@target@_FOUND
AND NOT @INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND
AND NOT @arg_NO_PRIVATE_MODULE@
AND (
__qt_@target@_always_load_private_module
OR DEFINED QT_REPO_MODULE_VERSION
OR QT_FIND_PRIVATE_MODULES
)
)
if("${_qt_cmake_dir}" STREQUAL "")
set(_qt_cmake_dir "${QT_TOOLCHAIN_RELOCATABLE_CMAKE_DIR}")
endif()
set(__qt_use_no_default_path_for_qt_packages "NO_DEFAULT_PATH")
if(QT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES)
set(__qt_use_no_default_path_for_qt_packages "")
endif()
find_package(@INSTALL_CMAKE_NAMESPACE@@target_private@ "@PROJECT_VERSION@" EXACT
QUIET
CONFIG
PATHS
${QT_BUILD_CMAKE_PREFIX_PATH}
"${CMAKE_CURRENT_LIST_DIR}/.."
"${_qt_cmake_dir}"
${_qt_additional_packages_prefix_paths}
${__qt_use_no_default_path_for_qt_packages}
)
if(NOT @INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND)
get_property(@INSTALL_CMAKE_NAMESPACE@@target_private@_warning_shown GLOBAL PROPERTY
@INSTALL_CMAKE_NAMESPACE@@target_private@_warning_shown
)
if(NOT @INSTALL_CMAKE_NAMESPACE@@target_private@_warning_shown)
message(VERBOSE
"The private module package '@INSTALL_CMAKE_NAMESPACE@@target_private@' "
"could not be found. It possibly needs to be installed separately with your "
"package manager."
)
set_property(GLOBAL PROPERTY
@INSTALL_CMAKE_NAMESPACE@@target_private@_warning_shown ON
)
endif()
endif()
endif()
set(QT_NO_PRIVATE_MODULE_WARNING ${__qt_@target@_save_QT_NO_PRIVATE_MODULE_WARNING})
unset(__qt_@target@_save_QT_NO_PRIVATE_MODULE_WARNING)
unset(__qt_@target@_always_load_private_module)
if (NOT QT_NO_CREATE_TARGETS AND @INSTALL_CMAKE_NAMESPACE@@target@_FOUND)
# DEPRECATED
# Provide old style variables for includes, compile definitions, etc.
# These variables are deprecated and only provided on a best-effort basis to facilitate porting.
@ -120,18 +177,28 @@ if (TARGET @QT_CMAKE_EXPORT_NAMESPACE@::@target@)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Plugins.cmake")
endif()
list(APPEND QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE "@target@")
if(NOT "@target@" IN_LIST QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE)
list(APPEND QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE "@target@")
list(APPEND QT_ALL_MODULES_VERSIONED_FOUND_VIA_FIND_PACKAGE
"@INSTALL_CMAKE_NAMESPACE@::@target@")
endif()
get_target_property(_qt_module_target_type "@INSTALL_CMAKE_NAMESPACE@::@target@" TYPE)
if(NOT _qt_module_target_type STREQUAL "INTERFACE_LIBRARY")
get_target_property(_qt_module_plugin_types
@INSTALL_CMAKE_NAMESPACE@::@target@ MODULE_PLUGIN_TYPES)
if(_qt_module_plugin_types)
list(APPEND QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE "${_qt_module_plugin_types}")
foreach(_qt_module_plugin_type IN LISTS _qt_module_plugin_types)
if(NOT "${_qt_module_plugin_type}"
IN_LIST QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE)
list(APPEND QT_ALL_PLUGIN_TYPES_FOUND_VIA_FIND_PACKAGE
"${_qt_module_plugin_type}")
endif()
endforeach()
unset(_qt_module_plugin_type)
endif()
endif()
# Load Module's BuildInternals should any exist
if (@INSTALL_CMAKE_NAMESPACE@BuildInternals_DIR AND
EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@BuildInternals.cmake")

View File

@ -0,0 +1,64 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
@PACKAGE_INIT@
cmake_minimum_required(VERSION @min_new_policy_version@...@max_new_policy_version@)
include(CMakeFindDependencyMacro)
# Find required dependencies, if any.
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@Dependencies.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@Dependencies.cmake")
_qt_internal_suggest_dependency_debugging(@target_private@
__qt_@target_private@_pkg ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
endif()
# If *ConfigDependencies.cmake exists, the variable value will be defined there.
# Don't override it in that case.
if(NOT DEFINED "@INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND")
set("@INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND" TRUE)
endif()
if(NOT DEFINED QT_REPO_MODULE_VERSION
AND NOT QT_NO_PRIVATE_MODULE_WARNING
AND NOT __qt_private_module_@target_private@_warning_shown)
message(WARNING
"This project is using headers of the @target_private@ module and will therefore be tied "
"to this specific Qt module build version. "
"Running this project against other versions of the Qt modules may crash at any arbitrary "
"point. This is not a bug, but a result of using Qt internals. You have been warned! "
"\nYou can disable this warning by setting QT_NO_PRIVATE_MODULE_WARNING to ON."
)
set(__qt_private_module_@target_private@_warning_shown TRUE)
endif()
if(NOT QT_NO_CREATE_TARGETS AND @INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@AdditionalTargetInfo.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@ExtraProperties.cmake"
OPTIONAL)
endif()
if(TARGET @QT_CMAKE_EXPORT_NAMESPACE@::@target_private@)
if(NOT QT_NO_CREATE_VERSIONLESS_TARGETS)
if(CMAKE_VERSION VERSION_LESS 3.18 OR QT_USE_OLD_VERSION_LESS_TARGETS)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@VersionlessTargets.cmake")
else()
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@VersionlessAliasTargets.cmake")
endif()
endif()
else()
set(@INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND FALSE)
if(NOT DEFINED @INSTALL_CMAKE_NAMESPACE@@target_private@_NOT_FOUND_MESSAGE)
set(@INSTALL_CMAKE_NAMESPACE@@target_private@_NOT_FOUND_MESSAGE
"Target \"@QT_CMAKE_EXPORT_NAMESPACE@::@target_private@\" was not found.")
if(QT_NO_CREATE_TARGETS)
string(APPEND @INSTALL_CMAKE_NAMESPACE@@target_private@_NOT_FOUND_MESSAGE
"Possibly due to QT_NO_CREATE_TARGETS being set to TRUE and thus "
"${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@Targets.cmake was not "
"included to define the target.")
endif()
endif()
endif()

View File

@ -32,16 +32,20 @@ endif()
set(__qt_@target@_third_party_deps "@third_party_deps@")
@third_party_deps_extra_info@
_qt_internal_find_third_party_dependencies("@target@" __qt_@target@_third_party_deps)
unset(__qt_@target@_third_party_deps)
# Find Qt tool package.
set(__qt_@target@_tool_deps "@main_module_tool_deps@")
_qt_internal_find_tool_dependencies("@target@" __qt_@target@_tool_deps)
unset(__qt_@target@_tool_deps)
# note: target_deps example: "Qt6Core\;5.12.0;Qt6Gui\;5.12.0"
set(__qt_@target@_target_deps "@target_deps@")
set(__qt_@target@_find_dependency_paths "${CMAKE_CURRENT_LIST_DIR}/.." "${_qt_cmake_dir}")
_qt_internal_find_qt_dependencies("@target@" __qt_@target@_target_deps
__qt_@target@_find_dependency_paths)
unset(__qt_@target@_target_deps)
unset(__qt_@target@_find_dependency_paths)
set(_@QT_CMAKE_EXPORT_NAMESPACE@@target@_MODULE_DEPENDENCIES "@qt_module_dependencies@")
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND TRUE)

View File

@ -81,7 +81,6 @@ endfunction()
# Options:
# NO_ADDITIONAL_TARGET_INFO
# Don't generate a Qt6*AdditionalTargetInfo.cmake file.
# The caller is responsible for creating one.
#
# MODULE_INTERFACE_NAME
# The custom name of the module interface. This name is used as a part of the include paths
@ -251,10 +250,9 @@ function(qt_internal_add_module target)
set(module_config_private_header "qt${arg_CONFIG_MODULE_NAME}-config_p.h")
# qt<module>-config.h/-config_p.h header files are not marked as GENERATED automatically
# for old CMake versions. Set the property explicitly here.
set_source_files_properties("${module_config_header}" "${module_config_private_header}"
PROPERTIES
GENERATED TRUE
SKIP_AUTOGEN TRUE
_qt_internal_set_source_file_generated(
SOURCES "${module_config_header}" "${module_config_private_header}"
SKIP_AUTOGEN
)
# Module define needs to take into account the config module name.
@ -327,7 +325,7 @@ function(qt_internal_add_module target)
set_target_properties(${target_private} PROPERTIES
_qt_config_module_name ${arg_CONFIG_MODULE_NAME}_private
_qt_package_version "${PROJECT_VERSION}"
_qt_package_name "${INSTALL_CMAKE_NAMESPACE}${target}"
_qt_package_name "${INSTALL_CMAKE_NAMESPACE}${target}Private"
_qt_is_private_module TRUE
_qt_public_module_target_name "${target}"
)
@ -340,6 +338,9 @@ function(qt_internal_add_module target)
)
set_property(TARGET "${target_private}" APPEND PROPERTY
EXPORT_PROPERTIES "${export_properties}")
# Let find_package(Qt6FooPrivate) also find_package(Qt6Foo).
qt_internal_register_target_dependencies("${target_private}" PUBLIC "Qt::${target}")
endif()
# FIXME: This workaround is needed because the deployment logic
@ -442,7 +443,7 @@ function(qt_internal_add_module target)
set(module_depends_header
"${module_build_interface_include_dir}/${module_include_name}Depends")
set_source_files_properties("${module_depends_header}" PROPERTIES GENERATED TRUE)
_qt_internal_set_source_file_generated(SOURCES "${module_depends_header}")
set_target_properties(${target} PROPERTIES _qt_module_depends_header
"${module_depends_header}")
if(NOT arg_HEADER_MODULE)
@ -659,7 +660,7 @@ function(qt_internal_add_module target)
# thus we can't use qt_internal_extend_target()'s PUBLIC_DEFINES option.
target_compile_definitions(${target} INTERFACE QT_${module_define_infix}_LIB)
if(NOT DEFINED arg_EXCEPTIONS)
if(NOT arg_EXCEPTIONS)
qt_internal_set_exceptions_flags("${target}" "DEFAULT")
else()
qt_internal_set_exceptions_flags("${target}" "${arg_EXCEPTIONS}")
@ -691,6 +692,12 @@ function(qt_internal_add_module target)
set(path_suffix "${INSTALL_CMAKE_NAMESPACE}${target}")
qt_path_join(config_build_dir ${QT_CONFIG_BUILD_DIR} ${path_suffix})
qt_path_join(config_install_dir ${QT_CONFIG_INSTALL_DIR} ${path_suffix})
if(NOT arg_NO_PRIVATE_MODULE)
set(path_suffix "${INSTALL_CMAKE_NAMESPACE}${target_private}")
qt_path_join(private_config_build_dir ${QT_CONFIG_BUILD_DIR} ${path_suffix})
qt_path_join(private_config_install_dir ${QT_CONFIG_INSTALL_DIR} ${path_suffix})
endif()
unset(path_suffix)
set(extra_cmake_files)
set(extra_cmake_includes)
@ -739,9 +746,17 @@ set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
endif()
foreach(cmake_file IN LISTS arg_EXTRA_CMAKE_FILES)
get_filename_component(basename ${cmake_file} NAME)
file(COPY ${cmake_file} DESTINATION ${config_build_dir})
list(APPEND extra_cmake_files "${config_build_dir}/${basename}")
get_source_file_property(install_path ${cmake_file} QT_INSTALL_PATH)
if(NOT install_path)
# Sanitize the install_path from `NOTFOUND` to ""
set(install_path "")
endif()
file(COPY ${cmake_file} DESTINATION "${config_build_dir}/${install_path}")
qt_install(FILES
${cmake_file}
DESTINATION "${config_install_dir}/${install_path}"
COMPONENT Devel
)
# Make sure touched extra cmake files cause a reconfigure, so they get re-copied.
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${cmake_file}")
@ -781,10 +796,16 @@ set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
qt_internal_get_min_new_policy_cmake_version(min_new_policy_version)
qt_internal_get_max_new_policy_cmake_version(max_new_policy_version)
configure_package_config_file(
"${QT_CMAKE_DIR}/QtModuleConfig.cmake.in"
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}Config.cmake"
INSTALL_DESTINATION "${config_install_dir}"
if(is_static_lib)
set(write_basic_module_package_args IS_STATIC_LIB)
else()
set(write_basic_module_package_args "")
endif()
qt_internal_write_basic_module_package("${target}" "${target_private}"
${write_basic_module_package_args}
CONFIG_BUILD_DIR ${config_build_dir}
CONFIG_INSTALL_DIR ${config_install_dir}
)
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}BuildInternals.cmake")
@ -794,38 +815,45 @@ set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
list(APPEND extra_cmake_files "${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}BuildInternals.cmake")
endif()
write_basic_package_version_file(
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigVersionImpl.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
qt_internal_write_qt_package_version_file(
"${INSTALL_CMAKE_NAMESPACE}${target}"
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigVersion.cmake"
)
qt_install(FILES
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}Config.cmake"
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigVersion.cmake"
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigVersionImpl.cmake"
${extra_cmake_files}
DESTINATION "${config_install_dir}"
COMPONENT Devel
)
file(COPY ${extra_cmake_files} DESTINATION "${config_build_dir}")
set(exported_targets ${target})
if(NOT ${arg_NO_PRIVATE_MODULE})
list(APPEND exported_targets ${target_private})
if(NOT arg_NO_PRIVATE_MODULE)
qt_internal_write_basic_module_package("${target}" "${target_private}"
${write_basic_module_package_args}
PRIVATE
CONFIG_BUILD_DIR ${private_config_build_dir}
CONFIG_INSTALL_DIR ${private_config_install_dir}
)
endif()
set(export_name "${INSTALL_CMAKE_NAMESPACE}${target}Targets")
qt_install(TARGETS ${exported_targets}
EXPORT ${export_name}
RUNTIME DESTINATION ${INSTALL_BINDIR}
LIBRARY DESTINATION ${INSTALL_LIBDIR}
ARCHIVE DESTINATION ${INSTALL_LIBDIR}
FRAMEWORK DESTINATION ${INSTALL_LIBDIR}
file(COPY ${extra_cmake_files} DESTINATION "${config_build_dir}")
set(targets_to_export ${target})
if(NOT ${arg_NO_PRIVATE_MODULE})
list(APPEND targets_to_export ${target_private})
endif()
_qt_internal_forward_function_args(
FORWARD_PREFIX arg
FORWARD_OUT_VAR export_module_args
FORWARD_OPTIONS NO_ADDITIONAL_TARGET_INFO
)
qt_internal_export_module(${target}
${export_module_args}
CONFIG_BUILD_DIR ${config_build_dir}
CONFIG_INSTALL_DIR ${config_install_dir}
)
if(NOT arg_NO_PRIVATE_MODULE)
qt_internal_export_module(${target_private}
${export_module_args}
CONFIG_BUILD_DIR ${private_config_build_dir}
CONFIG_INSTALL_DIR ${private_config_install_dir}
)
endif()
if(BUILD_SHARED_LIBS)
qt_apply_rpaths(TARGET "${target}" INSTALL_PATH "${INSTALL_LIBDIR}" RELATIVE_RPATH)
@ -839,29 +867,6 @@ set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
QT_ANDROID_MODULE_INSTALL_DIR ${INSTALL_LIBDIR})
endif()
qt_install(EXPORT ${export_name}
NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE}::
DESTINATION ${config_install_dir})
if(NOT arg_NO_ADDITIONAL_TARGET_INFO)
qt_internal_export_additional_targets_file(
TARGETS ${exported_targets}
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
CONFIG_INSTALL_DIR "${config_install_dir}")
endif()
qt_internal_export_modern_cmake_config_targets_file(
TARGETS ${exported_targets}
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
CONFIG_BUILD_DIR "${config_build_dir}"
CONFIG_INSTALL_DIR "${config_install_dir}"
)
qt_internal_export_genex_properties(TARGETS ${target}
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
CONFIG_INSTALL_DIR "${config_install_dir}"
)
### fixme: cmake is missing a built-in variable for this. We want to apply it only to modules and plugins
# that belong to Qt.
if(NOT arg_HEADER_MODULE)
@ -980,12 +985,125 @@ set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)")
${__qt_internal_sbom_multi_args}
)
_qt_internal_extend_sbom(${target} ${sbom_args})
qt_internal_extend_qt_entity_sbom(${target} ${sbom_args})
endif()
qt_add_list_file_finalizer(qt_finalize_module ${target} ${arg_INTERNAL_MODULE} ${arg_NO_PRIVATE_MODULE})
endfunction()
# Write and install the basic Qt6Foo and Qt6FooPrivate packages.
#
# If PRIVATE is specified, write Qt6FooPrivate.
# Otherwise write its public counterpart.
function(qt_internal_write_basic_module_package target target_private)
set(no_value_options
IS_STATIC_LIB
PRIVATE
)
set(single_value_options
CONFIG_BUILD_DIR
CONFIG_INSTALL_DIR
)
set(multi_value_options "")
cmake_parse_arguments(PARSE_ARGV 0 arg
"${no_value_options}" "${single_value_options}" "${multi_value_options}"
)
if(arg_PRIVATE)
set(package_name "${INSTALL_CMAKE_NAMESPACE}${target_private}")
set(module_config_input_file "QtModuleConfigPrivate.cmake.in")
else()
set(package_name "${INSTALL_CMAKE_NAMESPACE}${target}")
set(module_config_input_file "QtModuleConfig.cmake.in")
endif()
if(arg_IS_STATIC_LIB AND NOT arg_PRIVATE AND CMAKE_VERSION VERSION_LESS "3.26")
# We auto-load the private module package from the public module package if we have a static
# Qt module and CMake's version is < 3.26. This is needed for the case "Qt6Foo links against
# Qt6BarPrivate", because CMake generates a check for the target Qt6::BarPrivate in
# Qt6FooTargets.cmake. Once we can require CMake 3.26, we can simply link against
# $<BUILD_LOCAL_INTERFACE:Qt6BarPrivate> in qt_internal_extend_target.
#
# For older CMake versions, we create an additional CMake file that's optionally included by
# Qt6FooConfig.cmake to work around the lack of BUILD_LOCAL_INTERFACE.
file(CONFIGURE
OUTPUT "${arg_CONFIG_BUILD_DIR}/${package_name}-build.cmake"
CONTENT "# This file marks this directory as part of Qt's build tree.
set(__qt_${target}_always_load_private_module ON)
"
)
endif()
configure_package_config_file(
"${QT_CMAKE_DIR}/${module_config_input_file}"
"${arg_CONFIG_BUILD_DIR}/${package_name}Config.cmake"
INSTALL_DESTINATION "${arg_CONFIG_INSTALL_DIR}"
)
write_basic_package_version_file(
"${arg_CONFIG_BUILD_DIR}/${package_name}ConfigVersionImpl.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
qt_internal_write_qt_package_version_file(
"${package_name}"
"${arg_CONFIG_BUILD_DIR}/${package_name}ConfigVersion.cmake"
)
qt_install(FILES
"${arg_CONFIG_BUILD_DIR}/${package_name}Config.cmake"
"${arg_CONFIG_BUILD_DIR}/${package_name}ConfigVersion.cmake"
"${arg_CONFIG_BUILD_DIR}/${package_name}ConfigVersionImpl.cmake"
DESTINATION "${arg_CONFIG_INSTALL_DIR}"
COMPONENT Devel
)
endfunction()
function(qt_internal_export_module target)
set(no_value_options
NO_ADDITIONAL_TARGET_INFO
)
set(single_value_options
CONFIG_BUILD_DIR
CONFIG_INSTALL_DIR
)
set(multi_value_options "")
cmake_parse_arguments(PARSE_ARGV 1 arg
"${no_value_options}" "${single_value_options}" "${multi_value_options}"
)
_qt_internal_validate_all_args_are_parsed(arg)
set(export_name "${INSTALL_CMAKE_NAMESPACE}${target}Targets")
qt_install(TARGETS ${target}
EXPORT ${export_name}
RUNTIME DESTINATION ${INSTALL_BINDIR}
LIBRARY DESTINATION ${INSTALL_LIBDIR}
ARCHIVE DESTINATION ${INSTALL_LIBDIR}
FRAMEWORK DESTINATION ${INSTALL_LIBDIR}
)
qt_install(EXPORT ${export_name}
NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE}::
DESTINATION ${arg_CONFIG_INSTALL_DIR})
if(NOT arg_NO_ADDITIONAL_TARGET_INFO)
qt_internal_export_additional_targets_file(
TARGETS ${target}
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
CONFIG_INSTALL_DIR "${arg_CONFIG_INSTALL_DIR}")
endif()
qt_internal_export_modern_cmake_config_targets_file(
TARGETS ${target}
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
CONFIG_BUILD_DIR "${arg_CONFIG_BUILD_DIR}"
CONFIG_INSTALL_DIR "${arg_CONFIG_INSTALL_DIR}"
)
qt_internal_export_genex_properties(TARGETS ${target}
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
CONFIG_INSTALL_DIR "${arg_CONFIG_INSTALL_DIR}"
)
endfunction()
function(qt_internal_apply_apple_privacy_manifest target)
# Avoid "INTERFACE_LIBRARY targets may only have whitelisted properties" error on CMake < 3.17.
get_target_property(target_type ${target} TYPE)
@ -1016,8 +1134,11 @@ function(qt_finalize_module target)
# property which supposed to be updated inside every qt_internal_install_module_headers
# call.
qt_internal_add_headersclean_target(${target} "${module_headers_public}")
qt_internal_target_sync_headers(${target} "${module_headers_all}"
"${module_headers_generated}")
qt_internal_target_sync_headers(${target}
"${module_headers_all}"
"${module_headers_generated}"
"${module_headers_exclude_from_docs}"
)
get_target_property(module_depends_header ${target} _qt_module_depends_header)
qt_internal_install_module_headers(${target}
PUBLIC ${module_headers_public} "${module_depends_header}"
@ -1231,7 +1352,12 @@ function(qt_describe_module target)
qt_path_join(install_dir ${QT_INSTALL_DIR} ${path_suffix})
set(descfile_in "${QT_CMAKE_DIR}/ModuleDescription.json.in")
# IMPORTANT: If you adjust the file name not to be the exact target name and thus the CMake
# package name, it needs to consider also the code in QtConfig.cmake.in that globs the json
# files.
set(descfile_out "${build_dir}/${target}.json")
string(TOLOWER "${PROJECT_NAME}" lower_case_project_name)
set(extra_module_information "")
set(platforms_information "")
@ -1379,6 +1505,11 @@ function(qt_internal_generate_cpp_global_exports target module_define_infix)
set(${out_public_header} "${generated_header_path}" PARENT_SCOPE)
target_sources(${target} PRIVATE "${generated_header_path}")
_qt_internal_set_source_file_generated(
SOURCES "${generated_header_path}"
CONFIGURE_GENERATED
)
# `GENERATED` property is set in order to be processed by `qt_internal_collect_module_headers`
set_source_files_properties("${generated_header_path}" PROPERTIES GENERATED TRUE)
endfunction()
@ -1437,6 +1568,7 @@ endfunction()
function(qt_internal_collect_module_headers out_var target)
set(${out_var}_public "")
set(${out_var}_private "")
set(${out_var}_exclude_from_docs "")
set(${out_var}_qpa "")
set(${out_var}_rhi "")
set(${out_var}_ssg "")
@ -1511,6 +1643,12 @@ function(qt_internal_collect_module_headers out_var target)
set(is_3rdparty_header FALSE)
endif()
list(APPEND ${out_var}_all "${file_path}")
get_source_file_property(exclude_from_docs "${file_path}" _qt_syncqt_exclude_from_docs)
if(exclude_from_docs)
list(APPEND ${out_var}_exclude_from_docs "${file_path}")
endif()
if(qpa_filter AND file_name MATCHES "${qpa_filter}")
list(APPEND ${out_var}_qpa "${file_path}")
elseif(rhi_filter AND file_name MATCHES "${rhi_filter}")
@ -1553,6 +1691,7 @@ function(qt_internal_collect_module_headers out_var target)
endforeach()
set(${out_var}_all "${${out_var}_all}" PARENT_SCOPE)
set(${out_var}_generated "${${out_var}_generated}" PARENT_SCOPE)
set(${out_var}_exclude_from_docs "${${out_var}_exclude_from_docs}" PARENT_SCOPE)
if(has_header_types_properties)
set_target_properties(${target} PROPERTIES ${has_header_types_properties})

View File

@ -2,15 +2,10 @@
# SPDX-License-Identifier: BSD-3-Clause
# Find "ModuleTools" dependencies, which are other ModuleTools packages.
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
set(__qt_@target@_tool_deps "@package_deps@")
foreach(__qt_@target@_target_dep ${__qt_@target@_tool_deps})
list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg)
list(GET __qt_@target@_target_dep 1 __qt_@target@_version)
if (NOT ${__qt_@target@_pkg}_FOUND)
find_dependency(${__qt_@target@_pkg} ${__qt_@target@_version})
endif()
endforeach()
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND TRUE)
set(__qt_@target@_tool_third_party_deps "@third_party_deps@")
_qt_internal_find_third_party_dependencies("@target@" __qt_@target@_tool_third_party_deps)
set(__qt_@target@_tool_deps "@package_deps@")
_qt_internal_find_tool_dependencies("@target@" __qt_@target@_tool_deps)

View File

@ -22,8 +22,7 @@ endmacro()
# Create a Qt6*.pc file intended for pkg-config consumption.
function(qt_internal_generate_pkg_config_file module)
# TODO: PkgConfig is supported under MSVC with pkgconf (github.com/pkgconf/pkgconf)
if((NOT UNIX OR QT_FEATURE_framework)
AND NOT MINGW OR CMAKE_VERSION VERSION_LESS "3.20" OR ANDROID)
if(NOT UNIX AND NOT MINGW OR CMAKE_VERSION VERSION_LESS "3.20" OR ANDROID)
return()
endif()
if(NOT BUILD_SHARED_LIBS)
@ -34,7 +33,6 @@ function(qt_internal_generate_pkg_config_file module)
set(pkgconfig_name "${QT_CMAKE_EXPORT_NAMESPACE} ${module}")
set(pkgconfig_description "Qt ${module} module")
set(target "${QT_CMAKE_EXPORT_NAMESPACE}::${module}")
set(is_interface_library "$<STREQUAL:$<TARGET_PROPERTY:${target},TYPE>,INTERFACE_LIBRARY>")
# The flags macro expanded this variables so it's better to set them at
# their corresponding PkgConfig string.
set(includedir "\${includedir}")
@ -50,6 +48,12 @@ function(qt_internal_generate_pkg_config_file module)
get_target_property(loose_include_dirs ${target} INTERFACE_INCLUDE_DIRECTORIES)
list(TRANSFORM loose_include_dirs REPLACE "${INSTALL_INCLUDEDIR}" "\${includedir}")
list(TRANSFORM loose_include_dirs REPLACE "${INSTALL_MKSPECSDIR}" "\${mkspecsdir}")
if(QT_FEATURE_framework)
# Update the include path for framework headers which are located in INSTALL_LIBDIR,
# e.g. this results in -I${libdir}/Qt*.framework/Headers for Qt6*.pc file.
set(libdir "\${libdir}")
list(TRANSFORM loose_include_dirs REPLACE "${INSTALL_LIBDIR}" "\${libdir}")
endif()
# Remove genex wrapping around gc_sections flag because we can't evaluate genexes like
# $<CXX_COMPILER_ID> in file(GENERATE). And given that .pc files don't support dynamic
@ -69,6 +73,17 @@ function(qt_internal_generate_pkg_config_file module)
set(contains_mkspecs TRUE)
endif()
get_target_property(type ${target} TYPE)
if(NOT type STREQUAL "INTERFACE_LIBRARY")
get_target_property(is_framework ${target} FRAMEWORK)
if(is_framework)
qt_internal_get_framework_info(fw ${target})
string(PREPEND link_options "-F\${libdir} -framework ${fw_name} ")
else()
string(PREPEND link_options "-L\${libdir} -l${pkgconfig_file} ")
endif()
endif()
# TODO: Handle macOS framework builds
qt_internal_collect_direct_target_dependencies(${target} loose_target_requires)
foreach(dep IN LISTS loose_target_requires)

View File

@ -23,37 +23,10 @@ if (NOT IS_DIRECTORY "${ANDROID_SDK_ROOT}")
message(FATAL_ERROR "Could not find ANDROID_SDK_ROOT or path is not a directory: ${ANDROID_SDK_ROOT}")
endif()
function(qt_internal_sort_android_platforms out_var)
if(CMAKE_VERSION GREATER_EQUAL 3.18)
set(platforms ${ARGN})
list(SORT platforms COMPARE NATURAL)
else()
# Simulate natural sorting:
# - prepend every platform with its version as three digits, zero-padded
# - regular sort
# - remove the padded version prefix
set(platforms)
foreach(platform IN LISTS ARGN)
set(version "000")
if(platform MATCHES ".*-([0-9]+)$")
set(version ${CMAKE_MATCH_1})
string(LENGTH "${version}" version_length)
math(EXPR padding_length "3 - ${version_length}")
string(REPEAT "0" ${padding_length} padding)
string(PREPEND version ${padding})
endif()
list(APPEND platforms "${version}~${platform}")
endforeach()
list(SORT platforms)
list(TRANSFORM platforms REPLACE "^.*~" "")
endif()
set("${out_var}" "${platforms}" PARENT_SCOPE)
endfunction()
# This variable specifies the API level used for building Java code, it can be the same as Qt for
# Android's maximum supported Android version or higher.
if(NOT QT_ANDROID_API_USED_FOR_JAVA)
set(QT_ANDROID_API_USED_FOR_JAVA "android-34")
set(QT_ANDROID_API_USED_FOR_JAVA "android-35")
endif()
set(jar_location "${ANDROID_SDK_ROOT}/platforms/${QT_ANDROID_API_USED_FOR_JAVA}/android.jar")
@ -166,7 +139,7 @@ function(qt_internal_android_test_runner_arguments target out_test_runner out_te
set(${out_test_runner} "${QT_HOST_PATH}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}/androidtestrunner" PARENT_SCOPE)
set(deployment_tool "${QT_HOST_PATH}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}/androiddeployqt")
qt_internal_android_get_target_android_build_dir(${target} android_build_dir)
_qt_internal_android_get_target_android_build_dir(android_build_dir ${target})
set(${out_test_arguments}
"--path" "${android_build_dir}"
"--adb" "${ANDROID_SDK_ROOT}/platform-tools/adb"

View File

@ -29,8 +29,12 @@ if (NOT QT_NO_CREATE_TARGETS)
# Find required dependencies, if any.
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependencies.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependencies.cmake")
else()
set(@target@_FOUND TRUE)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@AdditionalTargetInfo.cmake")
if(@target@_FOUND)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@AdditionalTargetInfo.cmake")
endif()
endif()

View File

@ -1,11 +1,12 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
set(@target@_FOUND FALSE)
set(@target@_FOUND TRUE)
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
set(__qt_@target@_third_party_deps "@third_party_deps@")
_qt_internal_find_third_party_dependencies("@target@" __qt_@target@_third_party_deps)
unset(__qt_@target@_third_party_deps)
set(__qt_use_no_default_path_for_qt_packages "NO_DEFAULT_PATH")
if(QT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES)
@ -17,5 +18,9 @@ set(__qt_@target@_target_deps "@target_deps@")
set(__qt_@target@_find_dependency_paths "@find_dependency_paths@")
_qt_internal_find_qt_dependencies("@target@" __qt_@target@_target_deps
__qt_@target@_find_dependency_paths)
unset(__qt_@target@_target_deps)
unset(__qt_@target@_find_dependency_paths)
set(@target@_FOUND TRUE)
if(__qt_${target}_missing_deps)
set(@target@_FOUND FALSE)
endif()

View File

@ -208,10 +208,7 @@ function(qt_internal_add_plugin target)
set(plugin_install_package_suffix "${qt_module}")
get_target_property(aliased_target ${qt_module_target} ALIASED_TARGET)
if(aliased_target)
set(qt_module_target ${aliased_target})
endif()
_qt_internal_dealias_target(qt_module_target)
get_target_property(is_imported_qt_module ${qt_module_target} IMPORTED)
if(NOT is_imported_qt_module)
@ -229,8 +226,6 @@ function(qt_internal_add_plugin target)
__qt_internal_add_interface_plugin_target(${qt_module_target} ${target})
endif()
set(plugin_target_versioned "${QT_CMAKE_EXPORT_NAMESPACE}::${target}")
get_target_property(type "${plugin_target_versioned}" TYPE)
qt_internal_add_autogen_sync_header_dependencies(${target} ${qt_module_target})
endif()
@ -322,7 +317,7 @@ function(qt_internal_add_plugin target)
qt_internal_add_repo_local_defines("${target}")
if(NOT DEFINED arg_EXCEPTIONS)
if(NOT arg_EXCEPTIONS)
qt_internal_set_exceptions_flags("${target}" "DEFAULT")
else()
qt_internal_set_exceptions_flags("${target}" "${arg_EXCEPTIONS}")
@ -337,7 +332,15 @@ function(qt_internal_add_plugin target)
endif()
endforeach()
qt_register_target_dependencies("${target}" "${arg_PUBLIC_LIBRARIES}" "${qt_libs_private}")
set(qt_register_target_dependencies_args "")
if(arg_PUBLIC_LIBRARIES)
list(APPEND qt_register_target_dependencies_args PUBLIC ${arg_PUBLIC_LIBRARIES})
endif()
if(qt_libs_private)
list(APPEND qt_register_target_dependencies_args PRIVATE ${qt_libs_private})
endif()
qt_internal_register_target_dependencies("${target}"
${qt_register_target_dependencies_args})
if(target_type STREQUAL STATIC_LIBRARY)
if(qt_module_target)
@ -373,8 +376,8 @@ function(qt_internal_add_plugin target)
# when building standalone tests.
if(QT_INTERNAL_CONFIGURING_TESTS OR arg_TEST_PLUGIN)
if(NOT arg_TEST_PLUGIN)
message(WARNING "The installable test plugin ${target} is built as part of test"
" suite, but is not marked as TEST_PLUGIN using the repsective argument."
message(WARNING "The installable test plugin ${target} is built as part of a test"
" suite, but is not marked as TEST_PLUGIN using the respective argument."
"\nThis warning will soon become an error."
)
endif()
@ -470,7 +473,7 @@ endif()"
${__qt_internal_sbom_multi_args}
)
_qt_internal_extend_sbom(${target} ${sbom_args})
qt_internal_extend_qt_entity_sbom(${target} ${sbom_args})
endif()
qt_add_list_file_finalizer(qt_finalize_plugin ${target} ${finalizer_extra_args})

View File

@ -29,7 +29,7 @@ macro(qt_collect_third_party_deps target)
endif()
unset(_target_is_static)
foreach(dep ${${depends_var}} ${optional_public_depends} ${extra_third_party_deps})
foreach(dep ${${depends_var}} ${extra_third_party_deps})
# Gather third party packages that should be found when using the Qt module.
# Also handle nolink target dependencies.
string(REGEX REPLACE "_nolink$" "" base_dep "${dep}")
@ -48,9 +48,6 @@ macro(qt_collect_third_party_deps target)
if(dep_seen EQUAL -1 AND package_name)
list(APPEND third_party_deps_seen ${dep})
get_target_property(package_is_optional ${dep} INTERFACE_QT_PACKAGE_IS_OPTIONAL)
if(NOT package_is_optional AND dep IN_LIST optional_public_depends)
set(package_is_optional TRUE)
endif()
get_target_property(package_version ${dep} INTERFACE_QT_PACKAGE_VERSION)
if(NOT package_version)
set(package_version "")
@ -143,6 +140,13 @@ function(qt_internal_remove_qt_dependency_duplicates out_deps deps)
endfunction()
function(qt_internal_create_module_depends_file target)
set(no_value_options "")
set(single_value_options "")
set(multi_value_options "")
cmake_parse_arguments(PARSE_ARGV 1 arg
"${no_value_options}" "${single_value_options}" "${multi_value_options}"
)
get_target_property(target_type "${target}" TYPE)
set(is_interface_lib FALSE)
if(target_type STREQUAL "INTERFACE_LIBRARY")
@ -156,11 +160,6 @@ function(qt_internal_create_module_depends_file target)
get_target_property(public_depends "${target}" INTERFACE_LINK_LIBRARIES)
unset(optional_public_depends)
if(TARGET "${target}Private")
get_target_property(optional_public_depends "${target}Private" INTERFACE_LINK_LIBRARIES)
endif()
# Used for collecting Qt module dependencies that should be find_package()'d in
# ModuleDependencies.cmake.
get_target_property(target_deps "${target}" _qt_target_deps)
@ -168,8 +167,11 @@ function(qt_internal_create_module_depends_file target)
set(qt_module_dependencies "")
if(NOT is_interface_lib)
# TODO: deprecated code path. QT_EXTRA_PACKAGE_DEPENDENCIES shouldn't be used for the Qt
# packages.
get_target_property(extra_depends "${target}" QT_EXTRA_PACKAGE_DEPENDENCIES)
endif()
if(NOT extra_depends MATCHES "-NOTFOUND$")
list(APPEND target_deps "${extra_depends}")
endif()
@ -337,7 +339,6 @@ function(qt_internal_create_plugin_depends_file target)
get_target_property(depends "${target}" LINK_LIBRARIES)
get_target_property(public_depends "${target}" INTERFACE_LINK_LIBRARIES)
get_target_property(target_deps "${target}" _qt_target_deps)
unset(optional_public_depends)
set(target_deps_seen "")
@ -398,7 +399,6 @@ function(qt_internal_create_qt6_dependencies_file)
set(actual_target Platform)
get_target_property(public_depends "${actual_target}" INTERFACE_LINK_LIBRARIES)
unset(depends)
unset(optional_public_depends)
set(third_party_deps "")
set(third_party_deps_seen "")
@ -432,7 +432,7 @@ endif()")
# to the target CMAKE_INSTALL_DIR, if at all possible to do so in a reliable way.
get_filename_component(qt_host_path_absolute "${QT_HOST_PATH}" ABSOLUTE)
get_filename_component(qt_host_path_cmake_dir_absolute
"${Qt${PROJECT_VERSION_MAJOR}HostInfo_DIR}/.." ABSOLUTE)
"${${INSTALL_CMAKE_NAMESPACE}HostInfo_DIR}/.." ABSOLUTE)
endif()
if(third_party_deps OR platform_requires_host_info_package)
@ -467,6 +467,9 @@ function(qt_internal_create_depends_files)
foreach (target ${repo_known_modules})
qt_internal_create_module_depends_file(${target})
if(TARGET "${target}Private")
qt_internal_create_module_depends_file(${target}Private)
endif()
endforeach()
foreach (target ${QT_KNOWN_PLUGINS})
@ -494,67 +497,8 @@ function(qt_internal_create_plugins_auto_inclusion_files)
if(QT_MODULE STREQUAL "Qml")
set(QT_MODULE_PLUGIN_INCLUDES "${QT_MODULE_PLUGIN_INCLUDES}
# Qml plugin targets might have dependencies on other qml plugin targets, but the Targets.cmake
# files are included in the order that file(GLOB) returns, which means certain targets that are
# referenced might not have been created yet, and \${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
# might be set to a message saying those targets don't exist.
#
# Postpone checking of which targets don't exist until all Qml PluginConfig.cmake files have been
# included, by including all the files one more time and checking for errors at each step.
#
# TODO: Find a better way to deal with this, perhaps by using find_package() instead of include
# for the Qml PluginConfig.cmake files.
# Distributions should probably change this default.
if(NOT DEFINED QT_SKIP_AUTO_QML_PLUGIN_INCLUSION)
set(QT_SKIP_AUTO_QML_PLUGIN_INCLUSION OFF)
endif()
set(__qt_qml_plugins_config_file_list \"\")
set(__qt_qml_plugins_glob_prefixes \"\${CMAKE_CURRENT_LIST_DIR}\")
# Allow passing additional prefixes where we will glob for PluginConfig.cmake files.
if(QT_ADDITIONAL_QML_PLUGIN_GLOB_PREFIXES)
foreach(__qt_qml_plugin_glob_prefix IN LISTS QT_ADDITIONAL_QML_PLUGIN_GLOB_PREFIXES)
if(__qt_qml_plugin_glob_prefix)
list(APPEND __qt_qml_plugins_glob_prefixes \"\${__qt_qml_plugin_glob_prefix}\")
endif()
endforeach()
endif()
list(REMOVE_DUPLICATES __qt_qml_plugins_glob_prefixes)
foreach(__qt_qml_plugin_glob_prefix IN LISTS __qt_qml_plugins_glob_prefixes)
file(GLOB __qt_qml_plugins_glob_config_file_list
\"\${__qt_qml_plugin_glob_prefix}/QmlPlugins/${INSTALL_CMAKE_NAMESPACE}*Config.cmake\")
if(__qt_qml_plugins_glob_config_file_list)
list(APPEND __qt_qml_plugins_config_file_list \${__qt_qml_plugins_glob_config_file_list})
endif()
endforeach()
if (__qt_qml_plugins_config_file_list AND NOT QT_SKIP_AUTO_QML_PLUGIN_INCLUSION)
# First round of inclusions ensure all qml plugin targets are brought into scope.
foreach(__qt_qml_plugin_config_file \${__qt_qml_plugins_config_file_list})
include(\${__qt_qml_plugin_config_file})
# Temporarily unset any failure markers and mark the Qml package as found.
unset(\${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND TRUE)
endforeach()
# For the second round of inclusions, check and bail out early if there are errors.
foreach(__qt_qml_plugin_config_file \${__qt_qml_plugins_config_file_list})
include(\${__qt_qml_plugin_config_file})
if(\${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
string(APPEND \${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
\"\nThe message was set in \${__qt_qml_plugin_config_file} \")
set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
return()
endif()
endforeach()
endif()")
__qt_internal_include_qml_plugin_packages()
")
endif()
get_target_property(module_plugin_types "${QT_MODULE}" MODULE_PLUGIN_TYPES)
@ -584,6 +528,11 @@ function(qt_generate_install_prefixes out_var)
INSTALL_PLUGINSDIR INSTALL_LIBEXECDIR INSTALL_QMLDIR INSTALL_DATADIR INSTALL_DOCDIR
INSTALL_TRANSLATIONSDIR INSTALL_SYSCONFDIR INSTALL_EXAMPLESDIR INSTALL_TESTSDIR
INSTALL_DESCRIPTIONSDIR INSTALL_SBOMDIR)
# INSTALL_PUBLICBINDIR is processed only if it is not empty
# See usage in qt_internal_generate_user_facing_tools_info
if(NOT "${INSTALL_PUBLICBINDIR}" STREQUAL "")
list(APPEND vars INSTALL_PUBLICBINDIR)
endif()
foreach(var ${vars})
get_property(docstring CACHE "${var}" PROPERTY HELPSTRING)
@ -617,7 +566,15 @@ function(qt_create_hostinfo_package)
INSTALL_DESTINATION "${install_destination}"
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
qt_install(FILES "${config_file_path}" DESTINATION "${install_destination}")
set(version_file "${QT_CONFIG_BUILD_DIR}/${package}/${package}ConfigVersion.cmake")
write_basic_package_version_file(
"${version_file}"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
ARCH_INDEPENDENT
)
qt_install(FILES "${config_file_path}" "${version_file}" DESTINATION "${install_destination}")
endfunction()
function(qt_generate_build_internals_extra_cmake_code)
@ -921,6 +878,7 @@ function(qt_internal_generate_user_facing_tools_info)
if("${INSTALL_PUBLICBINDIR}" STREQUAL "")
return()
endif()
qt_path_join(tool_link_base_dir "${CMAKE_INSTALL_PREFIX}" "${INSTALL_PUBLICBINDIR}")
get_property(user_facing_tool_targets GLOBAL PROPERTY QT_USER_FACING_TOOL_TARGETS)
set(lines "")
foreach(target ${user_facing_tool_targets})
@ -937,6 +895,7 @@ function(qt_internal_generate_user_facing_tools_info)
endif()
qt_path_join(tool_target_path "${CMAKE_INSTALL_PREFIX}" "${INSTALL_BINDIR}" "${filename}")
qt_path_join(tool_link_path "${INSTALL_PUBLICBINDIR}" "${linkname}${PROJECT_VERSION_MAJOR}")
_qt_internal_relative_path(tool_target_path BASE_DIRECTORY ${tool_link_base_dir})
list(APPEND lines "${tool_target_path} ${tool_link_path}")
endforeach()
string(REPLACE ";" "\n" content "${lines}")

View File

@ -3,7 +3,7 @@
function(qt_update_precompiled_header target precompiled_header)
if (precompiled_header AND BUILD_WITH_PCH)
set_property(TARGET "${target}" APPEND PROPERTY "PRECOMPILE_HEADERS" "$<$<OR:$<COMPILE_LANGUAGE:CXX>,$<COMPILE_LANGUAGE:OBJCXX>>:${precompiled_header}>")
set_property(TARGET "${target}" APPEND PROPERTY "PRECOMPILE_HEADERS" "$<$<COMPILE_LANGUAGE:CXX,OBJCXX>:${precompiled_header}>")
endif()
endfunction()

View File

@ -871,29 +871,27 @@ function(guess_compiler_from_mkspec)
check_whether_to_guess_compiler(guess_c_compiler CC CMAKE_C_COMPILER)
check_whether_to_guess_compiler(guess_cxx_compiler CXX CMAKE_CXX_COMPILER)
if(NOT guess_c_compiler AND NOT guess_cxx_compiler)
return()
endif()
string(REGEX MATCH "(^|;)-DQT_QMAKE_TARGET_MKSPEC=\([^;]+\)" m "${cmake_args}")
set(mkspec ${CMAKE_MATCH_2})
set(c_compiler "")
set(cxx_compiler "")
if(mkspec MATCHES "-clang-msvc$")
set(c_compiler "clang-cl")
set(cxx_compiler "clang-cl")
elseif(mkspec MATCHES "-clang(-|$)" AND NOT mkspec MATCHES "android")
set(c_compiler "clang")
set(cxx_compiler "clang++")
elseif(mkspec MATCHES "-msvc(-|$)")
set(c_compiler "cl")
set(cxx_compiler "cl")
endif()
if(guess_c_compiler AND NOT c_compiler STREQUAL "")
push("-DCMAKE_C_COMPILER=${c_compiler}")
endif()
if(guess_cxx_compiler AND NOT cxx_compiler STREQUAL "")
push("-DCMAKE_CXX_COMPILER=${cxx_compiler}")
if(guess_c_compiler OR guess_cxx_compiler)
set(c_compiler "")
set(cxx_compiler "")
if(mkspec MATCHES "-clang-msvc$")
set(c_compiler "clang-cl")
set(cxx_compiler "clang-cl")
elseif(mkspec MATCHES "-clang(-|$)" AND NOT mkspec MATCHES "android")
set(c_compiler "clang")
set(cxx_compiler "clang++")
elseif(mkspec MATCHES "-msvc(-|$)")
set(c_compiler "cl")
set(cxx_compiler "cl")
endif()
if(guess_c_compiler AND NOT c_compiler STREQUAL "")
push("-DCMAKE_C_COMPILER=${c_compiler}")
endif()
if(guess_cxx_compiler AND NOT cxx_compiler STREQUAL "")
push("-DCMAKE_CXX_COMPILER=${cxx_compiler}")
endif()
endif()
if(mkspec MATCHES "-libc\\+\\+$")
push("-DFEATURE_stdlib_libcpp=ON")

View File

@ -10,7 +10,7 @@ function(_qt_internal_detect_latest_android_platform out_var)
# If list is not empty
if(android_platforms)
qt_internal_sort_android_platforms(android_platforms ${android_platforms})
_qt_internal_sort_android_platforms(android_platforms ${android_platforms})
list(REVERSE android_platforms)
list(GET android_platforms 0 android_platform_latest)
set(${out_var} "${android_platform_latest}" PARENT_SCOPE)
@ -18,3 +18,30 @@ function(_qt_internal_detect_latest_android_platform out_var)
set(${out_var} "${out_var}-NOTFOUND" PARENT_SCOPE)
endif()
endfunction()
function(_qt_internal_sort_android_platforms out_var)
if(CMAKE_VERSION GREATER_EQUAL 3.18)
set(platforms ${ARGN})
list(SORT platforms COMPARE NATURAL)
else()
# Simulate natural sorting:
# - prepend every platform with its version as three digits, zero-padded
# - regular sort
# - remove the padded version prefix
set(platforms)
foreach(platform IN LISTS ARGN)
set(version "000")
if(platform MATCHES ".*-([0-9]+)$")
set(version ${CMAKE_MATCH_1})
string(LENGTH "${version}" version_length)
math(EXPR padding_length "3 - ${version_length}")
string(REPEAT "0" ${padding_length} padding)
string(PREPEND version ${padding})
endif()
list(APPEND platforms "${version}~${platform}")
endforeach()
list(SORT platforms)
list(TRANSFORM platforms REPLACE "^.*~" "")
endif()
set("${out_var}" "${platforms}" PARENT_SCOPE)
endfunction()

View File

@ -97,9 +97,9 @@ function(_qt_internal_handle_ios_launch_screen target)
endif()
endfunction()
function(_qt_internal_find_ios_development_team_id out_var)
function(_qt_internal_find_apple_development_team_id out_var)
get_property(team_id GLOBAL PROPERTY _qt_internal_ios_development_team_id)
get_property(team_id_computed GLOBAL PROPERTY _qt_internal_ios_development_team_id_computed)
get_property(team_id_computed GLOBAL PROPERTY _qt_internal_apple_development_team_id_computed)
if(team_id_computed)
# Just in case if the value is non-empty but still booly FALSE.
if(NOT team_id)
@ -109,17 +109,31 @@ function(_qt_internal_find_ios_development_team_id out_var)
return()
endif()
set_property(GLOBAL PROPERTY _qt_internal_ios_development_team_id_computed "TRUE")
set_property(GLOBAL PROPERTY _qt_internal_apple_development_team_id_computed "TRUE")
set(home_dir "$ENV{HOME}")
set(xcode_preferences_path "${home_dir}/Library/Preferences/com.apple.dt.Xcode.plist")
# Extract the first account name (email) from the user's Xcode preferences
message(DEBUG "Trying to extract an Xcode development team id from '${xcode_preferences_path}'")
execute_process(COMMAND "/usr/libexec/PlistBuddy"
-x -c "print IDEProvisioningTeams" "${xcode_preferences_path}"
OUTPUT_VARIABLE teams_xml
ERROR_VARIABLE plist_error)
# Try Xcode 16.2 format first
_qt_internal_plist_buddy("${xcode_preferences_path}"
COMMANDS "print IDEProvisioningTeamByIdentifier"
EXTRA_ARGS -x
OUTPUT_VARIABLE teams_xml
ERROR_VARIABLE plist_error
)
# Then fall back to older format
if(plist_error OR NOT teams_xml)
_qt_internal_plist_buddy("${xcode_preferences_path}"
COMMANDS "print IDEProvisioningTeams"
EXTRA_ARGS -x
OUTPUT_VARIABLE teams_xml
ERROR_VARIABLE plist_error
)
endif()
# Parsing state.
set(is_free "")
@ -152,6 +166,16 @@ function(_qt_internal_find_ios_development_team_id out_var)
# ...
# </dict>
# </array>
# <key>AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE</key>
# <array>
# <dict>
# <key>isFreeProvisioningTeam</key>
# <false/>
# <key>teamID</key>
# <string>CCC</string>
# ...
# </dict>
# </array>
#</dict>
#</plist>
if(teams_xml AND NOT plist_error)
@ -270,7 +294,7 @@ function(_qt_internal_get_default_apple_bundle_identifier target out_var)
# For a better out-of-the-box experience, try to create a unique prefix by appending
# the sha1 of the team id, if one is found.
_qt_internal_find_ios_development_team_id(team_id)
_qt_internal_find_apple_development_team_id(team_id)
if(team_id)
string(SHA1 hash "${team_id}")
string(SUBSTRING "${hash}" 0 8 infix)
@ -378,7 +402,7 @@ function(_qt_internal_set_xcode_development_team_id target)
if(NOT CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM AND NOT QT_NO_SET_XCODE_DEVELOPMENT_TEAM_ID)
get_target_property(existing_team_id "${target}" XCODE_ATTRIBUTE_DEVELOPMENT_TEAM)
if(NOT existing_team_id)
_qt_internal_find_ios_development_team_id(team_id)
_qt_internal_find_apple_development_team_id(team_id)
set_target_properties("${target}"
PROPERTIES XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "${team_id}")
endif()
@ -635,10 +659,10 @@ endfunction()
function(_qt_internal_plist_buddy plist_file)
cmake_parse_arguments(PARSE_ARGV 1 arg
"" "OUTPUT_VARIABLE;ERROR_VARIABLE" "COMMANDS")
"" "OUTPUT_VARIABLE;ERROR_VARIABLE;EXTRA_ARGS" "COMMANDS")
foreach(command ${arg_COMMANDS})
execute_process(COMMAND "/usr/libexec/PlistBuddy"
-c "${command}" "${plist_file}"
${arg_EXTRA_ARGS} -c "${command}" "${plist_file}"
OUTPUT_VARIABLE plist_buddy_output
ERROR_VARIABLE plist_buddy_error)
string(STRIP "${plist_buddy_output}" plist_buddy_output)
@ -730,6 +754,25 @@ function(_qt_internal_set_ios_simulator_arch target)
"x86_64")
endfunction()
function(_qt_internal_set_xcode_entrypoint_attribute target entrypoint)
if(CMAKE_XCODE_ATTRIBUTE_LD_ENTRY_POINT
OR QT_NO_SET_XCODE_LD_ENTRY_POINT)
return()
endif()
get_target_property(existing_entrypoint
"${target}" XCODE_ATTRIBUTE_LD_ENTRY_POINT)
if(NOT existing_entrypoint MATCHES "-NOTFOUND")
return()
endif()
set_target_properties("${target}"
PROPERTIES
"XCODE_ATTRIBUTE_LD_ENTRY_POINT"
"${entrypoint}")
endfunction()
# Export Apple platform sdk and xcode version requirements to Qt6ConfigExtras.cmake.
# Always exported, even on non-Apple platforms, so that we can use them when building
# documentation.
@ -768,7 +811,8 @@ endif()")
set(${out_var} "${assignments}" PARENT_SCOPE)
endfunction()
function(_qt_internal_get_apple_sdk_version out_var)
function(_qt_internal_get_apple_sdk_name out_var)
set(sdk_name "")
if(APPLE)
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
set(sdk_name "iphoneos")
@ -778,28 +822,99 @@ function(_qt_internal_get_apple_sdk_version out_var)
# Default to macOS
set(sdk_name "macosx")
endif()
set(xcrun_version_arg "--show-sdk-version")
execute_process(COMMAND /usr/bin/xcrun --sdk ${sdk_name} ${xcrun_version_arg}
OUTPUT_VARIABLE sdk_version
ERROR_VARIABLE xcrun_error)
endif()
set(${out_var} "${sdk_name}" PARENT_SCOPE)
endfunction()
function(_qt_internal_execute_xcrun out_var)
set(opt_args "")
set(single_args "")
set(multi_args
XCRUN_ARGS
OUT_ERROR_VAR
)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
set(output "")
set(xcrun_error "")
if(NOT APPLE)
message(FATAL_ERROR
"Executing xcrun should only happen happen when targeting Apple plaforms")
endif()
find_program(QT_XCRUN xcrun)
if(NOT QT_XCRUN)
message(FATAL_ERROR "Can't find xcrun in PATH")
endif()
execute_process(COMMAND "${QT_XCRUN}" ${arg_XCRUN_ARGS}
OUTPUT_VARIABLE output
ERROR_VARIABLE xcrun_error)
if(arg_OUT_ERROR_VAR)
set(${arg_OUT_ERROR_VAR} "${xcrun_error}" PARENT_SCOPE)
endif()
set(${out_var} "${output}" PARENT_SCOPE)
endfunction()
function(_qt_internal_get_apple_sdk_path out_var)
set(sdk_path "")
if(APPLE)
_qt_internal_get_apple_sdk_name(sdk_name)
_qt_internal_execute_xcrun(sdk_path
XCRUN_ARGS --sdk ${sdk_name} --show-sdk-path
OUT_ERROR_VAR xcrun_error
)
if(NOT sdk_path)
message(FATAL_ERROR
"Can't determine darwin ${sdk_name} SDK path. Error: ${xcrun_error}")
endif()
string(STRIP "${sdk_path}" sdk_path)
endif()
set(${out_var} "${sdk_path}" PARENT_SCOPE)
endfunction()
function(_qt_internal_get_apple_sdk_version out_var)
set(sdk_version "")
if(APPLE)
_qt_internal_get_apple_sdk_name(sdk_name)
_qt_internal_execute_xcrun(sdk_version
XCRUN_ARGS --sdk ${sdk_name} --show-sdk-version
OUT_ERROR_VAR xcrun_error
)
if(NOT sdk_version)
message(FATAL_ERROR
"Can't determine darwin ${sdk_name} SDK version. Error: ${xcrun_error}")
endif()
string(STRIP "${sdk_version}" sdk_version)
set(${out_var} "${sdk_version}" PARENT_SCOPE)
endif()
set(${out_var} "${sdk_version}" PARENT_SCOPE)
endfunction()
function(_qt_internal_get_xcode_version_raw out_var)
set(xcode_version "")
if(APPLE)
execute_process(COMMAND /usr/bin/xcrun xcodebuild -version
OUTPUT_VARIABLE xcode_version
ERROR_VARIABLE xcrun_error)
_qt_internal_execute_xcrun(xcode_version
XCRUN_ARGS xcodebuild -version
OUT_ERROR_VAR xcrun_error
)
string(REPLACE "\n" " " xcode_version "${xcode_version}")
string(STRIP "${xcode_version}" xcode_version)
set(${out_var} "${xcode_version}" PARENT_SCOPE)
if(NOT xcode_version)
message(FATAL_ERROR
"Can't determine Xcode version. Is Xcode installed?"
" Error details:\n${xcrun_error}")
endif()
endif()
set(${out_var} "${xcode_version}" PARENT_SCOPE)
endfunction()
function(_qt_internal_get_xcode_version out_var)
@ -844,9 +959,9 @@ function(_qt_internal_get_cached_xcode_version out_var)
set(${out_var} "${xcode_version}" PARENT_SCOPE)
endfunction()
# Warn when the platform SDK or Xcode version are not supported.
# Warn or error out when the platform SDK or Xcode version are not supported.
#
# The warnings are currently only shown when building Qt, not when building user projects
# The messages are currently only shown when building Qt, not when building user projects
# with CMake.
# The warnings ARE shown for qmake user projects.
#
@ -891,11 +1006,14 @@ function(_qt_internal_check_apple_sdk_and_xcode_versions)
endif()
# The default differs in different branches.
set(failed_check_should_error FALSE)
set(failed_check_should_error TRUE)
if(failed_check_should_error)
# Allow downgrading the error into a warning.
if(QT_FORCE_WARN_APPLE_SDK_AND_XCODE_CHECK)
#
# Our cmake build tests might be executed on older not officially supported Xcode or SDK
# versions in the CI. Downgrade the error in this case as well.
if(QT_FORCE_WARN_APPLE_SDK_AND_XCODE_CHECK OR QT_INTERNAL_IS_CMAKE_BUILD_TEST)
set(message_type WARNING)
set(extra_message " Due to QT_FORCE_WARN_APPLE_SDK_AND_XCODE_CHECK being ON "
"the build will continue, but it will likely fail. Use at your own risk.")
@ -995,6 +1113,8 @@ function(_qt_internal_finalize_ios_app target)
_qt_internal_set_xcode_targeted_device_family("${target}")
_qt_internal_set_xcode_bitcode_enablement("${target}")
_qt_internal_set_ios_simulator_arch("${target}")
_qt_internal_set_xcode_entrypoint_attribute("${target}" "_qt_main_wrapper")
endfunction()
function(_qt_internal_finalize_macos_app target)

View File

@ -536,8 +536,14 @@ endfunction()
# Takes a list of path components and joins them into one path separated by forward slashes "/",
# and saves the path in out_var.
# Filters out any path parts that are bare "."s.
function(_qt_internal_path_join out_var)
string(JOIN "/" path ${ARGN})
set(args ${ARGN})
# Remove any bare ".", to avoid any CMP0177 warnings for paths passed to install().
list(REMOVE_ITEM args ".")
string(JOIN "/" path ${args})
set(${out_var} ${path} PARENT_SCOPE)
endfunction()
@ -597,6 +603,45 @@ function(_qt_internal_remove_args out_var)
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(__qt_internal_handle_find_all_qt_module_packages out_var)
set(opt_args "")
set(single_args "")
set(multi_args
COMPONENTS
)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_COMPONENTS)
return()
endif()
set(components ${arg_COMPONENTS})
if("ALL_QT_MODULES" IN_LIST components)
list(FIND components "ALL_QT_MODULES" all_qt_modules_index)
list(REMOVE_AT components ${all_qt_modules_index})
# Find the path to dir with module.json files. # We consider each file name to be a
# Qt package (component) name that contains a target with the same name.
set(json_modules_path "${QT6_INSTALL_PREFIX}/${QT6_INSTALL_DESCRIPTIONSDIR}")
file(GLOB json_modules "${json_modules_path}/*.json")
set(all_qt_modules "")
foreach(json_module IN LISTS json_modules)
get_filename_component(module_name "${json_module}" NAME_WE)
list(APPEND all_qt_modules ${module_name})
endforeach()
if(all_qt_modules)
list(INSERT components "${all_qt_modules_index}" ${all_qt_modules})
endif()
endif()
set(${out_var} "${components}" PARENT_SCOPE)
endfunction()
# Append ${ARGN} to ${target}'s ${property_name} property, removing duplicates.
function(_qt_internal_append_to_target_property_without_duplicates target property_name)
get_target_property(property "${target}" "${property_name}")
@ -690,6 +735,7 @@ function(_qt_internal_add_transitive_property target type property)
message(FATAL_ERROR "Attempt to assign unknown TRANSITIVE_${type}_PROPERTIES property")
endif()
_qt_internal_dealias_target(target)
get_target_property(transitive_properties ${target}
TRANSITIVE_${type}_PROPERTIES)
if(NOT "${property}" IN_LIST transitive_properties)
@ -697,3 +743,129 @@ function(_qt_internal_add_transitive_property target type property)
APPEND PROPERTY TRANSITIVE_${type}_PROPERTIES ${property})
endif()
endfunction()
# Compatibility of `cmake_path(RELATIVE_PATH)`
#
# In order to be compatible with `file(RELATIVE_PATH)`, path normalization of the result is
# always performed, with the trailing slash stripped.
#
# Synopsis
#
# _qt_internal_relative_path(<path-var>
# [BASE_DIRECTORY <input>]
# [OUTPUT_VARIABLE <out-var>]
# )
#
# Arguments
#
# `path-var`
# Equivalent to `cmake_path(RELATIVE_PATH <path-var>)`.
#
# `BASE_DIRECTORY`
# Equivalent to `cmake_path(RELATIVE_PATH BASE_DIRECTORY)`.
#
# `OUTPUT_VARIABLE`
# Equivalent to `cmake_path(RELATIVE_PATH OUTPUT_VARIABLE)`.
function(_qt_internal_relative_path path_var)
set(option_args "")
set(single_args
BASE_DIRECTORY
OUTPUT_VARIABLE
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 1 arg "${option_args}" "${single_args}" "${multi_args}")
if(NOT arg_BASE_DIRECTORY)
set(arg_BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()
if(NOT arg_OUTPUT_VARIABLE)
set(arg_OUTPUT_VARIABLE ${path_var})
endif()
if(CMAKE_VERSION VERSION_LESS 3.20)
file(RELATIVE_PATH ${arg_OUTPUT_VARIABLE}
"${arg_BASE_DIRECTORY}"
"${${path_var}}")
else()
cmake_path(RELATIVE_PATH ${path_var}
BASE_DIRECTORY "${arg_BASE_DIRECTORY}"
OUTPUT_VARIABLE ${arg_OUTPUT_VARIABLE}
)
cmake_path(NORMAL_PATH ${arg_OUTPUT_VARIABLE})
string(REGEX REPLACE "/$" "" ${arg_OUTPUT_VARIABLE}
"${${arg_OUTPUT_VARIABLE}}")
endif()
set(${arg_OUTPUT_VARIABLE} "${${arg_OUTPUT_VARIABLE}}" PARENT_SCOPE)
endfunction()
# Configures the file using either the input template or the CONTENT.
# Behaves as either file(CONFIGURE or configure_file( command, but do not depend
# on CMake version.
#
# Synopsis
# _qt_internal_configure_file(<CONFIGURE|GENERATE>
# OUTPUT <path>
# <INPUT path|CONTENT data>
# )
#
# Arguments
# `CONFIGURE` Run in pure CONFIGURE mode.
#
# `GENERATE` Configure CONTENT and generate file with the generator expression
# support.
#
# `OUTPUT` The output file name to generate.
#
# `INPUT` The input template file name.
#
# `CONTENT` The template content. If both INPUT and CONTENT are specified, INPUT
# argument is ignored.
function(_qt_internal_configure_file mode)
cmake_parse_arguments(PARSE_ARGV 1 arg "" "OUTPUT;INPUT;CONTENT" "")
if(NOT arg_OUTPUT)
message(FATAL_ERROR "No OUTPUT file provided to _qt_internal_configure_file.")
endif()
# Substitute the '@' wrapped variables and generate the file with the
# the generator expressions evaluation inside the resulting CONTENT.
if(mode STREQUAL "GENERATE")
if(arg_INPUT)
configure_file("${arg_INPUT}" "${arg_OUTPUT}.tmp" @ONLY)
file(GENERATE OUTPUT "${arg_OUTPUT}" INPUT "${arg_OUTPUT}.tmp")
else()
string(CONFIGURE "${arg_CONTENT}" arg_CONTENT @ONLY)
file(GENERATE OUTPUT "${arg_OUTPUT}" CONTENT "${arg_CONTENT}")
endif()
return()
endif()
# We use this check for the cases when the specified CONTENT is empty. The value of arg_CONTENT
# is undefined, but we still want to create a file with empty content.
if("CONTENT" IN_LIST ARGV)
if(arg_INPUT)
message(WARNING "Both CONTENT and INPUT are specified. CONTENT will be used to generate"
" output")
endif()
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
file(CONFIGURE OUTPUT "${arg_OUTPUT}" CONTENT "${arg_CONTENT}" @ONLY)
return()
endif()
set(template_name "QtFileConfigure.txt.in")
# When building qtbase, use the source template file.
# Otherwise use the installed file (basically wherever Qt6 package is found).
# This should work for non-prefix and superbuilds as well.
if(QtBase_SOURCE_DIR)
set(input_file "${QtBase_SOURCE_DIR}/cmake/${template_name}")
else()
set(input_file "${_qt_6_config_cmake_dir}/${template_name}")
endif()
set(__qt_file_configure_content "${arg_CONTENT}")
elseif(arg_INPUT)
set(input_file "${arg_INPUT}")
else()
message(FATAL_ERROR "No input value provided to _qt_internal_configure_file.")
endif()
configure_file("${input_file}" "${arg_OUTPUT}" @ONLY)
endfunction()

View File

@ -55,9 +55,8 @@ function(__qt_internal_force_allow_unsuitable_cmake_version_for_using_qt out_var
# Temporarily allow any version when using Qt in Qt's CI, so we can decouple the provisioning
# of the minimum CMake version from the bump of the minimum CMake version.
# The COIN_UNIQUE_JOB_ID env var is set in Qt's CI for both build and test work items.
# Current state is that this check is enabled.
# TODO: Disable it once provisioning is merged.
set(allow_any_version_in_ci TRUE)
# Current state is that this check is disabled.
set(allow_any_version_in_ci FALSE)
if(allow_any_version_in_ci AND DEFINED ENV{COIN_UNIQUE_JOB_ID})
set(allow_any_version TRUE)

View File

@ -34,6 +34,9 @@ macro(_qt_internal_find_third_party_dependencies target target_dep_list)
find_package(${__qt_${target}_find_package_args})
else()
find_dependency(${__qt_${target}_find_package_args})
if(NOT ${__qt_${target}_pkg}_FOUND)
list(APPEND __qt_${target}_missing_deps "${__qt_${target}_pkg}")
endif()
endif()
_qt_internal_get_package_components_id(
@ -83,15 +86,15 @@ macro(_qt_internal_find_tool_dependencies target target_dep_list)
"${_qt_additional_host_packages_root_paths}")
endif()
unset(__qt_${target}_find_package_args)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND __qt_${target}_find_package_args QUIET)
endif()
foreach(__qt_${target}_target_dep IN LISTS ${target_dep_list})
list(GET __qt_${target}_target_dep 0 __qt_${target}_pkg)
list(GET __qt_${target}_target_dep 1 __qt_${target}_version)
unset(__qt_${target}_find_package_args)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND __qt_${target}_find_package_args QUIET)
endif()
_qt_internal_save_find_package_context_for_debugging(${target})
find_package(${__qt_${target}_pkg}
@ -129,39 +132,22 @@ macro(_qt_internal_find_qt_dependencies target target_dep_list find_dependency_p
list(GET __qt_${target}_target_dep 1 __qt_${target}_version)
if (NOT ${__qt_${target}_pkg}_FOUND)
# TODO: Remove Private handling once sufficient time has passed, aka all developers
# updated their builds not to contain stale FooDependencies.cmake files without the
# _qt_package_name property.
set(__qt_${target}_pkg_names ${__qt_${target}_pkg})
if(__qt_${target}_pkg MATCHES "(.*)Private$")
set(__qt_${target}_pkg_names "${CMAKE_MATCH_1};${__qt_${target}_pkg}")
endif()
_qt_internal_save_find_package_context_for_debugging(${target})
find_dependency(${__qt_${target}_pkg} ${__qt_${target}_version}
NAMES
${__qt_${target}_pkg_names}
PATHS
${QT_BUILD_CMAKE_PREFIX_PATH}
${${find_dependency_path_list}}
${_qt_additional_packages_prefix_paths}
${__qt_use_no_default_path_for_qt_packages}
)
if(NOT ${__qt_${target}_pkg}_FOUND)
list(APPEND __qt_${target}_missing_deps "${__qt_${target}_pkg}")
endif()
endif()
endforeach()
endmacro()
# TODO: Remove once a dependency update completes and most developers have the Dependencies.cmake
# files updated in their builds.
# The name is too generic, it doesn't look for any kind of dependencies but only Qt package
# dependencies.
macro(_qt_internal_find_dependencies target_dep_list find_dependency_path_list)
_qt_internal_find_qt_dependencies("none" "${target_dep_list}" "${find_dependency_path_list}")
endmacro()
# If a dependency package was not found, provide some hints in the error message on how to debug
# the issue.
#
@ -243,9 +229,9 @@ function(_qt_internal_determine_if_host_info_package_needed out_var)
set(${out_var} "${needed}" PARENT_SCOPE)
endfunction()
macro(_qt_internal_find_host_info_package platform_requires_host_info)
macro(_qt_internal_find_host_info_package platform_requires_host_info install_namespace)
if(${platform_requires_host_info})
find_package(Qt6HostInfo
find_package(${install_namespace}HostInfo
CONFIG
REQUIRED
PATHS "${QT_HOST_PATH}"

View File

@ -49,6 +49,16 @@ function(_qt_internal_query_git_version)
set(git_version "${version_git_head}+${version_git_branch}")
endif()
if(QT_SBOM_FAKE_GIT_VERSION)
set(version_git_head "fakegithead")
set(version_git_hash "fakegithash")
set(version_git_branch "fakegitbranch")
set(version_git_tag "fakegittag")
set(git_version "${version_git_head}+${version_git_branch}")
_qt_internal_set_git_query_variables()
return()
endif()
if(NOT Git_FOUND)
message(STATUS "Git not found, skipping querying git version.")
_qt_internal_set_git_query_variables()

View File

@ -248,10 +248,7 @@ function(__qt_internal_add_static_plugin_init_object_library
CONTENT "${import_content}"
)
# CMake versions earlier than 3.18.0 can't find the generated file for some reason,
# failing at generation phase.
# Explicitly marking the file as GENERATED fixes the issue.
set_source_files_properties("${generated_qt_plugin_file_name}" PROPERTIES GENERATED TRUE)
_qt_internal_set_source_file_generated(SOURCES "${generated_qt_plugin_file_name}")
__qt_internal_get_static_plugin_init_target_name("${plugin_target}" plugin_init_target)
@ -518,6 +515,20 @@ function(__qt_internal_add_interface_plugin_target plugin_module_target plugin_t
APPEND PROPERTY INTERFACE_QT_PLUGIN_TARGETS ${plugin_target_name_wrapped})
endfunction()
# TODO: Figure out how to do this more reliably, instead of parsing the file name to get
# the target name.
function(__qt_internal_get_target_name_from_plugin_config_file_name
config_file_path
package_prefix_regex
out_var)
string(REGEX REPLACE
"^.*/${QT_CMAKE_EXPORT_NAMESPACE}(${package_prefix_regex})Config.cmake$"
"\\1"
target "${config_file_path}")
set(${out_var} "${target}" PARENT_SCOPE)
endfunction()
# Include CMake plugin packages that belong to the Qt module ${target} and initialize automatic
# linkage of the plugins in static builds.
# The variables inside the macro have to be named unique to the module because an included Plugin
@ -529,10 +540,7 @@ macro(__qt_internal_include_plugin_packages target)
# Properties can't be set on aliased targets, so make sure to unalias the target. This is needed
# when Qt examples are built as part of the Qt build itself.
get_target_property(_aliased_target ${__qt_${target}_plugin_module_target} ALIASED_TARGET)
if(_aliased_target)
set(__qt_${target}_plugin_module_target ${_aliased_target})
endif()
_qt_internal_dealias_target(__qt_${target}_plugin_module_target)
# Ensure that QT_PLUGIN_TARGETS is a known transitive compile property. Works with CMake
# versions >= 3.30.
@ -546,11 +554,14 @@ macro(__qt_internal_include_plugin_packages target)
file(GLOB __qt_${target}_plugin_config_files
"${CMAKE_CURRENT_LIST_DIR}/${QT_CMAKE_EXPORT_NAMESPACE}*PluginConfig.cmake")
foreach(__qt_${target}_plugin_config_file ${__qt_${target}_plugin_config_files})
string(REGEX REPLACE
"^.*/${QT_CMAKE_EXPORT_NAMESPACE}(.*Plugin)Config.cmake$"
"\\1"
__qt_${target}_qt_plugin "${__qt_${target}_plugin_config_file}")
include("${__qt_${target}_plugin_config_file}")
__qt_internal_get_target_name_from_plugin_config_file_name(
"${__qt_${target}_plugin_config_file}"
"(.*Plugin)"
__qt_${target}_qt_plugin
)
if(TARGET "${QT_CMAKE_EXPORT_NAMESPACE}::${__qt_${target}_qt_plugin}")
list(APPEND __qt_${target}_plugins ${__qt_${target}_qt_plugin})
__qt_internal_add_interface_plugin_target(${__qt_${target}_plugin_module_target}
@ -581,10 +592,34 @@ macro(__qt_internal_include_plugin_packages target)
continue()
endif()
list(APPEND "QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type}" "${plugin_target}")
set(plugin_target_versioned "${QT_CMAKE_EXPORT_NAMESPACE}::${plugin_target}")
if(NOT "${plugin_target}"
IN_LIST QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE)
# Old compatibility name.
# TODO: Remove once all usages are ported.
list(APPEND QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE "${plugin_target}")
# New name consistent with other such variables.
list(APPEND QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE "${plugin_target}")
list(APPEND QT_ALL_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE
"${plugin_target_versioned}")
endif()
if(NOT "${plugin_target}" IN_LIST QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE_${__plugin_type})
# Old compatibility name.
# TODO: Remove once all usages are ported.
list(APPEND QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_${__plugin_type} "${plugin_target}")
# New name consistent with other such variables.
list(APPEND QT_ALL_PLUGINS_FOUND_VIA_FIND_PACKAGE_${__plugin_type} "${plugin_target}")
list(APPEND
QT_ALL_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE_${__plugin_type}
"${plugin_target_versioned}")
endif()
# Auto-linkage should be set up only for static plugins.
set(plugin_target_versioned "${QT_CMAKE_EXPORT_NAMESPACE}::${plugin_target}")
get_target_property(type "${plugin_target_versioned}" TYPE)
if(type STREQUAL STATIC_LIBRARY)
__qt_internal_add_static_plugin_linkage(
@ -597,3 +632,87 @@ macro(__qt_internal_include_plugin_packages target)
set_target_properties(
${__qt_${target}_plugin_module_target} PROPERTIES __qt_internal_plugins_added TRUE)
endmacro()
# Include Qt Qml plugin CMake packages that are present under the Qml package directory.
# TODO: Consider moving this to qtdeclarative somehow.
macro(__qt_internal_include_qml_plugin_packages)
# Qml plugin targets might have dependencies on other qml plugin targets, but the Targets.cmake
# files are included in the order that file(GLOB) returns, which means certain targets that are
# referenced might not have been created yet, and ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
# might be set to a message saying those targets don't exist.
#
# Postpone checking of which targets don't exist until all Qml PluginConfig.cmake files have
# been included, by including all the files one more time and checking for errors at each step.
#
# TODO: Find a better way to deal with this, perhaps by using find_package() instead of include
# for the Qml PluginConfig.cmake files.
# Distributions should probably change this default.
if(NOT DEFINED QT_SKIP_AUTO_QML_PLUGIN_INCLUSION)
set(QT_SKIP_AUTO_QML_PLUGIN_INCLUSION OFF)
endif()
set(__qt_qml_plugins_config_file_list "")
set(__qt_qml_plugins_glob_prefixes "${CMAKE_CURRENT_LIST_DIR}")
# Allow passing additional prefixes where we will glob for PluginConfig.cmake files.
if(QT_ADDITIONAL_QML_PLUGIN_GLOB_PREFIXES)
foreach(__qt_qml_plugin_glob_prefix IN LISTS QT_ADDITIONAL_QML_PLUGIN_GLOB_PREFIXES)
if(__qt_qml_plugin_glob_prefix)
list(APPEND __qt_qml_plugins_glob_prefixes "${__qt_qml_plugin_glob_prefix}")
endif()
endforeach()
endif()
list(REMOVE_DUPLICATES __qt_qml_plugins_glob_prefixes)
foreach(__qt_qml_plugin_glob_prefix IN LISTS __qt_qml_plugins_glob_prefixes)
file(GLOB __qt_qml_plugins_glob_config_file_list
"${__qt_qml_plugin_glob_prefix}/QmlPlugins/${INSTALL_CMAKE_NAMESPACE}*Config.cmake")
if(__qt_qml_plugins_glob_config_file_list)
list(APPEND __qt_qml_plugins_config_file_list ${__qt_qml_plugins_glob_config_file_list})
endif()
endforeach()
if (__qt_qml_plugins_config_file_list AND NOT QT_SKIP_AUTO_QML_PLUGIN_INCLUSION)
# First round of inclusions ensure all qml plugin targets are brought into scope.
foreach(__qt_qml_plugin_config_file ${__qt_qml_plugins_config_file_list})
include(${__qt_qml_plugin_config_file})
# Temporarily unset any failure markers and mark the Qml package as found.
unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND TRUE)
endforeach()
# For the second round of inclusions, check and bail out early if there are errors.
foreach(__qt_qml_plugin_config_file ${__qt_qml_plugins_config_file_list})
include(${__qt_qml_plugin_config_file})
__qt_internal_get_target_name_from_plugin_config_file_name(
"${__qt_qml_plugin_config_file}"
"(.*)"
__qt_qml_plugin_target
)
set(__qt_qml_plugin_target_versioned
"${QT_CMAKE_EXPORT_NAMESPACE}::${__qt_qml_plugin_target}")
if(TARGET "${__qt_qml_plugin_target_versioned}"
AND NOT "${__qt_qml_plugin_target}"
IN_LIST QT_ALL_QML_PLUGINS_FOUND_VIA_FIND_PACKAGE)
list(APPEND QT_ALL_QML_PLUGINS_FOUND_VIA_FIND_PACKAGE "${__qt_qml_plugin_target}")
list(APPEND QT_ALL_QML_PLUGINS_VERSIONED_FOUND_VIA_FIND_PACKAGE
"${__qt_qml_plugin_target_versioned}")
endif()
unset(__qt_qml_plugin_target)
unset(__qt_qml_plugin_target_versioned)
if(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
string(APPEND ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"\nThe message was set in ${__qt_qml_plugin_config_file} ")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
return()
endif()
endforeach()
endif()
endmacro()

View File

@ -0,0 +1,599 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Handles attribution information for a target.
#
# If CREATE_SBOM_FOR_EACH_ATTRIBUTION is set, a separate sbom target is created for each parsed
# attribution entry, and the new targets are added as dependencies to the parent target.
#
# If CREATE_SBOM_FOR_EACH_ATTRIBUTION is not set, the information read from the first attribution
# entry is added directly to the parent target, aka the the values are propagated to the outer
# function scope to be read.. The rest of the attribution entries are created as separate targets
# and added as dependencies, as if the option was passed.
#
# Handles multiple attribution files and entries within a file.
# Attribution files can be specified either via directories and direct file paths.
# If ATTRIBUTION_ENTRY_INDEX is set, only that specific attribution entry will be processed
# from the given attribution file.
function(_qt_internal_sbom_handle_qt_attribution_files out_prefix_outer)
if(NOT QT_GENERATE_SBOM)
return()
endif()
if(CMAKE_VERSION LESS_EQUAL "3.19")
message(DEBUG "CMake version is too low, can't parse attribution.json file.")
return()
endif()
set(opt_args "")
set(single_args "")
set(multi_args "")
_qt_internal_get_sbom_specific_options(sbom_opt_args sbom_single_args sbom_multi_args)
list(APPEND opt_args ${sbom_opt_args})
list(APPEND single_args ${sbom_single_args})
list(APPEND multi_args ${sbom_multi_args})
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(attribution_files "")
set(attribution_file_count 0)
foreach(attribution_file_path IN LISTS arg_ATTRIBUTION_FILE_PATHS)
get_filename_component(real_path "${attribution_file_path}" REALPATH)
list(APPEND attribution_files "${real_path}")
math(EXPR attribution_file_count "${attribution_file_count} + 1")
endforeach()
foreach(attribution_file_dir_path IN LISTS arg_ATTRIBUTION_FILE_DIR_PATHS)
get_filename_component(real_path
"${attribution_file_dir_path}/qt_attribution.json" REALPATH)
list(APPEND attribution_files "${real_path}")
math(EXPR attribution_file_count "${attribution_file_count} + 1")
endforeach()
# If CREATE_SBOM_FOR_EACH_ATTRIBUTION is set, that means the parent target is likely not a
# 3rd party library, so each attribution entry should create a separate attribution target.
# In which case we don't want to proagate options like CPE to the child attribution targets,
# because the CPE is meant for the parent target.
set(propagate_sbom_options_to_new_attribution_targets TRUE)
if(arg___QT_INTERNAL_HANDLE_QT_ENTITY_ATTRIBUTION_FILES)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
if(is_qt_entity_type)
set(arg_CREATE_SBOM_FOR_EACH_ATTRIBUTION TRUE)
endif()
endif()
if(arg_CREATE_SBOM_FOR_EACH_ATTRIBUTION)
set(propagate_sbom_options_to_new_attribution_targets FALSE)
if(NOT arg_ATTRIBUTION_PARENT_TARGET)
message(FATAL_ERROR "ATTRIBUTION_PARENT_TARGET must be set")
endif()
endif()
if(arg_ATTRIBUTION_ENTRY_INDEX AND attribution_file_count GREATER 1)
message(FATAL_ERROR
"ATTRIBUTION_ENTRY_INDEX should only be set if a single attribution "
"file is specified."
)
endif()
set(ids_to_add "")
set(ids_found "")
if(arg_ATTRIBUTION_IDS)
set(ids_to_add ${arg_ATTRIBUTION_IDS})
endif()
set(file_index 0)
set(first_attribution_processed FALSE)
foreach(attribution_file_path IN LISTS attribution_files)
# Collect all processed attribution files to later create a configure-time dependency on
# them so that the SBOM is regenerated (and CMake is re-ran) if they are modified.
set_property(GLOBAL APPEND PROPERTY _qt_internal_project_attribution_files
"${attribution_file_path}")
# Set a unique out_prefix that will not overlap when multiple entries are processed.
set(out_prefix_file "${out_prefix_outer}_${file_index}")
# Get the number of entries in the attribution file.
_qt_internal_sbom_read_qt_attribution(${out_prefix_file}
GET_ATTRIBUTION_ENTRY_COUNT
OUT_VAR_VALUE attribution_entry_count
FILE_PATH "${attribution_file_path}"
)
# If a specific entry was specified, we will only process it from the file.
if(NOT "${arg_ATTRIBUTION_ENTRY_INDEX}" STREQUAL "")
set(entry_index ${arg_ATTRIBUTION_ENTRY_INDEX})
else()
set(entry_index 0)
endif()
# Go through each entry in the attribution file.
while("${entry_index}" LESS "${${out_prefix_file}_attribution_entry_count}")
# If this is the first entry to be processed, or if CREATE_SBOM_FOR_EACH_ATTRIBUTION
# is not set, we read the attribution file entry directly, and propagate the values
# to the parent scope.
if(NOT first_attribution_processed AND NOT arg_CREATE_SBOM_FOR_EACH_ATTRIBUTION)
# Set a prefix without indices, so that the parent scope add_sbom call can
# refer to the values directly with the outer prefix, without any index infix.
set(out_prefix "${out_prefix_outer}")
_qt_internal_sbom_read_qt_attribution(${out_prefix}
GET_DEFAULT_KEYS
ENTRY_INDEX "${entry_index}"
OUT_VAR_ASSIGNED_VARIABLE_NAMES variable_names
FILE_PATH "${attribution_file_path}"
)
# Check if we need to filter for specific ids.
if(ids_to_add AND ${out_prefix}_attribution_id)
if("${${out_prefix}_attribution_id}" IN_LIST ids_to_add)
list(APPEND ids_found "${${out_prefix}_attribution_id}")
else()
# Skip to next entry.
math(EXPR entry_index "${entry_index} + 1")
continue()
endif()
endif()
# Propagate the values to the outer scope.
foreach(variable_name IN LISTS variable_names)
set(${out_prefix}_${variable_name} "${${out_prefix}_${variable_name}}"
PARENT_SCOPE)
endforeach()
get_filename_component(relative_attribution_file_path
"${attribution_file_path}" REALPATH)
set(${out_prefix}_chosen_attribution_file_path "${relative_attribution_file_path}"
PARENT_SCOPE)
set(${out_prefix}_chosen_attribution_entry_index "${entry_index}"
PARENT_SCOPE)
set(first_attribution_processed TRUE)
if(NOT "${arg_ATTRIBUTION_ENTRY_INDEX}" STREQUAL "")
# We had a specific index to process, so break right after processing it.
break()
endif()
else()
# We are processing the second or later entry, or CREATE_SBOM_FOR_EACH_ATTRIBUTION
# was set. Instead of directly reading all the keys from the attribution file,
# we get the Id, and create a new sbom target for the entry.
# That will recursively call this function with a specific attribution file path
# and index, to process the specific entry.
set(out_prefix "${out_prefix_outer}_${file_index}_${entry_index}")
# Get the attribution id.
_qt_internal_sbom_read_qt_attribution(${out_prefix}
GET_KEY
KEY Id
OUT_VAR_VALUE attribution_id
ENTRY_INDEX "${entry_index}"
FILE_PATH "${attribution_file_path}"
)
# Check if we need to filter for specific ids
if(ids_to_add AND ${out_prefix}_attribution_id)
if("${${out_prefix}_attribution_id}" IN_LIST ids_to_add)
list(APPEND ids_found "${${out_prefix}_attribution_id}")
else()
# Skip to next entry.
math(EXPR entry_index "${entry_index} + 1")
continue()
endif()
endif()
# If no Id was retrieved, just add a numeric one, to make the sbom target
# unique.
set(attribution_target "${arg_ATTRIBUTION_PARENT_TARGET}_Attribution_")
if(NOT ${out_prefix}_attribution_id)
string(APPEND attribution_target "${file_index}_${entry_index}")
else()
string(APPEND attribution_target "${${out_prefix}_attribution_id}")
endif()
# Sanitize the target name, to avoid issues with slashes and other unsupported chars
# in target names.
string(REGEX REPLACE "[^a-zA-Z0-9_-]" "_"
attribution_target "${attribution_target}")
set(sbom_args "")
# Always propagate the package supplier, because we assume the supplier for 3rd
# party libs is the same as the current project supplier.
# Also propagate the internal qt entity type values like CPE, supplier, PURL
# handling options, attribution file values, if set.
_qt_internal_forward_function_args(
FORWARD_APPEND
FORWARD_PREFIX arg
FORWARD_OUT_VAR sbom_args
FORWARD_OPTIONS
USE_ATTRIBUTION_FILES
__QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_CPE
__QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_SUPPLIER
__QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_PURL
__QT_INTERNAL_HANDLE_QT_ENTITY_ATTRIBUTION_FILES
FORWARD_SINGLE
SUPPLIER
)
if(propagate_sbom_options_to_new_attribution_targets)
# Filter out the attributtion options, they will be passed mnaually
# depending on which file and index is currently being processed.
_qt_internal_get_sbom_specific_options(
sbom_opt_args sbom_single_args sbom_multi_args)
list(REMOVE_ITEM sbom_opt_args
NO_CURRENT_DIR_ATTRIBUTION
CREATE_SBOM_FOR_EACH_ATTRIBUTION
)
list(REMOVE_ITEM sbom_single_args ATTRIBUTION_ENTRY_INDEX)
list(REMOVE_ITEM sbom_multi_args
ATTRIBUTION_IDS
ATTRIBUTION_FILE_PATHS
ATTRIBUTION_FILE_DIR_PATHS
)
# Also filter out the FRIENDLY_PACKAGE_NAME option, otherwise we'd try to
# file(GENERATE) multiple times with the same file name, but different content.
list(REMOVE_ITEM sbom_single_args FRIENDLY_PACKAGE_NAME)
_qt_internal_forward_function_args(
FORWARD_APPEND
FORWARD_PREFIX arg
FORWARD_OUT_VAR sbom_args
FORWARD_OPTIONS
${sbom_opt_args}
FORWARD_SINGLE
${sbom_single_args}
FORWARD_MULTI
${sbom_multi_args}
)
endif()
# Create another sbom target with the id as a hint for the target name,
# the attribution file passed, and make the new target a dependency of the
# parent one.
if(arg___QT_INTERNAL_HANDLE_QT_ENTITY_ATTRIBUTION_FILES)
set(attribution_entity_type QT_THIRD_PARTY_SOURCES)
else()
set(attribution_entity_type THIRD_PARTY_SOURCES)
endif()
_qt_internal_add_sbom("${attribution_target}"
IMMEDIATE_FINALIZATION
TYPE "${attribution_entity_type}"
ATTRIBUTION_FILE_PATHS "${attribution_file_path}"
ATTRIBUTION_ENTRY_INDEX "${entry_index}"
NO_CURRENT_DIR_ATTRIBUTION
${sbom_args}
)
_qt_internal_extend_sbom_dependencies(${arg_ATTRIBUTION_PARENT_TARGET}
SBOM_DEPENDENCIES ${attribution_target}
)
endif()
math(EXPR entry_index "${entry_index} + 1")
endwhile()
math(EXPR file_index "${file_index} + 1")
endforeach()
# Show an error if an id is unaccounted for, it might be it has moved to a different file, that
# is not referenced.
if(ids_to_add)
set(attribution_ids_diff ${ids_to_add})
list(REMOVE_ITEM attribution_ids_diff ${ids_found})
if(attribution_ids_diff)
set(error_message
"The following required attribution ids were not found in the attribution files")
if(arg_ATTRIBUTION_PARENT_TARGET)
string(APPEND error_message " for target: ${arg_ATTRIBUTION_PARENT_TARGET}")
endif()
string(APPEND error_message " ids: ${attribution_ids_diff}")
message(FATAL_ERROR "${error_message}")
endif()
endif()
endfunction()
# Helper to parse a qt_attribution.json file and do various operations:
# - GET_DEFAULT_KEYS extracts the license id, copyrights, version, etc.
# - GET_KEY extracts a single given json key's value, as specified with KEY and saved into
# OUT_VAR_VALUE
# - GET_ATTRIBUTION_ENTRY_COUNT returns the number of entries in the json file, set in
# OUT_VAR_VALUE
#
# ENTRY_INDEX can be used to specify the array index to select a specific entry in the json file.
#
# Any retrieved value is set in the outer scope.
# The variables are prefixed with ${out_prefix}.
# OUT_VAR_ASSIGNED_VARIABLE_NAMES contains the list of variables set in the parent scope, the
# variables names in this list are not prefixed with ${out_prefix}.
#
# Requires cmake 3.19 for json parsing.
function(_qt_internal_sbom_read_qt_attribution out_prefix)
if(NOT QT_GENERATE_SBOM)
return()
endif()
if(CMAKE_VERSION LESS_EQUAL "3.19")
message(DEBUG "CMake version is too low, can't parse attribution.json file.")
return()
endif()
set(opt_args
GET_DEFAULT_KEYS
GET_KEY
GET_ATTRIBUTION_ENTRY_COUNT
)
set(single_args
FILE_PATH
KEY
ENTRY_INDEX
OUT_VAR_VALUE
OUT_VAR_ASSIGNED_VARIABLE_NAMES
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(file_path "${arg_FILE_PATH}")
if(NOT file_path)
message(FATAL_ERROR "qt attribution file path not given")
endif()
file(READ "${file_path}" contents)
if(NOT contents)
message(FATAL_ERROR "qt attribution file is empty: ${file_path}")
endif()
if(NOT arg_GET_DEFAULT_KEYS AND NOT arg_GET_KEY AND NOT arg_GET_ATTRIBUTION_ENTRY_COUNT)
message(FATAL_ERROR
"No valid operation specified to _qt_internal_sbom_read_qt_attribution call.")
endif()
if(arg_GET_KEY)
if(NOT arg_KEY)
message(FATAL_ERROR "KEY must be set")
endif()
if(NOT arg_OUT_VAR_VALUE)
message(FATAL_ERROR "OUT_VAR_VALUE must be set")
endif()
endif()
get_filename_component(attribution_file_dir "${file_path}" DIRECTORY)
# Parse the json file.
# The first element might be an array, or an object. We need to detect which one.
# Do that by trying to query index 0 of the potential root array.
# If the index is found, that means the root is an array, and elem_error is set to NOTFOUND,
# because there was no error.
# Otherwise elem_error will be something like 'member '0' not found', and we can assume the
# root is an object.
string(JSON first_elem_type ERROR_VARIABLE elem_error TYPE "${contents}" 0)
if(elem_error STREQUAL "NOTFOUND")
# Root is an array. The attribution file might contain multiple entries.
# Pick the first one if no specific index was specified, otherwise use the given index.
if(NOT "${arg_ENTRY_INDEX}" STREQUAL "")
set(indices "${arg_ENTRY_INDEX}")
else()
set(indices "0")
endif()
set(is_array TRUE)
else()
# Root is an object, not an array, which means the file has a single entry.
set(indices "")
set(is_array FALSE)
endif()
set(variable_names "")
if(arg_GET_KEY)
_qt_internal_sbom_get_attribution_key(${arg_KEY} ${arg_OUT_VAR_VALUE} ${out_prefix})
endif()
if(arg_GET_ATTRIBUTION_ENTRY_COUNT)
if(NOT arg_OUT_VAR_VALUE)
message(FATAL_ERROR "OUT_VAR_VALUE must be set")
endif()
if(is_array)
string(JSON attribution_entry_count ERROR_VARIABLE elem_error LENGTH "${contents}")
# There was an error getting the length of the array, so we assume it's empty.
if(NOT elem_error STREQUAL "NOTFOUND")
set(attribution_entry_count 0)
endif()
else()
set(attribution_entry_count 1)
endif()
set(${out_prefix}_${arg_OUT_VAR_VALUE} "${attribution_entry_count}" PARENT_SCOPE)
endif()
if(arg_GET_DEFAULT_KEYS)
_qt_internal_sbom_get_attribution_key(Id attribution_id "${out_prefix}")
_qt_internal_sbom_get_attribution_key(LicenseId license_id "${out_prefix}")
_qt_internal_sbom_get_attribution_key(License license "${out_prefix}")
_qt_internal_sbom_get_attribution_key(LicenseFile license_file "${out_prefix}")
_qt_internal_sbom_get_attribution_key(Version version "${out_prefix}")
_qt_internal_sbom_get_attribution_key(Homepage homepage "${out_prefix}")
_qt_internal_sbom_get_attribution_key(Name attribution_name "${out_prefix}")
_qt_internal_sbom_get_attribution_key(Description description "${out_prefix}")
_qt_internal_sbom_get_attribution_key(QtUsage qt_usage "${out_prefix}")
_qt_internal_sbom_get_attribution_key(DownloadLocation download_location "${out_prefix}")
_qt_internal_sbom_get_attribution_key(Copyright copyrights "${out_prefix}" IS_MULTI_VALUE)
_qt_internal_sbom_get_attribution_key(CopyrightFile copyright_file "${out_prefix}")
_qt_internal_sbom_get_attribution_key(PURL purls "${out_prefix}" IS_MULTI_VALUE)
_qt_internal_sbom_get_attribution_key(CPE cpes "${out_prefix}" IS_MULTI_VALUE)
# Some attribution files contain a copyright file that contains the actual list of
# copyrights. Read it and use it.
set(copyright_file_path "${attribution_file_dir}/${copyright_file}")
get_filename_component(copyright_file_path "${copyright_file_path}" REALPATH)
if(NOT copyrights AND copyright_file AND EXISTS "${copyright_file_path}")
file(READ "${copyright_file_path}" copyright_contents)
if(copyright_contents)
set(copyright_contents "${copyright_contents}")
set(copyrights "${copyright_contents}")
set(${out_prefix}_copyrights "${copyright_contents}" PARENT_SCOPE)
list(APPEND variable_names "copyrights")
endif()
endif()
endif()
if(arg_OUT_VAR_ASSIGNED_VARIABLE_NAMES)
set(${arg_OUT_VAR_ASSIGNED_VARIABLE_NAMES} "${variable_names}" PARENT_SCOPE)
endif()
endfunction()
# Extracts a string or an array of strings from a json index path, depending on the extracted value
# type.
#
# Given the 'contents' of the whole json document and the EXTRACTED_VALUE of a json key specified
# by the INDICES path, it tries to determine whether the value is an array, in which case the array
# is converted to a cmake list and assigned to ${out_var} in the parent scope.
# Otherwise the function assumes the EXTRACTED_VALUE was not an array, and just assigns the value
# of EXTRACTED_VALUE to ${out_var}
function(_qt_internal_sbom_handle_attribution_json_array contents)
set(opt_args "")
set(single_args
EXTRACTED_VALUE
OUT_VAR
)
set(multi_args
INDICES
)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
# Write the original value to the parent scope, in case it was not an array.
set(${arg_OUT_VAR} "${arg_EXTRACTED_VALUE}" PARENT_SCOPE)
if(NOT arg_EXTRACTED_VALUE)
return()
endif()
string(JSON element_type TYPE "${contents}" ${arg_INDICES})
if(NOT element_type STREQUAL "ARRAY")
return()
endif()
set(json_array "${arg_EXTRACTED_VALUE}")
string(JSON array_len LENGTH "${json_array}")
set(value_list "")
math(EXPR array_len "${array_len} - 1")
foreach(index RANGE 0 "${array_len}")
string(JSON value GET "${json_array}" ${index})
if(value)
list(APPEND value_list "${value}")
endif()
endforeach()
if(value_list)
set(${arg_OUT_VAR} "${value_list}" PARENT_SCOPE)
endif()
endfunction()
# Escapes various characters in json content, so that the generate cmake code to append the content
# to the spdx document is syntactically valid.
function(_qt_internal_sbom_escape_json_content content out_var)
# Escape backslashes
string(REPLACE "\\" "\\\\" escaped_content "${content}")
# Escape quotes
string(REPLACE "\"" "\\\"" escaped_content "${escaped_content}")
set(${out_var} "${escaped_content}" PARENT_SCOPE)
endfunction()
# This macro reads a json key from a qt_attribution.json file, and assigns the escaped value to
# out_var.
# Also appends the name of the out_var to the parent scope 'variable_names' var.
#
# Expects 'contents' and 'indices' to already be set in the calling scope.
#
# If IS_MULTI_VALUE is set, handles the key as if it contained an array of
# values, by converting the array of json values to a cmake list.
macro(_qt_internal_sbom_get_attribution_key json_key out_var out_prefix)
cmake_parse_arguments(arg "IS_MULTI_VALUE" "" "" ${ARGN})
# Reset any leftover value that might have been set in a previous iteration.
set(${out_prefix}_${out_var} "" PARENT_SCOPE)
string(JSON "${out_var}" ERROR_VARIABLE get_error GET "${contents}" ${indices} "${json_key}")
if(NOT "${${out_var}}" STREQUAL "" AND NOT get_error)
set(extracted_value "${${out_var}}")
if(arg_IS_MULTI_VALUE)
_qt_internal_sbom_handle_attribution_json_array("${contents}"
EXTRACTED_VALUE "${extracted_value}"
INDICES ${indices} ${json_key}
OUT_VAR value_list
)
if(value_list)
set(extracted_value "${value_list}")
endif()
endif()
_qt_internal_sbom_escape_json_content("${extracted_value}" escaped_content)
set(${out_prefix}_${out_var} "${escaped_content}" PARENT_SCOPE)
list(APPEND variable_names "${out_var}")
unset(extracted_value)
unset(escaped_content)
unset(value_list)
endif()
endmacro()
# Replaces placeholders in CPE and PURL strings read from qt_attribution.json files.
#
# VALUES - list of CPE or PURL strings
# OUT_VAR - variable to store the replaced values
# VERSION - version to replace in the placeholders
# Known placeholders:
# $<VERSION> - Replaces occurrences of the placeholder with the value passed to the VERSION option.
# $<VERSION_DASHED> - Replaces occurrences of the placeholder with the value passed to the VERSION
# option, but with dots replaced by dashes.
function(_qt_internal_sbom_replace_qa_placeholders)
set(opt_args "")
set(single_args
OUT_VAR
VERSION
)
set(multi_args
VALUES
)
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)
message(FATAL_ERROR "OUT_VAR must be set")
endif()
set(result "")
if(arg_VERSION)
string(REPLACE "." "-" dashed_version "${arg_VERSION}")
endif()
foreach(value IN LISTS arg_VALUES)
if(arg_VERSION)
string(REPLACE "$<VERSION>" "${arg_VERSION}" value "${value}")
string(REPLACE "$<VERSION_DASHED>" "${dashed_version}" value "${value}")
endif()
list(APPEND result "${value}")
endforeach()
set(${arg_OUT_VAR} "${result}" PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,90 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Computes a security CPE for a given set of attributes.
#
# When a part is not specified, a wildcard is added.
#
# References:
# https://spdx.github.io/spdx-spec/v2.3/external-repository-identifiers/#f22-cpe23type
# https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nistir7695.pdf
# https://nvd.nist.gov/products/cpe
#
# Each attribute means:
# 1. part
# 2. vendor
# 3. product
# 4. version
# 5. update
# 6. edition
# 7. language
# 8. sw_edition
# 9. target_sw
# 10. target_hw
# 11. other
function(_qt_internal_sbom_compute_security_cpe out_cpe)
set(opt_args "")
set(single_args
PART
VENDOR
PRODUCT
VERSION
UPDATE
EDITION
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(cpe_template "cpe:2.3:PART:VENDOR:PRODUCT:VERSION:UPDATE:EDITION:*:*:*:*:*")
set(cpe "${cpe_template}")
foreach(attribute_name IN LISTS single_args)
if(arg_${attribute_name})
set(${attribute_name}_value "${arg_${attribute_name}}")
else()
if(attribute_name STREQUAL "PART")
set(${attribute_name}_value "a")
else()
set(${attribute_name}_value "*")
endif()
endif()
string(REPLACE "${attribute_name}" "${${attribute_name}_value}" cpe "${cpe}")
endforeach()
set(${out_cpe} "${cpe}" PARENT_SCOPE)
endfunction()
# Computes the default security CPE for the Qt framework.
function(_qt_internal_sbom_get_cpe_qt out_var)
_qt_internal_sbom_get_root_project_name_lower_case(repo_project_name_lowercase)
_qt_internal_sbom_compute_security_cpe(repo_cpe
VENDOR "qt"
PRODUCT "${repo_project_name_lowercase}"
VERSION "${QT_REPO_MODULE_VERSION}"
)
set(${out_var} "${repo_cpe}" PARENT_SCOPE)
endfunction()
# Computes the default security CPE for a given qt repository.
function(_qt_internal_sbom_get_cpe_qt_repo out_var)
_qt_internal_sbom_compute_security_cpe(qt_cpe
VENDOR "qt"
PRODUCT "qt"
VERSION "${QT_REPO_MODULE_VERSION}"
)
set(${out_var} "${qt_cpe}" PARENT_SCOPE)
endfunction()
# Computes the list of security CPEs for Qt, including both the repo-specific one and generic one.
function(_qt_internal_sbom_compute_security_cpe_for_qt out_cpe_list)
set(cpe_list "")
_qt_internal_sbom_get_cpe_qt(repo_cpe)
list(APPEND cpe_list "${repo_cpe}")
_qt_internal_sbom_get_cpe_qt_repo(qt_cpe)
list(APPEND cpe_list "${qt_cpe}")
set(${out_cpe_list} "${cpe_list}" PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,265 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Walks a target's direct dependencies and assembles a list of relationships between the packages
# of the target dependencies.
# Currently handles various Qt targets and system libraries.
function(_qt_internal_sbom_handle_target_dependencies target)
set(opt_args "")
set(single_args
SPDX_ID
OUT_RELATIONSHIPS
)
set(multi_args
LIBRARIES
PUBLIC_LIBRARIES
)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_SPDX_ID)
message(FATAL_ERROR "SPDX_ID must be set")
endif()
set(package_spdx_id "${arg_SPDX_ID}")
set(libraries "")
if(arg_LIBRARIES)
list(APPEND libraries "${arg_LIBRARIES}")
endif()
get_target_property(extend_libraries "${target}" _qt_extend_target_libraries)
if(extend_libraries)
list(APPEND libraries ${extend_libraries})
endif()
get_target_property(target_type ${target} TYPE)
set(valid_target_types
EXECUTABLE
SHARED_LIBRARY
MODULE_LIBRARY
STATIC_LIBRARY
OBJECT_LIBRARY
)
if(target_type IN_LIST valid_target_types)
get_target_property(link_libraries "${target}" LINK_LIBRARIES)
if(link_libraries)
list(APPEND libraries ${link_libraries})
endif()
endif()
set(public_libraries "")
if(arg_PUBLIC_LIBRARIES)
list(APPEND public_libraries "${arg_PUBLIC_LIBRARIES}")
endif()
get_target_property(extend_public_libraries "${target}" _qt_extend_target_public_libraries)
if(extend_public_libraries)
list(APPEND public_libraries ${extend_public_libraries})
endif()
set(sbom_dependencies "")
if(arg_SBOM_DEPENDENCIES)
list(APPEND sbom_dependencies "${arg_SBOM_DEPENDENCIES}")
endif()
get_target_property(extend_sbom_dependencies "${target}" _qt_extend_target_sbom_dependencies)
if(extend_sbom_dependencies)
list(APPEND sbom_dependencies ${extend_sbom_dependencies})
endif()
list(REMOVE_DUPLICATES libraries)
list(REMOVE_DUPLICATES public_libraries)
list(REMOVE_DUPLICATES sbom_dependencies)
set(all_direct_libraries ${libraries} ${public_libraries} ${sbom_dependencies})
list(REMOVE_DUPLICATES all_direct_libraries)
set(spdx_dependencies "")
set(external_spdx_dependencies "")
# Go through each direct linked lib.
foreach(direct_lib IN LISTS all_direct_libraries)
if(NOT TARGET "${direct_lib}")
continue()
endif()
# Check for Qt-specific system library targets. These are marked via qt_find_package calls.
get_target_property(is_system_library "${direct_lib}" _qt_internal_sbom_is_system_library)
if(is_system_library)
# We need to check if the dependency is a FindWrap dependency that points either to a
# system library or a vendored / bundled library. We need to depend on whichever one
# the FindWrap script points to.
__qt_internal_walk_libs(
"${direct_lib}"
lib_walked_targets
_discarded_out_var
"sbom_targets"
"collect_targets")
# Detect if we are dealing with a vendored / bundled lib.
set(bundled_targets_found FALSE)
if(lib_walked_targets)
foreach(lib_walked_target IN LISTS lib_walked_targets)
get_target_property(is_3rdparty_bundled_lib
"${lib_walked_target}" _qt_module_is_3rdparty_library)
_qt_internal_sbom_get_spdx_id_for_target("${lib_walked_target}" lib_spdx_id)
# Add a dependency on the vendored lib instead of the Wrap target.
if(is_3rdparty_bundled_lib AND lib_spdx_id)
list(APPEND spdx_dependencies "${lib_spdx_id}")
set(bundled_targets_found TRUE)
endif()
endforeach()
if(bundled_targets_found)
# If we handled a bundled target, we can move on to process the next direct_lib.
continue()
endif()
endif()
if(NOT bundled_targets_found)
# If we haven't found a bundled target, then it's a regular system library
# dependency. Make sure to mark the system library as consumed, so that we later
# generate an sbom for it.
# Also fall through to the code that actually adds the dependency on the target.
_qt_internal_append_to_cmake_property_without_duplicates(
_qt_internal_sbom_consumed_system_library_targets
"${direct_lib}"
)
endif()
endif()
# Get the spdx id of the dependency.
_qt_internal_sbom_get_spdx_id_for_target("${direct_lib}" lib_spdx_id)
if(NOT lib_spdx_id)
message(DEBUG "Could not add target dependency on target ${direct_lib} "
"because no spdx id for it could be found.")
continue()
endif()
# Check if the target sbom is defined in an external document.
_qt_internal_sbom_is_external_target_dependency("${direct_lib}"
OUT_VAR is_dependency_in_external_document
)
if(NOT is_dependency_in_external_document)
# If the target is not in the external document, it must be one built as part of the
# current project.
list(APPEND spdx_dependencies "${lib_spdx_id}")
else()
# Refer to the package in the external document. This can be the case
# in a top-level build, where a system library is reused across repos, or for any
# regular dependency that was built as part of a different project.
_qt_internal_sbom_add_external_target_dependency("${direct_lib}"
extra_spdx_dependencies
)
if(extra_spdx_dependencies)
list(APPEND external_spdx_dependencies ${extra_spdx_dependencies})
endif()
endif()
endforeach()
set(relationships "")
# Keep the external dependencies first, so they are neatly ordered.
foreach(dep_spdx_id IN LISTS external_spdx_dependencies spdx_dependencies)
set(relationship
"${package_spdx_id} DEPENDS_ON ${dep_spdx_id}"
)
list(APPEND relationships "${relationship}")
endforeach()
set(${arg_OUT_RELATIONSHIPS} "${relationships}" PARENT_SCOPE)
endfunction()
# Checks whether the current target will have its sbom generated into the current repo sbom
# document, or whether it is present in an external sbom document.
function(_qt_internal_sbom_is_external_target_dependency target)
set(opt_args
SYSTEM_LIBRARY
)
set(single_args
OUT_VAR
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
get_target_property(is_imported "${target}" IMPORTED)
get_target_property(is_custom_sbom_target "${target}" _qt_sbom_is_custom_sbom_target)
_qt_internal_sbom_get_root_project_name_lower_case(current_repo_project_name)
get_property(target_repo_project_name TARGET ${target}
PROPERTY _qt_sbom_spdx_repo_project_name_lowercase)
if(NOT "${target_repo_project_name}" STREQUAL ""
AND NOT "${target_repo_project_name}" STREQUAL "${current_repo_project_name}")
set(part_of_other_repo TRUE)
else()
set(part_of_other_repo FALSE)
endif()
set(${arg_OUT_VAR} "${part_of_other_repo}" PARENT_SCOPE)
endfunction()
# Handles generating an external document reference SDPX element for each target package that is
# located in a different spdx document.
function(_qt_internal_sbom_add_external_target_dependency target out_spdx_dependencies)
_qt_internal_sbom_get_spdx_id_for_target("${target}" dep_spdx_id)
if(NOT dep_spdx_id)
message(DEBUG "Could not add external target dependency on ${target} "
"because no spdx id could be found")
set(${out_spdx_dependencies} "" PARENT_SCOPE)
return()
endif()
set(spdx_dependencies "")
# Get the external document path and the repo it belongs to for the given target.
get_property(relative_installed_repo_document_path TARGET ${target}
PROPERTY _qt_sbom_spdx_relative_installed_repo_document_path)
get_property(project_name_lowercase TARGET ${target}
PROPERTY _qt_sbom_spdx_repo_project_name_lowercase)
if(relative_installed_repo_document_path AND project_name_lowercase)
_qt_internal_sbom_get_external_document_ref_spdx_id(
"${project_name_lowercase}" external_document_ref)
get_cmake_property(known_external_document
_qt_known_external_documents_${external_document_ref})
set(dependency "${external_document_ref}:${dep_spdx_id}")
list(APPEND spdx_dependencies "${dependency}")
# Only add a reference to the external document package, if we haven't done so already.
if(NOT known_external_document)
set(install_prefixes "")
get_cmake_property(install_prefix _qt_internal_sbom_install_prefix)
list(APPEND install_prefixes "${install_prefix}")
set(external_document "${relative_installed_repo_document_path}")
_qt_internal_sbom_generate_add_external_reference(
EXTERNAL_DOCUMENT_FILE_PATH "${external_document}"
EXTERNAL_DOCUMENT_INSTALL_PREFIXES ${install_prefixes}
EXTERNAL_DOCUMENT_SPDX_ID "${external_document_ref}"
)
set_property(GLOBAL PROPERTY
_qt_known_external_documents_${external_document_ref} TRUE)
set_property(GLOBAL APPEND PROPERTY
_qt_known_external_documents "${external_document_ref}")
endif()
else()
message(AUTHOR_WARNING
"Missing spdx document path for external target dependency: ${target}")
endif()
set(${out_spdx_dependencies} "${spdx_dependencies}" PARENT_SCOPE)
endfunction()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,108 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Adds a license id and its text to the sbom.
function(_qt_internal_sbom_add_license)
if(NOT QT_GENERATE_SBOM)
return()
endif()
set(opt_args
NO_LICENSE_REF_PREFIX
)
set(single_args
LICENSE_ID
LICENSE_PATH
EXTRACTED_TEXT
)
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_LICENSE_ID)
message(FATAL_ERROR "LICENSE_ID must be set")
endif()
if(NOT arg_TEXT AND NOT arg_LICENSE_PATH)
message(FATAL_ERROR "Either TEXT or LICENSE_PATH must be set")
endif()
# Sanitize the content a bit.
if(arg_TEXT)
set(text "${arg_TEXT}")
string(REPLACE ";" "$<SEMICOLON>" text "${text}")
string(REPLACE "\"" "\\\"" text "${text}")
else()
file(READ "${arg_LICENSE_PATH}" text)
string(REPLACE ";" "$<SEMICOLON>" text "${text}")
string(REPLACE "\"" "\\\"" text "${text}")
endif()
set(license_id "${arg_LICENSE_ID}")
if(NOT arg_NO_LICENSE_REF_PREFIX)
set(license_id "LicenseRef-${license_id}")
endif()
_qt_internal_sbom_generate_add_license(
LICENSE_ID "${license_id}"
EXTRACTED_TEXT "<text>${text}</text>"
)
endfunction()
# Get a qt spdx license expression given the id.
function(_qt_internal_sbom_get_spdx_license_expression id out_var)
set(license "")
# The default for modules / plugins
if(id STREQUAL "QT_DEFAULT" OR id STREQUAL "QT_COMMERCIAL_OR_LGPL3")
set(license "LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only")
# For commercial only entities
elseif(id STREQUAL "QT_COMMERCIAL")
set(license "LicenseRef-Qt-Commercial")
# For GPL3 only modules
elseif(id STREQUAL "QT_COMMERCIAL_OR_GPL3")
set(license "LicenseRef-Qt-Commercial OR GPL-3.0-only")
# For tools and apps
elseif(id STREQUAL "QT_COMMERCIAL_OR_GPL3_WITH_EXCEPTION")
set(license "LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0")
# For things like the qtmain library
elseif(id STREQUAL "QT_COMMERCIAL_OR_BSD3")
set(license "LicenseRef-Qt-Commercial OR BSD-3-Clause")
# For documentation
elseif(id STREQUAL "QT_COMMERCIAL_OR_GFDL1_3")
set(license "LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only")
# For examples and the like
elseif(id STREQUAL "BSD3")
set(license "BSD-3-Clause")
endif()
if(NOT license)
message(FATAL_ERROR "No SPDX license expression found for id: ${id}")
endif()
set(${out_var} "${license}" PARENT_SCOPE)
endfunction()
# Joins two license IDs with the given ${op}, avoiding parenthesis when possible.
function(_qt_internal_sbom_join_two_license_ids_with_op left_id op right_id out_var)
if(NOT left_id)
set(${out_var} "${right_id}" PARENT_SCOPE)
return()
endif()
if(NOT right_id)
set(${out_var} "${left_id}" PARENT_SCOPE)
return()
endif()
set(value "(${left_id}) ${op} (${right_id})")
set(${out_var} "${value}" PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,861 @@
# Copyright (C) 2024 The Qt Company Ltd.
# Copyright (C) 2023-2024 Jochem Rutgers
# SPDX-License-Identifier: MIT AND BSD-3-Clause
# Handles the look up of Python, Python spdx dependencies and other various post-installation steps
# like NTIA validation, auditing, json generation, etc.
function(_qt_internal_sbom_setup_project_ops_generation)
set(opt_args
GENERATE_JSON
GENERATE_JSON_REQUIRED
GENERATE_SOURCE_SBOM
VERIFY_SBOM
VERIFY_SBOM_REQUIRED
VERIFY_NTIA_COMPLIANT
LINT_SOURCE_SBOM
LINT_SOURCE_SBOM_NO_ERROR
SHOW_TABLE
AUDIT
AUDIT_NO_ERROR
)
set(single_args "")
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(arg_GENERATE_JSON AND NOT QT_INTERNAL_NO_SBOM_PYTHON_OPS)
set(op_args
OP_KEY "GENERATE_JSON"
OUT_VAR_DEPS_FOUND deps_found
)
if(arg_GENERATE_JSON_REQUIRED)
list(APPEND op_args REQUIRED)
endif()
_qt_internal_sbom_find_and_handle_sbom_op_dependencies(${op_args})
if(deps_found)
_qt_internal_sbom_generate_json()
endif()
endif()
if(arg_VERIFY_SBOM AND NOT QT_INTERNAL_NO_SBOM_PYTHON_OPS)
set(op_args
OP_KEY "VERIFY_SBOM"
OUT_VAR_DEPS_FOUND deps_found
)
if(arg_VERIFY_SBOM_REQUIRED)
list(APPEND op_args REQUIRED)
endif()
_qt_internal_sbom_find_and_handle_sbom_op_dependencies(${op_args})
if(deps_found)
_qt_internal_sbom_verify_valid()
endif()
endif()
if(arg_VERIFY_NTIA_COMPLIANT AND NOT QT_INTERNAL_NO_SBOM_PYTHON_OPS)
_qt_internal_sbom_find_and_handle_sbom_op_dependencies(REQUIRED OP_KEY "RUN_NTIA")
_qt_internal_sbom_verify_ntia_compliant()
endif()
if(arg_SHOW_TABLE AND NOT QT_INTERNAL_NO_SBOM_PYTHON_OPS)
_qt_internal_sbom_find_python_dependency_program(NAME sbom2doc REQUIRED)
_qt_internal_sbom_show_table()
endif()
if(arg_AUDIT AND NOT QT_INTERNAL_NO_SBOM_PYTHON_OPS)
set(audit_no_error_option "")
if(arg_AUDIT_NO_ERROR)
set(audit_no_error_option NO_ERROR)
endif()
_qt_internal_sbom_find_python_dependency_program(NAME sbomaudit REQUIRED)
_qt_internal_sbom_audit(${audit_no_error_option})
endif()
if(arg_GENERATE_SOURCE_SBOM AND NOT QT_INTERNAL_NO_SBOM_PYTHON_OPS)
_qt_internal_sbom_find_python_dependency_program(NAME reuse REQUIRED)
_qt_internal_sbom_generate_reuse_source_sbom()
endif()
if(arg_LINT_SOURCE_SBOM AND NOT QT_INTERNAL_NO_SBOM_PYTHON_OPS)
set(lint_no_error_option "")
if(arg_LINT_SOURCE_SBOM_NO_ERROR)
set(lint_no_error_option NO_ERROR)
endif()
_qt_internal_sbom_find_python_dependency_program(NAME reuse REQUIRED)
_qt_internal_sbom_run_reuse_lint(
${lint_no_error_option}
BUILD_TIME_SCRIPT_PATH_OUT_VAR reuse_lint_script
)
endif()
endfunction()
# Helper to find a python interpreter and a specific python dependency, e.g. to be able to generate
# a SPDX JSON SBOM, or run post-installation steps like NTIA verification.
# The exact dependency should be specified as the OP_KEY.
#
# Caches the found python executable in a separate cache var QT_INTERNAL_SBOM_PYTHON_EXECUTABLE, to
# avoid conflicts with any other found python interpreter.
function(_qt_internal_sbom_find_and_handle_sbom_op_dependencies)
set(opt_args
REQUIRED
)
set(single_args
OP_KEY
OUT_VAR_DEPS_FOUND
)
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_OP_KEY)
message(FATAL_ERROR "OP_KEY is required")
endif()
set(supported_ops "GENERATE_JSON" "VERIFY_SBOM" "RUN_NTIA")
if(arg_OP_KEY STREQUAL "GENERATE_JSON" OR arg_OP_KEY STREQUAL "VERIFY_SBOM")
set(import_statement "import spdx_tools.spdx.clitools.pyspdxtools")
elseif(arg_OP_KEY STREQUAL "RUN_NTIA")
set(import_statement "import ntia_conformance_checker.main")
else()
message(FATAL_ERROR "OP_KEY must be one of ${supported_ops}")
endif()
# Return early if we found the dependencies.
if(QT_INTERNAL_SBOM_DEPS_FOUND_FOR_${arg_OP_KEY})
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} TRUE PARENT_SCOPE)
endif()
return()
endif()
# NTIA-compliance checker requires Python 3.9 or later, so we use it as the minimum for all
# SBOM OPs.
set(required_version "3.9")
set(python_common_args
VERSION "${required_version}"
)
set(everything_found FALSE)
# On macOS FindPython prefers looking in the system framework location, but that usually would
# not have the required dependencies. So we first look in it, and then fallback to any other
# non-framework python found.
if(CMAKE_HOST_APPLE)
set(extra_python_args SEARCH_IN_FRAMEWORKS QUIET)
_qt_internal_sbom_find_python_and_dependency_helper_lambda()
endif()
if(NOT everything_found)
set(extra_python_args QUIET)
_qt_internal_sbom_find_python_and_dependency_helper_lambda()
endif()
# Always save the python interpreter path if it is found, even if the dependencies are not
# found. This improves the error message workflow.
if(python_found AND NOT QT_INTERNAL_SBOM_PYTHON_EXECUTABLE)
set(QT_INTERNAL_SBOM_PYTHON_EXECUTABLE "${python_path}" CACHE INTERNAL
"Python interpeter used for SBOM generation.")
endif()
if(NOT everything_found)
if(arg_REQUIRED)
set(message_type "FATAL_ERROR")
else()
set(message_type "DEBUG")
endif()
if(NOT python_found)
# Look for python one more time, this time without QUIET, to show an error why it
# wasn't found.
if(arg_REQUIRED)
_qt_internal_sbom_find_python_helper(${python_common_args}
OUT_VAR_PYTHON_PATH unused_python
OUT_VAR_PYTHON_FOUND unused_found
)
endif()
message(${message_type} "Python ${required_version} for running SBOM ops not found.")
elseif(NOT dep_found)
message(${message_type} "Python dependency for running SBOM op ${arg_OP_KEY} "
"not found:\n Python: ${python_path} \n Output: \n${dep_find_output}")
endif()
else()
message(DEBUG "Using Python ${python_path} for running SBOM ops.")
set(QT_INTERNAL_SBOM_DEPS_FOUND_FOR_${arg_OP_KEY} "TRUE" CACHE INTERNAL
"All dependencies found to run SBOM OP ${arg_OP_KEY}")
endif()
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} "${QT_INTERNAL_SBOM_DEPS_FOUND_FOR_${arg_OP_KEY}}"
PARENT_SCOPE)
endif()
endfunction()
# Helper that checks a variable for truthiness, and sets the OUT_VAR_DEPS_FOUND and
# OUT_VAR_REASON_FAILURE_MESSAGE variables based on what was passed in.
function(_qt_internal_sbom_handle_sbom_op_missing_dependency)
set(opt_args "")
set(single_args
VAR_TO_CHECK
OUT_VAR_DEPS_FOUND
OUT_VAR_REASON_FAILURE_MESSAGE
)
set(multi_args
FAILURE_MESSAGE
)
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_VAR_TO_CHECK)
message(FATAL_ERROR "VAR_TO_CHECK is required")
endif()
set(reason "")
set(value "${${arg_VAR_TO_CHECK}}")
if(NOT value)
if(arg_FAILURE_MESSAGE)
list(JOIN arg_FAILURE_MESSAGE " " reason)
endif()
set(deps_found FALSE)
else()
set(deps_found TRUE)
endif()
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} "${deps_found}" PARENT_SCOPE)
endif()
if(arg_OUT_VAR_REASON_FAILURE_MESSAGE)
set(${arg_OUT_VAR_REASON_FAILURE_MESSAGE} "${reason}" PARENT_SCOPE)
endif()
endfunction()
# Helper to query whether the sbom python interpreter is available, and also the error message if it
# is not available.
function(_qt_internal_sbom_check_python_interpreter_available)
set(opt_args "")
set(single_args
OUT_VAR_DEPS_FOUND
OUT_VAR_REASON_FAILURE_MESSAGE
)
set(multi_args
FAILURE_MESSAGE_PREFIX
)
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(failure_message
"QT_INTERNAL_SBOM_PYTHON_EXECUTABLE is missing a valid path to a python interpreter")
if(arg_FAILURE_MESSAGE_PREFIX)
list(PREPEND failure_message ${arg_FAILURE_MESSAGE_PREFIX})
endif()
_qt_internal_sbom_handle_sbom_op_missing_dependency(
VAR_TO_CHECK QT_INTERNAL_SBOM_PYTHON_EXECUTABLE
FAILURE_MESSAGE ${failure_message}
OUT_VAR_DEPS_FOUND deps_found
OUT_VAR_REASON_FAILURE_MESSAGE reason
)
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} "${deps_found}" PARENT_SCOPE)
endif()
if(arg_OUT_VAR_REASON_FAILURE_MESSAGE)
set(${arg_OUT_VAR_REASON_FAILURE_MESSAGE} "${reason}" PARENT_SCOPE)
endif()
endfunction()
# Helper to assert that the python interpreter is available.
function(_qt_internal_sbom_assert_python_interpreter_available error_message_prefix)
_qt_internal_sbom_check_python_interpreter_available(
FAILURE_MESSAGE_PREFIX ${error_message_prefix}
OUT_VAR_DEPS_FOUND deps_found
OUT_VAR_REASON_FAILURE_MESSAGE reason
)
if(NOT deps_found)
message(FATAL_ERROR ${reason})
endif()
endfunction()
# Helper to query whether an sbom python dependency is available, and also the error message if it
# is not available.
function(_qt_internal_sbom_check_python_dependency_available)
set(opt_args "")
set(single_args
OUT_VAR_DEPS_FOUND
OUT_VAR_REASON_FAILURE_MESSAGE
VAR_TO_CHECK
)
set(multi_args
FAILURE_MESSAGE_PREFIX
FAILURE_MESSAGE_SUFFIX
)
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(failure_message
"Required Python dependencies not found: ")
if(arg_FAILURE_MESSAGE_PREFIX)
list(PREPEND failure_message ${arg_FAILURE_MESSAGE_PREFIX})
endif()
if(arg_FAILURE_MESSAGE_SUFFIX)
list(APPEND failure_message ${arg_FAILURE_MESSAGE_SUFFIX})
endif()
_qt_internal_sbom_handle_sbom_op_missing_dependency(
VAR_TO_CHECK ${arg_VAR_TO_CHECK}
FAILURE_MESSAGE ${failure_message}
OUT_VAR_DEPS_FOUND deps_found
OUT_VAR_REASON_FAILURE_MESSAGE reason
)
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} "${deps_found}" PARENT_SCOPE)
endif()
if(arg_OUT_VAR_REASON_FAILURE_MESSAGE)
set(${arg_OUT_VAR_REASON_FAILURE_MESSAGE} "${reason}" PARENT_SCOPE)
endif()
endfunction()
# Helper to assert that an sbom python dependency is available.
function(_qt_internal_sbom_assert_python_dependency_available key dep error_message_prefix)
_qt_internal_sbom_check_python_dependency_available(
VAR_TO_CHECK QT_INTERNAL_SBOM_DEPS_FOUND_FOR_${key}
FAILURE_MESSAGE_PREFIX ${error_message_prefix}
FAILURE_MESSAGE_SUFFIX ${dep}
OUT_VAR_DEPS_FOUND deps_found
OUT_VAR_REASON_FAILURE_MESSAGE reason
)
if(NOT deps_found)
message(FATAL_ERROR ${reason})
endif()
endfunction()
# Helper to query whether the json sbom generation dependency is available, and also the error
# message if it is not available.
function(_qt_internal_sbom_check_generate_json_dependency_available)
set(opt_args "")
set(single_args
OUT_VAR_DEPS_FOUND
OUT_VAR_REASON_FAILURE_MESSAGE
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_check_python_dependency_available(
VAR_TO_CHECK QT_INTERNAL_SBOM_DEPS_FOUND_FOR_GENERATE_JSON
FAILURE_MESSAGE_SUFFIX "spdx_tools.spdx.clitools.pyspdxtools"
OUT_VAR_DEPS_FOUND deps_found
OUT_VAR_REASON_FAILURE_MESSAGE reason
)
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} "${deps_found}" PARENT_SCOPE)
endif()
if(arg_OUT_VAR_REASON_FAILURE_MESSAGE)
set(${arg_OUT_VAR_REASON_FAILURE_MESSAGE} "${reason}" PARENT_SCOPE)
endif()
endfunction()
# Helper to generate a SPDX JSON file from a tag/value format file.
# This also implies some additional validity checks, useful to ensure a proper sbom file.
function(_qt_internal_sbom_generate_json)
set(error_message_prefix "Failed to generate an SBOM json file.")
_qt_internal_sbom_assert_python_interpreter_available("${error_message_prefix}")
_qt_internal_sbom_assert_python_dependency_available(GENERATE_JSON
"spdx_tools.spdx.clitools.pyspdxtools" ${error_message_prefix})
set(content "
message(STATUS \"Generating JSON: \${QT_SBOM_OUTPUT_PATH}.json\")
execute_process(
COMMAND ${QT_INTERNAL_SBOM_PYTHON_EXECUTABLE} -m spdx_tools.spdx.clitools.pyspdxtools
-i \"\${QT_SBOM_OUTPUT_PATH}\" -o \"\${QT_SBOM_OUTPUT_PATH}.json\"
RESULT_VARIABLE res
)
if(NOT res EQUAL 0)
message(FATAL_ERROR \"SBOM conversion to JSON failed: \${res}\")
endif()
")
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(verify_sbom "${sbom_dir}/convert_to_json.cmake")
file(GENERATE OUTPUT "${verify_sbom}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_verify_include_files "${verify_sbom}")
endfunction()
# Helper to query whether the all required dependencies are available to generate a tag / value
# document from a json one.
function(_qt_internal_sbom_verify_deps_for_generate_tag_value_spdx_document)
set(opt_args "")
set(single_args
OUT_VAR_DEPS_FOUND
OUT_VAR_REASON_FAILURE_MESSAGE
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
# First try to find dependencies, because they might not have been found yet.
_qt_internal_sbom_find_and_handle_sbom_op_dependencies(
OP_KEY "GENERATE_JSON"
)
_qt_internal_sbom_check_python_interpreter_available(
OUT_VAR_DEPS_FOUND python_found
OUT_VAR_REASON_FAILURE_MESSAGE python_error
)
_qt_internal_sbom_check_generate_json_dependency_available(
OUT_VAR_DEPS_FOUND dep_found
OUT_VAR_REASON_FAILURE_MESSAGE dep_error
)
set(reasons "")
if(python_error)
string(APPEND reasons "${python_error}\n")
endif()
if(dep_error)
string(APPEND reasons "${dep_error}\n")
endif()
if(python_found AND dep_found)
set(deps_found "TRUE")
else()
set(deps_found "FALSE")
endif()
set(${arg_OUT_VAR_DEPS_FOUND} "${deps_found}" PARENT_SCOPE)
set(${arg_OUT_VAR_REASON_FAILURE_MESSAGE} "${reasons}" PARENT_SCOPE)
endfunction()
# Helper to generate a tag/value SPDX file from a SPDX JSON format file.
#
# Will be used by WebEngine to convert the Chromium JSON file to a tag/value SPDX file.
#
# This conversion needs to happen before the document is referenced in the SBOM generation process,
# so that the file already exists when it is parsed for its unique id and namespace.
# It also needs to happen before verification codes are computed for the current document
# that will depend on the target one, to ensure the the file exists and its checksum can be
# computed.
#
# OPERATION_ID - a unique id for the operation, used to generate a unique cmake file name for
# the SBOM generation process.
#
# INPUT_JSON_PATH - the absolute path to the input JSON file.
#
# OUTPUT_FILE_PATH - the absolute path where to create the output tag/value SPDX file.
# Note that if the output file path is set, it is up to the caller to also copy / install the file
# into the build and install directories where the build system expects to find all external
# document references.
#
# OUTPUT_FILE_NAME - when OUTPUT_FILE_PATH is not specified, the output directory is automatically
# set to the SBOM output directory. In this case OUTPUT_FILE_NAME can be used to override the
# outout file name. If not specified, it will be derived from the input file name.
#
# OUT_VAR_OUTPUT_FILE_NAME - output variable where to store the output file.
#
# OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH - output variable where to store the output file path.
# Note that the path will contain an unresolved '${QT_SBOM_OUTPUT_DIR}' which only has a value at
# install time. So the path can't be used sensibly during configure time.
#
# OPTIONAL - whether the operation should return early, if the required python dependencies are
# not found. OUT_VAR_DEPS_FOUND is still set in that case.
#
# OUT_VAR_DEPS_FOUND - output variable where to store whether the python dependencies for the
# operation were found, and thus the conversion will be attempted.
function(_qt_internal_sbom_generate_tag_value_spdx_document)
if(NOT QT_GENERATE_SBOM)
return()
endif()
set(opt_args
OPTIONAL
)
set(single_args
OPERATION_ID
INPUT_JSON_FILE_PATH
OUTPUT_FILE_PATH
OUTPUT_FILE_NAME
OUT_VAR_OUTPUT_FILE_NAME
OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH
OUT_VAR_DEPS_FOUND
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
# First try to find dependencies, because they might not have been found yet.
_qt_internal_sbom_find_and_handle_sbom_op_dependencies(
OP_KEY "GENERATE_JSON"
OUT_VAR_DEPS_FOUND deps_found
)
if(arg_OPTIONAL)
set(deps_are_required FALSE)
else()
set(deps_are_required TRUE)
endif()
# If the operation has to succeed, then the deps are required. Assert they are available.
if(deps_are_required)
set(error_message_prefix "Failed to generate a tag/value SBOM file from a json SBOM file.")
_qt_internal_sbom_assert_python_interpreter_available("${error_message_prefix}")
_qt_internal_sbom_assert_python_dependency_available(GENERATE_JSON
"spdx_tools.spdx.clitools.pyspdxtools" ${error_message_prefix})
# If the operation is optional, don't error out if the deps are not found, but silently return
# and mention that the deps are not found.
elseif(NOT deps_found)
set(${arg_OUT_VAR_DEPS_FOUND} "${deps_found}" PARENT_SCOPE)
return()
endif()
set(${arg_OUT_VAR_DEPS_FOUND} "${deps_found}" PARENT_SCOPE)
if(NOT arg_OPERATION_ID)
message(FATAL_ERROR "OPERATION_ID is required")
endif()
if(NOT arg_INPUT_JSON_FILE_PATH)
message(FATAL_ERROR "INPUT_JSON_FILE_PATH is required")
endif()
if(arg_OUTPUT_FILE_PATH)
set(output_path "${arg_OUTPUT_FILE_PATH}")
else()
if(arg_OUTPUT_FILE_NAME)
set(output_name "${arg_OUTPUT_FILE_NAME}")
else()
# Use the input file name without the last extension (without .json) as the output name.
get_filename_component(output_name "${arg_INPUT_JSON_FILE_PATH}" NAME_WLE)
endif()
set(output_path "\${QT_SBOM_OUTPUT_DIR}/${output_name}")
endif()
if(arg_OUT_VAR_OUTPUT_FILE_NAME)
get_filename_component(output_name_resolved "${output_path}" NAME)
set(${arg_OUT_VAR_OUTPUT_FILE_NAME} "${output_name_resolved}" PARENT_SCOPE)
endif()
if(arg_OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH)
set(${arg_OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH} "${output_path}" PARENT_SCOPE)
endif()
set(content "
message(STATUS
\"Generating tag/value SPDX document: ${output_path} from \"
\"${arg_INPUT_JSON_FILE_PATH}\")
execute_process(
COMMAND ${QT_INTERNAL_SBOM_PYTHON_EXECUTABLE} -m spdx_tools.spdx.clitools.pyspdxtools
-i \"${arg_INPUT_JSON_FILE_PATH}\" -o \"${output_path}\"
RESULT_VARIABLE res
)
if(NOT res EQUAL 0)
message(FATAL_ERROR \"SBOM conversion to tag/value failed: \${res}\")
endif()
")
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(convert_sbom "${sbom_dir}/convert_to_tag_value_${arg_OPERATION_ID}.cmake")
file(GENERATE OUTPUT "${convert_sbom}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_include_files
"${convert_sbom}")
endfunction()
# Helper to verify the generated sbom is valid.
function(_qt_internal_sbom_verify_valid)
set(error_message_prefix "Failed to verify SBOM file syntax.")
_qt_internal_sbom_assert_python_interpreter_available("${error_message_prefix}")
_qt_internal_sbom_assert_python_dependency_available(VERIFY_SBOM
"spdx_tools.spdx.clitools.pyspdxtools" ${error_message_prefix})
set(content "
message(STATUS \"Verifying: \${QT_SBOM_OUTPUT_PATH}\")
execute_process(
COMMAND ${QT_INTERNAL_SBOM_PYTHON_EXECUTABLE} -m spdx_tools.spdx.clitools.pyspdxtools
-i \"\${QT_SBOM_OUTPUT_PATH}\"
RESULT_VARIABLE res
)
if(NOT res EQUAL 0)
message(FATAL_ERROR \"SBOM verification failed: \${res}\")
endif()
")
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(verify_sbom "${sbom_dir}/verify_valid.cmake")
file(GENERATE OUTPUT "${verify_sbom}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_verify_include_files "${verify_sbom}")
endfunction()
# Helper to verify the generated sbom is NTIA compliant.
function(_qt_internal_sbom_verify_ntia_compliant)
set(error_message_prefix "Failed to run NTIA checker on SBOM file.")
_qt_internal_sbom_assert_python_interpreter_available("${error_message_prefix}")
_qt_internal_sbom_assert_python_dependency_available(RUN_NTIA
"ntia_conformance_checker.main" ${error_message_prefix})
set(content "
message(STATUS \"Checking for NTIA compliance: \${QT_SBOM_OUTPUT_PATH}\")
execute_process(
COMMAND ${QT_INTERNAL_SBOM_PYTHON_EXECUTABLE} -m ntia_conformance_checker.main
--file \"\${QT_SBOM_OUTPUT_PATH}\"
RESULT_VARIABLE res
)
if(NOT res EQUAL 0)
message(FATAL_ERROR \"SBOM NTIA verification failed: \{res}\")
endif()
")
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(verify_sbom "${sbom_dir}/verify_ntia.cmake")
file(GENERATE OUTPUT "${verify_sbom}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_verify_include_files "${verify_sbom}")
endfunction()
# Helper to show the main sbom document info in the form of a CLI table.
function(_qt_internal_sbom_show_table)
set(extra_code_begin "")
if(DEFINED ENV{COIN_UNIQUE_JOB_ID})
# The output of the process dynamically adjusts the width of the shown table based on the
# console width. In the CI, the width is very short for some reason, and thus the output
# is truncated in the CI log. Explicitly set a bigger width to avoid this.
set(extra_code_begin "
set(backup_env_columns \$ENV{COLUMNS})
set(ENV{COLUMNS} 150)
")
set(extra_code_end "
set(ENV{COLUMNS} \${backup_env_columns})
")
endif()
set(content "
message(STATUS \"Showing main SBOM document info: \${QT_SBOM_OUTPUT_PATH}\")
${extra_code_begin}
execute_process(
COMMAND ${QT_SBOM_PROGRAM_SBOM2DOC} -i \"\${QT_SBOM_OUTPUT_PATH}\"
RESULT_VARIABLE res
)
${extra_code_end}
if(NOT res EQUAL 0)
message(FATAL_ERROR \"Showing SBOM document failed: \${res}\")
endif()
")
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(verify_sbom "${sbom_dir}/show_table.cmake")
file(GENERATE OUTPUT "${verify_sbom}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_verify_include_files "${verify_sbom}")
endfunction()
# Helper to audit the generated sbom.
function(_qt_internal_sbom_audit)
set(opt_args NO_ERROR)
set(single_args "")
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(handle_error "")
if(NOT arg_NO_ERROR)
set(handle_error "
if(NOT res EQUAL 0)
message(FATAL_ERROR \"SBOM Audit failed: \${res}\")
endif()
")
endif()
set(content "
message(STATUS \"Auditing SBOM: \${QT_SBOM_OUTPUT_PATH}\")
execute_process(
COMMAND ${QT_SBOM_PROGRAM_SBOMAUDIT} -i \"\${QT_SBOM_OUTPUT_PATH}\"
--disable-license-check --cpecheck --offline
RESULT_VARIABLE res
)
${handle_error}
")
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(verify_sbom "${sbom_dir}/audit.cmake")
file(GENERATE OUTPUT "${verify_sbom}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_verify_include_files "${verify_sbom}")
endfunction()
# Returns path to project's potential root source reuse.toml file.
function(_qt_internal_sbom_get_project_reuse_toml_path out_var)
set(reuse_toml_path "${PROJECT_SOURCE_DIR}/REUSE.toml")
set(${out_var} "${reuse_toml_path}" PARENT_SCOPE)
endfunction()
# Helper to generate and install a source SBOM using reuse.
function(_qt_internal_sbom_generate_reuse_source_sbom)
set(opt_args NO_ERROR)
set(single_args "")
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(file_op "${sbom_dir}/generate_reuse_source_sbom.cmake")
_qt_internal_sbom_get_project_reuse_toml_path(reuse_toml_path)
if(NOT EXISTS "${reuse_toml_path}" AND NOT QT_FORCE_SOURCE_SBOM_GENERATION)
set(skip_message
"Skipping source SBOM generation: No reuse.toml file found at '${reuse_toml_path}'.")
message(STATUS "${skip_message}")
set(content "
message(STATUS \"${skip_message}\")
")
file(GENERATE OUTPUT "${file_op}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_post_generation_include_files
"${file_op}")
return()
endif()
set(handle_error "")
if(NOT arg_NO_ERROR)
set(handle_error "
if(NOT res EQUAL 0)
message(FATAL_ERROR \"Source SBOM generation using reuse tool failed: \${res}\")
endif()
")
endif()
set(source_sbom_path "\${QT_SBOM_OUTPUT_PATH_WITHOUT_EXT}.source.spdx")
file(TO_CMAKE_PATH "$ENV{QT_QA_LICENSE_TEST_DIR}/$ENV{QT_SOURCE_SBOM_TEST_SCRIPT}"
full_path_to_license_test)
set(verify_source_sbom "
if(res EQUAL 0)
message(STATUS \"Verifying source SBOM ${source_sbom_path} using qtqa tst_licenses.pl ${full_path_to_license_test}\")
if(NOT EXISTS \"${full_path_to_license_test}\")
message(FATAL_ERROR \"Source SBOM check has failed: The tst_licenses.pl script could not be found at ${full_path_to_license_test}\")
endif()
execute_process(
COMMAND perl \"\$ENV{QT_SOURCE_SBOM_TEST_SCRIPT}\" -sbomonly -sbom \"${source_sbom_path}\"
WORKING_DIRECTORY \"\$ENV{QT_QA_LICENSE_TEST_DIR}\"
RESULT_VARIABLE res
COMMAND_ECHO STDOUT
)
if(NOT res EQUAL 0)
message(FATAL_ERROR \"Source SBOM check has failed: \${res}\")
endif()
endif()
")
set(extra_reuse_args "")
get_property(project_supplier GLOBAL PROPERTY _qt_sbom_project_supplier)
if(project_supplier)
get_property(project_supplier_url GLOBAL PROPERTY _qt_sbom_project_supplier_url)
# Add the supplier url if available. Add it in parenthesis to stop reuse from adding its
# own empty parenthesis.
if(project_supplier_url)
set(project_supplier "${project_supplier} (${project_supplier_url})")
endif()
# Unfortunately there's no way to silence the addition of the 'Creator: Person' field,
# even though 'Creator: Organization' is supplied.
list(APPEND extra_reuse_args --creator-organization "${project_supplier}")
endif()
set(content "
message(STATUS \"Generating source SBOM using reuse tool: ${source_sbom_path}\")
set(extra_reuse_args \"${extra_reuse_args}\")
execute_process(
COMMAND
${QT_SBOM_PROGRAM_REUSE}
--root \"${PROJECT_SOURCE_DIR}\"
spdx
-o ${source_sbom_path}
\${extra_reuse_args}
RESULT_VARIABLE res
)
${handle_error}
if(\"\$ENV{VERIFY_SOURCE_SBOM}\")
${verify_source_sbom}
endif()
")
file(GENERATE OUTPUT "${file_op}" CONTENT "${content}")
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_post_generation_include_files "${file_op}")
endfunction()
# Helper to run 'reuse lint' on the project source dir.
function(_qt_internal_sbom_run_reuse_lint)
set(opt_args
NO_ERROR
)
set(single_args
BUILD_TIME_SCRIPT_PATH_OUT_VAR
)
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 no reuse.toml file exists, it means the repo is likely not reuse compliant yet,
# so we shouldn't error out during installation when running the lint.
_qt_internal_sbom_get_project_reuse_toml_path(reuse_toml_path)
if(NOT EXISTS "${reuse_toml_path}" AND NOT QT_FORCE_REUSE_LINT_ERROR)
set(arg_NO_ERROR TRUE)
endif()
set(handle_error "")
if(NOT arg_NO_ERROR)
set(handle_error "
if(NOT res EQUAL 0)
message(FATAL_ERROR \"Running 'reuse lint' failed: \${res}\")
endif()
")
endif()
set(content "
message(STATUS \"Running 'reuse lint' in '${PROJECT_SOURCE_DIR}'.\")
execute_process(
COMMAND ${QT_SBOM_PROGRAM_REUSE} --root \"${PROJECT_SOURCE_DIR}\" lint
RESULT_VARIABLE res
)
${handle_error}
")
_qt_internal_get_current_project_sbom_dir(sbom_dir)
set(file_op_build "${sbom_dir}/run_reuse_lint_build.cmake")
file(GENERATE OUTPUT "${file_op_build}" CONTENT "${content}")
# Allow skipping running 'reuse lint' during installation. But still allow running it during
# build time. This is a fail safe opt-out in case some repo needs it.
if(QT_FORCE_SKIP_REUSE_LINT_ON_INSTALL)
set(skip_message "Skipping running 'reuse lint' in '${PROJECT_SOURCE_DIR}'.")
set(content "
message(STATUS \"${skip_message}\")
")
set(file_op_install "${sbom_dir}/run_reuse_lint_install.cmake")
file(GENERATE OUTPUT "${file_op_install}" CONTENT "${content}")
else()
# Just reuse the already generated script for installation as well.
set(file_op_install "${file_op_build}")
endif()
set_property(GLOBAL APPEND PROPERTY _qt_sbom_cmake_verify_include_files "${file_op_install}")
if(arg_BUILD_TIME_SCRIPT_PATH_OUT_VAR)
set(${arg_BUILD_TIME_SCRIPT_PATH_OUT_VAR} "${file_op_build}" PARENT_SCOPE)
endif()
endfunction()

View File

@ -0,0 +1,305 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Parse purl arguments for a specific purl entry.
# arguments_var_name is the variable name that contains the args.
# prefix is the prefix passed to cmake_parse_arguments.
macro(_qt_internal_sbom_parse_purl_entry_options prefix arguments_var_name)
_qt_internal_get_sbom_purl_parsing_options(purl_opt_args purl_single_args purl_multi_args)
cmake_parse_arguments(${prefix} "${purl_opt_args}" "${purl_single_args}" "${purl_multi_args}"
${${arguments_var_name}})
_qt_internal_validate_all_args_are_parsed(${prefix})
endmacro()
# Helper macro to prepare forwarding all set purl options to some other function.
# Expects the options names to be set in the parent scope by calling
# _qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
macro(_qt_internal_sbom_forward_purl_handling_options args_var_name)
if(NOT opt_args)
message(FATAL_ERROR
"Expected opt_args to be set by _qt_internal_get_sbom_purl_handling_options")
endif()
if(NOT single_args)
message(FATAL_ERROR
"Expected single_args to be set by _qt_internal_get_sbom_purl_handling_options")
endif()
if(NOT multi_args)
message(FATAL_ERROR
"Expected multi_args to be set by _qt_internal_get_sbom_purl_handling_options")
endif()
_qt_internal_forward_function_args(
FORWARD_PREFIX arg
FORWARD_OUT_VAR ${args_var_name}
FORWARD_OPTIONS
${opt_args}
FORWARD_SINGLE
${single_args}
FORWARD_MULTI
${multi_args}
)
endmacro()
# Handles purl arguments specified to functions like qt_internal_add_sbom.
#
# Synopsis
#
# qt_internal_add_sbom(<target>
# PURLS
# [[PURL_ENTRY
# PURL_ID <id>
# PURL_TYPE <type>
# PURL_NAMESPACE <namespace>
# PURL_NAME <name>
# PURL_VERSION <version>]...]
# PURL_VALUES
# [purl-string...]
# )
#
# Example
#
# qt_internal_add_sbom(<target>
# PURLS
# PURL_ENTRY
# PURL_ID "UPSTREAM"
# PURL_TYPE "github"
# PURL_NAMESPACE "harfbuzz"
# PURL_NAME "harfbuzz"
# PURL_VERSION "v8.5.0"
# PURL_ENTRY
# PURL_ID "MIRROR"
# PURL_TYPE "git"
# PURL_NAMESPACE "harfbuzz"
# PURL_NAME "harfbuzz"
# PURL_QUALIFIERS "vcs_url=https://code.qt.io/qt/qtbase"
# ....
# PURL_VALUES
# pkg:git/harfbuzz/harfbuzz@v8.5.0
# pkg:github/harfbuzz/harfbuzz@v8.5.0
# ....
#
#
# PURLS accepts multiple purl entries, each starting with the PURL_ENTRY keyword.
# PURL_VALUES takes a list of pre-built purl strings.
#
# If no arguments are specified, for qt entity types (e.g. libraries built as part of Qt repos),
# default purls will be generated.
#
# There is no limit to the number of purls that can be added to a target.
function(_qt_internal_sbom_handle_purl_values target)
_qt_internal_get_sbom_purl_handling_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_OUT_VAR)
message(FATAL_ERROR "OUT_VAR must be set")
endif()
_qt_internal_get_sbom_purl_parsing_options(purl_opt_args purl_single_args purl_multi_args)
set(project_package_options "")
# Collect each PURL_ENTRY args into a separate variable.
set(purl_idx -1)
set(purl_entry_indices "")
foreach(purl_arg IN LISTS arg_PURLS)
if(purl_arg STREQUAL "PURL_ENTRY")
math(EXPR purl_idx "${purl_idx}+1")
list(APPEND purl_entry_indices "${purl_idx}")
elseif(purl_idx GREATER_EQUAL 0)
list(APPEND purl_${purl_idx}_args "${purl_arg}")
else()
message(FATAL_ERROR "Missing PURL_ENTRY keyword.")
endif()
endforeach()
# Validate the args for each collected entry.
foreach(purl_idx IN LISTS purl_entry_indices)
list(LENGTH purl_${purl_idx}_args num_args)
if(num_args LESS 1)
message(FATAL_ERROR "Empty PURL_ENTRY encountered.")
endif()
_qt_internal_sbom_parse_purl_entry_options(arg purl_${purl_idx}_args)
endforeach()
# Append qt specific placeholder entries when handling Qt entities.
if(arg___QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_PURL)
_qt_internal_sbom_forward_purl_handling_options(purl_handling_args)
_qt_internal_sbom_handle_qt_entity_purl_entries(${purl_handling_args}
OUT_VAR_IDS qt_purl_ids
)
if(qt_purl_ids)
# Create purl placeholder indices for each qt purl id.
foreach(qt_purl_id IN LISTS qt_purl_ids)
math(EXPR purl_idx "${purl_idx}+1")
list(APPEND purl_entry_indices "${purl_idx}")
list(APPEND purl_${purl_idx}_args PURL_ID "${qt_purl_id}")
endforeach()
endif()
endif()
foreach(purl_idx IN LISTS purl_entry_indices)
# Clear previous values.
foreach(option_name IN LISTS purl_opt_args purl_single_args purl_multi_args)
unset(arg_${option_name})
endforeach()
_qt_internal_sbom_parse_purl_entry_options(arg purl_${purl_idx}_args)
set(purl_args "")
# Override the purl version with the package version.
if(arg_PURL_USE_PACKAGE_VERSION AND arg_PACKAGE_VERSION)
set(arg_PURL_VERSION "${arg_PACKAGE_VERSION}")
endif()
# Append a vcs_url to the qualifiers if specified.
if(arg_PURL_VCS_URL)
list(APPEND arg_PURL_QUALIFIERS "vcs_url=${arg_PURL_VCS_URL}")
endif()
_qt_internal_forward_function_args(
FORWARD_APPEND
FORWARD_PREFIX arg
FORWARD_OUT_VAR purl_args
FORWARD_OPTIONS
${purl_opt_args}
FORWARD_SINGLE
${purl_single_args}
FORWARD_MULTI
${purl_multi_args}
)
# Qt entity types get special treatment to gather the required args.
if(arg___QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_PURL
AND arg_PURL_ID
AND arg_PURL_ID IN_LIST qt_purl_ids)
_qt_internal_sbom_handle_qt_entity_purl("${target}"
${purl_handling_args}
PURL_ID "${arg_PURL_ID}"
OUT_PURL_ARGS qt_purl_args
)
if(qt_purl_args)
list(APPEND purl_args "${qt_purl_args}")
endif()
endif()
_qt_internal_sbom_assemble_purl(${target}
${purl_args}
OUT_VAR package_manager_external_ref
)
list(APPEND project_package_options ${package_manager_external_ref})
endforeach()
foreach(purl_value IN LISTS arg_PURL_VALUES)
_qt_internal_sbom_get_purl_value_extref(
VALUE "${purl_value}" OUT_VAR package_manager_external_ref)
# The order in which the purls are generated, matters for tools that consume the SBOM.
# Some tools can only handle one PURL per package, so the first one should be the
# important one.
# For now, I deem that the directly specified ones (probably via a qt_attribution.json
# file) are the more important ones. So we prepend them.
list(PREPEND project_package_options ${package_manager_external_ref})
endforeach()
set(${arg_OUT_VAR} "${project_package_options}" PARENT_SCOPE)
endfunction()
# Assembles an external reference purl identifier.
# PURL_TYPE and PURL_NAME are required.
# Stores the result in the OUT_VAR.
# Accepted options:
# PURL_TYPE
# PURL_NAME
# PURL_NAMESPACE
# PURL_VERSION
# PURL_SUBPATH
# PURL_QUALIFIERS
function(_qt_internal_sbom_assemble_purl target)
set(opt_args "")
set(single_args
OUT_VAR
)
set(multi_args "")
_qt_internal_get_sbom_purl_parsing_options(purl_opt_args purl_single_args purl_multi_args)
list(APPEND opt_args ${purl_opt_args})
list(APPEND single_args ${purl_single_args})
list(APPEND multi_args ${purl_multi_args})
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(purl_scheme "pkg")
if(NOT arg_PURL_TYPE)
message(FATAL_ERROR "PURL_TYPE must be set")
endif()
if(NOT arg_PURL_NAME)
message(FATAL_ERROR "PURL_NAME must be set")
endif()
if(NOT arg_OUT_VAR)
message(FATAL_ERROR "OUT_VAR must be set")
endif()
# https://github.com/package-url/purl-spec
# Spec is 'scheme:type/namespace/name@version?qualifiers#subpath'
set(purl "${purl_scheme}:${arg_PURL_TYPE}")
if(arg_PURL_NAMESPACE)
string(APPEND purl "/${arg_PURL_NAMESPACE}")
endif()
string(APPEND purl "/${arg_PURL_NAME}")
if(arg_PURL_VERSION)
string(APPEND purl "@${arg_PURL_VERSION}")
endif()
if(arg_PURL_QUALIFIERS)
# TODO: Note that the qualifiers are expected to be URL encoded, which this implementation
# is not doing at the moment.
list(JOIN arg_PURL_QUALIFIERS "&" qualifiers)
string(APPEND purl "?${qualifiers}")
endif()
if(arg_PURL_SUBPATH)
string(APPEND purl "#${arg_PURL_SUBPATH}")
endif()
_qt_internal_sbom_get_purl_value_extref(VALUE "${purl}" OUT_VAR result)
set(${arg_OUT_VAR} "${result}" PARENT_SCOPE)
endfunction()
# Takes a PURL VALUE and returns an SBOM purl external reference in OUT_VAR.
function(_qt_internal_sbom_get_purl_value_extref)
set(opt_args "")
set(single_args
OUT_VAR
VALUE
)
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)
message(FATAL_ERROR "OUT_VAR must be set")
endif()
if(NOT arg_VALUE)
message(FATAL_ERROR "VALUE must be set")
endif()
# SPDX SBOM External reference type.
set(ext_ref_prefix "PACKAGE-MANAGER purl")
set(external_ref "${ext_ref_prefix} ${arg_VALUE}")
set(result "EXTREF" "${external_ref}")
set(${arg_OUT_VAR} "${result}" PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,250 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Helper macro to find python and a given dependency. Expects the caller to set all of the vars.
# Meant to reduce the line noise due to the repeated calls.
macro(_qt_internal_sbom_find_python_and_dependency_helper_lambda)
_qt_internal_sbom_find_python_and_dependency_helper(
PYTHON_ARGS
${extra_python_args}
${python_common_args}
DEPENDENCY_ARGS
DEPENDENCY_IMPORT_STATEMENT "${import_statement}"
OUT_VAR_PYTHON_PATH python_path
OUT_VAR_PYTHON_FOUND python_found
OUT_VAR_DEP_FOUND dep_found
OUT_VAR_PYTHON_AND_DEP_FOUND everything_found
OUT_VAR_DEP_FIND_OUTPUT dep_find_output
)
endmacro()
# Tries to find python and a given dependency based on the args passed to PYTHON_ARGS and
# DEPENDENCY_ARGS which are forwarded to the respective finding functions.
# Returns the path to the python interpreter, whether it was found, whether the dependency was
# found, whether both were found, and the reason why the dependency might not be found.
function(_qt_internal_sbom_find_python_and_dependency_helper)
set(opt_args)
set(single_args
OUT_VAR_PYTHON_PATH
OUT_VAR_PYTHON_FOUND
OUT_VAR_DEP_FOUND
OUT_VAR_PYTHON_AND_DEP_FOUND
OUT_VAR_DEP_FIND_OUTPUT
)
set(multi_args
PYTHON_ARGS
DEPENDENCY_ARGS
)
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(everything_found_inner FALSE)
set(deps_find_output_inner "")
if(NOT arg_OUT_VAR_PYTHON_PATH)
message(FATAL_ERROR "OUT_VAR_PYTHON_PATH var is required")
endif()
if(NOT arg_OUT_VAR_PYTHON_FOUND)
message(FATAL_ERROR "OUT_VAR_PYTHON_FOUND var is required")
endif()
if(NOT arg_OUT_VAR_DEP_FOUND)
message(FATAL_ERROR "OUT_VAR_DEP_FOUND var is required")
endif()
if(NOT arg_OUT_VAR_PYTHON_AND_DEP_FOUND)
message(FATAL_ERROR "OUT_VAR_PYTHON_AND_DEP_FOUND var is required")
endif()
if(NOT arg_OUT_VAR_DEP_FIND_OUTPUT)
message(FATAL_ERROR "OUT_VAR_DEP_FIND_OUTPUT var is required")
endif()
_qt_internal_sbom_find_python_helper(
${arg_PYTHON_ARGS}
OUT_VAR_PYTHON_PATH python_path_inner
OUT_VAR_PYTHON_FOUND python_found_inner
)
if(python_found_inner AND python_path_inner)
_qt_internal_sbom_find_python_dependency_helper(
${arg_DEPENDENCY_ARGS}
PYTHON_PATH "${python_path_inner}"
OUT_VAR_FOUND dep_found_inner
OUT_VAR_OUTPUT dep_find_output_inner
)
if(dep_found_inner)
set(everything_found_inner TRUE)
endif()
endif()
set(${arg_OUT_VAR_PYTHON_PATH} "${python_path_inner}" PARENT_SCOPE)
set(${arg_OUT_VAR_PYTHON_FOUND} "${python_found_inner}" PARENT_SCOPE)
set(${arg_OUT_VAR_DEP_FOUND} "${dep_found_inner}" PARENT_SCOPE)
set(${arg_OUT_VAR_PYTHON_AND_DEP_FOUND} "${everything_found_inner}" PARENT_SCOPE)
set(${arg_OUT_VAR_DEP_FIND_OUTPUT} "${dep_find_output_inner}" PARENT_SCOPE)
endfunction()
# Tries to find the python intrepreter, given the QT_SBOM_PYTHON_INTERP path hint, as well as
# other options.
# Ignores any previously found python.
# Returns the python interpreter path and whether it was successfully found.
#
# This is intentionally a function, and not a macro, to prevent overriding the Python3_EXECUTABLE
# non-cache variable in a global scope in case if a different python is found and used for a
# different purpose (e.g. qtwebengine or qtinterfaceframework).
# The reason to use a different python is that an already found python might not be the version we
# need, or might lack the dependencies we need.
# https://gitlab.kitware.com/cmake/cmake/-/issues/21797#note_901621 claims that finding multiple
# python versions in separate directory scopes is possible, and I claim a function scope is as
# good as a directory scope.
function(_qt_internal_sbom_find_python_helper)
set(opt_args
SEARCH_IN_FRAMEWORKS
QUIET
)
set(single_args
VERSION
OUT_VAR_PYTHON_PATH
OUT_VAR_PYTHON_FOUND
)
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_PYTHON_PATH)
message(FATAL_ERROR "OUT_VAR_PYTHON_PATH var is required")
endif()
if(NOT arg_OUT_VAR_PYTHON_FOUND)
message(FATAL_ERROR "OUT_VAR_PYTHON_FOUND var is required")
endif()
# Allow disabling looking for a python interpreter shipped as part of a macOS system framework.
if(NOT arg_SEARCH_IN_FRAMEWORKS)
set(Python3_FIND_FRAMEWORK NEVER)
endif()
set(required_version "")
if(arg_VERSION)
set(required_version "${arg_VERSION}")
endif()
set(find_quiet "")
if(arg_QUIET)
set(find_quiet "QUIET")
endif()
# Locally reset any executable that was possibly already found.
# We do this to ensure we always re-do the lookup/
# This needs to be set to an empty string, to override any cache variable
set(Python3_EXECUTABLE "")
# This needs to be unset, because the Python module checks whether the variable is defined, not
# whether it is empty.
unset(_Python3_EXECUTABLE)
if(QT_SBOM_PYTHON_INTERP)
set(Python3_ROOT_DIR ${QT_SBOM_PYTHON_INTERP})
endif()
find_package(Python3 ${required_version} ${find_quiet} COMPONENTS Interpreter)
set(${arg_OUT_VAR_PYTHON_PATH} "${Python3_EXECUTABLE}" PARENT_SCOPE)
set(${arg_OUT_VAR_PYTHON_FOUND} "${Python3_Interpreter_FOUND}" PARENT_SCOPE)
endfunction()
# Helper that takes an python import statement to run using the given python interpreter path,
# to confirm that the given python dependency can be found.
# Returns whether the dependency was found and the output of running the import, for error handling.
function(_qt_internal_sbom_find_python_dependency_helper)
set(opt_args "")
set(single_args
DEPENDENCY_IMPORT_STATEMENT
PYTHON_PATH
OUT_VAR_FOUND
OUT_VAR_OUTPUT
)
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_PYTHON_PATH)
message(FATAL_ERROR "Python interpreter path not given.")
endif()
if(NOT arg_DEPENDENCY_IMPORT_STATEMENT)
message(FATAL_ERROR "Python depdendency import statement not given.")
endif()
if(NOT arg_OUT_VAR_FOUND)
message(FATAL_ERROR "Out var found variable not given.")
endif()
set(python_path "${arg_PYTHON_PATH}")
execute_process(
COMMAND
${python_path} -c "${arg_DEPENDENCY_IMPORT_STATEMENT}"
RESULT_VARIABLE res
OUTPUT_VARIABLE output
ERROR_VARIABLE output
)
if("${res}" STREQUAL "0")
set(found TRUE)
set(output "${output}")
else()
set(found FALSE)
string(CONCAT output "SBOM Python dependency ${arg_DEPENDENCY_IMPORT_STATEMENT} not found. "
"Error:\n${output}")
endif()
set(${arg_OUT_VAR_FOUND} "${found}" PARENT_SCOPE)
if(arg_OUT_VAR_OUTPUT)
set(${arg_OUT_VAR_OUTPUT} "${output}" PARENT_SCOPE)
endif()
endfunction()
# Helper to find a python installed CLI utility.
# Expected to be in PATH.
function(_qt_internal_sbom_find_python_dependency_program)
set(opt_args
REQUIRED
)
set(single_args
NAME
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(program_name "${arg_NAME}")
string(TOUPPER "${program_name}" upper_name)
set(cache_var "QT_SBOM_PROGRAM_${upper_name}")
set(hints "")
# The path to python installed apps is different on Windows compared to UNIX, so we use
# a different path than where the python interpreter might be located.
if(QT_SBOM_PYTHON_APPS_PATH)
list(APPEND hints ${QT_SBOM_PYTHON_APPS_PATH})
endif()
find_program(${cache_var}
NAMES ${program_name}
HINTS ${hints}
)
if(NOT ${cache_var})
if(arg_REQUIRED)
set(message_type "FATAL_ERROR")
set(prefix "Required ")
else()
set(message_type "STATUS")
set(prefix "Optional ")
endif()
message(${message_type} "${prefix}SBOM python program '${program_name}' not found.")
endif()
endfunction()

View File

@ -0,0 +1,492 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Helper macro to prepare forwarding all set sbom options to some other function.
# Expects the options names to be set in the parent scope by calling
# _qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
macro(_qt_internal_sbom_forward_sbom_add_target_options args_var_name)
if(NOT opt_args)
message(FATAL_ERROR
"Expected opt_args to be set by _qt_internal_get_sbom_add_target_options")
endif()
if(NOT single_args)
message(FATAL_ERROR
"Expected single_args to be set by _qt_internal_get_sbom_add_target_options")
endif()
if(NOT multi_args)
message(FATAL_ERROR
"Expected multi_args to be set by _qt_internal_get_sbom_add_target_options")
endif()
_qt_internal_forward_function_args(
FORWARD_PREFIX arg
FORWARD_OUT_VAR ${args_var_name}
FORWARD_OPTIONS
${opt_args}
FORWARD_SINGLE
${single_args}
FORWARD_MULTI
${multi_args}
)
endmacro()
# Helper function to add a default supplier for a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_supplier target)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
_qt_internal_sbom_is_qt_3rd_party_entity_type("${arg_TYPE}" is_qt_3rd_party_entity_type)
set(supplier "")
if(NOT arg_SUPPLIER
AND (is_qt_entity_type OR is_qt_3rd_party_entity_type)
AND NOT arg_NO_DEFAULT_QT_SUPPLIER)
_qt_internal_sbom_get_default_supplier(supplier)
endif()
if(supplier)
set(${arg_OUT_VAR} "${supplier}" PARENT_SCOPE)
endif()
endfunction()
# Helper function to add a default package for a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_package_version target)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
set(package_version "")
if(NOT arg_PACKAGE_VERSION
AND is_qt_entity_type
AND NOT arg_NO_DEFAULT_QT_PACKAGE_VERSION)
_qt_internal_sbom_get_default_qt_package_version(package_version)
endif()
if(package_version)
set(${arg_OUT_VAR} "${package_version}" PARENT_SCOPE)
endif()
endfunction()
# Helper function to add a default repo download location for a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_download_location target)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
set(download_location "")
if(NOT arg_DOWNLOAD_LOCATION AND is_qt_entity_type)
_qt_internal_sbom_get_qt_repo_source_download_location(download_location)
endif()
if(download_location)
set(${arg_OUT_VAR} "${download_location}" PARENT_SCOPE)
endif()
endfunction()
# Helper function to add a default license expression for a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_license_expression target)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
set(license_expression "")
# For Qt entities, we have some special handling.
if(is_qt_entity_type AND NOT arg_NO_DEFAULT_QT_LICENSE AND NOT arg_QT_LICENSE_ID)
if(arg_TYPE STREQUAL "QT_TOOL" OR arg_TYPE STREQUAL "QT_APP")
if(QT_SBOM_DEFAULT_QT_LICENSE_ID_EXECUTABLES
AND NOT arg_NO_DEFAULT_QT_LICENSE_ID_EXECUTABLES)
# A repo might contain only the "gpl3" license variant as the default for all
# executables, so allow setting it at the repo level to avoid having to repeat it
# for each target.
_qt_internal_sbom_get_spdx_license_expression(
"${QT_SBOM_DEFAULT_QT_LICENSE_ID_EXECUTABLES}" license_expression)
else()
# For tools and apps, we use the gpl exception variant by default.
_qt_internal_sbom_get_spdx_license_expression("QT_COMMERCIAL_OR_GPL3_WITH_EXCEPTION"
license_expression)
endif()
elseif(QT_SBOM_DEFAULT_QT_LICENSE_ID_LIBRARIES
AND NOT arg_NO_DEFAULT_QT_LICENSE_ID_LIBRARIES)
# A repo might contain only the "gpl3" license variant as the default for all modules
# and plugins, so allow setting it at the repo level to avoid having to repeat it
# for each target.
_qt_internal_sbom_get_spdx_license_expression(
"${QT_SBOM_DEFAULT_QT_LICENSE_ID_LIBRARIES}" license_expression)
else()
# Otherwise, for modules and plugins we use the default qt license.
_qt_internal_sbom_get_spdx_license_expression("QT_DEFAULT" license_expression)
endif()
endif()
# Some Qt entities might request a specific license from the subset that we usually use.
if(arg_QT_LICENSE_ID)
_qt_internal_sbom_get_spdx_license_expression("${arg_QT_LICENSE_ID}"
requested_license_expression)
_qt_internal_sbom_join_two_license_ids_with_op(
"${license_expression}" "AND" "${requested_license_expression}"
license_expression)
endif()
# Allow setting a license expression string per directory scope via a variable.
if(is_qt_entity_type AND QT_SBOM_LICENSE_EXPRESSION AND NOT arg_NO_DEFAULT_DIRECTORY_QT_LICENSE)
set(qt_license_expression "${QT_SBOM_LICENSE_EXPRESSION}")
_qt_internal_sbom_join_two_license_ids_with_op(
"${license_expression}" "AND" "${qt_license_expression}"
license_expression)
endif()
if(license_expression)
set(${arg_OUT_VAR} "${license_expression}" PARENT_SCOPE)
endif()
endfunction()
# Helper function to add a default license declared expression for a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_license_declared_expression target)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR LICENSE_CONCLUDED_EXPRESSION)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
set(license_expression "")
# For qt entities we know the license we provide, so we mark it as declared as well.
if(is_qt_entity_type AND arg_LICENSE_CONCLUDED_EXPRESSION)
set(license_expression "${arg_LICENSE_CONCLUDED_EXPRESSION}")
endif()
if(license_expression)
set(${arg_OUT_VAR} "${license_expression}" PARENT_SCOPE)
endif()
endfunction()
# Get the default qt copyright.
function(_qt_internal_sbom_get_default_qt_copyright_header out_var)
set(${out_var}
"Copyright (C) The Qt Company Ltd. and other contributors."
PARENT_SCOPE)
endfunction()
# Helper function to add default copyrights for a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_copyrights target)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
set(qt_default_copyright "")
if(is_qt_entity_type AND NOT arg_NO_DEFAULT_QT_COPYRIGHTS)
_qt_internal_sbom_get_default_qt_copyright_header(qt_default_copyright)
endif()
if(qt_default_copyright)
set(${arg_OUT_VAR} "${qt_default_copyright}" PARENT_SCOPE)
endif()
endfunction()
# Helper function to add default CPEs for a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_cpe target)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND single_args OUT_VAR)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
_qt_internal_sbom_is_qt_3rd_party_entity_type("${arg_TYPE}" is_qt_3rd_party_entity_type)
set(cpe_list "")
# Add the qt-specific CPE if the target is a Qt entity type, or if it's a 3rd party entity type
# without any CPE specified.
if(is_qt_entity_type OR (is_qt_3rd_party_entity_type AND NOT arg_CPE))
_qt_internal_sbom_compute_security_cpe_for_qt(cpe_list)
endif()
if(cpe_list)
set(${arg_OUT_VAR} "${cpe_list}" PARENT_SCOPE)
endif()
endfunction()
# Returns a vcs url for purls where qt entities of the current repo are hosted.
function(_qt_internal_sbom_get_qt_entity_vcs_url target)
set(opt_args "")
set(single_args
REPO_NAME
VERSION
OUT_VAR
)
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_REPO_NAME)
message(FATAL_ERROR "REPO_NAME must be set")
endif()
if(NOT arg_OUT_VAR)
message(FATAL_ERROR "OUT_VAR must be set")
endif()
set(version_part "")
if(arg_VERSION)
set(version_part "@${arg_VERSION}")
endif()
set(vcs_url "https://code.qt.io/qt/${arg_REPO_NAME}.git${version_part}")
set(${arg_OUT_VAR} "${vcs_url}" PARENT_SCOPE)
endfunction()
# Returns a relative path to the source where the target was created, to be embedded into a
# mirror purl as a subpath.
function(_qt_internal_sbom_get_qt_entity_repo_source_dir target)
set(opt_args "")
set(single_args
OUT_VAR
)
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_OUT_VAR)
message(FATAL_ERROR "OUT_VAR must be set")
endif()
get_target_property(repo_source_dir "${target}" SOURCE_DIR)
# Get the path relative to the PROJECT_SOURCE_DIR
file(RELATIVE_PATH relative_repo_source_dir "${PROJECT_SOURCE_DIR}" "${repo_source_dir}")
set(sub_path "${relative_repo_source_dir}")
set(${arg_OUT_VAR} "${sub_path}" PARENT_SCOPE)
endfunction()
# Gets a list of arguments to pass to _qt_internal_sbom_assemble_purl when handling a Qt entity
# type. The purl for Qt entity types have Qt-specific defaults, but can be overridden per purl
# component.
# The arguments are saved in OUT_VAR.
function(_qt_internal_sbom_get_qt_entity_purl_args target)
set(opt_args "")
set(single_args
NAME
REPO_NAME
SUPPLIER
VERSION
OUT_VAR
)
set(multi_args "")
_qt_internal_get_sbom_purl_parsing_options(purl_opt_args purl_single_args purl_multi_args)
list(APPEND opt_args ${purl_opt_args})
list(APPEND single_args ${purl_single_args})
list(APPEND multi_args ${purl_multi_args})
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
if(arg_VERSION)
set(purl_version "${arg_VERSION}")
endif()
if(arg_PURL_ID STREQUAL "GENERIC")
set(purl_type "generic")
set(purl_namespace "${arg_SUPPLIER}")
set(purl_name "${arg_NAME}")
elseif(arg_PURL_ID STREQUAL "GITHUB")
set(purl_type "github")
set(purl_namespace "qt")
set(purl_name "${arg_REPO_NAME}")
endif()
if(arg_PURL_TYPE)
set(purl_type "${arg_PURL_TYPE}")
endif()
if(arg_PURL_NAMESPACE)
set(purl_namespace "${arg_PURL_NAMESPACE}")
endif()
if(arg_PURL_NAME)
set(purl_name "${arg_PURL_NAME}")
endif()
if(arg_PURL_VERSION)
set(purl_version "${arg_PURL_VERSION}")
endif()
set(purl_version_option "")
if(purl_version)
set(purl_version_option PURL_VERSION "${purl_version}")
endif()
set(purl_args
PURL_TYPE "${purl_type}"
PURL_NAMESPACE "${purl_namespace}"
PURL_NAME "${purl_name}"
${purl_version_option}
)
if(arg_PURL_QUALIFIERS)
list(APPEND purl_args PURL_QUALIFIERS "${arg_PURL_QUALIFIERS}")
endif()
if(arg_PURL_SUBPATH)
list(APPEND purl_args PURL_SUBPATH "${arg_PURL_SUBPATH}")
endif()
set(${arg_OUT_VAR} "${purl_args}" PARENT_SCOPE)
endfunction()
# Helper to get the list of default purl ids for a qt entity.
#
# Qt entities have two purls by default:
# - a GITHUB one pointing to the qt github mirror
# - a GENERIC one pointing to code.qt.io via vcs_url
#
# Third party libraries vendored in Qt also have the same purls, like regular Qt
# libraries, but might also have an upstream one which is specified explicitly.
function(_qt_internal_sbom_get_qt_entity_default_purl_ids out_var)
set(supported_purl_ids GITHUB GENERIC)
set(${out_var} "${supported_purl_ids}" PARENT_SCOPE)
endfunction()
# Helper function to decide which purl ids to add for a qt entity.
# Returns either a list of qt purl ids, or an empty list if it's not a qt entity type or qt 3rd
# party type.
function(_qt_internal_sbom_handle_qt_entity_purl_entries)
_qt_internal_get_sbom_purl_handling_options(opt_args single_args multi_args)
list(APPEND single_args
OUT_VAR # This is unused, but added by the calling function.
OUT_VAR_IDS
)
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(purl_ids "")
_qt_internal_sbom_is_qt_entity_type("${arg_TYPE}" is_qt_entity_type)
_qt_internal_sbom_is_qt_3rd_party_entity_type("${arg_TYPE}" is_qt_3rd_party_entity_type)
if(is_qt_entity_type OR is_qt_3rd_party_entity_type)
_qt_internal_sbom_get_qt_entity_default_purl_ids(purl_ids)
endif()
if(purl_ids)
set(${arg_OUT_VAR_IDS} "${purl_ids}" PARENT_SCOPE)
endif()
endfunction()
# Helper function to add purl values for a specific purl entry of a qt entity type.
function(_qt_internal_sbom_handle_qt_entity_purl target)
_qt_internal_get_sbom_purl_handling_options(opt_args single_args multi_args)
list(APPEND single_args
OUT_VAR # This is unused, but added by the calling function.
OUT_PURL_ARGS
PURL_ID
)
cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(purl_args "")
_qt_internal_sbom_get_git_version_vars()
# Return early if not handling one of the default qt purl ids, or if requested not to add a
# default purl.
_qt_internal_sbom_get_qt_entity_default_purl_ids(default_purl_ids)
if(arg_NO_DEFAULT_QT_PURL OR (NOT arg_PURL_ID IN_LIST default_purl_ids))
set(${arg_OUT_PURL_ARGS} "${purl_args}" PARENT_SCOPE)
return()
endif()
_qt_internal_sbom_get_root_project_name_lower_case(repo_project_name_lowercase)
# Add a vcs_url to the GENERIC purl entry.
if(arg_PURL_ID STREQUAL "GENERIC")
set(entity_vcs_url_version_option "")
# Can be empty.
if(QT_SBOM_GIT_HASH_SHORT)
set(entity_vcs_url_version_option VERSION "${QT_SBOM_GIT_HASH_SHORT}")
endif()
_qt_internal_sbom_get_qt_entity_vcs_url(${target}
REPO_NAME "${repo_project_name_lowercase}"
${entity_vcs_url_version_option}
OUT_VAR vcs_url)
list(APPEND purl_args PURL_QUALIFIERS "vcs_url=${vcs_url}")
endif()
# Add the subdirectory path where the target was created as a custom qualifier.
_qt_internal_sbom_get_qt_entity_repo_source_dir(${target} OUT_VAR sub_path)
if(sub_path)
list(APPEND purl_args PURL_SUBPATH "${sub_path}")
endif()
# Add the target name as a custom qualifer.
list(APPEND purl_args PURL_QUALIFIERS "library_name=${target}")
# Can be empty.
if(QT_SBOM_GIT_HASH_SHORT)
list(APPEND purl_args VERSION "${QT_SBOM_GIT_HASH_SHORT}")
endif()
# Get purl args the Qt entity type, taking into account defaults.
_qt_internal_sbom_get_qt_entity_purl_args(${target}
NAME "${repo_project_name_lowercase}-${target}"
REPO_NAME "${repo_project_name_lowercase}"
SUPPLIER "${arg_SUPPLIER}"
PURL_ID "${arg_PURL_ID}"
${purl_args}
OUT_VAR purl_args
)
if(purl_args)
set(${arg_OUT_PURL_ARGS} "${purl_args}" PARENT_SCOPE)
endif()
endfunction()
# Get the default qt package version.
function(_qt_internal_sbom_get_default_qt_package_version out_var)
set(${out_var} "${QT_REPO_MODULE_VERSION}" PARENT_SCOPE)
endfunction()
# Get the default qt supplier.
function(_qt_internal_sbom_get_default_supplier out_var)
set(${out_var} "TheQtCompany" PARENT_SCOPE)
endfunction()
# Get the default qt supplier url.
function(_qt_internal_sbom_get_default_supplier_url out_var)
set(${out_var} "https://qt.io" PARENT_SCOPE)
endfunction()
# Get the default qt download location.
# If git info is available, includes the hash.
function(_qt_internal_sbom_get_qt_repo_source_download_location out_var)
_qt_internal_sbom_get_root_project_name_lower_case(repo_project_name_lowercase)
set(download_location "git://code.qt.io/qt/${repo_project_name_lowercase}.git")
_qt_internal_sbom_get_git_version_vars()
if(QT_SBOM_GIT_HASH)
string(APPEND download_location "@${QT_SBOM_GIT_HASH}")
endif()
set(${out_var} "${download_location}" PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,165 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Records information about a system library target, usually due to a qt_find_package call.
# This information is later used to generate packages for the system libraries, but only after
# confirming that the library was used (linked) into any of the Qt targets.
function(_qt_internal_sbom_record_system_library_usage target)
if(NOT QT_GENERATE_SBOM)
return()
endif()
set(opt_args "")
set(single_args
TYPE
PACKAGE_VERSION
FRIENDLY_PACKAGE_NAME
)
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_TYPE)
message(FATAL_ERROR "TYPE must be set")
endif()
# A package might be looked up more than once, make sure to record it once.
get_property(already_recorded GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_target_${target})
if(already_recorded)
return()
endif()
set_property(GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_target_${target} TRUE)
# Defer spdx id creation until _qt_internal_sbom_begin_project is called, so we know the
# project name. The project name is used in the package infix generation of the system library,
# but _qt_internal_sbom_record_system_library_usage might be called before sbom generation
# has started, e.g. during _qt_internal_find_third_party_dependencies.
set(spdx_options
${target}
TYPE "${arg_TYPE}"
PACKAGE_NAME "${arg_FRIENDLY_PACKAGE_NAME}"
)
get_cmake_property(sbom_repo_begin_called _qt_internal_sbom_repo_begin_called)
if(sbom_repo_begin_called AND TARGET "${target}")
_qt_internal_sbom_record_system_library_spdx_id(${target} ${spdx_options})
else()
set_property(GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_spdx_options_${target} "${spdx_options}")
endif()
# Defer sbom info creation until we detect usage of the system library (whether the library is
# linked into any other target).
set_property(GLOBAL APPEND PROPERTY
_qt_internal_sbom_recorded_system_library_targets "${target}")
set_property(GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_options_${target} "${ARGN}")
endfunction()
# Helper to record spdx ids of all system library targets that were found so far.
function(_qt_internal_sbom_record_system_library_spdx_ids)
get_property(recorded_targets GLOBAL PROPERTY _qt_internal_sbom_recorded_system_library_targets)
if(NOT recorded_targets)
return()
endif()
foreach(target IN LISTS recorded_targets)
get_property(args GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_spdx_options_${target})
# qt_find_package PROVIDED_TARGETS might refer to non-existent targets in certain cases,
# like zstd::libzstd_shared for qt_find_package(WrapZSTD), because we are not sure what
# kind of zstd build was done. Make sure to check if the target exists before recording it.
if(TARGET "${target}")
set(target_unaliased "${target}")
_qt_internal_dealias_target(target_unaliased)
_qt_internal_sbom_record_system_library_spdx_id(${target_unaliased} ${args})
else()
message(DEBUG
"Skipping recording system library for SBOM because target does not exist: "
" ${target}")
endif()
endforeach()
endfunction()
# Helper to record the spdx id of a system library target.
function(_qt_internal_sbom_record_system_library_spdx_id target)
# Save the spdx id before the sbom info is added, so we can refer to it in relationships.
_qt_internal_sbom_record_target_spdx_id(${ARGN} OUT_VAR package_spdx_id)
if(NOT package_spdx_id)
message(FATAL_ERROR "Could not generate spdx id for system library target: ${target}")
endif()
set_target_properties("${target}" PROPERTIES _qt_internal_sbom_is_system_library TRUE)
set_property(GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_package_${target} "${package_spdx_id}")
endfunction()
# Goes through the list of consumed system libraries (those that were linked in) and creates
# sbom packages for them.
# Uses information from recorded system libraries (calls to qt_find_package).
function(_qt_internal_sbom_add_recorded_system_libraries)
get_property(recorded_targets GLOBAL PROPERTY _qt_internal_sbom_recorded_system_library_targets)
get_property(consumed_targets GLOBAL PROPERTY _qt_internal_sbom_consumed_system_library_targets)
set(unconsumed_targets "${recorded_targets}")
set(generated_package_names "")
message(DEBUG
"System libraries that were marked consumed "
"(some target linked to them): ${consumed_targets}")
message(DEBUG
"System libraries that were recorded "
"(they were marked with qt_find_package()): ${recorded_targets}")
foreach(target IN LISTS consumed_targets)
# Some system targets like qtspeech SpeechDispatcher::SpeechDispatcher might be aliased,
# and we can't set properties on them, so unalias the target name.
set(target_original "${target}")
_qt_internal_dealias_target(target)
get_property(args GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_options_${target})
get_property(package_name GLOBAL PROPERTY
_qt_internal_sbom_recorded_system_library_package_${target})
set_property(GLOBAL PROPERTY _qt_internal_sbom_recorded_system_library_target_${target} "")
set_property(GLOBAL PROPERTY _qt_internal_sbom_recorded_system_library_options_${target} "")
set_property(GLOBAL PROPERTY _qt_internal_sbom_recorded_system_library_package_${target} "")
# Guard against generating a package multiple times. Can happen when multiple targets belong
# to the same package.
if(sbom_generated_${package_name})
continue()
endif()
# Automatic system library sbom recording happens at project root source dir scope, which
# means it might accidentally pick up a qt_attribution.json file from the project root,
# that is not intended to be use for system libraries.
# For now, explicitly disable using the root attribution file.
list(APPEND args NO_CURRENT_DIR_ATTRIBUTION)
list(APPEND generated_package_names "${package_name}")
set(sbom_generated_${package_name} TRUE)
_qt_internal_extend_sbom(${target} ${args})
_qt_internal_finalize_sbom(${target})
list(REMOVE_ITEM unconsumed_targets "${target_original}")
endforeach()
message(DEBUG "System libraries that were recorded, but not consumed: ${unconsumed_targets}")
message(DEBUG "Generated SBOMs for the following system packages: ${generated_package_names}")
# Clean up, before configuring next repo project.
set_property(GLOBAL PROPERTY _qt_internal_sbom_consumed_system_library_targets "")
set_property(GLOBAL PROPERTY _qt_internal_sbom_recorded_system_library_targets "")
endfunction()

View File

@ -62,10 +62,7 @@ function(__qt_internal_set_link_order_matters target link_order_matters)
message(FATAL_ERROR "Unable to set _qt_link_order_matters flag. ${target} is not a target.")
endif()
get_target_property(aliased_target ${target} ALIASED_TARGET)
if(aliased_target)
set(target "${aliased_target}")
endif()
_qt_internal_dealias_target(target)
if(link_order_matters)
set(link_order_matters TRUE)
@ -101,10 +98,7 @@ endfunction()
function(__qt_internal_check_cmp0099_available)
set(platform_target ${QT_CMAKE_EXPORT_NAMESPACE}::Platform)
get_target_property(aliased_target ${platform_target} ALIASED_TARGET)
if(aliased_target)
set(platform_target "${aliased_target}")
endif()
_qt_internal_dealias_target(platform_target)
__qt_internal_get_cmp0099_genex_check(cmp0099_check)
set_target_properties(${platform_target} PROPERTIES
@ -224,10 +218,7 @@ function(__qt_internal_collect_object_libraries_recursively out_var target initi
set(lib "${CMAKE_MATCH_1}")
endif()
if(TARGET ${lib})
get_target_property(aliased_target ${lib} ALIASED_TARGET)
if(aliased_target)
set(lib ${aliased_target})
endif()
_qt_internal_dealias_target(lib)
if(${lib} IN_LIST processed_object_libraries)
continue()
@ -424,3 +415,109 @@ function(_qt_internal_warn_about_example_add_subdirectory)
)
endif()
endfunction()
# Mark source files as generated.
#
# This sets `GENERATED` property to TRUE, along with other Qt relevant properties,
# e.g. `SKIP_LINTING`.
#
# Synopsis
#
# _qt_internal_set_source_file_generated(SOURCE <src1> ...
# [CONFIGURE_GENERATED]
# [SKIP_AUTOGEN]
# [DIRECTORY <dirs> ...]
# [TARGET_DIRECTORY <targets> ...]
# )
#
# Arguments
#
# `SOURCES`
# Source files that are generated.
#
# Equivalent to `set_source_files_properties(<files>)`.
#
# `DIRECTORY`
# Equivalent to `set_source_files_properties(DIRECTORY)`.
#
# `TARGET_DIRECTORY`
# Equivalent to `set_source_files_properties(TARGET_DIRECTORY)`.
#
# `SKIP_AUTOGEN`
# Set SKIP_AUTOGEN property to True as well.
#
# `CONFIGURE_GENERATED`
# Files are generated with `configure_file`.
# Does not set `GENERATED TRUE` property. This is needed to avoid removing the file when
# running the clean target.
function(_qt_internal_set_source_file_generated)
set(option_args
SKIP_AUTOGEN
CONFIGURE_GENERATED
)
set(single_args "")
set(multi_args
SOURCES
DIRECTORY
TARGET_DIRECTORY
)
cmake_parse_arguments(PARSE_ARGV 0 arg
"${option_args}" "${single_args}" "${multi_args}"
)
# Parse required variables
if(NOT arg_SOURCES AND QT_FEATURE_developer_build)
message(WARNING
"Unexpected call _qt_internal_set_source_file_generated with empty `SOURCES`."
)
endif()
# Prepend again the appropriate keywords to pass to `set_source_files_properties`
if(arg_DIRECTORY)
list(PREPEND arg_DIRECTORY DIRECTORY)
endif()
if(arg_TARGET_DIRECTORY)
list(PREPEND arg_TARGET_DIRECTORY TARGET_DIRECTORY)
endif()
# Construct the properties list
set(properties "")
if(NOT arg_CONFIGURE_GENERATED)
list(APPEND properties
GENERATED TRUE
)
endif()
if(arg_SKIP_AUTOGEN)
list(APPEND properties
SKIP_AUTOGEN TRUE
)
endif()
# Add SKIP_LINTING if possible. We do not add it unconditionally here to avoid
# confusion when CMake ignores this variable.
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.27" AND NOT QT_FEATURE_lint_generated_code)
list(APPEND properties
SKIP_LINTING TRUE
)
endif()
set_source_files_properties(${arg_SOURCES}
${arg_DIRECTORY}
${arg_TARGET_DIRECTORY}
PROPERTIES ${properties}
)
endfunction()
# Get the real target checking for ALIASED_TARGET
function(_qt_internal_get_real_target out_var target)
get_target_property(aliased_target "${target}" ALIASED_TARGET)
if(aliased_target)
set(${out_var} "${aliased_target}" PARENT_SCOPE)
else()
set(${out_var} "${target}" PARENT_SCOPE)
endif()
endfunction()
# Helpful shortcut to `_qt_internal_get_real_target` if we just need to dealias
function(_qt_internal_dealias_target target_var)
_qt_internal_get_real_target(${target_var} ${${target_var}})
set(${target_var} "${${target_var}}" PARENT_SCOPE)
endfunction()

View File

@ -68,7 +68,10 @@ is not specified")
# It's necessary to call actual test inside 'cmd.exe', because 'execute_process' uses
# SW_HIDE to avoid showing a console window, it affects other GUI as well.
# See https://gitlab.kitware.com/cmake/cmake/-/issues/17690 for details.
set(extra_runner "cmd /c")
#
# Run the command using the proxy 'call' command to avoid issues related to invalid
# processing of quotes and spaces in cmd.exe arguments.
set(extra_runner "cmd /c call")
endif()
if(arg_PRE_RUN)
@ -118,3 +121,35 @@ endfunction()
function(_qt_internal_test_batch_target_name out)
set(${out} "test_batch" PARENT_SCOPE)
endfunction()
# Create a *_check target of the ctest execution for alternative execution
# Arguments:
# : CTEST_TEST_NAME: (default: ${testname})
# name of the ctest test used
function(_qt_internal_make_check_target testname)
set(options "")
set(singleOpts CTEST_TEST_NAME)
set(multiOpts "")
cmake_parse_arguments(PARSE_ARGV 1 arg
"${options}" "${singleOpts}" "${multiOpts}"
)
if(NOT arg_CTEST_TEST_NAME)
set(arg_CTEST_TEST_NAME ${testname})
endif()
set(test_config_options "")
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
if(is_multi_config)
set(test_config_options -C $<CONFIG>)
endif()
# Note: By default the working directory here is CMAKE_CURRENT_BINARY_DIR, which will
# work as long as this is called anywhere up or down the path where the equivalent
# `add_test` is called (not down a different branch path).
add_custom_target(${testname}_check
VERBATIM
COMMENT "Running ctest -V -R \"^${arg_CTEST_TEST_NAME}$\" ${test_config_options}"
COMMAND
"${CMAKE_CTEST_COMMAND}" -V -R "^${arg_CTEST_TEST_NAME}$" ${test_config_options}
)
endfunction()

View File

@ -139,7 +139,7 @@ macro(_qt_internal_execute_proccess_in_qt_env execute_process_args_var)
# We avoid escaping issues this way.
execute_process(${${execute_process_args_var}})
if(CMAKE_HOST_WIN32)
set(ENV{PATH} "${path_backup}")
set(ENV{PATH} "${_qt_internal_execute_proccess_in_qt_env_path_backup}")
unset(_qt_internal_execute_proccess_in_qt_env_path_backup)
endif()
endmacro()

View File

@ -153,9 +153,16 @@ function(__qt_internal_walk_libs
lib "${lib}")
endwhile()
# Skip static plugins.
# Skip processing static plugins.
# There are some abuses of this genex marker, because the more generic one below did
# not exist yet.
set(_is_plugin_marker_genex "\\$<BOOL:QT_IS_PLUGIN_GENEX>")
if(lib MATCHES "${_is_plugin_marker_genex}")
# Skip any genex expressions that contain the marker. Useful in cases like processing
# link expressions for prl file generation, where some link expressions should be
# skipped either because they don't make sense or they are handled differently.
set(_is_skip_marker_genex "\\$<BOOL:QT_SKIP_WALK_LIBS_PROCESSING>")
if(lib MATCHES "${_is_plugin_marker_genex}" OR lib MATCHES "${_is_skip_marker_genex}")
continue()
endif()
@ -172,10 +179,24 @@ function(__qt_internal_walk_libs
if(lib MATCHES "^\\$<TARGET_OBJECTS:")
# Skip object files.
continue()
elseif(lib MATCHES "^\\$<LINK_ONLY:(.*)>$")
set(lib_target ${CMAKE_MATCH_1})
else()
set(lib_target ${lib})
endif()
set(lib_target "${lib}")
# Unwrap targets like $<LINK_ONLY:$<BUILD_INTERFACE:Qt6::CorePrivate>>
while(lib_target
MATCHES "^\\$<(LINK_ONLY|BUILD_INTERFACE|BUILD_LOCAL_INTERFACE):(.*)>$")
set(lib_target "${CMAKE_MATCH_2}")
endwhile()
# If one of the values is "$<LINK_ONLY:$<BUILD_LOCAL_INTERFACE:Foo>>", this will be
# exported by cmake as "$<LINK_ONLY:>", which will become an empty value after the
# unwrapping above.
# In that case, skip the processing. Otherwise in some weird unknown conditions,
# CMake might consider the empty name to be a valid target, and cause errors further
# down.
if("${lib_target}" STREQUAL "")
continue()
endif()
# Skip CMAKE_DIRECTORY_ID_SEP. If a target_link_libraries is applied to a target
@ -240,10 +261,7 @@ function(__qt_internal_walk_libs
endif()
if(operation STREQUAL "promote_3rd_party_global")
set(lib_target_unaliased "${lib_target}")
get_target_property(aliased_target ${lib_target} ALIASED_TARGET)
if(aliased_target)
set(lib_target_unaliased ${aliased_target})
endif()
_qt_internal_dealias_target(lib_target_unaliased)
get_property(is_imported TARGET ${lib_target_unaliased} PROPERTY IMPORTED)

View File

@ -53,7 +53,7 @@ endfunction()
function(__qt_internal_get_emcc_recommended_version out_var)
# This version of Qt needs this version of emscripten.
set(QT_EMCC_RECOMMENDED_VERSION "3.1.56")
set(QT_EMCC_RECOMMENDED_VERSION "3.1.70")
set(${out_var} "${QT_EMCC_RECOMMENDED_VERSION}" PARENT_SCOPE)
endfunction()

View File

@ -33,11 +33,10 @@ function(qt6_add_win_app_sdk target)
set(generated_headers_path "${CMAKE_CURRENT_BINARY_DIR}/winrt_includes")
find_path(WINAPPSDK_GENERATED_INCLUDE_DIR
NAMES winrt/Microsoft.UI.h
HINTS "${generated_headers_path}")
set(winappsdk_generated_include_dir "${generated_headers_path}/winrt")
# If headers are not already generated
if(NOT WINAPPSDK_GENERATED_INCLUDE_DIR)
if(NOT EXISTS "${winappsdk_generated_include_dir}")
if(CPP_WIN_RT_PATH)
set(cpp_win_rt_path "${CPP_WIN_RT_PATH}")
elseif(DEFINED ENV{CPP_WIN_RT_PATH})
@ -53,23 +52,26 @@ function(qt6_add_win_app_sdk target)
message(FATAL_ERROR "cppwinrt.exe could not be found")
endif()
find_path(WINAPPSDK_INCLUDE_DIR
find_path(winappsdk_include_dir
NAMES MddBootstrap.h
HINTS ${win_app_sdk_root}/include)
HINTS ${win_app_sdk_root}/include
NO_CACHE)
find_library(WINAPPSDK_LIBRARY
find_library(winappsdk_library
NAMES Microsoft.WindowsAppRuntime
HINTS ${WINAPPSDK_LIBRARY_DIR} "${win_app_sdk_root}"
"${win_app_sdk_root}/lib"
"${win_app_sdk_root}/lib/win10-${win_app_sdk_arch}")
"${win_app_sdk_root}/lib/win10-${win_app_sdk_arch}"
NO_CACHE)
find_library(WINAPPSDK_BOOTSTRAP_LIBRARY
find_library(winappsdk_bootstrap_library
NAMES Microsoft.WindowsAppRuntime.Bootstrap
HINTS ${WINAPPSDK_LIBRARY_DIR} "${win_app_sdk_root}"
"${win_app_sdk_root}/lib"
"${win_app_sdk_root}/lib/win10-${win_app_sdk_arch}")
"${win_app_sdk_root}/lib/win10-${win_app_sdk_arch}"
NO_CACHE)
if(WINAPPSDK_INCLUDE_DIR AND WINAPPSDK_LIBRARY AND WINAPPSDK_BOOTSTRAP_LIBRARY)
if(winappsdk_include_dir AND winappsdk_library AND winappsdk_bootstrap_library)
execute_process(COMMAND
${cpp_win_rt_path} -out "${generated_headers_path}" -ref sdk
-in "${win_app_sdk_root}/lib/uap10.0"
@ -77,12 +79,8 @@ function(qt6_add_win_app_sdk target)
-in "${win_app_sdk_root}/lib/uap10.0.18362"
-in "${web_view_root}/lib")
find_path(WINAPPSDK_GENERATED_INCLUDE_DIR
NAMES winrt/Microsoft.UI.h
HINTS "${generated_headers_path}")
if(NOT WINAPPSDK_GENERATED_INCLUDE_DIR)
message(FATAL_ERROR "Windows App SDK library headers generation failed")
if(NOT EXISTS "${winappsdk_generated_include_dir}")
message(FATAL_ERROR "Windows App SDK library headers generation failed.")
endif()
else()
message(FATAL_ERROR "Windows App SDK library not found")

View File

@ -1,10 +1,15 @@
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# For now these are simple internal forwarding wrappers for the public counterparts, which are
# meant to be used in qt repo CMakeLists.txt files.
function(qt_internal_add_sbom)
_qt_internal_add_sbom(${ARGN})
# These internal sbom functions are meant to be used in qt repo CMakeLists.txt files.
function(qt_internal_add_sbom target)
if(NOT QT_GENERATE_SBOM)
return()
endif()
qt_internal_sbom_get_default_sbom_args("${target}" sbom_extra_args ${ARGN})
_qt_internal_add_sbom(${target} ${ARGN} ${sbom_extra_args})
endfunction()
function(qt_internal_extend_sbom)
@ -31,3 +36,161 @@ function(qt_internal_sbom_end_qt_repo_project)
_qt_internal_sbom_end_qt_repo_project(${ARGN})
endfunction()
function(qt_internal_sbom_add_files)
_qt_internal_sbom_add_files(${ARGN})
endfunction()
function(qt_internal_sbom_add_cmake_include_step)
_qt_internal_sbom_add_cmake_include_step(${ARGN})
endfunction()
function(qt_internal_sbom_add_external_reference)
_qt_internal_sbom_generate_add_external_reference(${ARGN})
endfunction()
function(qt_internal_sbom_add_project_relationship)
_qt_internal_sbom_generate_add_project_relationship(${ARGN})
endfunction()
function(qt_internal_sbom_generate_tag_value_spdx_document)
_qt_internal_sbom_generate_tag_value_spdx_document(${ARGN})
set(opt_args "")
set(single_args
OUT_VAR_OUTPUT_FILE_NAME
OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH
OUT_VAR_DEPS_FOUND
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
if(arg_OUT_VAR_OUTPUT_FILE_NAME)
set(${arg_OUT_VAR_OUTPUT_FILE_NAME} "${${arg_OUT_VAR_OUTPUT_FILE_NAME}}" PARENT_SCOPE)
endif()
if(arg_OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH)
set(${arg_OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH} "${${arg_OUT_VAR_OUTPUT_ABSOLUTE_FILE_PATH}}"
PARENT_SCOPE)
endif()
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} "${${arg_OUT_VAR_DEPS_FOUND}}" PARENT_SCOPE)
endif()
endfunction()
function(qt_internal_sbom_verify_deps_for_generate_tag_value_spdx_document)
_qt_internal_sbom_verify_deps_for_generate_tag_value_spdx_document(${ARGN})
set(opt_args "")
set(single_args
OUT_VAR_DEPS_FOUND
OUT_VAR_REASON_FAILURE_MESSAGE
)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 0 arg "${opt_args}" "${single_args}" "${multi_args}")
if(arg_OUT_VAR_DEPS_FOUND)
set(${arg_OUT_VAR_DEPS_FOUND} "${${arg_OUT_VAR_DEPS_FOUND}}" PARENT_SCOPE)
endif()
if(arg_OUT_VAR_REASON_FAILURE_MESSAGE)
set(${arg_OUT_VAR_REASON_FAILURE_MESSAGE}
"${${arg_OUT_VAR_REASON_FAILURE_MESSAGE}}" PARENT_SCOPE)
endif()
endfunction()
function(qt_internal_sbom_get_project_spdx_id out_var)
set(result "")
if(QT_GENERATE_SBOM)
get_cmake_property(project_spdx_id _qt_internal_sbom_project_spdx_id)
if(project_spdx_id)
set(result "${project_spdx_id}")
endif()
endif()
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(qt_internal_sbom_get_target_spdx_id target out_var)
set(result "")
if(QT_GENERATE_SBOM)
_qt_internal_sbom_get_spdx_id_for_target(${target} result)
endif()
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(qt_internal_sbom_get_external_document_ref_spdx_id project_name out_var)
set(result "")
if(QT_GENERATE_SBOM)
string(TOLOWER "${project_name}" project_name_lowercase)
_qt_internal_sbom_get_external_document_ref_spdx_id("${project_name_lowercase}" result)
endif()
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
macro(qt_internal_sbom_get_git_version_vars)
_qt_internal_sbom_get_git_version_vars()
endmacro()
function(qt_internal_sbom_get_project_supplier out_var)
get_property(result GLOBAL PROPERTY _qt_sbom_project_supplier)
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(qt_internal_sbom_get_project_supplier_url out_var)
get_property(result GLOBAL PROPERTY _qt_sbom_project_supplier_url)
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(qt_internal_sbom_get_project_namespace out_var)
get_property(result GLOBAL PROPERTY _qt_sbom_project_namespace)
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(qt_internal_sbom_compute_project_namespace out_var)
_qt_internal_sbom_compute_project_namespace(result ${ARGN})
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(qt_internal_sbom_compute_project_file_name out_var)
_qt_internal_sbom_compute_project_file_name(result ${ARGN})
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
function(qt_internal_sbom_get_sanitized_spdx_id out_var hint)
_qt_internal_sbom_get_sanitized_spdx_id(result "${hint}")
set(${out_var} "${result}" PARENT_SCOPE)
endfunction()
# Gets a list of default sbom args to use when processing qt entity types.
function(qt_internal_sbom_get_default_sbom_args target out_var)
_qt_internal_get_sbom_add_target_options(opt_args single_args multi_args)
list(APPEND opt_args IMMEDIATE_FINALIZATION)
cmake_parse_arguments(PARSE_ARGV 2 arg "${opt_args}" "${single_args}" "${multi_args}")
_qt_internal_validate_all_args_are_parsed(arg)
set(sbom_args "")
list(APPEND sbom_args USE_ATTRIBUTION_FILES)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_PACKAGE_VERSION)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_SUPPLIER)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_DOWNLOAD_LOCATION)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_LICENSE)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_COPYRIGHTS)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_CPE)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_TYPE_PURL)
list(APPEND sbom_args __QT_INTERNAL_HANDLE_QT_ENTITY_ATTRIBUTION_FILES)
set(${out_var} "${sbom_args}" PARENT_SCOPE)
endfunction()
function(qt_internal_extend_qt_entity_sbom target)
qt_internal_sbom_get_default_sbom_args("${target}" sbom_extra_args ${ARGN})
_qt_internal_extend_sbom(${target} ${ARGN} ${sbom_extra_args})
endfunction()

View File

@ -270,7 +270,7 @@ function(qt_enable_separate_debug_info target installDestination)
if(QNX)
set(debug_info_suffix sym)
set(debug_info_keep --keep-file-symbols)
set(strip_args "--strip-debug -R.ident")
set(strip_args --strip-debug -R.ident)
else()
set(debug_info_suffix debug)
set(debug_info_keep --only-keep-debug)

View File

@ -6,7 +6,11 @@
# QT_REPO_PUBLIC_NAMESPACE_REGEX cache variable, that can be set by repository in .cmake.conf file.
# The variable tells the syncqt program, what namespaces are treated as public. Symbols in public
# namespaces are considered when generating CaMeL case header files.
function(qt_internal_target_sync_headers target module_headers module_headers_generated)
function(qt_internal_target_sync_headers target
module_headers
module_headers_generated
module_headers_exclude_from_docs
)
if(NOT TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::syncqt)
message(FATAL_ERROR "${QT_CMAKE_EXPORT_NAMESPACE}::syncqt is not a target.")
endif()
@ -80,6 +84,13 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
# std::filesystem API
get_filename_component(source_dir_real "${sync_source_directory}" REALPATH)
get_filename_component(binary_dir_real "${CMAKE_CURRENT_BINARY_DIR}" REALPATH)
if(QT6_INSTALL_PREFIX)
get_filename_component(install_dir_real "${QT6_INSTALL_PREFIX}" REALPATH)
set(install_include_dir_argument
-installIncludeDir "${install_dir_real}/${QT6_INSTALL_HEADERS}")
else()
set(install_include_dir_argument "")
endif()
if(QT_REPO_PUBLIC_NAMESPACE_REGEX)
set(public_namespaces_filter -publicNamespaceFilter "${QT_REPO_PUBLIC_NAMESPACE_REGEX}")
@ -109,6 +120,7 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
-binaryDir "${binary_dir_real}"
-privateHeadersFilter "${private_filter_regex}"
-includeDir "${module_build_interface_include_dir}"
${install_include_dir_argument}
-privateIncludeDir "${module_build_interface_private_include_dir}"
-qpaIncludeDir "${module_build_interface_qpa_include_dir}"
-rhiIncludeDir "${module_build_interface_rhi_include_dir}"
@ -146,6 +158,13 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
list(FILTER module_headers EXCLUDE REGEX
"(.+/(ui_)[^/]+\\.h|${CMAKE_CURRENT_SOURCE_DIR}(/.+)?/doc/+\\.h)")
# Filter out all headers that should be excluded from documentation generation.
# Documentation generation shouldn't depend on headers like the dbus-generated ones.
set(module_headers_for_docs "${module_headers}")
if(module_headers_exclude_from_docs)
list(REMOVE_ITEM module_headers_for_docs ${module_headers_exclude_from_docs})
endif()
set(syncqt_staging_dir "${module_build_interface_include_dir}/.syncqt_staging")
set(syncqt_args "${common_syncqt_arguments}")
@ -225,10 +244,16 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
"@${syncqt_all_args_rsp}"
${external_headers_dir_copy_cmd}
DEPENDS
${module_headers}
# Note, we don't depend anymore on ${target}_sync_headers so that we don't bring
# in the headers that are usually excluded from docs.
# This means if someone manually calls
# `ninja sync_all_public_headers Gui_sync_headers` it will cause havoc due to two
# syncqt calls accessing the same files concurrently. This is an edge case that should
# not happen, but it ends up happening, we will have to implement some kind of lock
# file mechanism.
${module_headers_for_docs}
${syncqt_all_args_rsp}
${QT_CMAKE_EXPORT_NAMESPACE}::syncqt
${target}_sync_headers
VERBATIM
)

View File

@ -148,6 +148,7 @@ function(qt_internal_extend_target target)
list(TRANSFORM arg_PUBLIC_LIBRARIES REPLACE "^Qt::" "${QT_CMAKE_EXPORT_NAMESPACE}::")
list(TRANSFORM arg_LIBRARIES REPLACE "^Qt::" "${QT_CMAKE_EXPORT_NAMESPACE}::")
qt_internal_wrap_private_modules(arg_LIBRARIES ${arg_LIBRARIES})
# Set-up the target
@ -231,6 +232,9 @@ function(qt_internal_extend_target target)
)
endif()
set(all_libraries ${arg_LIBRARIES} ${arg_PUBLIC_LIBRARIES})
qt_internal_work_around_autogen_discarded_dependencies(${target} ${all_libraries})
if(QT_GENERATE_SBOM)
set(sbom_args "")
_qt_internal_forward_function_args(
@ -257,6 +261,9 @@ function(qt_internal_extend_target target)
if(TARGET "${target_private}")
target_link_libraries("${target_private}"
INTERFACE ${arg_PRIVATE_MODULE_INTERFACE})
qt_internal_register_target_dependencies("${target_private}"
PUBLIC ${arg_PRIVATE_MODULE_INTERFACE}
)
elseif(arg_PRIVATE_MODULE_INTERFACE)
set(warning_message "")
string(APPEND warning_message
@ -266,10 +273,18 @@ function(qt_internal_extend_target target)
"Ensure the target exists or remove the option.")
message(AUTHOR_WARNING "${warning_message}")
endif()
qt_register_target_dependencies("${target}"
"${arg_PUBLIC_LIBRARIES};${arg_PRIVATE_MODULE_INTERFACE}"
"${qt_libs_private};${arg_LIBRARIES}")
set(qt_register_target_dependencies_args "")
if(arg_PUBLIC_LIBRARIES)
list(APPEND qt_register_target_dependencies_args
PUBLIC ${arg_PUBLIC_LIBRARIES})
endif()
if(qt_libs_private OR arg_LIBRARIES)
list(APPEND qt_register_target_dependencies_args
PRIVATE ${qt_libs_private} ${arg_LIBRARIES})
endif()
qt_internal_register_target_dependencies("${target}"
${qt_register_target_dependencies_args})
qt_autogen_tools(${target}
ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS}
@ -329,6 +344,43 @@ function(qt_internal_extend_target target)
endif()
endfunction()
# Takes an output variable and a list of libraries.
#
# Every library that is a private module is wrapped in $<BUILD_INTERFACE> or
# $<BUILD_LOCAL_INTERFACE> if CMake is new enough.
#
# This is necessary for static builds, because if Qt6Foo links to Qt6BarPrivate, this link
# dependency is purely internal. If we don't do this, CMake adds a target check for Qt6BarPrivate
# in Qt6FooTargets.cmake. This breaks if Qt6BarPrivate is not find_package'ed before.
function(qt_internal_wrap_private_modules out_var)
set(result "")
if(CMAKE_VERSION VERSION_LESS "3.26")
set(wrapper_genex "BUILD_INTERFACE")
else()
set(wrapper_genex "BUILD_LOCAL_INTERFACE")
endif()
foreach(lib IN LISTS ARGN)
if(TARGET "${lib}")
get_target_property(lib_is_private_module ${lib} _qt_is_private_module)
if(lib_is_private_module)
# Add the public module as non-wrapped link dependency. This is necessary for
# targets that link only to the private module. Consumers of this target would then
# get a linker error about missing symbols from that Qt module.
get_target_property(lib_public_module_target ${lib} _qt_public_module_target_name)
list(APPEND result "${INSTALL_CMAKE_NAMESPACE}::${lib_public_module_target}")
# Wrap the private module in BUILD_LOCAL_INTERFACE.
set(lib "$<${wrapper_genex}:${lib}>")
endif()
endif()
list(APPEND result "${lib}")
endforeach()
set("${out_var}" "${result}" PARENT_SCOPE)
endfunction()
# Given CMAKE_CONFIG and ALL_CMAKE_CONFIGS, determines if a directory suffix needs to be appended
# to each destination, and sets the computed install target destination arguments in OUT_VAR.
# Defaults used for each of the destination types, and can be configured per destination type.

View File

@ -232,6 +232,7 @@ function(qt_internal_get_test_arg_definitions optional_args single_value_args mu
QML_IMPORTPATH
TESTDATA
QT_TEST_SERVER_LIST
ANDROID_TESTRUNNER_PRE_TEST_ADB_COMMANDS
${__default_private_args}
${__default_public_args}
PARENT_SCOPE
@ -456,6 +457,8 @@ endfunction()
# The option forces adding the provided TESTDATA to resources.
# MANUAL
# The option indicates that the test is a manual test.
# ANDROID_TESTRUNNER_PRE_TEST_ADB_COMMANDS
# Passes --pre-test-adb-command <command> to androidTestRunner. Android specific argument.
function(qt_internal_add_test name)
qt_internal_get_test_arg_definitions(optional_args single_value_args multi_value_args)
@ -684,6 +687,13 @@ function(qt_internal_add_test name)
if(QT_ENABLE_VERBOSE_DEPLOYMENT OR build_environment STREQUAL "ci")
list(APPEND extra_test_args "--verbose")
endif()
if(arg_ANDROID_TESTRUNNER_PRE_TEST_ADB_COMMANDS)
foreach(command IN LISTS arg_ANDROID_TESTRUNNER_PRE_TEST_ADB_COMMANDS)
list(APPEND extra_test_args "--pre-test-adb-command" "${command}")
endforeach()
endif()
set(test_working_dir "${CMAKE_CURRENT_BINARY_DIR}")
elseif(QNX)
set(test_working_dir "")
@ -708,7 +718,11 @@ function(qt_internal_add_test name)
set(browser "chrome")
endif()
list(APPEND extra_test_args "--browser=${browser}")
list(APPEND extra_test_args "--browser_args=\"--password-store=basic\"")
if(DEFINED ENV{HEADLESS_CHROME_FOR_TESTING})
list(APPEND extra_test_args "--browser_args=\"--password-store=basic --headless\"")
else()
list(APPEND extra_test_args "--browser_args=\"--password-store=basic\"")
endif()
list(APPEND extra_test_args "--kill_exit")
# Tests may require asyncify if they use exec(). Enable asyncify for
@ -794,18 +808,10 @@ function(qt_internal_add_test name)
)
endif()
# Add a ${target}/check makefile target, to more easily test one test.
set(test_config_options "")
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
if(is_multi_config)
set(test_config_options -C $<CONFIG>)
endif()
add_custom_target("${testname}_check"
VERBATIM
COMMENT "Running ${CMAKE_CTEST_COMMAND} -V -R \"^${name}$\" ${test_config_options}"
COMMAND "${CMAKE_CTEST_COMMAND}" -V -R "^${name}$" ${test_config_options}
)
# Add a ${target}_check makefile target, to more easily test one test.
# TODO: Note in batch mode testname tests would execute all batched tests defined in name
_qt_internal_make_check_target(${testname} CTEST_TEST_NAME ${name})
# Add appropriate dependencies to the targets as needed
if(TARGET "${name}")
add_dependencies("${testname}_check" "${name}")
if(ANDROID)
@ -902,6 +908,20 @@ function(qt_internal_add_test name)
endif()
endif()
if(MACOS AND NOT CMAKE_GENERATOR STREQUAL "Xcode")
# Add com.apple.security.get-task-allow entitlement to each
# test binary, so we can hook into the Swift crash handling.
if(NOT arg_QMLTEST AND arg_SOURCES)
set(entitlements_file
"${__qt_internal_cmake_apple_support_files_path}/test.entitlements.plist")
add_custom_command(TARGET "${name}"
POST_BUILD COMMAND codesign --sign -
--entitlements "${entitlements_file}"
"$<TARGET_FILE:${name}>"
)
endif()
endif()
qt_internal_add_test_finalizers("${name}")
endfunction()

View File

@ -168,7 +168,10 @@ function(qt_internal_add_tool target_name)
APPEND PROPERTY
EXPORT_PROPERTIES "_qt_package_version")
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0" AND QT_FEATURE_debug_and_release)
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0"
AND QT_FEATURE_debug_and_release
AND is_multi_config)
set_property(TARGET "${target_name}"
PROPERTY EXCLUDE_FROM_ALL "$<NOT:$<CONFIG:${QT_MULTI_CONFIG_FIRST_CONFIG}>>")
endif()
@ -303,7 +306,7 @@ function(qt_internal_add_tool target_name)
${__qt_internal_sbom_multi_args}
)
_qt_internal_extend_sbom(${target_name} ${sbom_args})
qt_internal_extend_qt_entity_sbom(${target_name} ${sbom_args})
endif()
qt_add_list_file_finalizer(qt_internal_finalize_tool ${target_name})
@ -385,6 +388,7 @@ function(qt_export_tools module_name)
# List of package dependencies that need be find_package'd when using the Tools package.
set(package_deps "")
set(third_party_deps "")
# Additional cmake files to install
set(extra_cmake_files "")
@ -397,7 +401,15 @@ function(qt_export_tools module_name)
# e.g. qtwaylandscanner depends on WaylandScanner (non-qt package).
get_target_property(extra_packages "${tool_name}" QT_EXTRA_PACKAGE_DEPENDENCIES)
if(extra_packages)
list(APPEND package_deps "${extra_packages}")
foreach(third_party_dep IN LISTS extra_packages)
list(GET third_party_dep 0 third_party_dep_name)
list(GET third_party_dep 1 third_party_dep_version)
# Assume that all tool thirdparty deps are mandatory.
# TODO: Components are not supported
list(APPEND third_party_deps
"${third_party_dep_name}\\\;FALSE\\\;${third_party_dep_version}\\\;\\\;")
endforeach()
endif()
get_target_property(_extra_cmake_files "${tool_name}" EXTRA_CMAKE_FILES)
@ -700,14 +712,14 @@ function(qt_internal_find_tool out_var target_name tools_target)
set(${tools_package_name}_BACKUP_CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH}")
if(QT_HOST_PATH_CMAKE_DIR)
set(qt_host_path_cmake_dir_absolute "${QT_HOST_PATH_CMAKE_DIR}")
elseif(Qt${PROJECT_VERSION_MAJOR}HostInfo_DIR)
elseif(${INSTALL_CMAKE_NAMESPACE}HostInfo_DIR)
get_filename_component(qt_host_path_cmake_dir_absolute
"${Qt${PROJECT_VERSION_MAJOR}HostInfo_DIR}/.." ABSOLUTE)
"${${INSTALL_CMAKE_NAMESPACE}HostInfo_DIR}/.." ABSOLUTE)
else()
# This should never happen, serves as an assert.
message(FATAL_ERROR
"Neither QT_HOST_PATH_CMAKE_DIR nor "
"Qt${PROJECT_VERSION_MAJOR}HostInfo_DIR available.")
"${INSTALL_CMAKE_NAMESPACE}HostInfo_DIR available.")
endif()
set(CMAKE_PREFIX_PATH "${qt_host_path_cmake_dir_absolute}")

View File

@ -7,10 +7,10 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
target_link_options("${wasmTarget}" INTERFACE
"SHELL:-s MAX_WEBGL_VERSION=2"
"SHELL:-s FETCH=1"
"SHELL:-s WASM_BIGINT=1"
"SHELL:-s STACK_SIZE=5MB")
set(executable_link_flags "-sFETCH")
## wasm64
if (WASM64)
target_compile_options("${wasmTarget}" INTERFACE "SHELL:-s MEMORY64=1" )
@ -99,7 +99,7 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
set(enable_side_module_if_needed
"$<$<IN_LIST:$<TARGET_PROPERTY:TYPE>,${side_modules}>:SHELL:-s SIDE_MODULE=1>")
set(enable_main_module_if_needed
"$<$<IN_LIST:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:SHELL:-s MAIN_MODULE=1>")
"$<$<IN_LIST:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:SHELL:-sMAIN_MODULE=1 ${executable_link_flags}>")
set(set_shared_module_type_if_needed
"${enable_side_module_if_needed}"
"${enable_main_module_if_needed}"
@ -115,7 +115,7 @@ function (qt_internal_setup_wasm_target_properties wasmTarget)
target_link_options("${wasmTarget}" INTERFACE "${set_shared_module_type_if_needed}")
else()
target_link_options("${wasmTarget}" INTERFACE "SHELL:-s ERROR_ON_UNDEFINED_SYMBOLS=1")
target_link_options("${wasmTarget}" INTERFACE "SHELL:-sERROR_ON_UNDEFINED_SYMBOLS=1 ${executable_link_flags}")
endif()
# Suppress warnings for known issues for developer builds

View File

@ -8,7 +8,7 @@ function(qt_internal_check_msvc_versions)
set(min_msvc_version "1930")
if(MSVC_VERSION VERSION_LESS min_msvc_version)
message(FATAL_ERROR
"Qt requires at least Visual Studio 2019 (MSVC ${min_msvc_version} or newer), "
"Qt requires at least Visual Studio 2022 (MSVC ${min_msvc_version} or newer), "
"you're building against version ${MSVC_VERSION}. "
"You can turn off this version check by setting QT_NO_MSVC_MIN_VERSION_CHECK to ON."
)

View File

@ -50,6 +50,7 @@ The following table describes the mapping of configure options to CMake argument
| -sbom-json-required | -DQT_SBOM_REQUIRE_GENERATE_JSON=ON | Fails the build if Python deps are not found |
| -sbom-verify | -DQT_SBOM_VERIFY=ON | Enables verification of generated SBOMs |
| -sbom-verify-required | -DQT_SBOM_REQUIRE_VERIFY=ON | Fails the build if Python deps are not found |
| -sbomdir <dir> | -DINSTALL_SBOMDIR=<dir> | Installation location of SBOM files. |
| -qtinlinenamespace | -DQT_INLINE_NAMESPACE=ON | Make the namespace specified by -qtnamespace an inline one. |
| -qtnamespace <name> | -DQT_NAMESPACE=<name> | |
| -qtlibinfix <infix> | -DQT_LIBINFIX=<infix> | |
@ -57,8 +58,10 @@ The following table describes the mapping of configure options to CMake argument
| -gcov | -DINPUT_coverage=gcov | Enables code coverage using the gcov tool. |
| -trace [backend] | -DINPUT_trace=yes or -DINPUT_trace=<backend> | |
| | or -DFEATURE_<backend> | |
| -sanitize address -sanitize undefined | -DFEATURE_sanitize_address=ON | Directly setting -DECM_ENABLE_SANITIZERS=foo is not supported |
| | -DFEATURE_sanitize_undefined=ON | |
| -sanitize address | -DFEATURE_sanitize_address=ON | Directly setting -DECM_ENABLE_SANITIZERS=foo is not supported |
| -sanitize undefined | -DFEATURE_sanitize_undefined=ON | See above. |
| -sanitize thread | -DFEATURE_sanitize_thread=ON | See above. |
| -sanitize memory | -DFEATURE_sanitize_memory=ON | See above. |
| -c++std c++20 | -DFEATURE_cxx20=ON | |
| -sse2/-sse3/-ssse3/-sse4.1 | -DFEATURE_sse4=ON | |
| -mips_dsp/-mips_dspr2 | -DFEATURE_mips_dsp=ON | |

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.get-task-allow</key>
<true/>
</dict>
</plist>

View File

@ -52,8 +52,8 @@ if(QT_USE_VCPKG OR (NOT DEFINED QT_USE_VCPKG AND __qt_initially_configured_use_v
)
endif()
if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE AND QT_CHAINLOAD_TOOLCHAIN_FILE)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${QT_CHAINLOAD_TOOLCHAIN_FILE}" CACHE STRING "")
if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE AND __qt_chainload_toolchain_file)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${__qt_chainload_toolchain_file}" CACHE STRING "")
endif()
set(__qt_chainload_toolchain_file "${__qt_vcpkg_toolchain_file}")

View File

@ -21,8 +21,8 @@ instructions:
variableValue: " {{.SourceDir}}/coin_qnx_qemu_runner.sh"
enable_if:
condition: property
property: target.osVersion
in_values: [QNX_710]
property: target.os
equals_value: QNX
- type: AppendToEnvironmentVariable
variableName: TESTRUNNER
variableValue: " {{.AgentWorkingDir}}/coin_vxworks_qemu_runner.sh"
@ -141,6 +141,16 @@ instructions:
maxTimeBetweenOutput: 14400
userMessageOnFailure: >
Failed to run tests.
- type: ExecuteCommand
command: >
cmake -E copy
Testing{{.Env.CI_PATH_SEP}}Temporary{{.Env.CI_PATH_SEP}}LastTest.log
{{.Env.COIN_CTEST_RESULTSDIR}}{{.Env.CI_PATH_SEP}}CTest.log
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
ignoreExitCode: false
userMessageOnFailure: >
Failed to copy LastTest.log to testresults directory.
executeOn: always
- type: Group
enable_if:
condition: runtime
@ -155,16 +165,13 @@ instructions:
maxTimeBetweenOutput: 14400
userMessageOnFailure: >
Failed to run tests.
- type: Group
instructions:
- type: ExecuteCommand
command: >
cmake -E copy
Testing{{.Env.CI_PATH_SEP}}Temporary{{.Env.CI_PATH_SEP}}LastTest.log
{{.Env.COIN_CTEST_RESULTSDIR}}{{.Env.CI_PATH_SEP}}CTest.log
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
ignoreExitCode: false
ignoreExitCode: true
userMessageOnFailure: >
Failed to copy LastTest.log to testresults directory.
executeOn: always

View File

@ -18,7 +18,7 @@ instructions:
equals_property: target.os
- condition: property
property: target.osVersion
not_in_values: [QEMU, QNX_710, VxWorks]
not_in_values: [QEMU, QNX_710, QNX_800, VxWorks]
- type: Group
instructions:
- type: EnvironmentVariable
@ -32,7 +32,7 @@ instructions:
equals_property: target.os
- condition: property
property: target.osVersion
not_in_values: [QEMU, QNX_710, VxWorks]
not_in_values: [QEMU, QNX_710, QNX_800, VxWorks]
- type: Group
instructions:
- !include "{{qt/qtbase}}/cmake_setup_running_qnxqemu_tests_env_vars.yaml"
@ -40,8 +40,8 @@ instructions:
condition: and
conditions:
- condition: property
property: target.osVersion
equals_value: QNX_710
property: target.os
equals_value: QNX
- condition: property
property: features
not_contains_value: DisableTests

View File

@ -1,6 +1,7 @@
type: Group
instructions:
- !include "{{qt/qtbase}}/prepare_building_env.yaml"
- !include "{{qt/qtbase}}/prepare_source_sbom_check.yaml"
- type: Group
instructions:
- type: Group
@ -54,19 +55,13 @@ instructions:
- type: Group
instructions:
- !include "{{qt/qtbase}}/cmake_cross_compilation_module_build_instructions.yaml"
- type: Group
instructions:
- !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts_target.yaml"
enable_if:
condition: property
property: target.osVersion
in_values: [Android_ANY, QEMU, IOS_ANY, QNX_710, WebAssembly, INTEGRITY, VxWorks]
- !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts_target.yaml"
enable_if:
condition: or
conditions:
- condition: property
property: target.osVersion
in_values: [Android_ANY, QEMU, IOS_ANY, QNX_710, WebAssembly, INTEGRITY, VxWorks]
in_values: [Android_ANY, QEMU, IOS_ANY, QNX_710, QNX_800, WebAssembly, INTEGRITY, VxWorks]
- condition: and
conditions:
- condition: property

View File

@ -73,8 +73,8 @@ instructions:
condition: and
conditions:
- condition: property
property: target.osVersion
equals_value: QNX_710
property: target.os
equals_value: QNX
- condition: property
property: features
not_contains_value: DisableTests

View File

@ -24,7 +24,7 @@ instructions:
equals_property: target.os
- condition: property
property: target.osVersion
in_values: [QEMU, QNX_710]
in_values: [QEMU, QNX_710, QNX_800]
disable_if:
condition: or
conditions:

View File

@ -22,7 +22,7 @@ instructions:
equals_property: target.os
- condition: property
property: target.osVersion
in_values: [QEMU, QNX_710, IOS_ANY]
in_values: [QEMU, QNX_710, QNX_800, IOS_ANY]
- condition: property
property: features
contains_value: AndroidTestRun

View File

@ -1,6 +1,7 @@
type: Group
instructions:
- !include "{{qt/qtbase}}/prepare_building_env.yaml"
- !include "{{qt/qtbase}}/prepare_source_sbom_check.yaml"
- type: Group
instructions:
- !include "{{qt/qtbase}}/cmake_qtbase_build_instructions.yaml"
@ -45,19 +46,13 @@ instructions:
property: target.arch
equals_value: Multi
- !include "{{qt/qtbase}}/prepare_android_multi_abi_env.yaml"
- type: Group
instructions:
- !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts_target.yaml"
enable_if:
condition: property
property: target.osVersion
in_values: [Android_ANY, QEMU, IOS_ANY, QNX_710, WebAssembly, INTEGRITY, VxWorks]
- !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts_target.yaml"
enable_if:
condition: or
conditions:
- condition: property
property: target.osVersion
in_values: [Android_ANY, QEMU, IOS_ANY, QNX_710, WebAssembly, INTEGRITY, VxWorks]
in_values: [Android_ANY, QEMU, IOS_ANY, QNX_710, QNX_800, WebAssembly, INTEGRITY, VxWorks]
- condition: and
conditions:
- condition: property

View File

@ -369,6 +369,22 @@ instructions:
variableValue: "{{.Env.VXWORKS_HOME}}/wrenv.linux"
# QNX variables
- type: EnvironmentVariable
variableName: QNX_ACTIVE
variableValue: "{{.Env.QNX_710}}"
enable_if:
condition: property
property: target.osVersion
equals_value: QNX_710
- type: EnvironmentVariable
variableName: QNX_ACTIVE
variableValue: "{{.Env.QNX_800}}"
enable_if:
condition: property
property: target.osVersion
equals_value: QNX_800
- type: Group
enable_if:
condition: and
@ -380,63 +396,45 @@ instructions:
property: target.os
equals_value: QNX
instructions:
- type: EnvironmentVariable
variableName: QNX_TARGET
variableValue: "{{.Env.QNX_710}}/target/qnx7"
- type: EnvironmentVariable
variableName: QNX_CONFIGURATION_EXCLUSIVE
variableValue: "{{.Env.HOME}}/.qnx"
- type: EnvironmentVariable
variableName: QNX_CONFIGURATION
variableValue: "{{.Env.HOME}}/.qnx"
- type: PrependToEnvironmentVariable
variableName: PATH
variableValue: "{{.Env.QNX_710}}/host/linux/x86_64/usr/bin:"
- type: PrependToEnvironmentVariable
variableName: PATH
variableValue: "{{.Env.QNX_710}}/host/common/bin:"
- type: PrependToEnvironmentVariable
variableName: PATH
variableValue: "{{.Env.HOME}}/.qnx:"
- type: EnvironmentVariable
variableName: QNX_HOST
variableValue: "{{.Env.QNX_710}}/host/linux/x86_64"
- type: AppendToEnvironmentVariable
variableName: PATH
variableValue: ":{{.Env.QEMUARMV7_TOOLCHAIN_SYSROOT}}/../x86_64-pokysdk-linux/usr/bin:"
- type: EnvironmentVariable
variableName: QNX_TARGET
variableValue: "{{.Env.QNX_ACTIVE}}/target/qnx7"
- type: PrependToEnvironmentVariable
variableName: PATH
variableValue: "{{.Env.QNX_ACTIVE}}/host/linux/x86_64/usr/bin:"
- type: PrependToEnvironmentVariable
variableName: PATH
variableValue: "{{.Env.QNX_ACTIVE}}/host/common/bin:"
- type: EnvironmentVariable
variableName: QNX_HOST
variableValue: "{{.Env.QNX_ACTIVE}}/host/linux/x86_64"
- type: Group
- type: SetEnvironmentFromScript
command: "{{.Env.QNX_ACTIVE}}\\qnxsdp-env.bat"
userMessageOnFailure: "Failed to set QNX environment"
maxTimeInSeconds: 60
maxTimeBetweenOutput: 60
enable_if:
condition: and
conditions:
- condition: property
property: host.os
equals_value: Windows
property: target.osVersion
contains_value: QNX
- condition: property
property: target.os
equals_value: QNX
instructions:
- type: EnvironmentVariable
variableName: QNX_TARGET
variableValue: "{{.Env.QNX_710_CMAKE}}/target/qnx7"
- type: EnvironmentVariable
variableName: QNX_CONFIGURATION_EXCLUSIVE
variableValue: "{{.Env.HOMEPATH}}\\.qnx"
- type: EnvironmentVariable
variableName: QNX_CONFIGURATION
variableValue: "{{.Env.HOMEPATH}}\\.qnx"
- type: PrependToEnvironmentVariable
variableName: PATH
variableValue: "{{.Env.QNX_710}}\\host\\win64\\x86_64\\usr\\bin;"
- type: PrependToEnvironmentVariable
variableName: PATH
variableValue: "{{.Env.QNX_710}}\\host\\common\\bin;"
- type: PrependToEnvironmentVariable
variableName: PATH
variableValue: "{{.Env.HOMEPATH}}\\.qnx;"
- type: EnvironmentVariable
variableName: QNX_HOST
variableValue: "{{.Env.QNX_710}}\\host\\win64\\x86_64"
property: host.os
contains_value: Windows
# Enable warnings are errors
- type: Group

View File

@ -0,0 +1,47 @@
type: Group
instructions:
- type: ChangeDirectory
directory: "{{.AgentWorkingDir}}"
- type: EnvironmentVariable
variableName: QTQA_LICHECK_BRANCH
variableValue: "{{ slice .Env.TESTED_MODULE_BRANCH_COIN 5 }}"
enable_if:
condition: runtime
env_var: TESTED_MODULE_BRANCH_COIN
contains_value: "tqtc/"
- type: EnvironmentVariable
variableName: QTQA_LICHECK_BRANCH
variableValue: "{{ .Env.TESTED_MODULE_BRANCH_COIN }}"
disable_if:
condition: runtime
env_var: TESTED_MODULE_BRANCH_COIN
contains_value: "tqtc/"
# The command must not have whitespace directly after any piping,
# as whitespace directly after pipes will be interpreted as part of the command.
- type: ExecuteCommand
command: ["bash", "-c", "git clone --depth=1 -b {{ .Env.QTQA_LICHECK_BRANCH }} git://{{.Env.QT_COIN_GIT_DAEMON}}/qt-project/qt/qtqa qt/qtqa-latest ||git clone --depth=1 -b dev git://{{.Env.QT_COIN_GIT_DAEMON}}/qt-project/qt/qtqa qt/qtqa-latest"]
maxTimeInSeconds: 600
maxTimeBetweenOutput: 600
userMessageOnFailure: >
Failed to clone qtqa sources. Please investigate why.
disable_if:
condition: property
property: host.os
equals_value: Windows
- type: ExecuteCommand
command: ["cmd.exe", "/C", "git clone --depth=1 -b {{ .Env.QTQA_LICHECK_BRANCH }} git://{{.Env.QT_COIN_GIT_DAEMON}}/qt-project/qt/qtqa qt/qtqa-latest ||git clone --depth=1 -b dev git://{{.Env.QT_COIN_GIT_DAEMON}}/qt-project/qt/qtqa qt/qtqa-latest"]
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
maxTimeInSeconds: 600
maxTimeBetweenOutput: 600
userMessageOnFailure: >
Failed to clone qtqa sources. Please investigate why.
enable_if:
condition: property
property: host.os
equals_value: Windows
- type: EnvironmentVariable
variableName: QT_MODULE_TO_TEST
variableValue: "{{.SourceDir}}"
userMessageOnFailure: >
Failed to set QT_MODULE_TO_TEST environment variable. This should not happen.

View File

@ -0,0 +1,52 @@
type: Group
instructions:
# need qemu toolchains update to have perl script verifying source SBOM
- type: Group
instructions:
- type: EnvironmentVariable
variableName: VERIFY_SOURCE_SBOM
variableValue: "OFF"
enable_if:
condition: and
conditions:
- condition: property
property: host.os
equals_value: Linux
- condition: property
property: target.arch
equals_value: MIPS64
- type: Group
instructions:
- type: EnvironmentVariable
variableName: VERIFY_SOURCE_SBOM
variableValue: "OFF"
enable_if:
condition: and
conditions:
- condition: property
property: host.os
equals_value: Windows
- condition: property
property: target.arch
equals_value: AARCH64
- type: Group
instructions:
- !include "{{qt/qtbase}}/prepare_license_test.yaml"
- type: Group
instructions:
- type: EnvironmentVariable
variableName: QT_QA_LICENSE_TEST_DIR
variableValue: "{{.AgentWorkingDir}}"
- type: EnvironmentVariable
variableName: QT_SOURCE_SBOM_TEST_SCRIPT
variableValue: "qt{{.Env.CI_PATH_SEP}}qtqa-latest{{.Env.CI_PATH_SEP}}tests{{.Env.CI_PATH_SEP}}prebuild{{.Env.CI_PATH_SEP}}license{{.Env.CI_PATH_SEP}}tst_licenses.pl"
userMessageOnFailure: >
Failed to set QT_SOURCE_SBOM_TEST_SCRIPT environment variable. This should not happen.
enable_if:
condition: property
property: features
contains_value: GenerateSBOM

View File

@ -1,35 +1,6 @@
type: Group
instructions:
- type: ChangeDirectory
directory: "{{.AgentWorkingDir}}"
- type: EnvironmentVariable
variableName: QTQA_LICHECK_BRANCH
variableValue: "{{ slice .Env.TESTED_MODULE_BRANCH_COIN 5 }}"
enable_if:
condition: runtime
env_var: TESTED_MODULE_BRANCH_COIN
contains_value: "tqtc/"
- type: EnvironmentVariable
variableName: QTQA_LICHECK_BRANCH
variableValue: "{{ .Env.TESTED_MODULE_BRANCH_COIN }}"
disable_if:
condition: runtime
env_var: TESTED_MODULE_BRANCH_COIN
contains_value: "tqtc/"
# The command must not have whitespace directly after any piping,
# as whitespace directly after pipes will be interpreted as part of the command.
- type: ExecuteCommand
command: ["bash", "-c", "git clone --depth=1 -b {{ .Env.QTQA_LICHECK_BRANCH }} git://{{.Env.QT_COIN_GIT_DAEMON}}/qt-project/qt/qtqa qt/qtqa-latest ||git clone --depth=1 -b dev git://{{.Env.QT_COIN_GIT_DAEMON}}/qt-project/qt/qtqa qt/qtqa-latest"]
maxTimeInSeconds: 600
maxTimeBetweenOutput: 600
userMessageOnFailure: >
Failed to clone qtqa sources. Please investigate why.
- type: EnvironmentVariable
variableName: QT_MODULE_TO_TEST
variableValue: "{{.SourceDir}}"
userMessageOnFailure: >
Failed to set QT_MODULE_TO_TEST environment variable. This should not happen.
- !include "{{qt/qtbase}}/prepare_license_test.yaml"
- type: ExecuteCommand
command: perl qt/qtqa-latest/tests/prebuild/license/tst_licenses.pl
maxTimeInSeconds: 7200

View File

@ -10,7 +10,7 @@ instructions:
testdir="$(dirname $1)"
testexecutable="$1"
echo RUNNING via serial: "$quoted_args"
echo "cmd rtp exec -p 200 -t 0x01000000 -u 1000000 $testexecutable -- $quoted_args" > /home/qt/work/vx.sh
echo "cmd rtp exec -p 200 -t 0x01000000 -u 0x1000000 $testexecutable -- $quoted_args" > /home/qt/work/vx.sh
echo "cmd echo \"qtest_in_vxworks_complete: $?\"" >> /home/qt/work/vx.sh
#rtp exec Execute a process.
# -p : specify the initial task priority
@ -22,11 +22,17 @@ instructions:
# qtest_in_vxworks_complete echo is used to detect test process completion as it will
# be echoed after test process ends normally or crashes when normal log lines are not present.
# Check that emulator is functioning
echo "cmd echo \"health check\"" > /tmp/guest.in
sleep 0.5
read -t 5 echoline</tmp/guest.out
read -t 1 testline</tmp/guest.out
( echo "cmd echo \"health check\"" > /tmp/guest.in ) & pid=$!
( sleep 5 && kill -HUP $pid ) 2>/dev/null & watcher=$!
wait $pid 2>/dev/null && pkill -HUP -P $watcher
if [[ "$?" -eq "0" ]]; then
read -t 5 echoline</tmp/guest.out
read -t 1 testline</tmp/guest.out
fi
if [[ -z "$testline" ]]; then
echo "Restarting stuck emulator"
pkill qemu-system
@ -58,4 +64,16 @@ instructions:
exitcode=$(echo "$line" | sed -nr 's/qtest_in_vxworks_complete: (-?[0-9]+)/\1/gp' | tr -d '\r')
exit $exitcode
fi
# Handle crashes
if echo "$line" | /usr/bin/grep -qE "(SIGSEGV)|(SIGABRT)|(S_rtpLib_[A-Z_]+)"
then
# Empty output pipe
while read -t 1 line; do
echo $line
done < /tmp/guest.out
echo "Test crashed"
pkill qemu-system # Kill emulator to force restart on next test start
exit 1
fi
done < /tmp/guest.out

View File

@ -1,4 +1,5 @@
version: 2
tags: [git]
accept_configuration:
condition: property
property: features
@ -11,7 +12,11 @@ machine_type:
cores: 4
instructions:
Build:
- type: EnvironmentVariable
variableName: VERIFY_SOURCE_SBOM
variableValue: "ON"
- !include "{{qt/qtbase}}/coin_qtbase_build_template_v2.yaml"
Test:

Some files were not shown because too many files have changed in this diff Show More