70892 Commits

Author SHA1 Message Date
Ivan Solovev
c0d39fd2ed Move qtformat_impl.h into corelib/text
... because it is not really related to IO.
We were choosing between serialization and text, and ended up with
text, because that's where the standard itself puts format [0].

[0]: https://eel.is/c++draft/format.functions

Amends ffac33964d51971a1c1f61308b6f0a60a4133296.

Found in Qt 6.9 API review.

Change-Id: I827322175da81bc027a9e136098b7e84677f43f7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 584ac8185255da9b15360bf0ca50677cba46ac9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-06 00:52:50 +00:00
Marc Mutz
51bbe63d05 Port qcompare.h to qstdlibdetection.h's Q_STL_ macros
... and add more specific #errors.

There are two distinct error cases here:

- First, someone could add more Q_STL_ macros to qstdlibdetection.h,
  so like a switch with -Wswitch, list them all here and #error out if
  there's a Q_STL_ we haven't yet seen. The audience here is Qt
  developers, via the CI.

- Second, one of the "non-major" libraries (ie. not libc++, libstdc++
  or MS-STL) add support for C++20, specifically the std::ordering
  types as announced by __cpp_lib_three_way_comparison, in which case
  we need to retroactively add the correct unordered value here. The
  audience here is both Qt developers, via CI, but also Qt users.

So separate the two error conditions.

Also, for platforms where we don't know the numeric value of
std::partial_ordering::unordered, use Qt's legacy value, for
potentially faster conversions to/from QPartialOrdering. There's no
point in guessing which value _might_ be used by a future STL, and
swapping STLs is _always_ BiC, so we don't need to guess which STL
will follow the Dinkumware ones on QNX and VxWorks.

Amends 0231f33ad121a85368bb3f43273973b9632735dc.

Change-Id: I1d06a18ca5bb26aceb7c76a0f035ecd8d4673547
Reviewed-by: Michał Łoś <michal.los@siili.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 1a74f77f57fff52e0166dd895a8c6d9e09b388a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-06 00:02:44 +00:00
Andrew Forrest
65e9eca63b Android: Fix mouse button processing
Fixes clicking UI elements with a mouse on Android.

8d8cbe87e21f05b7d611ed4be47299977288b267 introduced changes to support
mouse buttons other than Qt::LeftButton, but the release always looked
like no buttons changed, nor were they tracked (m_buttons is always
Qt::NoButton). Qt was not notified of mouse up, so nothing was clickable.

Now all mouse events go through sendMouseButtonEvents, and the last seen
button state is tracked for every event. If a mouse up with no buttons
occurs, the last seen set of buttons is used instead, so Qt correctly
handles the event. Also adds the mouse button state information to
mouse move events from Android, so the workaround for delivering
Qt::LeftButton when a window is tracking a move while a button is
pressed has been removed.

Tested on a Samsung A1 with a Bluetooth mouse.

Fixes: QTBUG-132700
Fixes: QTBUG-130297
Pick-to: 6.8
Change-Id: I241282c2915d7e6cf99db7f0bc1ad2d541349077
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d908e043984dcfed3aa80e30cd1cafacd13b644d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 18:29:25 +00:00
David Redondo
281c45452b QScreen: Add a note to use QWindow::devicePixelRatio if possible
Like QGuiApplication does as well. Also add a note that screen and
window DPR can be different.

Pick-to: 6.8
Change-Id: I1a24cf7f11e945187da9dce4421039350e811997
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 97049278443860d3dd1b1efd20d1f7dabaf72a35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 17:14:06 +00:00
Giuseppe D'Angelo
5ca7ad268a QVLA*: honor the RO5
The various base classes that abstract away template-independent parts
of QVLA have protected destructors to prevent slicing. Re-add the
special 5 (using the macro) and a defaulted default constructor.

