71023 Commits

Author SHA1 Message Date
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>
v6.9.0-beta3
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