70403 Commits

Author SHA1 Message Date
Thiago Macieira
d0787745aa 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.

Change-Id: Ieb80c6571213dddc518bfffdb6c86632df8f932c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 4216ba7c37dbdf67bfb5dc793d01a232ce4ea762)
(cherry picked from commit 22dd10e261c1c9ab46a8bfe99f574bae1c6c01e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-18 23:23:15 +00:00
Marc Mutz
9a6b7641e8 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.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>
(cherry picked from commit df8f7becfc38ad6441a7f409525c2becc1e3bf93)
2025-04-18 23:23:15 +00:00
Alexey Edelev
6d6d76f9cf 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.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>
(cherry picked from commit 4ea5f55aed0b66d266d9efa895d7bc8fe6d59f5f)
2025-04-18 20:22:53 +00:00
Marc Mutz
a99b78bf51 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).

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>
(cherry picked from commit da619f9e0b855d1c4b72820ed304ae8229f76829)
2025-04-18 17:41:13 +00:00
Marc Mutz
dd934d675a 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.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>
(cherry picked from commit f98c49666a518df3ac182e1f4920b581d1a6bda7)
2025-04-18 17:41:10 +00:00
Marc Mutz
45e8c81c52 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.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>
(cherry picked from commit 4b20e23ed7a7c32b6557e526bf88804c48ac8325)
2025-04-18 17:41:08 +00:00
Kai Uwe Broulik
61943ea3e7 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.

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>
(cherry picked from commit 9909c896770c844004f14e520db6122ddc2f48a7)
2025-04-17 11:34:32 +00:00
Shawn Rutledge
ecff73ccaa 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.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>
(cherry picked from commit 4f89fbc9a9e6a83c02e7e425a206db4e105df6aa)
2025-04-17 11:34:30 +00:00
Volker Hilsheimer
e8d28ae006 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
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>
(cherry picked from commit c78963023a4a200a298489648a4e6019400c073c)
2025-04-17 11:34:27 +00:00
Volker Hilsheimer
e2beffe6f5 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).

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>
(cherry picked from commit c9ba8760deec4b2f5c245e9120d59b622b383ceb)
2025-04-17 11:34:09 +00:00
Volker Hilsheimer
b93d9dc01a 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.

Change-Id: I6a3c73e971f1b9e10f5754018a1fa5941dca6172
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 920a490d659836785f03d51edc11da1711ade965)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit bc2f4ace0ea4d98847218a9e2d2633efeccd28e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-16 21:00:30 +02:00
Volker Hilsheimer
983bb1f225 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.

Conflict resolution in 6.8: adapt to usage of raw timer IDs,
as 5e36b9e929bb62a96cfe8d16bcc23d6a45d8294b is only in 6.9 and
later.

Fixes: QTBUG-135636
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>
(cherry picked from commit cb199ab2aabb57c2825a042ab398679f3804e940)
2025-04-16 21:00:30 +02:00
Giuseppe D'Angelo
23e902a4ac 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
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>
(cherry picked from commit 35c18eba64b6220e36ea14d32b911342e9d0921c)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-04-16 18:44:13 +02:00
Frédéric Lefebvre
e1e121d9b9 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.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>
(cherry picked from commit aa4511af9d26c773373e850c348ca9ff2704b07b)
2025-04-16 14:12:23 +00:00
Juha Vuolle
adb2ca107b Put qxmlstreamreader code behind its feature-flag
Missed feature guards from:
- QXmlStreamReaderPrivate class declaration

(Cherry-pick edit for 6.8: writeCurrentToken guards
already existed)

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>
(cherry picked from commit 3e67c1241a1915effd96d9c5b2d797f7a5d7df2a)
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2025-04-16 12:01:21 +03:00
Marc Mutz
05998caa38 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.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>
(cherry picked from commit 62f382f2711d3d48f63ce8f825dc3ac838c3f662)
2025-04-16 01:54:57 +00:00
David Faure
46d9b07dee 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.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>
(cherry picked from commit df454f51f884004c4e65386b690c565d60af3630)
2025-04-16 01:54:50 +00:00
Volker Hilsheimer
3eed9f2725 Blacklist tst_Android::orientationChange
The test fails almost daily.