Pick-to: 6.8 6.5
Change-Id: I60f036eafc808862a1abee72fd53023dd99b4cc3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c10072895d1061e258d23f3cc2a9050de5236a46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 15:57:31 +00:00
Ivan Solovev
624784a729 [docs] Add three-way comparison overview
Task-number: QTBUG-128837
Pick-to: 6.8
Change-Id: I64ae12994f8a48ee5f4e48ca6ed7f5980476f2aa
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 737c87b2b21e30abf5e51126fd8ff4e45521144e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 15:57:31 +00:00
David Faure
7328f90e64 Linux: autodetect gdb (to add -nograb) even in release mode
Application developers using Qt from their distribution, or from the
official installer, get a release-mode Qt build, where QT_DEBUG wasn't
defined. That's no reason to hit the issue that a breakpoint in
code that gets hit when opening a popup menu should lead to a complete
desktop freeze due to the mouse/keyboard grab.

Change-Id: Idf0df03ce5afb792261b62cabb06fab17b5e2952
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit a176f87a6451412a632866fda1fd79290b9d7520)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 15:57:30 +00:00
Giuseppe D'Angelo
711b86fa24 QtGlobal: introduce a helper macro for declaring the RO5 SMFs as defaulted
If a class honors the RO0 we usually just leave a comment in the class'
body, and don't explicitly redeclare any of the RO5 special member
functions.

In some cases we may need to redeclare (some of) them. The main use-case
so far is to declare a protected destructor for a base class that is
not polymorphic, in order to prevent slicing; the compiler-provided
destructor is always public.

We can easily declare and default such a protected destructor, but that
comes with the problem that now we're violating the RO5 (as far as C++
is concerned, declaring a SMF counts towards the RO5, even if it's
immediately defaulted).

Specifically: by declaring the destructor, the class loses the
compiler-generated move operations, and the copy operations are
generated but deprecated. Clang >= 18 warns about this.

In such a scenario we *must* redeclare all five SMFs... and default them
all. This is boilerplate, therefore I'm adding a macro to streamline it.

Apply the new macro to a couple of cases were manual refactoring has
already been done.

Pick-to: 6.8 6.5
Change-Id: I5dc0ff9770621fbec0b1057c164d0623f901e3e9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fcb57391f73d36914e10ba964dbd9b01fe6f3af2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 15:57:30 +00:00
David Boddie
40dc33a9d3 Fix broken auto-links in QAtomic docs
- There is no load() in Q*Atomic (unlike std::atomic), so link to
  loadAcquire()/loadRelaxed(), depending on context.

- Also remove the template argument, <T>, which prevents qdoc linking.

Amends b62c3a85452aecf4f6c863645db34857b05d5ebf and
329e09a3c303fad1ab001de74924288aae1e7a9d.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: I8c58674ffc7e779fee982555edcd45ed40d4c17d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 9854482835071993968a524878b601c1d9327f1e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 12:08:40 +00:00
Marc Mutz
eb13efc4a6 Unbreak QSet::intersect()
The selection of which set to iterate over and which one to remove
from based on their relative size violates the function's
documentation, which clearly states that items are removed from *this,
and not from `other`, so the result must never contain any elements
from `other`.

Amends 4f2c96eaa8bfa4d8a6dfb92096e4e4030d0cdea7. Instead of reverting
to the gruesome old code with the forced detach-just-to-remove copies,
distinguish four cases:

- if the two sets are shallow copies of each other, then their
  intersection is *this

- otherwise, if either set is empty, clear() *this. This is required
  for one of the tests that 29017f1395b1bc52e60760fa58c92f6fa4ee4f60
  added to succeed.

- otherwise, if *this is detached, perform the operation in-place,
  using removeIf()

- otherwise, create a new set and move-assign to *this to avoid
  detaching just to remove something again. In this case, we can
  continue to iterate over the smaller set, but we need to keep
  picking elements from LHS into the result.

[ChangeLog][QtCore][QSet] Fixed a regression (introduced for Qt 5.2)
in intersect() that caused equivalent elements of `*this` to be
overwritten by elements of `other` if `other.size()` was larger than
`this->size()`.

Not picking to 5.15, as users will have likely adjusted their code to
the buggy behavior, and because removeIf() isn't available there.

Pick-to: 6.8 6.5
Fixes: QTBUG-132536
Task-number: QTBUG-106179
Change-Id: Idfa17c3b3589c4eacec27259fc01df6aeaa6c45f
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 162015e9c6f469951d9212ef655cff16dcace071)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2025-02-05 13:08:40 +01:00
Marc Mutz
3dff1a3f7b Revert "Optimize QSet::unite"
This reverts commit 92acc94fa98d19929d28feb5d543acf8c50c2290.

