74548 Commits

Author SHA1 Message Date
Marc Mutz
532400a722 tst_QPointer: make capture compatible between C++17..23
Clang 19 -std=c++23 complained that ITERATIONS_PER_THREAD was
captured, but not used, so 668d81f73a5c2f4ec14764d1892f2eaf6494c0f1
dropped it, after making the variable constexpr.

Picking that change back to older branches, we found that MSVC
(14.29?) complains that it's _not_ captured anymore:

   tst_qpointer.cpp(491): error C3493: 'ITERATIONS_PER_THREAD' cannot be implicitly captured because no default capture mode has been specified

To appease both compilers, and cover the maximum range of C++ standard
editions, use implicit [&] capture, which should work everywhere.

Not picking to 6.5, because the cherry-pick of
668d81f73a5c2f4ec14764d1892f2eaf6494c0f1 already had to make that
change in order to pass CI.

Pick-to: 6.10 6.9 6.8
Change-Id: Iacbd53d3904608e8c9cd73edf31ba7924fd508e6
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2025-06-15 16:37:14 +00:00
Marc Mutz
6600a332c6 QScopeGuard: only include what you need
... not all of qglobal.h.

[ChangeLog][Potentially Source-Incompatible Changes][QtCore] The
qscopeguard.h header no longer includes qglobal.h, but only what it
itself needs. A backwards-compatible fix is to not depend on
transitive includes and include all you need explicitly.

Pick-to: 6.10
Change-Id: I257ae4cbd36d331e2fbda7fa238dcbc26a75647c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-06-15 16:37:06 +00:00
Frédéric Lefebvre
00750cd8ba Refactor tst_QScroller::overshoot
tst_QScroller::overshoot was initially a boilerplate, making it
difficult to understand what was actually being tested.

Refactor this test to be data-driven. Additionally, create a new test
function, overshoot_segments, which was part of
tst_QScroller::overshoot and should be tested independently.

Transfer the blacklisted platform of overshoot to overshoot_segments.

Change-Id: I59d89dfab4bb09c41fce99ad4f40163736c6ef78
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-06-15 17:44:06 +02:00
Matthias Rauter
bb48dbb113 Add conversion from QUtf8StringView to std::u8string_view
Writing the tests for QUtf8StringView showed that this conversation does
not work if the underlying storage_type is not char8_t. This is
something a user rightfully expects from our library and we therefore
added an explicit conversion operator for it.

[ChangeLog][QtCore][QUtf8StringView] Added std::u8string_view operator
if compiled with C++20.

Pick-to: 6.10
Change-Id: Ia80507bdd76686bee16a40745be064e9bdfef130
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-06-15 09:35:08 +00:00
Christian Ehrlicher
cfd52c5c5f QStyleSheetStyle: replace c arrays with std::array
Replace some c-arrays with std::array<> for easier handling.

Pick-to: 6.10 6.9
Change-Id: I34766a2aad603d83187515626982adc976667d48
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-06-14 16:55:46 +00:00
Axel Spoerl
3416d28c8b QWindowsScreenManager::removeScreen() - don't leave stale screen behind
QWindowsScreenManager::removeScreen() read an element from m_screens
and removed it. If the removed screen was not the primary screen,
QWindowSystemInterface::flushWindowSystemEvents() is called.

When removeScreen() is called from handleScreenChanges() in the same
class, flushing window events can lead to a re-entry. That is e.g. the
case when a RDP connection is closed and the server removes the virtual
screen.

QWindowScreenManager::removeScreen() removes the platform screen only
at the very end, which means that m_screens contains a stale pointer.
The re-entry can therefore crash with a double delete.

Take the platform screen at the beginning of the method, to make it
safe for re-entry.

Fixes: QTBUG-135337
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Id18a6fb3e72922bcdb62c9e79857b6bb713c0c1b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
2025-06-14 17:51:17 +02:00
Marc Mutz
e45916fada [docs] QScopeGuard: fix a grammar mistake in ctor docs
Even though there are two \fn's, we still use singular form when we
refer to the effects of the function.

Amends 4f077b7e5ff1081afc0e362bdab6522c2b7ee43b.

Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I7cc150eb96b4aac40abcf7076bb82049a209f837
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-06-14 15:38:40 +02:00
Marc Mutz
902e0a723a [docs] QScopeGuard: mention dismiss()ing in \class
The class docs should include a discussion of salient API, not leave
that only to \fn's.