Task-number: QTBUG-119205
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>
(cherry picked from commit d8fc1a6fa25cc1c769f216ec5952f940b22ae8da)
2025-04-16 01:53:29 +00:00
Alexandru Croitor
88f843e824 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.

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>
(cherry picked from commit 189d5ebbda7753df7fd363a5f457309521c957bc)
2025-04-15 03:16:03 +00:00
Edward Welbourne
eea6782ed6 Convert QTextStream internals to char16_t QChar::unicode()
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>
(cherry picked from commit f07a3e07d108650e3220d399f51f42fca086fd95)
2025-04-15 03:16:03 +00:00
Alexandru Croitor
e25aa58ee3 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.

Change-Id: Ic3895f74cfcac337bff069f8e6ec1517aec6c8d0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit c0f0a275b379b97f3ddccdaa9fd8aa8f10cf0adf)
(cherry picked from commit 3ce44b88e22891839820407e5e45df021f7a55e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-15 03:16:03 +00:00
Oliver Wolff
4b3fccb68e 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
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>
(cherry picked from commit 95f659aedab4c063d5bd3d8fdd10a9ca9c4f489d)
2025-04-15 03:16:02 +00:00
Alexey Edelev
a30cc31e8c [androidtestrunner] Add early return if AndroidManifest.xml is missing
Helps to debug deployment issues.

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>
(cherry picked from commit c971288a041529d263870b1cbe8d121e35f064c4)
2025-04-15 03:16:02 +00:00
Topi Reinio
284afd136d 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.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>
(cherry picked from commit 9520dc55a91c33632dfb92edd88d1b52efc39131)
2025-04-15 03:16:02 +00:00
Edward Welbourne
d8d9cf943f 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.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>
(cherry picked from commit dc3659f70fd1fdf945503dc9fefd92081797b951)
2025-04-15 03:16:02 +00:00
Edward Welbourne
0eb9b9523e 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.

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>
(cherry picked from commit d4f4cd2ef22cc4216950c0ba8d4e90a456c83f04)
2025-04-15 03:16:02 +00:00
Giuseppe D'Angelo
6bbc587932 Include <QTest>, not <QtTest>
Avoid module-wide inclusions for QtTest. The transitive inclusions
eat a considerable amount of compilation time.

Task-number: QTQAINFRA-7110
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>
(cherry picked from commit cb84d80c8a5a31dc6b1954ec84a732d29763203a)
2025-04-15 03:16:02 +00:00
Alexey Edelev
366def8f6b 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
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>
(cherry picked from commit 1f2f5ee08c5e8bf53bc2067bda1567aa0d3edec7)
2025-04-15 03:16:02 +00:00
Giuseppe D'Angelo
114a5a29f2 QProcessTask: include what you use
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>
(cherry picked from commit 304e4e5cc409724cf932706a466ec9c80c5d4fe6)
2025-04-15 03:16:02 +00:00
Joni Poikelin
cb856915d0 Call xcrun from PATH
The xcrun binary may be installed in a different location when cross
compiling to macOS using osxcross.

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>
(cherry picked from commit 14bfa63b4866178129292e9323669da2d94530e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-15 03:16:02 +00:00
Bartlomiej Moskal
ae2b30bda0 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

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>
(cherry picked from commit 95ea70197f967286b151028bf33263e23af8118c)
2025-04-15 03:16:02 +00:00
Mårten Nordheim
f981baf3dd 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
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>
(cherry picked from commit 55ea4ebe34caa82d939859e97e411b43975e0d6e)
2025-04-15 03:16:02 +00:00
David Faure
b3ee8cda10 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.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>
(cherry picked from commit 120a987544dc4d3824b02016dc837850b1fc8aef)
2025-04-15 03:16:02 +00:00
Robert Löhning
9878254088 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.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>
(cherry picked from commit 7a8baa2583d8a1dea01c82bb00ab78bb27390776)
2025-04-15 03:16:02 +00:00
Topi Reinio
e4eed41f6a Doc: Qt D-Bus: Add image alt texts
To increase accessibility for the documentation, provide altenative
descriptions for the images.

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>
(cherry picked from commit f4c1d51cae258559a00d4e929af1a11b6d304059)
2025-04-15 03:16:01 +00:00
Axel Spoerl
0902a10ba9 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.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>
(cherry picked from commit b7aae992470d3a9e7beb57e3bd66259bbed11a53)
2025-04-15 03:16:01 +00:00
Laszlo Agocs
a4a98a74ca rhi: d3d12: Avoid 1 sec timeout when skipping present
Follow the d3d11 change.

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>
(cherry picked from commit 7cd1dbce12b56afb35989292c96893c594f713bf)
2025-04-15 03:16:01 +00:00
Alexey Edelev
779dcc9a34 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).

Change-Id: I9bef2265210404113596db95085b6e0d5f03ae13
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 1c886724bcb70f706e2a729461e4f1ea88e27ae3)
(cherry picked from commit 78f4273b97a6eaf9d3722e60ad3c9385906126ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-04-15 03:16:01 +00:00
Edward Welbourne
2cc2618f9d 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.

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>
(cherry picked from commit b50bbd42694b24012e242c9bea0d0b2d96b6c5af)
2025-04-15 03:16:01 +00:00
David Faure
d91b032918 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.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>
(cherry picked from commit 854ef306beff3f336f90d0829d46183366deeaad)
2025-04-15 03:16:01 +00:00
Giuseppe D'Angelo
e0b4bf9483 Tests: include what you use (QElapsedTimer)
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>
(cherry picked from commit a101ffb700b8ed3331205831d764c16f952dfcad)
2025-04-15 03:16:01 +00:00
Ivan Solovev
9de391b4e9 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.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>
(cherry picked from commit f0dbb0906bcd8fea47bcf07f62d22972856da8cb)
2025-04-14 18:50:56 +00:00
Ivan Solovev
f58657efc4 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.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>
(cherry picked from commit ec8f043ec514d9556f5e8a1c98b99fa562e813a9)
2025-04-14 18:50:50 +00:00
Jarek Kobus
2eb2ae4cf4 TaskTree: Sync sources
Source sync Creator -> AssetDownloader.

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>
(cherry picked from commit cabdf3f94ab4973e1c6ac0d70ab196356ce44a32)
2025-04-14 18:50:48 +00:00
Axel Spoerl
aac28b280f 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.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>
(cherry picked from commit 5cafb9c760e6381b75e70d5c5f8328e5e62bef5e)
2025-04-14 18:50:47 +00:00
Frédéric Lefebvre
dbb9888a45 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.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>
(cherry picked from commit a40fdae4e7fa3c1734c92771bc5cf65e31ad8809)
2025-04-14 18:50:46 +00:00
Juha Vuolle
485f1aa118 Make autotests compile without draganddrop feature
Disable tst_qdrag test itself, and put proper feature
guards in tst_event test.

Fixes: QTBUG-135806
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>
(cherry picked from commit 1ae9914a32f557d15e74aec645e97f04e7f47fde)
2025-04-14 18:50:44 +00:00
Ivan Solovev
1568816715 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.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>
(cherry picked from commit adbb269eb9ee4cd01cc397b5691830906b07486c)
2025-04-14 18:50:43 +00:00
Laszlo Agocs
8105f7b9e9 rhi: d3d11: Fix not setting activeAdapter when importing
This was added as part of other work in 6.9. Create a dedicated
backport for 6.8.

Fixes: QTBUG-135112
Change-Id: I5eeb9b2ce2210116fa2a445fdaab7c5cab2d5328
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2025-04-14 15:11:47 +01:00
Christian Ehrlicher
e937243e4f 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.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>
(cherry picked from commit 62c1f8da1e4652d6dd2ac18f658397a6af7d06d4)
2025-04-14 16:11:43 +02:00