The change broke QSet ordering guarantees: The documentation clearly
states that each item from `other` that isn't already in `*this` is
inserted ("STL insertion behavior"). Swapping *this and other breaks
this.

Independent of STL vs. Qt insertion behavior, making the picking of
elements from containers "random" in the sense that the size of the
container is now important, and not merely LHS vs. RHS, is a bad idea.

[ChangeLog][QtCore][QSet] Fixed a regression in unite() that caused
equivalent elements of `*this` to be overwritten by elements of
`other` if `other.size()` was larger than `this->size()`.

Pick-to: 6.8
Fixes: QTBUG-132500
Change-Id: Ia636b62325139d618b5467a643ff710716324296
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 2d1b3028673493cb144060cbec49b1b95f4188d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 12:08:40 +00:00
Marc Mutz
12f39bb2ab QSet: check that unite() and intersect() prefer elements from *this
In Qt versions 5.0..6.7, at least, this used to be the implemented
behavior for unite(). For intersect(), it was implemented up to and
excl. 5.2. Even the documentation states as much:

intersect(): Removes all items from _this set_ that are not
             contained in the other set.

unite(): Each item in the other set that isn't already in this set
         is inserted into this set.

Add checks that the functions behave as documented (hint: they no
longer do, since 6.8 (unite()) and 5.2 (intersect()), resp.), this
being the only correct way to implement these functions (items in
sets may be equivalent, but not identical; it is important that the
set operations work in a manner consistent with insert(), to meet
user's expectation of how these functions work (unite() just
inserts() the rhs, intersect() removes if !rhs.contains). Note that
QSet, unlike other Qt associative containers, actually has STL-style
insertion behavior (insert() doesn't overwrite).

subtract() is the only one that's still true to its docs. A test for
this function will be added in a follow-up commit - eventually.

In anticipation of adding rvalue-other overloads of at least
unite(), add a test with that, too.

Pick-to: 6.8 6.5 6.2 5.15
Task-number: QTBUG-132500
Task-number: QTBUG-132536
Change-Id: Id309ab5192e6d1c9bbeef496cbd7116d306eaae8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 0d4fd5c545b47966c56ed0b9eb9b5c0a8f75c02a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 12:08:40 +00:00
Kai Uwe Broulik
0048e8de0e doc: Fix typo in Qt Style Sheets Reference
It's QAbs*t*ractScrollArea.

Pick-to: 6.8 6.5
Change-Id: I94a8d35c40445883a232a8671e56780afffb2e01
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 46809abbb7cd525e287360455a7fa074eeb800d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 12:08:40 +00:00
Ivan Solovev
bec66636c8 QProcess/Unix: add an actual check of DisableCoreDumps flag
The original patch that added this feature was disabling the core dumps
unconditionally. I guess the check was simply forgotten.

Amends 9df6e8ad3b3a7a57af87e6a3fef2ef793610cb3d.

Found in Qt 6.9 API review.

Change-Id: If3f9cb35d11a0262241a465626a25f6d7d2bbdb4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9860f6522919d154dd4f95ff6f6ae58d3e4c435e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 08:32:42 +00:00
Allan Sandfeld Jensen
11599cb379 Make -platform linux-clang-libc++ work with icecc
It usage of libc++ was never detected if the compiler was explicitly set
to a specific clang binary and clang wrapper.

Change-Id: I5fd3c84223cafedf06b34afe91d975e71c199e24
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 982fe396e5908a6f1089ba577ed6220d90eaaa95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Mårten Nordheim
2ce7e21766 Unicode tool: handle required QFile::open return
Fixing warnings/errors about QFile::open() return value not being
checked, and print the name of the file and the error message that
occurred.

Task-number: QTBUG-132902
Change-Id: I099b300b5fd4563334fa547ffa365ec3f68e08cf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e99d5c6268862e5773056a008c273e18bf5b4ef7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Mårten Nordheim
00ddc174b4 QUrl: sort idn whitelist
We look it up with a binary search, so it needs to be sorted.

Pick-to: 6.8 6.5
Change-Id: I0aa25e6ff9722372c0a09f2dce9f9c839fedf00e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 382a7d006b52faa08b84e56d97cc6c216925a43e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Mårten Nordheim
67500054d2 Unicode tool: print values using portable types
ssize_t is not universal; fails to compile in Windows.

Task-number: QTBUG-132902
Change-Id: I4b8f45cba32202329ac085c7caa0a8c19a11c621
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f7d0366207709ec0dc33f5d10d21b8f3c9d6534f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Mårten Nordheim
09b06a740d Unicode tool: use unsigned values for the bitfields
On MSVC the values stored end up as negative.

Task-number: QTBUG-132902
Pick-to: 6.8 6.5
Change-Id: I963c57c34479041911c1364a1100d04998bdfaed
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 62685375a2d71fa34015faac76f03e709e4217c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Christian Ehrlicher
2a3c016894 Windows11Style: don't create a QPen when not needed
Use QPainter::setPen(QColor) and QPainter::setBrush(QColor) overload
instead creating a temporary QPen/QBrush to gain advantaged of the newly
introduced QPen and QBrush assignment functions from
ab53500cfa11b988e7e4234583fa6eb5027b4c08

Change-Id: I3b8c4f7d669a08558cf6abcc77c23a4fdda99c02
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 82a5e8bdb788179d1323e76b725d57efaab0b217)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:21 +00:00
Assam Boudjelthia
d31a94a70a Android: fix Q_JNI_NATIVE_METHOD() with namespace builds
Prepend the Qt namespace to the JNI method under Q_JNI_NATIVE_METHOD.