Amends 9229452e574e603aa86fd5adb28da33cf5879db9.

Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I53144c7e56eca21ceeda0c1bca0028e987da9e18
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-06-14 15:38:40 +02:00
Fabian Kosmale
f2ef861688 moc: support __has_include
__has_include is part of C++17, but moc did not handle it so far.
This commit fixes moc to correctly support it.

It should be noted that support for __has_include relies on all
necessary include paths being passed to moc.

Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-136097
Change-Id: I7284e97dea12d1637b38349d32e090c0102124e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-06-14 12:48:30 +02:00
Fabian Kosmale
246b43d581 cmake: Unify the set flags between AUTOMOC and qt_wrap_cpp
For AUTOMOC, we were missing the compiler flavor flag, as well as the
WIN32 define. While the latter has not caused any known issues yet, the
former is rather problematic for implementing __has_include in moc.

Note that this only applies in the case where the AUTOMOC flags are set
by us in a qt_ function like qt_add_excutable. Plain add_executable
won't benefit from it, but we already mention that Qt targets should not
use plain CMake functions.

This change is (indirectly) tested by the commit adding __has_include
support for moc.

Task-number: QTBUG-136097
Pick-to: 6.10 6.9 6.8
Change-Id: Ie2beb08a44a3a67e3bc363d9c1ba93b7d6a49133
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-06-14 12:48:30 +02:00
Ulf Hermann
9a7d06f0d4 QNetworkAccessBackend: Do not leak wrapped upload byte device
The wrappedUploadByteDevice is obviously intended to be owned by
QNetworkAccessBackend. It needs to be deleted when QNetworkAccessBackend
is destroyed.

Ideally we shouldn't use bare pointers at all here, but since we need
to pick this back all the way to 6.5, a minimal fix is preferred.

Amends commit bba0bdb35c2806bcdde8e89965e99b3d412b8d3a

Change-Id: Icbe857ad02c23693c313d3fcb2d0ee068362e5b7
Pick-to: 6.10 6.9 6.8 6.5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-06-14 09:38:39 +00:00
Marc Mutz
f4e7eebd27 QCoreApplication: fold two atomic ops into one
The old code performed a fetchAndSubAcquire() followed by an implicit
loadAcquire() in the Q_ASSERT(). But fetchAndSub() returns the old
value, so we don't need to re-load it; we just need to store the
result of fetchAndSub().

We need to adjust the assertion, of course, since we're now checking
the old value, which is one more than a load would show, so replace ≥
0 with > 0.

Amends the start of the public history.

Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I6f6804261cd56a5a8bbb276ed7a0ac360c94195e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-06-14 09:38:39 +00:00
Thiago Macieira
96dfe0373c QVarLengthArray: use assign() for the iterator,iterator ctor
Let's avoid std::back_inserter for non-complex types, which generates a
huge amount of unnecessary code. The implementation of assign() is far
more modern.

Pick-to: 6.10
Change-Id: Ia8b9c90336af2bebd49ffffd0d69ace761c6aa59
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-06-13 21:24:53 -07:00
Thiago Macieira
54069d37ef tst_ContainerApiSymmetry: add non-deprecated copy assignment to Movable
Despite the name, this class is copyable, as evidenced by the fact it
has a copy constructor. But that copy constructor causes the implicitly-
declared copy-assignment operator to be deprecated.

warning: implicitly-declared ‘constexpr Movable& Movable::operator=(const Movable&)’ is deprecated [-Wdeprecated-copy]
tst_containerapisymmetry.cpp:55:5: note: because ‘Movable’ has user-provided ‘Movable::Movable(const Movable&)’

Amends 2e1763d83a1dacfc5b747934fb77fa7cec7bfe47 (5.14).

Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ie661f7361a8d86648b21fffdaf9e7d076f86ebe9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-06-13 21:24:29 -07:00
Rami Potinkara
1141a6fa17 Android: fix QtDisplayManager getDisplaySize function
This patch fixed QtDisplayManager::getDisplaySize
function to use API's that do not require
MANAGE_APP_TOKENS permission.

The function previously failed on 32-bit architectures
with Android 11 aka SDK 30 aka VERSION R due to
createWindowContext requiring MANAGE_APP_TOKENS
permission. The earlier try-catch lead to next error,
because of invalid values.

Amends: 98120622ff1f6f87664f4c42e830000a21391751