Pick-to: 6.8
Fixes: QTBUG-132490
Change-Id: I73bb8119a0d760e8f7ce82e70ced2684bec76eb0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d1694476271346d13ac8ca3138328d295bf403b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:20 +00:00
Thiago Macieira
8c5736e68f QUrl: avoid going up from the drive path on Windows file URLs
On Windows, using a URL of "file:///c:/" as a base to be resolved with
"../" should not result in the Windows drive being removed.

[ChangeLog][QtCore][QUrl] Fixed a bug (regression from 6.7) where
resolving a base URL of an absolute file path containing a Windows drive
could result in said drive being removed (e.g., resolving "file:///c:/"
with "../" would result in "file:///").

Fixes: QTBUG-133402
Pick-to: 6.8
Change-Id: I58286b9c5e5d02363f0efffdb06f983b560340df
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 340c9d88ab353e201f117d64609fa5f7d2fa2b21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:20 +00:00
Thiago Macieira
86597d2891 QUrl: set the host to empty but present for "file" URLs
We set it when manipulating full URLs. If you're creating them from
parts, you may end up with one without a host. We will still fix that up
in QUrl::toString() ("manipulates full URL").

This allows the path normalization code to avoid accidentally creating a
URL with no host/authority and with a path that starts with double
slash.

[ChangeLog][QtCore][QUrl] Fixed a bug (regression from 6.7) where
QUrl::resolved() could create invalid URLs when the relative URI being
resolved contained a path with double slashes (e.g., combining
"scheme:a" with "..//b.txt")

Pick-to: 6.8
Fixes: QTBUG-133403
Change-Id: I3fe9d5fbd2efcaa66d66fffdc010e5a84066b641
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 7d05f5ed7d3472028e28a09eeda175bb1b1eeb00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:20 +00:00
Thiago Macieira
d37960b35a QTypeInfo: work around MSVC 2022 bug "isRelocatable: undeclared identifier"
Definitely a compiler bug because it passes for everything we threw at
the compiler in the CI but fails for a user. At least the workaround is
simple.

Fixes: QTBUG-133032
Pick-to: 6.8
Change-Id: Ie84590c466cf1d6f01bbfffd3ca1d6c262d77200
Reviewed-by: Irfan Omair <irfan.omair@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 0a5b37b706ee72c7d9042efcde244aa93a5ce9a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:20 +00:00
Vladimir Belyavsky
d35a1eb1ac CoreText: prevent colored glyphs (like emoji) to be clipped
To prevent colored glyphs (like emoji) from being cut off at the edges,
we can simply apply the solution from bbba71748438dc05d344bb9727f10b7f55a5d229
to colored glyphs as well (i.e. to glyphs with QFontEngine::Format_ARGB format).

Fixes: QTBUG-133297
Pick-to: 6.8
Change-Id: I5578e2d12f956d0635b662b3ecf714aa63474945
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 7cc0ea0b5a1dc1d9e1a9a8cc8639958e42adba3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:19 +00:00
Jaishree Vyas
d7ff69741b Doc: Make C++20 overview visible to the new sidebar
Added the link to the qtcore-toc.

Task-number: QTBUG-130085
Change-Id: I765e01aeda0bce694157bf15ff5a036f239168f5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 43cb7f93a4da2d57513acb3c4cbdd56c1eaf188f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:19 +00:00
Marc Mutz
7197992341 Long live qstdlibdetection.h!
I've been meaning to add this since at least 2012 (cf. commit message
of 9180d9aa8bfb9e9f66fad13f194398a98698eb77), this is as good a time
as any.

Detection taken from qcompare.h, except for
- libstdc++: using version macro instead of date one
- Dinkumware, which is taken from the above-mentioned commit (adjusted
  for the LIBCPP->CPPLIB typo),
- STLport/SGI, which are taken from stlport's _stlport_version.h,
- RogueWave, which is taken from Apache stdcxx's rw/_config.h, a fork
  of RogueWave, contributed to Apache by RogueWave themselves.

It looks like not all STLs provide a version macro, and those that do
vary a lot in granularity, so for the time being, just define these
macros to nothing and not to some form of version.

[ChangeLog][QtCore] Added Q_STL_ macros for stdlib detection (libc++,
libstdc++, MSSTL, Dinkumware, STLport, SGI, RogueWave). If your STL is
lacking, please file a bug report. Note that these macros are not
considered public API just yet.

Picking to all active branches, since not picking is more risky (code
that assumed these macros existed in older branches could silently
change behavior if they don't).

Fixes: QTBUG-132908
Fixes: QTBUG-132909
Pick-to: 6.8 6.5 6.2 5.15
Change-Id: I8f956d131292483b7727f11f69b460b12a06b583
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b6f825a857d0d2266ea89879f26703f86ddf669a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:19 +00:00
Ivan Solovev
69fa60518c Bump the deprecation version for WindowType::MaximizeUsingFullscreenGeometryHint
The replacement is new in 6.9, so the deprecation should be done in a
later Qt release.

Amends 90fe9874d22f0c4b809a3e493766ef852c72cc39.

Found in Qt 6.9 API review.

Change-Id: If68685f98928015163cd4aa0e65fed2c6578e429
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit b0364bc2633f322630028a13fe1143e222015cd1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:19 +00:00
Allan Sandfeld Jensen
f20166d2de Fix AVX512-FP16 build
Was missing explicit conversion from float to FastType when
FastType isn't float.

Pick-to: 6.8
Fixes: QTBUG-133430
Change-Id: I227558f6ecc1018158c88514dbb23bfe095ef77f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit d076420bb0740e0410a886fc2feb5fcf8b729f4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:18 +00:00
Thiago Macieira
d07a849e98 Fix detection of -fPIE code for QT_CONFIG(reduce_relocations)
Amends commit 19b7f854a274812d9c95fc7aaf134a12530c105f, which removed
the __PIE__ check because of the GCC version check that was alongside.
GCC and Clang define both __PIE__ and __PIC__ for -fPIE, so checking for
__PIC__'s presence isn't enough.

Drive-by amend the no-PIC #error message to also suggest
-DFEATURE_no_direct_extern_access=ON, which is more modern and produces
better code for executables too. Because of that, I've also changed the
reduce_relocations option to the CMake one, as there is no configure-
style equivalent for the modern option.

Pick-to: 6.8 6.5
Fixes: QTBUG-133101
Change-Id: I957b264eaee360fd964afffd60617964b26fe934
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 014e77801fa4b99cdb03330ccce1e212ac13a0af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-05 00:34:18 +00:00
Liang Qi
b33813534e xcb: call qGuiApp->exit() on xcb connection error
Fixes: QTBUG-130741
Pick-to: 6.8 6.5
Change-Id: I67eff8e58d4a4a8d18fb49699111f72ed9100480
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit facf2c17707ac4827e624fb6e9546278aef0c38d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 21:47:34 +00:00
Rym Bouabid
7a2b93fc78 ibus: Make address a QByteArray instead of a view in createConnection()
When "address" is a QBAV, it points to line(QBAV) which points to
lineArray(QBA), so its data will be overwitten after every read:
      while(file.readLineInto(&lineArray))

This amends f0aa391ef89a393221d77d5ad3c1616a4727f11a .

Fixes: QTBUG-133445
Change-Id: Id23e726327529c44e205c4c0720af0dad42c175b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 07eeb45d881bb0240e472167217912b08be44371)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 11:51:24 +00:00
Tor Arne Vestbø
c04a7aa2c6 macOS: Emit font dialog change when dialog is not active window
The NSFontPanel emits changeFont even when not the active window, and
applications are expected to update their views accordingly.