Fixes: QTBUG-137027
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ia9c3a64ea41ad0575a34a96858851a1123cfc915
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-06-14 06:37:14 +03:00
Ahmad Samir
cee8ea7c13 QDirListing: properly deprecate ExcludeSpecial
Add "since 6.10" to ExcludeOther's docs.

Found in API review.

Amends c553f39e3d3cd02854850da0dfc639acbae59299.

Pick-to: 6.10
Change-Id: I3edb32d4d50864ddbdde03aaca750d590a0e0854
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-06-14 05:40:56 +03:00
Mårten Nordheim
94f0ff704e Schannel: Use modern key management APIs
The key/certificate lifetime management in our Schannel backend is a
little lacking. We haven't guaranteed that the original contexts are
held alive for the full duration of their usage. Though with default
settings they get persisted to disk so it has been mostly fine.

One problem with that is that the legacy APIs in Windows for this is not
smart enough to figure out that a repeatedly-loaded key is the same one,
so it 'persists' a new file to disk every time we set up a credential
context for a connection. For a busy server this may end up with
creating a ton of small files that don't get deleted (or reused).

By using the ncrypt APIs we don't fully stop persisting _all_ data to
disk, but from testing we now only have one file per key. Regardless of
the amount of connections.

Another patch around lifetimes can be done for dev, and dev only, as
it's quite a bit more extensive, and not fit for picking back to the
LTS branches.

Fixes: QTBUG-136055
Pick-to: 6.10 6.9 6.8
Change-Id: I61398a3773ef8c25aab21df3e78b71f3ab11d488
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-06-14 04:40:56 +02:00
Christian Ehrlicher
a0c591c120 QStyleSheetStyle: use range-based for loops
Replace some for loops with range-based ones.

Pick-to: 6.10 6.9
Change-Id: Ib11fb4ec5785b8ec4c9c297684f90d7f5031fe58
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-06-13 23:10:14 +02:00
Volker Hilsheimer
560bf5a077 Android/iOS: prefer files icons to come from the Icon theme
There are no icons for computer, trash, desktop, folders, files etc. on
mobile platforms. QAbstractFileIconProvider tests the
QPlatformTheme::PreferFileIconFromTheme hint, and if set, gives
QIcon::fromTheme a try with an icon name mapped to the icon provider's
icon type.

We have at least some mapping of such standard icons in the native icon
engines, and those engines would also be the right place to perform
additional platform specific look-ups of icons (i.e. for specific file
types). So as a first improvement, try to use the icon engine for file
icon provider icons.

Task-number: QTBUG-134239
Pick-to: 6.10
Change-Id: Ib8c301a19b0d7e23f1d3ebdccde2147709f3ddb3
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-06-13 19:52:41 +02:00
Volker Hilsheimer
9f93ddd2f3 QGroupBox: document non-standard behavior for enable/disable logic
When QGroupBox::checked changes, it disables children, and enables
children that are not explicitly disabled. The group box itself however
remains enabled, so it's possible for user code to override the behavior
for individual child widgets, which can happen accidentally when
the order in which children are added, and the checked state of the
group box is changed, is inconsistent.

We won't change this as it has too many side effects. Instead, document
the conceptually deviation from enable/disable state propagation.

Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-25938
Change-Id: I2aa37600ec932cd4ce721bfa98f63169eb0d0beb
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-06-13 19:31:12 +02:00
Marc Mutz
ab53b12931 QAccessibleWidget: replace QString default arg with overload
We should not use defaulted arguments of non-trivial type, because
their construction and destruction, even if not passed, is repeated at
every call site, producing O(n) executable code.

By overloading out-of-line, we execute the same code at runtime, but
we have only one copy of the arg construction and destruction, in the
library, O(1) executable code production.

Found in API-review of QAccessibleWidgetV2.

Amends the start of the public history.

Can't pick further than (unreleased) 6.10, because this adds a new
symbol.

Pick-to: 6.10
Task-number: QTBUG-98117
Change-Id: I705bca764992d9e7a2aa1021e0f94006b6817177
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-06-13 14:31:56 +02:00
Axel Spoerl
444e5b63c3 Blacklist tst_qscroller::overshoot() on Windows
Function has become flaky due to additions made in
84e09e060bedd37d8de7cded7e430371e335c029.

Blacklist for now.
Add missing link to QTBUG-134105 in BLACKLIST file.