As the changeFont action message is sent through the responder chain we
were only picking up the changes when the font panel was active, thanks
to the NSWindow delegate we were installing on the panel.

But when the active window is one of our other windows, we were failing
to process the changeFont message in our QNSView.

We now handle the message by forwarding it to the font dialog delegate,
so that we enter the same code path as before, and emit the right
signals for QFontDialog and friends.

Pick-to: 6.8
Change-Id: I97427c73fe46f129ca11afa6b2c222bf0f0fb0af
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 3d42f31243ce52e517e09843b93f40b79925652f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 11:51:24 +00:00
Giuseppe D'Angelo
97880102dc QSqlQuery: complete the deprecation/removal of its copies
QSqlQuery has been made movable in Qt 6.2
(14f9f00fdb2dc428610c08e3d9d03e38e9602166). The pre-existing copy
operations have been deprecated, but not removed, in order to preserve
SC/BC.

This left us with two issues:

1) Whether or not to keep the deprecated copies in Qt 7. The answer is
no: the copy operations are impossible to implement in a way consistent
with value semantics (the state of the DB driver can't be copied in
general). Therefore, mark the related APIs as to-be-removed, and not
just deprecated.

2) While we no longer copy QSqlQuery from Qt code directly, QMetaType
still detects the presence of the copy constructor and extracts it,
triggering the deprecation warning.

Rather than unconditionally suppressing the warning (which will hide any
similar issue we might have in the future), add a local workaround that
raises a runtime warning if QSqlQuery is copied through QMetaType, while
not raising the deprecation warning when building Qt itself.

[ChangeLog][QtSql][QSqlQuery] Copying a QSqlQuery object via QMetaType
now raises a runtime warning. Note that copy operations for QSqlQuery
objects have already been deprecated since Qt 6.2, and are planned to be
removed in Qt 7.

Fixes: QTBUG-132752
Task-number: QTBUG-91766
Change-Id: I48714ad53ec706a5e4e055c45a1c05f372382940
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit f744cef06cf3a56591782f487c545b55b2a673fb)
2025-02-04 08:42:49 +00:00
Marc Mutz
4e475b5cc2 XCB: replace header guards with #pragma once
Following qtbase/1c8884fc277c5916a420a3c14de68547a391f9fc's making
syncqt error out when an installable header contains #pragma once, we
can now flip the coin and use #pragma once as a static assertion that
the given header is not going to be installed, making it easier to
understand which headers are "public", which ones are "private" and
which ones are "neither, since never installed".

Do this for the XCB platform support files.

In qxcbglintegration.h, the header guard was actually broken (had only
#ifndef and #endif, was missing the actual #define).

As a drive-by, normalize vertical whitespace.

Pick-to: 6.8 6.5
Change-Id: Iede0605c38cda7606edfc7155bd8bfc95990c5bc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 91f9ba2993a2652bcb349ce639aff67b5bfc8938)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 05:19:37 +00:00
Thiago Macieira
ae2502b4ad QLibraryInfo: speed up checking if ":/qt/etc/qt.conf" resource exists
Go straight for QResource, because this is run very early in Qt's
initialization, usually as a result of some debug message, via
QLoggingRegistry::initializeRules(). This bypasses the need to create
QResourceFileEnginePrivate, QResourceFileEngine, QFileInfoPrivate, and
QFileInfo, all of which would end up in this .isValid() call.

Additionally, I'm making it query in the C locale, which will also avoid
initializing the system & default QLocales. If a resource exists in any
language, the C locale query will find it.

Pick-to: 6.8
Task-number: QTBUG-133206
Change-Id: I434b498903d793c12d35fffd3e297bfdbdc1b6fe
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d59e640c868f3db2d661970f3d34a22013d49053)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 03:01:59 +00:00
Ahmad Samir
0ca8024da2 QDirListing: clarify the ExcludeSpecial flag API docs
Amends e583c3d5163a5512abac85e32359652e28a053f7.

Pick-to: 6.8
Change-Id: I2ed231990778d03384045bc417efc58a6019fc14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e5fbe88708103781ee8d60f5280ea1ad4bed21f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-04 02:47:39 +00:00
Christian Ehrlicher
c7f914c68c Widgets/styles: don't create a QPen when not needed
Use QPainter::setPen(QColor) overload instead creating a temporary QPen
to gain advantaged of the newly introduced QPen operator=(QColor)
function from ab53500cfa11b988e7e4234583fa6eb5027b4c08

Change-Id: Ib29a932a183b629f2c5f3ce32f4e00bd7ab24a03
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 678564291d8faa7689b4a65376b2c60118fc9936)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-03 05:13:25 +00:00
Eskil Abrahamsen Blomfeldt
b6557e4be8 Fix compilation with unofficial DirectWrite headers
Reportedly, some unofficial DirectWrite ports are missing the
default values to the arguments for IDWritePaintReader's
MoveToFirstChild() and MoveToNextSibling(), so we make this
explicit to work around the problem.

Fixes: QTBUG-133336
Change-Id: Ia9a01e371e7424508db0d5ad3c75037caaf16854
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cbce69ebd643bb4841de20f34c5b23bddbcde0c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:53:16 +00:00
Alexandru Croitor
9ffc3b0705 CMake: Wrap path in quotes to avoid issues with spaces in paths
Otherwise running the deployment script fails on macOS with something
like

CMake Error at
 .qt/deploy_qml_app_texteditorexample_32987d3e6e.cmake:1 (include):
  include called with invalid argument:
   2/build/.qt/QtDeploySupport.cmake

due to the following generated content:
  include(build/texteditor space 2/build/.qt/QtDeploySupport.cmake)

Pick-to: 6.8
Task-number: QTBUG-126827
Change-Id: I8f9923db8dc670a6efbd6f75c48da5dfd1af687d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 65f08c09713b6d167638c4e19ebafcac045fc1c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:53:05 +00:00
Robert Löhning
01b90c38e7 libinput: Fix developer build without xkbcommon
Before this fix, the build failed with:
error: unused variable 'REPEAT_DELAY' [-Werror,-Wunused-const-variable]
error: unused variable 'REPEAT_RATE' [-Werror,-Wunused-const-variable]

Pick-to: 6.8
Change-Id: I44a76e2270c1f5d8af6bd018869db5e30e40ecbb
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 42ea8c31fe459ac252144f89986891b241c3e9d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:52:51 +00:00
Cristian Le
9601b5fa5b Check for misspelled FEATURE_* variable
The feature names are normalized using `qt_feature_normalize_name`, but
a user might read `qt_feature` usage and not realize that they should
normalize the name in the `FEATURE_*` variable.

This change emits an error if it detects such invalid names.

Fixes: QTBUG-132464
Pick-to: 6.8
Change-Id: I33c7ab9f589c92e11e16d376660e8b6152339d12
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b71647d06970b2cc3b63b93c020eca8caf0a519f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:52:36 +00:00
Ivan Solovev
7e80af2bc2 QSharedPointer: document rvalue overloads of various cast methods
The patch provides two documentation snippets: for an arbitrary arg
and for \c {*this}. That is because qdoc does not support passing
a command (e.g. \c) as a part of the snippet's parameter.

Amends e95fb04202b3f786037c10942fd4e912644fd7d2.

Found in Qt 6.9 API review.

Change-Id: I4eed234d18e39f2fc0c30a647a423f3240e31d40
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 8511149d886e5aef2a065efffc336c7b25e6540e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:52:27 +00:00
Andreas Eliasson
c965151d4d Doc: Fix typo in in scope resolution operator
Fixes: QTBUG-132911
Pick-to: 6.8 6.7 6.5
Change-Id: Iaa7c4830abd273ccfe558e089da5072a83607f26
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit bc733ea787ad6993e945146a9d297d14cb6175ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:51:43 +00:00
Liang Qi
98065efdfa Fix dangling references - GCC 15
This amends 8a6750475410629741de0417c28f574c25c65338 and
18def77d27f88ce26b6af29fe56a80429fed555d.