Task-number: QTBUG-134105
Pick-to: 6.10 6.9
Change-Id: I2e53ab8de08575f13c950dd92d24ad3017a7dc0a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-06-13 12:25:08 +00:00
Volker Hilsheimer
5dc261357e a11y on macOS: return a valid window element
Our accessibilityWindow implementation asks the parent for it's window,
expecting that it will always be the same. This is conceptually correct.

However, as we don't represent windows through QAccessibilityInterface
and instead rely on the natively provided element, the filtering out of
ignored elements result in accessibilityParent return a null object once
the parent is the window.

Instead, check if we get an interface that represents a Window, and
if so fall through to the code returning the NSView (after going through
QAcessibilityInterface::window call, which was so far missing).

And if we then get a Window element as the parent, then we don't have
to call accessibilityWindow on that parent again. Instead, return the
result directly and only keep going if we got some other element.

Add a test case that confirms that we now get a valid result for the
window attribute.

Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-137157
Change-Id: Ifa485734b290284bd5a1286e3b3c18454442fa10
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2025-06-13 14:25:08 +02:00
Marc Mutz
90dbb413bf QCoreApplication: relax an atomic load in a Q_ASSERT()
A Q_ASSERT() must not have side-effects, incl. ordering memory. So the
implicit loadAcquire() was too strong. The code must also work with
loadRelaxed(), so use that.

Amends the start of the public history.

Pick-to: 6.10
Change-Id: Ib94bd0989d1a358b552275dc3963b014e6e4c180
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-06-13 14:25:04 +02:00
Marc Mutz
5efcbf9fb8 QAccessibleWidgetV2: make the dtor protected
QAccessibleWidget (i.e. V1) has a protected dtor, so V2, which merely
extends V1 because we can't add new virtuals (via a new base class)
due to BC constraints, shouldn't differ in this respect.

Amends bb2121551c3d7b1af1553710bc211ba0e39b4212.

Found in API-review.

Pick-to: 6.10
Change-Id: I0c9a00691a14c600b020ff1a9f433634bb7c8d24
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-06-13 14:25:04 +02:00
Marc Mutz
b9a43e7767 tst_moc: fix Clang -Winline-namespace-reopened-noninline
Says Clang:

  tst_moc.cpp:86:14: warning: inline namespace reopened as a non-inline namespace [-Winline-namespace-reopened-noninline]
     86 |    namespace B::inline C {}
        |              ^
        |    inline
  tst_moc.cpp:84:21: note: previous definition is here
     84 | namespace A::inline B {}
        |                     ^

There's no minimally-invasive fix, because neither

   inline namespace B::inline C {}

nor

   namespace inline B::inline C {}

are valid C++.

So wrap the whole thing in another namespace ("Qt_", to avoid clashing
with somthing else, incl. our own namespace Qt), so we have roughly
the same structure as before, but with two non-inline outer namespaces
instead of one.

Amends 5222df2be7d10bf44dfc2971774eadcb526b7a13.

Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ia0e35e87934abebc76b719e3bd8124ac77ea07f5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-06-13 14:25:04 +02:00
Marc Mutz
79ab9305c1 QAccessibleWidgetV2: de-inline ctors and avoid QString default arg
We should not use defaulted arguments of non-trivial type, because
their construction and destruction, even if not passed, is repeated at
every call site, producing O(n) executable code.

By overloading out-of-line, we execute the same code at runtime, but
a) we have only one copy of the arg construction and destruction, in
the library, O(1) executable code production, and b) being out-of-line
in the library, the compiler can optimize the call to the base class
ctor away, if it wants to, because it sees its implementation.

Found in API-review.

Amends bb2121551c3d7b1af1553710bc211ba0e39b4212.

Pick-to: 6.10
Task-number: QTBUG-98117
Change-Id: Ib6a3b15cc861893797c0445a91691132b21bbf2c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-06-13 12:25:04 +00:00
Wladimir Leuschner
295933aadc WindowsQPA: Make custom titlebar a child window
The current approach for custom titlebar uses an overlay of a
frameless popup window at the position of the titlebar area. This
involves synchronizing the window state, position and size of the
popup window with the original window. Also, the drawing of
rounded edges needs to be done manually with the old approach.
This patch adds the titlebar as a real child to the
original window, so that the window manager takes care of the
synchronization and clipping process.