Pick-to: 6.8
Change-Id: I31068527458da3d25211743fb64e2624039bd78b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9379b95b533216593d4d37c0cbf70f91d1ce037a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 09:26:07 +00:00
Marc Mutz
0ce4cdddb4 util/update_public_suffix_list.sh: use commit date, not wall clock
This is both more accurate and also more stable: The suffix-list
update usually takes several days to go through all branches; using
the commit date avoids using newer fetch dates in older branches.

Pick-to: 6.8 6.5 6.2 5.15
Change-Id: Ifefd7158e4104c7bbdfe6a2d8a505d8acf7275b4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit cbea57f80b43a969d2e15d53b759abb9924d52c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-01 00:09:42 +00:00
Christian Ehrlicher
7a9f724735 QMenu: Ignore disabled hotkey during hotkey search
When two actions in one menu have the same hotkey and the first action
is not enabled, the action search was selecting the first, disabled
action despite the fact that it could not be selected later on.

Pick-to: 6.8
Fixes: QTBUG-56952
Change-Id: I894ee09d9ccc7154ca506ef907924cd150ac6ed2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 13636f848da6932f9864bf9335d19b439b8387cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 23:06:46 +00:00
Assam Boudjelthia
44b706457e Android:CMake: add \cmakepropertysince to packaging type properties
QT_ANDROID_SYSTEM_LIBS_PREFIX and QT_ANDROID_NO_DEPLOY_QT_LIBS were
added in Qt 6.4, but they were missing \cmakepropertysince 6.4.

Pick-to: 6.8
Change-Id: Ife0f68e79d331f4923d1015431f5af65d80dca36
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 51474d795a4c801933f9444b73d536fb1c407e72)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 22:03:12 +00:00
Assam Boudjelthia
6f6c291beb Android:CMake: remove \preliminarycmakeproperty for non-preliminary cases
Those Android CMake properties have been carrying the documentation tag
of \preliminarycmakeproperty by mistake.

Pick-to: 6.8
Change-Id: I739fee2f078300427557a29b25e1898d57cf04d7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2abc4594791823f1e56d692df38ede69f83e45cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 22:03:05 +00:00
Marc Mutz
7dca077bb6 QObjectData: Return const QMetaObject* from dynamicMetaObject() already now
It's semi-private API (ie. undocumented) and for most platforms¹, the
change is a no-op, which is why the approach here is a bit different
than your usual REMOVED_SINCE:

Normally, when only the return value changes, we mark the new overload
as QT6_*_NEW_OVERLOAD to allow the two function to coexist and the old
function to call the new one.

But the extra argument backing QT6_*_NEW_OVERLOAD would change the
mangling of the function even on platforms that don't mangle the
return type (the majority), and we'd have to decorate all calls that
could possibly be seen by QtCore's removed_api.cpp TU with
QT6_CALL_NEW_OVERLOAD. The main user of the API is moc-generated code,
though, and so I didn't want to have to change moc's output, even
though, currently, nothing in removed_api.cpp includes moc-generated
code. But it may, at some point in time.

This means I needed to grasp the nettle and duplicate the (granted,
trivial) implementation. Even a private helper function would mean
(maintenance and runtime) overhead for "normal"¹ platforms, so I opted
not to go there, either.

¹ those that (rightfully) don't mangle the return type, ie. all except
  ... MSVC.

As a benefit, we catch the mistake of modifying the dynamic
QMetaObject under the object's radar already now.

[ChangeLog][Potentially Source-Incompatible Changes][QtCore][QObjectData] This
(undocumented) class' dynamicMetaObject() function now returns a const
QMetaObject* (was: non-const). The backwards-compatible fix is to
receive the result in a const QMetaObject* variable (or to use auto),
and applying a manual const_cast, if a non-const object pointer was
actually required. Modifying the meta object that was returned by this
function was never supported and may lead to problems elsewhere.

Amends 0b044e8b055f9c1d93b278ed69aba76f7c886cb1.

Change-Id: I4ebc43018a2a87433ab7a97554196842b97cf1ba
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2c212e15f8b9dc2578d93ac69a0f5826ea9de18f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-31 10:16:43 +00:00