Fixes: QTBUG-135643
Fixes: QTBUG-133943
Fixes: QTBUG-133946
Pick-to: 6.10 6.9
Change-Id: I1770580a1c306074f41a7ff64c1d525c93918480
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2025-06-13 14:25:04 +02:00
Kai Uwe Broulik
3d405bfe67 doc: Fix typo in QCalendarWidget::dateTextFormat
renderd -> rendered

Pick-to: 6.10 6.8 6.9 6.5
Change-Id: If4df3cd0dd7a11e30283bf5925dc6364d0d79225
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-06-13 13:38:52 +02:00
Jonas Karlsson
c15e9740b3 Fix standardbutton-apply-16.png
There were some artifacts added (white pixels and bad anti aliasing)
when the icon was changed in e771e5e2d7ae77f46d01f087242e0f777fdc02ac

Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I12a8658090a1f081321e53433d17fc19ad3e5f12
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-06-13 13:38:51 +02:00
Even Oscar Andersen
30c254591d wasm: a11y - Implement support for disabled attribute
Fixes: QTBUG-137449
Change-Id: I6aa07c7108b5ad14c12e6f24e71b8dda12fec483
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2025-06-13 12:02:20 +02:00
Dheerendra Purohit
60841478d3 Doc: Fix QtConcurrent::run member function parameter order documentation
Updated the description to match Qt 6 behavior,
clarifying that the instance argument now follows
the member function pointer.

Fixes: QTBUG-113401
Pick-to: 6.10 6.9 6.8
Change-Id: I6cb9c63718790eda153bc5202ed4eb1d23f032bc
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-06-13 08:27:35 +00:00
Christian Ehrlicher
4832f61212 SQL/DB2: Add and document DB2_ROOT
Sync the cmake arguments to search for DB2 with the rest of the qsql
find modules and provide a DB2_ROOT env or cmake var.
Also allow the old variables as a fallback.

Pick-to: 6.10
Change-Id: I587e519b5cf3513e9580f64f0fb9b46bf789da5c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-06-13 07:42:54 +00:00
Thiago Macieira
6489c41234 QTest::CrashHandler: print the Unix signal si_code name
It's easier to interpret an "SEGV_MAPERR", "FPE_INTDIV", or "ILL_ILLOPC"
rather than "code 1".

Alongside the decoded instruction pointer from the previous commit, we
now get a message like:

  Received signal 11 (SIGSEGV), code SEGV_MAPERR, at address 0x00005637dd5c1346, for address 0x0000000000000004

Change-Id: Ic9f54e06fd2956fea3ccfffde7aa7b54167333b7
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-06-12 19:14:58 -07:00
Thiago Macieira
5d28c05ba8 QFileSystemEngine/Unix: fix typos and correct comments
Change-Id: I4d90d8ea8d25b89c9e8dfffd0210fc99e0d5ac3e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2025-06-12 23:14:41 -03:00
Thiago Macieira
e1d418bcd0 QFileSystemEngine/Unix: avoid an unnecessary conversion to QString
Sometimes, fillMetaData() is called with a QFileSystemEntry with only
the native (QByteArray) format, which we used above in this function
anyway in order to lstat() and stat() the path. This avoids forcing the
QFSE to create the QString form for us to check the first character.

Pick-to: 6.10 6.9 6.8
Change-Id: I8d93f6db83a28d70a192fffd6668734a8024b88b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2025-06-12 23:14:37 -03:00
Thiago Macieira
c5e6034bbd QFileSystemEngine/Linux: correct a minor problem with lstatx() failures
Our wrappers around the statx(2) system call on Linux return the
negative of errno, to avoid setting errno and reading it back for the
OSes where the system call doesn't apply. That means the vast majority
of errors from qt_lstatx() will not be -1 (the most common being -2 for
ENOENT) and we'd thus not enter the next block:

    // second, we try a regular stat(2)
    if (statResult == -1 && (what & QFileSystemMetaData::PosixStatFlags)) {

Pick-to: 6.10 6.9 6.8
Change-Id: I489e7c9ee1327fb98510fffd315c66948956534f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-06-12 23:14:36 -03:00
Thiago Macieira
07d3d3935c QRangeModel/Doc: link to QtWidgets only if the feature is set
Amends efe41182fda94c0e4805c24b3305577e5da81880.

The code already tests for QT_NO_WIDGETS before including and using
Widgets APIs, and we will want to extend the corelib_snippets target
with more of the existing snippets code to make sure that they build.

To not break -no-widgets builds, don't link against Qt::Widgets unless
the feature is set.

Pick-to: 6.10
Fixes: QTBUG-137556
Change-Id: Ic30fd519416068c275c3fffd0e1df10a76ce8fad
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-06-12 21:17:58 +00:00
Volker Hilsheimer
45202b26ce Fix -no-feature-draganddrop builds
Amends 7d0017cda8fde28a1130feaeecf41010b40e3cb3 which added the APIs,
and ef7e5ea616a3f04ff0ba5f6fe34487a332152b01 which only added the guard
for QListWidget.

Address header review comment.

Pick-to: 6.10
Task-number: QTBUG-137478
Change-Id: I405190190f4d64dd810d7d35e9ef616ab0147b19
Reviewed-by: David Faure <david.faure@kdab.com>
2025-06-12 20:22:38 +02:00
Marc Mutz
668d81f73a tst_QPointer: fix Clang 19 -Wunused-lambda-capture
Clang informs that ITERATIONS_PER_THREAD need not be captured:

  tst_qpointer.cpp:548:66: warning: lambda capture 'ITERATIONS_PER_THREAD' is not required to be captured for this use [-Wunused-lambda-capture]
    548 |                 QThread::create([&startSemaphore, &targetObject, ITERATIONS_PER_THREAD]() {
        |                                                                ~~^~~~~~~~~~~~~~~~~~~~~

Make ITERATIONS_PER_THREAD (and NUM_THREADS, while at it) constexpr,
indicating even to non-language-lawyers that these variables, indeed,
need not be captured, then drop the capture.

Amends 253f34082f526ff1ffd9eaefac73cc9aa616ab2a.

Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I27d94763058e1dcea3a65d4ff2c859b40336446f
Reviewed-by: David Faure <david.faure@kdab.com>
2025-06-12 18:22:38 +00:00
Marc Mutz
901a6e7986 tst_ContainerApiSymmetry: ensure we're checking defined iterator types
The old code used the same type of container for both target and
source in the range-assign() test. This limits our test coverage.

Fork the test to explicitly test with random-access (std::vector), as
well as forward-only (std::forward_list) iterators. This ensures we
have coverage of random-access, forward as well as the existing input
iterator types.

Amends 426d975cee9c783aec0832f376b836cdabee983f.

Pick-to: 6.10 6.9 6.8
Change-Id: I59c7a322ecbcc564baa1263e02b234bc53563fac
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-06-12 20:22:38 +02:00
Marc Mutz
c51a038615 tst_ContainerApiSymmetry: rename a variable in assign_impl()
A container is not an iterator, so don't call a container
'iter'. Since we're copying from it, call it 'src'.

Amends 7cbdc8abbda12488f51317313347bbc220b42fe0.

Pick-to: 6.10 6.9 6.8
Change-Id: I7732465f222032b2833396576873fed370f71d11
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-06-12 20:22:38 +02:00
Thiago Macieira
4f0156fa4b Q*Mutex: unexport for Qt 7
Those weren't caught for the Qt 6.0 release.

Pick-to: 6.10
Change-Id: I5831d4ad80b7f60d8782fffd6c64ef552f82ad6e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-06-12 11:22:38 -07:00
Alexey Edelev
d91d49ffe2 Move Android ABI detection to the separate function
Allows reusing the Android ABI detection.

Pick-to: 6.8 6.9 6.10
Change-Id: I8e452605b25e522c953f39a525c038a88174094b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-06-12 18:58:33 +02:00
Alexey Edelev
1f10cd4b45 Introduce _qt_internal_append_cmake_configure_depends
The function append the unique entries to the CMAKE_CONFIGURE_DEPENDS
property. This suppress the ninja recompat issue, which complains
about the duplicated entries in that come from the
CMAKE_CONFIGURE_DEPENDS property. It's likely the CMake issue, but
we may work around it.

Pick-to: 6.8 6.9 6.10
Change-Id: I2f10834b0dca3d2aa08fe13fba69849e97fa77d0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-06-12 18:58:33 +02:00
Mårten Nordheim
1bcfbfa3bc QDateTime::currentDateTime: fix time zone offset for repeated hours
Because we were consulting GetLocalTime we didn't get disambiguated
times for repeated hours. Drop that code-path and simple rely on
GetSystemTime instead.

Done-with: Mate Barany <mate.barany@qt.io>
Done-with: Edward Welbourne <edward.welbourne@qt.io>
Fixes: QTBUG-133656
Pick-to: 6.10 6.9 6.8
Change-Id: I3f1f09edfd9fb3135ccc12bf98e06254327e76fe
Reviewed-by: Mate Barany <mate.barany@qt.io>
2025-06-12 16:58:33 +00:00
Mårten Nordheim
3af5e42bdd Http2ProtocolHandler: fix logic error with potential use-after-free
We previously asserted that the reply was not nullptr, except in some
special circumstance. But then we proceeded to dereference it anyway.
This was then recently changed to be an if-check, but that just
highlighted the logic-flaw (and made static analyzers warn about it...)

What we want to assert is that the stream object is valid and
conditionally return early if the reply is nullptr, which it is for
promised streams, since no request has been made yet so no reply is
created.

At the same time, update the logic in the QHttp2Stream to not store or
emit header-related signals for a stream that has been reset.

Pick-to: 6.10 6.9
Change-Id: I55d69bbedc027893f6ad125c29468a34e7fb406f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-06-12 18:58:33 +02:00
Mårten Nordheim
f9fbdba3a1 Schannel: Use smart-ptr to manage the certiticate context
We already have the alias for it, we just never updated the stored
member to use it.

Pick-to: 6.10 6.9 6.8
Change-Id: I850c9f0b899a15603b4c5ac83693019b856effb2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-06-12 16:58:33 +00:00
Marc Mutz
6c18b438a3 QMetaObject: port QArgumentType to QByteArrayView
Now that argumentTypesFromString() actually doesn't normalize types
anymore, all type names are substrings of the signature, and so
QByteArrayView suffices (was: QByteArray) to hold the result.

QArgumentType in only used transitively, during QMetaObject member
function or QObject::connect() calls, so the source string will also
never go out of scope before the QArgumentType object that references
it.

As a drive-by, make the QArgumentType ctor explicit and port from
QVLA::op+=() to emplace_back().

No discernable impact on tst_bench_qobject's connect_disconnect.

Task-number: QTBUG-135572
Change-Id: If6544917b9df8191a256dc2a67e31c6b7e5a38cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-06-12 18:03:50 +02:00
Marc Mutz
afdf37ad8f QMetaObject: deprecate the Qt 6 QVector -> QList porting kludge
The argumentTypesFromString() function is clearly documented not to
perform any normalization, yet in typical Qt 6.0 porting rush, it did,
and this kludge was never removed.

Do it now; it's in the way of porting QArgumentType from QBA to QBAV,
and it's causing correct code to incorrectly fail.

This, however, changes the behavior of QMetaObject::indexOf*(), because
they don't fall back to normalization (indeed, these functions are used
as isNormalized checks, e.g. in connect()). So we can't remove the
kludge just yet, but we can drag it out of the fast path and re-try
with QVector replaced by QList when nothing was found using the
original signature. This way, we only pessimize unported users (and
calls that would have failed for other reasons, by scanning for
"QVector<" in the signature).

Add a qWarning() that we'll remove this behavior going forward.

It does, however, fix the bug that signals and slots that contain
types that match, but are not, "QVector<", fail to be found by the
machinery:

[ChangeLog][QtCore][QMetaObject/QObject] Fixed a bug that caused
signals and slots with argument types matching "QVector<"
(e.g. "MyQVector<int>" or "NotQt::QVector<int>") to not be found in
QObject::connect() or QMetaObject::indexOfMethod().

[ChangeLog][Deprecation Notices][QMetaObject] The
indexOf{Constructor,Slot,Signal,Method}() functions are documented to
require input according to QMetaObject::normalizedSignature(), but
accepted a QList declared as QVector. This was an internal porting aid
and is being deprecated now. Watch out for runtime warnings about this.
QObject::connect() and QMetaObject::invokeMethod() are unaffected, as
they fall back to normalizeSignature() automatically.

No change in tst_bench_qobject connect performance, which is
unsurprising, as the benchmark doesn't use a QVector alias.

Amends 03326a2fec416405b437089874f6439e937bbada.

Task-number: QTBUG-135572
Pick-to: 6.10
Change-Id: I7fd9293bba5d2b57b4452e55499ffbf360bc6123
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2025-06-12 16:03:50 +00:00