Commit Graph

18936 Commits (724716ea335605dc1f9287c7cd9f88c709f6993c)

Author SHA1 Message Date
Jaishree Vyas 0a258409ef [docs] Create an overview of C++20 features available in Qt
A template for C++20 overview.

Task-number: QTBUG-128837
Change-Id: I7a442c3c58613587c2c75a77082f66512e97adb4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit f9de20d9ca818b775930956a0f1c4804119a24c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-25 18:28:29 +00:00
Volker Hilsheimer 490b2b4c90 QJniArray: fix local reference leak
We get a local reference from New*Array, and then construct a QJniArray
from that, which will create a new global reference, without deleting
the local reference.

Instead, go through QJniObject::fromLocalRef, and release the local
reference also in case of failure.

Change-Id: I88108315240133369efab30e55fdbea17a17a26d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
(cherry picked from commit 37638c84efaf2810ad49da0b987f19287d8c4ad6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-25 03:25:38 +00:00
Cage Lee e50c29da84 doc: Fix a typo for QCborMap
Change-Id: I2579205350ffc6ec00cb002e0d68f1125d9885d6
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit c034ffd5275d310a1d47c2ebfee24e6bc3fa8093)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-25 01:13:20 +00:00
Jøger Hansegård 4aa38ca8a6 Document that size is number of code units in QString::fromWCharArray
Other functions that creates QString instances from buffers document
that the size argument represents the number of characters to copy. This
patch adds this statement to QString::fromWCharArray too, but makes it
explicit that the size represents the number of code units.

Change-Id: If3c0ebe299281a3c0ffc2d9e609b89df2578811d
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit a315a9e70e69e36cef0e51058faad048773040e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-23 21:08:01 +00:00
Thiago Macieira 3f7d309a1c QThreadData: inline ref() and deref()
You *should* be using LTO if you want performance, but these functions
are trivial enough that it makes sense to inline them.

The !QT_CONFIG(thread) support seems wrong and is probably leaking
memory for the QAdoptedThread for the main thread. But since that only
happens because the program is exiting anyway, it's a case of "leak" in
quotes and one I don't care about.

Change-Id: I2bb6e519239ea33cc521fffd71f57574f940ed62
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 278d2255e25d659ce5be08d2b81226556b1dfee2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-22 17:57:26 +00:00
Thiago Macieira 027ee82051 QPostEventList: use qsizetype to count posted events
It's highly unlikely you're going to have more than 2 billion pending
events for a thread, but this is the right thing to do.

Change-Id: Ia162b024815c3b970d71fffd3bc022621b2e07b4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 67a71d71093b50d0db172b92aa1b548a1a2bd959)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-22 17:57:26 +00:00
David Warner 177761f0f3 Recognize Windows Server 2025 build number
Fixes: QTBUG-131395
Change-Id: If3c4d6371b21720be4cbecc1508f83c9b3526751
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit c20c7814f4f43af00ef14fb41b2b25ca86539abf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-21 09:32:14 +00:00
Assam Boudjelthia 1547be2ae5 Android: add note QPermission under private permission APIs
Link to the newer permission API and note that the private
API can still be used for permission types not covered by
QPermission.

Fixes: QTBUG-130372
Change-Id: I093edd72bc50372eba3b06105087ccd4884b0bac
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit d2a8a0dc29b15a4076ff055e0b500a1d9207c5d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-20 19:03:46 +00:00
Allan Sandfeld Jensen 5642b6fe7c Facilitate disabling multi-threading in image manipulation and painting
On some platforms and setups, the multi-threaded implementation of this functionality is not desirable. Allow disabling it at runtime by setting the environment variable QT_NO_GUI_THREADPOOL.

Task-number: QTBUG-129650
Change-Id: If089ecb3b335defc06f14749841bf9f6041e6f5e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 7a8cefd6fb66e6bc6880aaf5a938194611278bed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-19 15:17:40 +00:00
Marc Mutz c29f10a0b0 Suppress -Woverloaded-virtual in QAbstractEventDispatcherV2 hierarchy
Says GCC (e.g.):

  qabstracteventdispatcher.h:122:9:
  warning: ‘virtual int QAbstractEventDispatcherV2::remainingTime(int)’ was
  hidden [-Woverloaded-virtual]

    122 |     int remainingTime(int timerId) final;
        |         ^~~~~~~~~~~~~

  qeventdispatcher_glib_p.h:47:14:
  warning: by ‘virtual QAbstractEventDispatcher::Duration
  QEventDispatcherGlib::remainingTime(Qt::TimerId) const’
  [-Woverloaded-virtual]

     47 |     Duration remainingTime(Qt::TimerId timerId) const override final;
        |              ^~~~~~~~~~~~~

The usual way to fix this warning, adding `using base::func;`, doesn't
work here, because (the int overloads of) the functions in question
are made private in QAbstractEventDispatcherV2, so the `using` fails
with "is private in this context" errors.

Since this situation is temporary (until Qt 7, when the overloading
stops), simply suppress the warnings manually.

Found that the Windows dispatcher doesn't inherit from V2, yet, and
created QTBUG-129170 to track the issue.

Amends f8da484d57.

Task-number: QTBUG-126219
Change-Id: I0da821f08364f97fb7a17c9019586064ae58b0b5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 222cf3145ede99d1919fe7f388a9101f2c576255)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-19 15:17:39 +00:00
Kai Köhne 573a44a110 Doc: Fix typo in 'reglar expression'
Amends 82058367923ce164024885854c139ee5e0d89949.

Pick-to: 6.5 6.2
Task-number: QTBUG-129573
Change-Id: I4e42bbc7c4ebd869c2a6042c860482a79c2eb585
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 9ce9770421e807be5cbd991d4deee5704f13d255)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-18 12:20:32 +00:00
Martin Storsjö 21504ec27a IPC: Add missing includes of errno.h
These files use errno constants such as EACCES, while relying on
this header to be included implicitly.

If building with the latest libc++ versions, configured with
_LIBCPP_REMOVE_TRANSITIVE_INCLUDES=1 (which removes unnecessary
transitive includes from the public headers), one runs into this
error, where errno.h no longer is implicitly included through
other headers.

Prior to 762017f03c, these functions
were in separate files that explicitly did include errno.h.

Change-Id: I7b02f2ffa35b86606f6c173bf6a6d2917dbdc151
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 9f429468326e3d857c84276c4acb86d2e8e83279)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-16 09:19:13 +00:00
Alexandru Croitor e2ba5d9053 CMake: Add PURL and CPE info to 3rd party attribution files
The change adds CPE and PURL keys to all qt_attribution.json files in
the repo.

In case if no sensible CPE or PURL exists, a "Comment" field is added
with the text "no relevant CPE or PURL found". If only one of them
does not exist, it is written as such in the Comment field.

This allows filtering for files that haven't had the information added
yet vs those that were looked up but no relevant information was
found.

For sources that are not hosted on github, a generic PURL is used with
a download_url fragment pointing either to the exact location where
the sources can be downloaded, or to the homepage of the project.
The generic package name was chosen based on the 'Id' key of the
attribution entry where it was present, and is not authoritative.

For PURL github packages, the 'git tag' name was specified into the
'version' part of the PURL, rather than the 'version number', because
SBOM processing tooling handle that better than the version number.
For example for the freetype package, we specify the string
'VER-2-13-3' rather than the tag name '2.13.3'.
We might revisit this in the future.

[ChangeLog][Third-Party Code] Added PURL and CPE information to the
attribution files of 3rd party sources.

Task-number: QTBUG-122899
Task-number: QTBUG-129602
Change-Id: Iad126242cafc3ea0b678c5c36b26f857039b1dbd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 36dca3c04f759449f74008a3e79021a179b0f35e)
2024-11-15 17:41:43 +01:00
Peter Varga f3aabe7ed5 qproperty_p.h: fix -Wshadow in notify()
Clang warning:
.../qproperty_p.h:666:58: warning: declaration shadows a local variable [-Wshadow]
  666 |                             if (QPropertyObserverPointer observer = d.firstObserver())
      |                                                          ^
.../qproperty_p.h:660:46: note: previous declaration is here
  660 |                 if (QPropertyObserverPointer observer = d.firstObserver()) {
      |

Fix by abbreviating the variable name in if statement.

Change-Id: I7905de08f15124466f8aa587691b2880c889199f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 2fc5735f60e0bcd7b7b451a32fd999f2d36a33c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-15 16:16:53 +00:00
Thiago Macieira dce6ef8fac QThread/Unix: do clean up the QAdoptedThread for the main thread
Commit 1ed0dd88a3 ("QThread/Unix: make
QThreadPrivate::finish() be called much later") introduced this problem.
Commit 4fabde349f16b59f37568da2a4c050c6dd53a34e split the thread
termination in two phases, but did not fix this.

This re-applies commit 950b35cf97 ("Clear
the current thread data for the main thread"), which was reverted in
commit 7dc622290b ("Make sure QThreadData
and QAdoptedThread object is destroyed at app exit"), both from Qt 5.1.

Between Qt 5.1 and 6.7, the responsibility of clearing the
QAdoptedThread for the main thread was split: it could occur either in
~QCoreApplicationData if exit() was called in that thread or in
~QThreadData() if it wasn't (e.g., when the Qt "main thread" is not
main()'s thread):
  * frame #0: 0x0000000101db8a28 QtCore`QAdoptedThread::~QAdoptedThread(this=0x000060000176c070) at qthread.cpp:139:1
    frame #1: 0x0000000101db81eb QtCore`QThreadData::~QThreadData(this=0x0000600002468000) at qthread.cpp:82:5
    frame #2: 0x0000000101db8379 QtCore`QThreadData::~QThreadData(this=0x0000600002468000) at qthread.cpp:57:1
    frame #3: 0x0000000101db841c QtCore`QThreadData::deref(this=0x0000600002468000) at qthread.cpp:108:9
    frame #4: 0x0000000101f4ec79 QtCore`destroy_current_thread_data(p=0x0000600002468000) at qthread_unix.cpp:104:11

This commit centralizes and gives ~QThreadData() the exclusive
responsibility.  That requires not resetting QThreadData::threadId so
~QThreadData can know it is theMainThread.

Fixes: QTBUG-130895
Task-number: QTBUG-129927
Task-number: QTBUG-129846
Task-number: QTBUG-130341
Task-number: QTBUG-117996
Change-Id: Ie3f3cbdc5523837b505cfffd95fba5e6498b5069
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 65093a84c2b94b1543fd4593bc45d491951d28d4)
2024-11-15 03:17:29 -07:00
Ivan Solovev d17bb8fa85 Doc: fix deprecation version for QScopedPointer's member-swap()
The code tells that it's deprecated in 6.2, while the docs were
mentioning 6.1. Update the docs to use the correct deprecation version.

Amends 1bf48c16b166c80d208f130fb4f8130f63ef741c.

Pick-to: 6.5 6.2
Change-Id: I4ec3b8e840ec5aa534ea1f2687a23584178bb4a6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 0b34a205cc3ab6985efa705d066e85167ce0181c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-14 18:58:59 +00:00
Thiago Macieira 2b3e56e2b4 QCoreApplication: use QThread::isMainThread() more
QCoreApplicationPrivate::mainThread() asserts that there is a main
thread, which means we can't use it to detect after the main thread has
been unset (late destructor-on-exit).

Change-Id: Iedcd0827d1e659f3de35fffd60cac0b47cc496bb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9bac90db46913ae70fd29676cb22890b4ac9aaa4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-13 21:57:00 +00:00
Thiago Macieira 752ee25559 QCoreApplication: remove now-unnecessary thread affinity check
Partially reverts commit 65953e05d3 (the
rest will be addressed in the next commit) now that we have an atomic
access to the QCoreApplication instance.

This thread-affinity check code was there because the code had a data
race in accessing QCoreApplication::self. It ensured that we only read
that variable if the receiver was in the main thread, because if a
receiver is not in the main thread, then it can't be QCoreApplication.

Change-Id: I09618961cca80fef2dc1fffdab65316164023207
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit a90349aa2141767147498d8f6a6d69dc25af89bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-13 21:56:53 +00:00
Thiago Macieira a00bff6525 Add a way to access QCoreApplication's instance atomically
We use it from many places in Qt that may run before QCoreApplication
has been created (officially not supported but it happens) and after it
has been destroyed. In particular, we have code in QtDBus that runs in
another thread after QCoreApplication has been destroyed and uses the
event system. Accessing QCoreApplication::self anywhere but the main
thread was a race condition in those conditions.

Change-Id: If4ad1af9301dca98ba69fffdf88c63b220db53ac
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 7d92ecd9173a5ce4af8eb6ac05d6e7648d433db4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-13 21:56:47 +00:00
Marc Mutz 6be6081ffe [docs] Add missing docs for QScopedPointer::swap()
Only the ADL swap was documented, but this class has member-swap, too
(albeit deprecated), so document it.

Pick-to: 6.7 6.5 6.2
Change-Id: I71a6636172170387c9e4a264d2d118c2a9ce6f91
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 1bf48c16b166c80d208f130fb4f8130f63ef741c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-13 18:04:25 +00:00
Alexey Edelev 97420aaa46 Android: Do not duplicate copy_if_different command for android target
The CMake copy_if_different command, which copies the android target
library to a libs/<arch> directory could be executed in different code
paths which caused a multiple access to a same file in a filesystem.

Avoid doing this and depend on <target>_prepare_apk_dir target for the
depfile code path too.

Pick-to: 6.5
Change-Id: Ib62cf24ecc69a17ce1b52cd1f001aeff866051cd
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 76fef03f19ab2a41ec9fdc9a72a08b5e1ea80a95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-13 18:04:25 +00:00
Edward Welbourne 33bf7dc9f8 Make static constexpr data tables inline in corelib/t*/q*_data_p.h
This should keep gcc from complaining that they're unused const
variables. Pick to 6.8 required conflict resolutions in non-generated
code and qlocalexml2cpp.py due to dev's updates to handle time zone
name L10n; regeneration of data took care of the other conflicts.

Fixes: QTBUG-128930
Change-Id: I4d0bccc5f158dfc72e4cf38a085b90cb562dc185
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 08ef4d232df82c056d4f5fda636b62b65fc054ad)
2024-11-13 15:04:00 +01:00
Marc Mutz b8c9a4c3d1 Create qdoc macros for C++ class docs 1.3: member-swap(), non-standard phrasing
We have some patterns for how to document certain functions, but we
also vary the sentences a lot, and you have to look up one
documentation piece and copy it, essentially. If we ever want to
change them, we end up with shotgun surgery.

So apply DRY to the documentation and start a collection of macros to
help with repetitive C++ class documentation tasks.

The first macro is for member-swap(), and this third patch is for
documentation that used a non-standard phrasing for documenting
member-swap(). By using the macro, the documentation automatically
conforms to what the documentation team picks as the \memberswap
expansion going forward.

As a drive-by, fix doc block indentation to the Qt standard of 4
spaces (only in changed lines), and add a few blank lines where they
were missing before.

Fixes: QTBUG-129573
Pick-to: 6.7 6.5 6.2
Change-Id: If007602d7690572fcbb848a8d0235416c908cfd2
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 82058367923ce164024885854c139ee5e0d89949)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-12 13:09:02 +00:00
Marc Mutz e1f46ee8ae Create qdoc macros for C++ class docs 1.2: member-swap(), simplified phrasing
We have some patterns for how to document certain functions, but we
also vary the sentences a lot, and you have to look up one
documentation piece and copy it, essentially. If we ever want to
change them, we end up with shotgun surgery.

So apply DRY to the documentation and start a collection of macros to
help with repetitive C++ class documentation tasks.

The first macro is for member-swap(), and this second patch is for
documentation that used the simplified phrasing ("Swaps this X with \a
other."), which this patch adopts as the text for \memberswap, too,
because it doesn't repeat the macro argument, making it easier to find a
grammatically-fitting argument than in the traditional phrasing.

This doesn't change the documentation, except as follows:

* standardizes on simpified instead of traditional phrasing for docs
  that already use the \memberswap macro
* adds the "very fast and never fails" blurb, if it was missing
* changes the function's argument name to `other`, as required by
  the macro.

Task-number: QTBUG-129573
Pick-to: 6.7 6.5 6.2
Change-Id: I1123e783ce0da76c5997ff74007d77504ac5b334
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 5627e113793df3df24742d7af502a075c2c9e95d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-12 13:09:02 +00:00
Marc Mutz 285bfffc63 Create qdoc macros for C++ class docs 1.1: member-swap(), traditional phrasing
We have some patterns for how to document certain functions, but we
also vary the sentences a lot, and you have to look up one
documentation piece and copy it, essentially. If we ever want to
change them, we end up with shotgun surgery.

So apply DRY to the documentation and start a collection of macros to
help with repetitive C++ class documentation tasks.

The first macro is for member-swap(), and the first patch is for
documentation that used the traditional phrasing ("Swaps the X \a
other with this X.").

This doesn't change the documentation, except as follows:

* adds the "very fast and never fails" blurb, if it was missing
* changes the function's argument name to `other`, as required by
  the macro.

Task-number: QTBUG-129573
Pick-to: 6.7 6.5 6.2
Change-Id: Ib494bd218334724b3b43796ba6f71fb52b83aa94
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 3ccb4ce781463f1b8e0cb4c9283b3067fe92a32e)
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-11-12 13:09:01 +00:00
Jarno Lämsä c81e250f85 Don't support moving files to trash on VxWorks
On VxWorks 24.03, the `AT_FDCWD` wasn't defined, which happened to
branch to the correct branch. VxWorsk 24.09 TP does define the
`AT_FDCWD`, which causes the preprocessor directives to branch to a
branch where moving files to trash would be supported.

In a sidenote, VxWorks doesn't define `renameat`, `O_DIRECTORY` nor
`O_NOFOLLOW`.

Task-number: QTBUG-130629
Change-Id: I2b850813aeff6f925ab91932efd7aeb13f753f69
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 039b0c6b9b94eb7601fa3b652e8b668d32251f7e)
2024-11-12 04:42:51 +02:00
Alexandru Croitor c53a9d9ffb CMake: Add the android finalizer to Core also during the qtbase build
This will allow running the finalizer properly for Android tests in a
qtbase built with in-tree tests.

This is similar to what we do with the
_qt_internal_add_qml_deploy_info_finalizer for the Qml module.

Task-number: QTBUG-93625
Task-number: QTBUG-112212
Change-Id: I233ce229054b5ce15783cf06b9a69aaa68eb8847
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a72dacce214e394da33529f2501e14c21b13c763)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-11-11 16:39:27 +01:00
Jøger Hansegård e04d9276b9 Remove TODO statement from QWinRegistryKey::stringValue()
QWinRegistryKey::stringValue is more readable than
key::value<QString>().value_or(QString()).

This patch also adds developer documentation for the function.

Change-Id: I6a760db77a50ca9fa810196e14af14068df8aee3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 16ca13e148445b5a18ea768c096dfedfbacce3c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-09 20:00:08 +00:00
Jøger Hansegård 8a23001ca6 Replace QWinRegistryKey::dwordValue with QWinRegistryKey::value<T>
QWinRegistryKey::value<T> returns an optional<T> which can make code a
bit more readable than the std::pair<DWORD, bool> return value from
QWinRegistryKey::dwordValue.

This implements part of the "TODO: Remove once all usages are migrated
to new interface." comment in QWinRegistry class because it allows us to
remove the QWinRegistryKey::dwordValue function.

Change-Id: If568de4e31778e91ce7aadadb4aac90e41222826
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7a63a25ef71fbbe7b3eaa6ecb9a26c3e497e582a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-09 20:00:08 +00:00
Marc Mutz 5a9c513231 QPromise: fix documentation re:setException() after cancel() or finish()
The implementation checks the state and returns without storing the
exception when its canceled or finished.

Add tests for both situations.

Done-with: Ivan Solovev <ivan.solovev@qt.io> (analysis and phrasing)
Pick-to: 6.5 6.2
Fixes: QTBUG-128405
Change-Id: I4610a022ea12e1bc9ce24cb17b972b5b9e051f0a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 6efec3850da188d3bba075185aa6e5c264c815eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-08 21:43:11 +00:00
Joerg Bornemann eda1e4b84f CMake: Fix CMP0177 warnings
CMake 3.31 introduced CMP0177 that warns if an install destination is a
not-normalized path. Fix this by normalizing the offending paths before
using them.

Change-Id: I1586bf192a4fd26108aa0448431f19e69df8aacd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 14fc7f0852903109fed8357e2df9edc851f31b65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-08 18:52:25 +00:00
Thiago Macieira 0c2c9ca7f4 QThread/Unix: replace some uses of pthread_self() with our code
This code predated the existence of the currentThreadId() and
isCurrentThread() functions. Our implementations are slightly faster.

Change-Id: Id2b20a7f06e0c2a1bc35fffd4fb4dcf3f20769cd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8a8e91a7c141994c331d2b9da7d9c5e2129c70b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-07 22:00:12 +00:00
Thiago Macieira 4f85eed8e3 QThread: avoid unlock/lock/unlock in ~QThread if state is Finishing
This is a corner-case scenario but valid because we tell users they can
destroy the QThread object right after finished() has been emitted. But
emitting finished() does not mean the launched thread has actually
exited: it may still be in Finishing state for an arbitrarily long time.
Completely aside from what else may run from other libraries, we only
destroy QThreadStorage and the thread's event dispatcher after
finished() has been emitted.

This commit avoids the unnecessary mutex unlocking in the destructor,
then QThread::wait() locking again, only to unlock yet again so that it
can perform the necessary low-level wait calls. The same for the return
path: wait() locked again to check the state, then unlocked, only for
the destructor to lock again. Now, QThreadPrivate::wait() is responsible
for returning with a locked mutex.

Change-Id: I87adffb89f275accea18fffd6b4293861ea7cf39
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 6bd271cf74d6d57816531f688c82c51d29f1be91)
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-11-07 15:00:11 -07:00
Thiago Macieira 90c436dd1e QThread: make finish() and cleanup() non-static members
Looks cleaner.

Change-Id: I77148a15c316ea0eaf63fffd9358d952c5b9e1d0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f94c9b0f3a060fa98c270d5ccab3055e77ebc35f)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-11-07 15:00:11 -07:00
Thiago Macieira 334a3922c0 QThread/Unix: refactor to split QThreadPrivate::finish() in two phases
Commit 1ed0dd88a3 moved the finish()
functionality from immediately after run() returns to the time of
thread-local destruction, to make sure that user destructors didn't run
after our cleaning up. But as a side effect, it made other user code run
too late, after some thread-local statics had been destroyed.

This is a common practice, which causes the destructor for worker to run
too late:

    worker->moveToThread(thread);
...
    QObject::connect(thread, &QThread::finished, thread, &QObject::deleteLater);
    QObject::connect(thread, &QThread::finished, worker, &QObject::deleteLater);

This commit splits the cleanup in two phases: QThreadPrivate::finish(),
which runs immediately after run() and will call back out to user code
(finished() signal and delivery of deleteLater()), and cleanup() that
cleans up the QThread{Private,Data} state and destroys the event
dispatcher. That destruction is the only call out to user code.

I've removed the complex mix of pre-C++11 pthread_setspecific() content
and C++11 thread_local variables in favor of using one or the other, not
both. We prefer the thread-local for future-proofing and simplicity, on
platforms where we can verify this C++11 feature works, and because it
allows us to clean up QThreadData and the event dispatcher as late as
possible. (There's some code that runs even later, such as pthread TLS
destructors, used by Glib's GMainLoop)

Unfortunately, we can't use it everywhere. The commit above had already
noticed QNX has a problem and recent bug reports have shown other
platforms (Solaris, MUSL libc) that, 13 years after the ratification of
the standard, still have broken support, so we use pthread for them and
we call cleanup() from within finish() (that is, no late cleaning-up,
retaining the status quo from Qt 4 and 5). See QTBUG-129846 for an
analysis.

Drive-by moving the resetting of thread priority to after finished() is
emitted.

[ChangeLog][QtCore][QThread] Restored the Qt 6.7 timing of when the
finished() signal is emitted relative to the destruction of thread_local
variables. Qt 6.8.0 contained a change that moved this signal to a later
time on most Unix systems, which has caused problems with the order in
which those variables were accessed. The destruction of the event
dispatcher is kept at this late stage, wherever possible.

Fixes: QTBUG-129927
Fixes: QTBUG-129846
Fixes: QTBUG-130341
Task-number: QTBUG-117996
Change-Id: Ie5e40dd18faa05d8f777fffdf7dc30fc4fe0c7e9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4fabde349f16b59f37568da2a4c050c6dd53a34e)
2024-11-07 15:00:11 -07:00
Lucie Gérard 27ae8dbab4 Add REUSE.toml files
Those files are read by reuse to complement or override the copyright
and licensing information found in file.

The use of REUSE.toml files was introduced in REUSE version 3.1.0a1.
This reuse version is compatible with reuse specification
version 3.2 [1].
With this commit's files,
* The SPDX document generated by reuse spdx conforms to SPDX 2.3,
* The reuse lint command reports that the Qt project is reuse compliant.

[1]: https://reuse.software/spec-3.2/

Task-number: QTBUG-124453
Task-number: QTBUG-125211
Change-Id: I01023e862607777a5e710669ccd28bbf56091097
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4c83657448f66ac0ee46900aff2e5a230eda49b0)
2024-11-07 08:38:49 +01:00
Marc Mutz d480177789 Make QSpan::isEmpty() constexpr
Negligent omission, since empty() is constexpr, and so is everything
else in the QSpan API.

Amends 03e78e5d62.

[ChangeLog][QtCore][QSpan] Fixed isEmpty() to be constexpr (empty()
already was).

Change-Id: If1e1e72422d68b0c35c37354067098332e6e4e10
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 0576c2b7266003d8f17e9af896de15cf7184b858)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-05 18:53:19 +00:00
Safiyyah Moosa 50f507eb44 Doc: Clarify run() and started() order in QThread
This fix addresses a customer suggestion to clarify the QThread()
documentation. It now states that started() is emitted by the newly
started thread, so any slots connected to it will occur by queued
invocation. For clarity purposes, an additional sentence has been
added to state that whilst the event may have been posted before
run() is called, cross-thread delivery of the signal may still
be pending. A link to 'Signals and Slots Across Threads' has also
been added.

Fixes: QTBUG-112221
Pick-to: 6.7 6.5
Change-Id: Id502eb4bf48b745af4d9906d7cd05de73d2b6418
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 371872af23c1c9f9b3b56dd191fb13f850615dd4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-05 16:32:50 +00:00
Tor Arne Vestbø 683d839f14 visionOS: Handle CNAuthorizationStatusLimited for contacts permission
Change-Id: If6565d9cc3303b2a3ec7140d67d3a773ea64fff9
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 6cc0b775def78cb92705b65c0bc7abd0ad673049)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-05 15:30:22 +00:00
Assam Boudjelthia 6aca2efd62 CMake:Android: add wrapper scripts to easily run apps
Create a script that allows running an app or a test easily similar
to running on host. This improves development workflow and time by
allowing quick runs without having to manually call the various adb
commands to launch, get a pid of the app and then print the logcat,
let alone passing parameters or environment variables.

For normal apps, the app package name is retrieved by the script, run
and live logcat is printed as long as the app is still running.

For tests, the script calls androidtestrunner, allowing test parameters
to be passed to the test.

For CI debugging, this would save quite a lot of hussle and frustration
trying to run or debug a test app.

One other benefit for this is enabling running Android tests from Qt
Creator's testlib plugin without big changes to Qt Creator to support
androidtestrunner explicitly.

Because file(GENERATE) would fail if called twice for the same file,
I use file(WRITE). This is used because at the time of calling the
target executable finalizer, we don't know if the target is a test
or not, so we rely on writing the script first as a normal target,
then call it if the target is a test where it overrides the script.
For this also, parameters passed to the runner or androidtestrunner
can't handle generator expressions.

[ChangeLog][CMake][Android] Add wrapper scripts to run Android apps and
tests with ease from the host.

Task-number: QTBUG-129889
Change-Id: I84e85ce2bbf6944c8aa20bdc2c2b6d7b956bc748
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a905d26f14da1cf86b8490331c0cc41c2a45b283)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-11-04 11:00:57 +01:00
Jaishree Vyas 12e30532de Doc: QString::slice uses the wrong snippet
Changed the number, which caused the problem of showing the snippet.
Two of the same numbers were given to the different snippets.

Fixes: QTBUG-130565
Change-Id: Iba738a1bdaf5821df48bf5e222bee911c5ddf1fc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit b3e5b134eeaae85025879cd0309664ce0ba1f6de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-02 16:25:07 +00:00
Thiago Macieira c68c0fb64c QWaitCondition/Unix: fix execution with negative deadlines
pthread_cond_timedwait() doesn't like it.

Change-Id: I37ae26948fbc72fd1028fffd107e561cc54c4553
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d60472c2c436fc464d5a1b81538967676f71b6a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-02 16:25:06 +00:00
Ivan Solovev 0f2afeba04 Docs: fix documentation for deprecated QDateStream::readBytes overload
The patch that introduced the deprecation lost '!' at the beginning of
the comment block. As a result, the documentation for the deprecated
method was not generated at all.

Amends cbc6ee0eb9.

Change-Id: Ief2f4aae7e21363224fa44ef42847aa132ea769a
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
(cherry picked from commit 4ce7235fdd6183478eebfcf2f1d6058a172b285a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-02 16:25:05 +00:00
Alexandru Croitor 45c8ab1149 CMake: Split target finalization code into a separate function
It was duplicated across a few public API.
Splitting it will also allow it to be be reused in a future change
in another function.

Also add the ability to use the poor man finalizer approach for
CMake 3.16, but only via an opt-in that will be set by the qt build
process, so that the finalizers can be used for tests in a future
change.

Task-number: QTBUG-93625
Task-number: QTBUG-112212
Change-Id: I097faf5e3db98457acfdfb3ae2011efb6640f35e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2bbc0bda30e0c34ea63f0b6836c34c765a06e049)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-02 14:49:16 +01:00
Marc Mutz ced68767da QByteArrayView: port IsCompatibleByteTypeHelper from is_same-chain to specialization
Less templates to instantiate, so faster compilation.

Pick-to: 6.5 6.2
Change-Id: I0552e496895db2710f33b8fd4b555cfa5c2d8157
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 327e8a904cb8e6665b7e42ae35cdcfd2afc84409)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-02 02:48:02 +00:00
Edward Welbourne fcd52bf984 Rework the tzAbbr() helper of dateTimeToString()
Break out the offset-specific code (partly in preparation for handling
its localization better, but also) to ensure we try more candidates
and, when using the system locale, only use QTimeZone::displayName()
if we must - as it may oblige us to instantiate the system time-zone
instance. Tweak ordering of #include headers while I'm about it.

Change-Id: I183ddd1bcb181120df5561bfdc4d89a218292ee0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1b909695a66500b3cceb0fee668b12a663ed3b8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-01 14:31:32 +00:00
Marc Mutz ae01520633 Fix cxx11_future test
The test incorrectly failed on Linux because of a linker error
(unresolved symbol pthread_create()).

Fix by adding Threads::Threads, which provides -lpthread, where
needed.

Amends ced943e936.

Fixes: QTBUG-130621
Change-Id: I25f7a5d6528576700628a85953c2e5c1a88dfe41
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 129523280cb7a6c9af5c6edc2da09bb333bc7833)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-01 14:31:31 +00:00
Marc Mutz 86b676ffc6 QAnyStringView: group the char-ish ctors visually
Separate them with blank lines from the other ctor sets, remove an
internal blank.

Pick-to: 6.5 6.2
Change-Id: I5cb165930520681b68a85b57d05a86c0ca440805
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f68443d981babe9e2d98b9e7cad53b287d8229c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-01 04:01:21 +00:00
Volker Hilsheimer 8c40e8cf12 QTranslator: work around uiLanguages not including lang_Terr variants
Amends 7a7f2547f3, which added the triplet
including the script before the language_Territory name without it. The
truncate-from-the-end algorithm in QTranslator ended up trying the pure
language first, and - if found - ignored any more specific territory-
variant that might be present.

To fix this, replace the truncate-from-the-end algorithm when we try
to find files, and instead create a comprehensive list of fallbacks,
avoiding duplicates as we go along. Insert those fallbacks right after
their base-entry. We then try to find files for each entry, with and
without the prefix.

This fix is needed only in 6.8 and 6.5; from 6.9 onwards, the change to
QLocale::uiLanguages in 84afaafc9c6968dd76fcadc5392065d340543521 fixes
this on the correct level, making kludges in QTranslator unnecessary.

As a drive-by, replace int indices in for-loops with qsizetype.

Fixes: QTBUG-124898
Pick-to: 6.5
Change-Id: Ia3deceb4ed2c6ef5ca0a815cc7b8878bf29ef088
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-10-31 23:15:29 +02:00
Assam Boudjelthia 74a5f3c308 Android: pass QString directly to jni call in QAndroidItemModelProxy
Change-Id: I69b21972008809e4e8eb12e05aea9d959a4f7ee6
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
(cherry picked from commit 9bb2b6cec8bc502414edfcb328498663fde30f44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 19:12:11 +00:00
Joerg Bornemann 847b491520 CMake: Fix qt_add_resources calls in different directory scopes
"Different" meaning here "different from the target's directory scope".

Consider a qt_add_resources call in a directory scope that's different
from the target's directory scope. Then CMake's AUTORCC would pick up
the generated .qrc file. This leads to duplicate symbols errors in the
linking phase.

The reason for that is that we add the .qrc file as source file to the
target, and the SKIP_AUTOGEN property is ineffective, because we're
setting it without the TARGET_DIRECTORY option.

This situation occurs, for example, with a qt_add_translations call in
the top-level CMakeLists.txt on a AUTORCC-enabled target that's defined
in a subdirectory.

Fix this by adding the TARGET_DIRECTORY option when setting SKIP_AUTOGEN
on the generated .qrc file.

Pick-to: 6.5
Fixes: QTBUG-130056
Change-Id: Iedc847eb85d918c5a1df20cb477e3192d1138b7f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d516a452232bd9b969db19a62586e969dfc54b39)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 15:35:47 +00:00
Nils Petter Skålerud a6ffdfec98 Darwin, permissions: Fix crash caused by callback going out of scope
Change 0990bd49407aac4f96acf78761af1070ff934215 introduced a runtime
crash where callback object was being referenced rather than copied,
causing it to go out of scope and causing a segfault. This patch
captures the callback by copy explicitly.

Change-Id: I9670041273ec8f7bb53108cbaf816e895225cf02
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 05b4b1e1250843155d91c929b25d8a8e188315fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-31 15:35:46 +00:00
Juha Vuolle cba3c30047 Prioritize Android permissions of the application manifest
This is a manual cherry-pick from
2c1506b1bd551249852d43250d7919f5e3ac7ac1
With minor documentation modification (6.8.1 instead of 6.9).

Users may use their own AndroidManifest.xml and define permissions.
However in case the manifest defines a permission that a Qt module also
sets when the <!-- %%INSERT_PERMISSIONS --> template replacement is
done, an error will occur during the application build (duplicate
permission definition).

This patch prioritizes such manual permissions and removes any
previous ones a Qt module might have set.

Task-number: QTBUG-129944
Change-Id: If94c218928aa5672686dd468a8d66995508d591f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 2c1506b1bd551249852d43250d7919f5e3ac7ac1)
2024-10-31 08:31:18 +02:00
Juha Vuolle e28adc19ed Decouple location and bluetooth permissions if API level >= 31
This is a manual cherry-pick from
bb8cf72233e05c88424d525ca578cbf21d66c938
With minor documentation modification (6.8.1 instead of 6.9)

Since Android-12 / API-level 31, the ACCESS_FINE_LOCATION is no longer
mandatory for Bluetooth usage. Removing it will avoid unnecessary
location permission query (user prompt).

There are less common use cases to derive the location too. In these
cases the user must override the BLUETOOTH_SCAN permission so that it
no longer asserts neverForLocation, and also request the
ACCESS_FINE_LOCATION permission separately (QLocationPermission).

This change relates to QtBluetooth change, which adds
android:usesPermissionFlags="neverForLocation" attribute to
BLUETOOTH_SCAN permission (in default-generated AndroidManifest.xml)

[ChangeLog][Important Behavior Changes][QBluetoothPermission]
ACCESS_FINE_LOCATION is no longer requested if API-level >= 31

Task-number: QTBUG-129944
Task-number: QTBUG-117358
Task-number: QTBUG-112164
Change-Id: I774d0aada4c08829860d252a616fd0c3992a853d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit bb8cf72233e05c88424d525ca578cbf21d66c938)
2024-10-31 08:31:12 +02:00
Edward Welbourne 38b8c15358 Cope with empty name for a time zone
QTimeZone::displayName() may return empty if it has no
suitably-localized name for the zone. So QCalendarBackend's
dateTimeToString() can't rely on its tzAbbr() returning a string that
starts with UTC (and it may now, with proper L10n, start with some
other prefix) or indeed has length >= 3 (so sliced(3) could crash).
Rework the handling of offset name (mainly for the pick back to 6.8,
as I'll be back to get rid of the kludging in 6.9) to at least not
crash on empty return. In the process, use decreasingly appropriate
forms as fallbacks if we don't get what we want.

Fixes: QTBUG-129696
Change-Id: Id4f42778ca9a4806ac5dba23ce7068261a90500b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9e749df879a5bc76fa416c96f73378d81608801f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-30 15:09:29 +00:00
Edward Welbourne 8196b4d380 Expand suppression of gcc's free-nonheap-object warning
Added a comment to the suppression, to make clear why it's justified.

Change-Id: Ibc8aea809a8e9467b3a194a142296ea6b79e1971
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b460d0bd809b10705d2658bfb62cb0d04835c015)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-30 15:09:24 +00:00
Edward Welbourne 87b6540a08 Rename example parameter to better reflect its role
The Q_GLOBAL_STATIC docs repeatedly used MyType as the name for an
illustrative type but staticType as the name for the variable of that
type. While this was surely meant to mean "static of MyType" it made
it sound like it was the name of a type. So rename it myGlobal.

Pick-to: 6.5 6.2 5.15
Task-number: QTBUG-130613
Change-Id: Ia1bb1dbdb27e45ea84daad5bd5ec77313a53236f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 60962e7a9cd765ac114de3c2eeee4ca2a7a6d21a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-30 15:09:07 +00:00
Edward Welbourne b11f2ccc5b Correct QGlobalStatic<>::exists() documentation
The documentation claimed that exists() would return true even after
destruction. This was not true when this implementation of QGS was
introduced by commit f7eff72517. The
docs in commit c0860d26a1, however,
claimed it and no-one seems to have noticed the error until now.
Both commits first landed in Qt 5.1.

Pick-to: 6.5 6.2 5.15
Change-Id: Ic92c8ead25faed0125ff583cb76420a4154af9df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e9226e6e44419affb13ebdd9c624ea8ef357dc2c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-30 15:09:04 +00:00
Alexandru Croitor acd906061a CMake: Clean up _qt_internal_finalize_batch
The _qt_internal_finalize_batch function had a bunch of problems,
style-wise and function-wise:
- it called find_package(Qt6) in its body, which broke when
  configuring qtbase with in-tree tests

- it constantly rewrote the merged blacklist file on each
  reconfiguration

- it used file(WRITE) to concatenate content

- it was in the public API file

The changes are:
- Move the function to the internal test helpers file.

- Change it to use qt_configure_file instead of file(WRITE).

- Call it at the end of the qt_build_tests for a repo, or at the end
  of configuring a super build, instead of relying on a finalizer.

- Remove the find_package call. The reason this was added in the first
  place, was to populate the __qt_core_macros_module_base_dir variable
  so that qt_internal_add_resource configure_file call doesn't fail in
  standalone tests build.
  The variable was unset because the finalized function was called in
  the top level directory scope, whereas the very first find_package
  call was in the tests/ scope, meaning the variable was empty.
  This is still a problem in the top-level build where the tests scope
  and the top-level scope are different. Work around it by relying on
  a global property to reset the value if it's empty.

Amends 6a9e89121d

Change-Id: Id6fe41ee86d09b8118bea52cac8a59965d7ecb9e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit c997e3bb8b4a35a729f1c207b01385d1323cad2b)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-10-30 10:57:14 +01:00
Phil Thompson d61a15d043 Fix QFlag properties built by QMetaObjectBuilder
When Q_PROPERTY is used to define a property with type (for example)
Qt::Alignment the name of the type stored in the meta-object is
"Qt::Alignment".

When QMetaObjectBuilder.addProperty() is used it will instead use the
name of the meta-type (ie. "QFlags<Qt::AlignmentFlag>") which it has
obtained from QMetaType::fromName("Qt::Alignment").name().

In the QMetaProperty ctor it tries to resolve the QMetaEnum for the
property and uses the internal parse_scope() to extract the scope and
qualified key from the name. However it does not handle template names
and so fails with dynamically created properties.

This change to parse_scope() removes the "QFlags<>" so that the
template type can then be parsed.

Another solution would be for addProperty() to always use the type name
it was given rather than use QMetaType::fromName(). That has the
advantage that the layout of the dynamic meta-object would match that
generated by moc.

Change-Id: Iac9e2db2f134029709158b4e500286922396501d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5624060865e3ccd3c487f10355cb740b7322f93c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-29 20:51:12 +00:00
Thiago Macieira 778c70c84c QMetaMethodBuilder: limit the bits of attribute()/setAttribute()
Change-Id: I2d680563e65be28666f5fffd6aac927fd40c6b5d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d0580a231c9b8e2a97fc0ea6a558b593dcb0c3d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-29 20:51:12 +00:00
Mårten Nordheim 19899d88eb Wrap QModelIndex in QSortFilterProxyModel for hash performance
The qHash implementation for QModelIndex is not very good resulting in
hundreds of collisions in the hash table. This means most lookups in the
table essentially becomes a linear search. This was 'generically' fixed
for Qt 7, but couldn't be fixed for 6 because of the qHash
implementation is inline and would result in different hash values for
the same QModelIndex in different translation units.

To work around this for this particular instance, we wrap the
QModelIndex in a struct that has the fixed qHash implementation.

Fixes: QTBUG-130309
Pick-to: 6.5
Change-Id: I586fb10cadf73900f3d644f421c37b381224a419
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1558811a8485f6dcc51a50a2bba0846091ca8bf6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-29 20:51:12 +00:00
Alexandru Croitor 1ca3e4d04f CMake: Fix deprecation level regex
It should allow a through f for hex digits as well.

Fixes: QTBUG-130119
Change-Id: I79a13d4e5dfee5c4c229eb64c26a5530928d0495
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ff5bc9266a39dc1d63ca02f592089bd4c2d9c4f6)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-10-29 19:08:23 +01:00
Mårten Nordheim 298ea22e98 Don't include qglobal when qnamespace is enough
Since all it needs is Qt::HANDLE qglobal.h is an overkill.

Task-number: QTBUG-106722
Change-Id: Ib000532bae3500a06c548b3c308e28bf0abf80d1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit dee05596d3ef95572e97a84191f9141e9231e75f)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-10-29 12:40:29 +02:00
Ivan Solovev 0174df3a4b Docs: Fix QScoped(Array)Pointer::swap() deprecation version
The code tells that it was deprecated since 6.2, but the docs were
incorreclty mentioning 6.1. Fix it.

Amends fe9d7bf759
and a2c8184b6b.

Pick-to: 6.5 6.2
Change-Id: Icff14ccc5d581d27d721241e8d594ac9fad8e7a6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 65e9c215ff25f7b97520a2b502548c5f5af0e589)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-29 01:10:31 +00:00
Marc Mutz 6535b6d5f3 QList: fix std::to_address(QList::iterator) on older compilers
Need to enable element_type unconditionally, to direct the default
std::pointer_traits::to_address to fall back to operator->().

[ChangeLog][QtCore][QList] Fixed std::to_address() on QList::iterator
on older compilers.

Fixes: QTBUG-130643
Change-Id: I521f327933c51ca87c511a7741b2dce65094032b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit b8c879f273533d87f52dbc8e9d2f9b3b3566cd60)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-29 01:10:27 +00:00
Ivan Solovev 301e2d2929 Docs: Specify deprecation version for QLibraryInfo::LibraryLocation
The typedef was deprecated in 6.0, but the docs were missing this info.

Amends 557623cc4f.

Pick-to: 6.5 6.2
Change-Id: I634d946e54302c9ca06c1a91c5b63c3fc6a07aa3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b85d704c4bf762a9a5965661835d711f1d00435d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-28 20:57:09 +00:00
Marc Mutz 7338e481a9 QMessageAuthenticationCode: remove unused qvarlengtharray.h include
Amends 1fb0dca140, which removed the
last QVLA use from the TU.

Pick-to: 6.5
Change-Id: Ia1848c1e4bb1336706aadb72b864d788aed8f2fe
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 2c7910cada7668ab55ad0edac82cf9c215ff4adb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-28 17:48:45 +00:00
Marc Mutz bf8bdf4564 Move QSmallByteArray out of qcryptographichash.cpp
Its definition triggers QTCREATORBUG-28838, which has been marked as
Won't-Do.

By moving the class into its own header file, we limit the fallout of
said bug, which otherwise makes working in qcryptographichash.cpp a
nightmare with QtCreator.

Task-number: QTCREATORBUG-28838
Pick-to: 6.5
Change-Id: I12b8069ab77bfaee33b5df1b09757d617b142a44
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d36835f0e3cb58a9858dc6cc13fbdec9ded7c227)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-28 17:48:45 +00:00
Marc Mutz c851050fae QSmallByteArray: add missing Windows min/max macro protection
This is in preparation of moving the type into its own header file.

Amends 29050fa65b.

Task-number: QTCREATORBUG-28838
Pick-to: 6.5
Change-Id: I9dd35c1adc9b1ea32d8616ace89975c07a380ae4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 4a1e0ddeae566ab730c1505bb654471509ba0cfa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-28 17:48:45 +00:00
Lorn Potter b56e959d60 wasm: fix wasm sockets when data buffer is less than 3696
The socket message comes in too early so add an additional
postEvent when registering the socket notifier.

Fixes: QTBUG-125874
Change-Id: Ie951b7a1b858d12927478e071157780ac4fc320b
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9b01f1bdb7e4107de3f898446fa087efa81e029e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-26 00:04:49 +00:00
Dheerendra Purohit f03d386039 Add parameter for function call in QIdentityProxyModel
This change ensures that the correct model index is passed to the sourceModel()->data() function when retrieving the DateRole value.

Pick-to: 6.5
Fixes: QTBUG-70792
Change-Id: I66c9f2404533625f05dd51db2d9263287db6ee91
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit f0d6bfb2426392060575dc61bfa698df7964bf5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-26 00:04:48 +00:00
Marc Mutz e5e560c7fd QDebug: simplify op<<(std::optional)
We don't need to enable nospace() if we stream but a single element
(nullopt). As a consequence, delay construction of the StateSaver
until we have determined that the optional is engaged.

Amends b7657ddccb.

Change-Id: Id974dff078cb989b92f84b63bf14956a2fba32b2
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 25931bf2181706e1cba416b0530f07959182f074)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-26 00:04:46 +00:00
Edward Welbourne 00f35aa0a3 Fix trivial typo in QDateTime::fromString() doc
Change-Id: If9011108af7ac0752057e2952e9d67a393792006
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9a0838d553e852130f12c03d1903d560ad8fa6b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-26 00:04:44 +00:00
Ahmed El Khazari a8eaa0c5ac QLockFile: Use fcntl for file locking on Android
This commit updates the setNativeLocks function to use fcntl for file
locking on Android systems. Previously, the function attempted to use
flock, which would return false immediately upon failure in some cases.
By switching to fcntl, the function aims to provide more reliable lock
acquisition on Android.
This change is specific to Android systems and does not impact other
platforms where flock is used.

Fixes: QTBUG-116511
Pick-to: 6.7 6.5 6.2 5.15
Change-Id: Ifb93cb6a8aec801539ba378c23d9b1ada3f069bb
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 3b8e8bd081c3d58d9e0e7ef4129b4f27ea0e250f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-25 08:33:29 +00:00
Giuseppe D'Angelo 41eccd318a Enforce the availability of std::byte
MS-STL has an opt-out that makes std::byte unavailable.
This causes build errors in our headers in case client code opts out,
so detect this case and provide a clean(er) error message.

Change-Id: Iec0790f4c33eb876a98e2e34afbc9889f42333b5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5a3859e0a455d82aea9e7c09b87f0dec91dec4e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-23 05:39:23 +00:00
Ahmad Samir 25b754dbf1 QStringView: de-duplicate some API docs
Change-Id: I736874037780147c2ec0d657689fa4f3066ebe7d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0130ba3cbd43f532726e4db39daf3f64295c861e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-23 05:39:23 +00:00
Edward Welbourne 4408d077ac Address problems with date-time parsing near bounds
Document the limited range of datetimes that can be parsed from
strings and the (awkward) consequence of the range bounds being
specified in local time.

Add tests for UTC hitting those bounds and QEXPECT_FAIL() the ones
that (as the new docs say they may) fail. Technically the fact that
the UTC:min one *doesn't* fail is evidence of a bug in the existing
date-time parser. Its replacement should support unbounded parsing.

Pick to 6.8 required removing a QEXPECT_FAIL() specific (on MS) to the
std::chrono::tzdb backend, which isn't present before 6.9.

Fixes: QTBUG-129287
Task-number: QTBUG-77948
Pick-to: 6.5
Change-Id: Ic90558f1a06a62f7d0a947e37802370d1ab4e373
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3e25203d4d5ba428309e972367dbdf99c4e70327)
2024-10-22 18:53:18 +02:00
Marc Mutz 0f23f9c136 qendian_p.h: fix -Wunused-const-variable
Mark QSpecialIntegerBitfieldZero as inline to avoid the warning.

Amends 38002df206, but not picking to
5.15, because inline variables are a C++17 feature.

Pick-to: 6.5 6.2
Change-Id: Ib10821f575e1c00061bb02592e4ac5462284d515
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit beda65ba9f4252b83aeeb3099465de7cce005fe2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-22 13:15:24 +00:00
Thiago Macieira 76da2f74d4 QUuid: restore sorting order of Qt < 6.8
This brings back and adapted version of the sorting code that was
removed by commit 15f753ca5a60b5273d243f528978e25c28a9b56d. The issue,
as shown in the test, is that we store data1, data2, and data3 as
native-endian integers, so the bitcasts in the new code cause them to
become mangled in little-endian platforms.

Since this is a weird behavior and we'll be changing the sorting order
in Qt 7 anyway, I've left a warning for us to think about it at the
time.

[ChangeLog][QtCore][QUuid] Fixed a regression that caused QUuid sorting
order to change for some UUIDs, compared to Qt 6.7 and earlier versions.

Fixes: QTBUG-130155
Change-Id: I5eeb7b36bfc5ed7218e1fffd6a773c582ad0f6f4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 222891d0b6b84bbf995bd75420bdfb55292c0901)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-22 13:15:24 +00:00
Ahmad Samir 1487d7edb3 QThreadPool: handle negative expiryTimeouts
When setting/getting the expiryTimeout.

Negative values mean "never expire", so use duration::max(), which
QDeadlineTimer interprets as QDeadline::Forever.

Amends (and partially reverts) c57027199996d0f0d2ac8ebc4505c78afa54ab5a

Task-number: QTBUG-129898
Change-Id: I8f141cd3fc3c2ff4d21ba2d9663619bc507aeca4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4678d96d874c21b69f4942e3bfdc5fc97128cf4e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-20 21:49:34 +00:00
David Faure f60bef8768 Tika mimetypes: make SVG magic more tolerant to doctype and comments
Detected by qthttpserver's unittests

Change-Id: I6d60ec232ceb5474f24f22ad822e55a9f2444fae
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit c612a82bbaa0411ca54fbabd2ca1760f0c5e0645)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-20 11:05:04 +00:00
Ahmad Samir ff4252b0b6 QAbstractFileEngine: remove beginEntryList(QDir::Filters)
It was kept so as not to break compilation of user code (overriding a
function that doesn't exist in the base class). But as Marcus Tillmanns
pointed out in a qtcreator code review, it can't work because
QDirListing calls the virutal
engine->beginEntryList(QDirListing::IteratorFlags).

Removing beginEntryList(QDir::Filters) and getting a compile-timer error
is better than the code failing silently in user code (all sub-classes
of QAbstractFileEngine in qtbase have been already ported).

QDir::entryList() isn't affected because it calls
QAbstractFileEngine::entryList() which has an overload that works with
QDir::Filters.

Change-Id: I3cb18402f602ac78a6b29be57e59febb2b9db7c0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4fecfcc867f8215defaa40b50f0340654a36b4c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-19 10:09:37 +00:00
Mårten Nordheim 701263379a QFreeList: return timer IDs with the serial included
When a timer gets unregistered there is a chance that a new timer is
registered again immediately and gets the same ID.
On Windows this is a problem because there may be WM_TIMER messages
remaining in the native event loop that have not been processed.
This may result in unexpected timeouts for newly started timers.

By not masking away the serial/generation from the ID we generate
we will no longer return the same ID that was just freed.

While QFreeList mostly was prepared to be used in this way, one function
was not, and the tests were written with the assumption that the serial
was masked out. So this patch also addresses that.

Fixes: QTBUG-124496
Pick-to: 6.7 6.5
Change-Id: If6784815bfa41e497cbc4e00bef51da3ded5f255
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
(cherry picked from commit 21e9875d62414306fde9738ab255e55f22d1c8ed)
2024-10-19 06:50:26 +00:00
Ahmad Samir 55a8050d1e QDirIterator: don't crash with next() after hasNext() returned false
The typical use-case is calling hasNext() first before using next, but
the API docs say that calling next() even when hasNext() is false,
should just return an empty string.

[ChangeLog][QtCore][QDirIterator] Fixed a crash that happened if you
called next() after hasNext() had already returned false. Ideally you
should never call next() without first calling hasNext() as that could
lead to unexpected results (for example, infinite loops).

Fixes: QTBUG-130142
Change-Id: If0a8b1fe7dbd13b45793409a7a241e53c7257f24
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c7691842f743f568a073582c8f0cacd6ee188f98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-18 01:52:28 +00:00
Thiago Macieira e25150ca29 QFactoryLoader: fix the ability to load symlinks to plugins
Amends commit 7cf39bd785, which changed to
use QDirListing but used FilesOnly. As documented, that does not include
symlinks to files.

I'm updating a few other uses of FilesOnly where they were ported from
QDir::Files and it would be reasonable to expect that symlink to files
would be included. That's why I've left QNetworkDiskCache alone.

Fixes: QTBUG-130109
Change-Id: I1fa195b42fd5e00be157fffd6c861f6ddb1eeed1
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 56fa23911c3a0681de39601489d51805e208dc03)
2024-10-17 17:01:41 -07:00
Thiago Macieira c3fd08e42c QThread: use load/store operations with explicit ordering
The implicit load is an acquire, which isn't necessary in any of these
cases, including the two liens changing the store: they were creating a
temporary QAtomicPointer, which introduced the loadAcquire().

I've left the qCDebug() lines alone.

Pick-to: 6.5
Change-Id: If45e068eaaf3cd4d2c81fffd1459a779b4eb4110
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6806391600b5398d4fdb3c4d2d5e442289522756)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-17 23:40:15 +00:00
Edward Welbourne c5e38fd385 Fix sorting of timezone alias table to be in case-insensitive order
The lookup into it is done case-insensitively (because user-supplied
names of zones might not have the right case) but I forgot to make the
sorting of the data table case-insensitive in the aliases. Regenerate
data: only the qtimezone*_data_p.h are changed by the reindexing of
zone aliases.

On picking to 6.8, drop the change to QTZlocale_data_p.h, as that's
not active until 6.9; and back-date the QTZprivate_data_p.h to match
the change on dev four days ago, as that might just reduce the risk of
later conflicts.

Change-Id: Id5e95c245c7ca421a77298f23baefe6b7021a396
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ff58e09c8d5b3f505d5d3fe9a205e35e96de922d)
Reviewed-by: Mate Barany <mate.barany@qt.io>
2024-10-17 21:30:33 +02:00
Mårten Nordheim ba526d4b84 QOperatingSystemVersion: fix documentation for the Unexported entries
They were not showing up because the qdoc branch sees them as private.

Change-Id: I8be18c389288ff9b589267dd17fbc16dcd7998c7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 5be7b99a160a4cc973fcd82e3ab15e4272814b14)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-17 19:30:33 +00:00
Thiago Macieira 81b71852fa Darwin: Capture 'this' via '&' instead of '=' to fix build with C++20
qdarwinpermissionplugin.mm:37:35: error: implicit capture of 'this'
with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]

Change-Id: I05afd05f43ddceb88cb5fffd85959b494c29ce6a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 0990bd49407aac4f96acf78761af1070ff934215)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-17 16:36:38 +00:00
Edward Welbourne 3167b157cd Remove untruth from QDateTime::fromString() documentation
Two examples were given, one to show "invalid" usage that would, in
fact, work now - producing a date in 2012 - and the other to show
"correct" code which, while correctly delivering the date in 1912 its
author appears to have meant (albeit, giving a four-digit year would
have made that clearer), uses the string API where code should
normally construct dates - much more efficiently - by just passing the
numbers to suitable constructors.

Add tests verifying that the two date-times from the out-of-date
examples do in fact work, even if you tell them the wrong century as
default for two-digit dates.

Pick-to: 6.7 6.5
Change-Id: I8155af019c80729323ba3958fe3942a72bfefc22
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 82d85c16d912b25bfa5b0a081e515fcecda1f975)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-17 16:18:37 +00:00
Edward Welbourne 9b6a585f71 QTimeZone: short-cut the empty-name case for the system zone and its id
The systemTimeZoneId() delegated to systemTimeZone() in a way that
worked - but wasn't easy to follow - in the case where the backend's
systemTimeZoneId() failed but its default constructor succeeds. This
went via the QTimeZone(id) constructor, relying on its handling of
empty id (which gets the system zone, unlike the default constructor
which gets an invalid zone). When it gets an empty id, it falls back
to newBackendTimeZone(), which uses the default constructor of the
backend; and we have (and are even accessing the backend methods via)
a default-constructed backend, so can simply share that with
global_tz. This, if nothing else, saves repeating the systemTimeZone()
look-up for the system ID when delegated to by systemTimeZoneId().

There's a risk that this might miss a change to the system
configuration since the global_tz was initialized, but it's only used
in a fallback and backends tend to cache this information anyway. When
we come to address QTBUG-56899, we can have the refresh function
update the global_tz object.

Change-Id: I8541e74f378e92af5a2a7187a49a9eb14a66c744
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2068645f07ab9108fc54fa2c499b1b2661a35bfd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-16 11:15:43 +00:00
Mårten Nordheim d6c592aa2f QThreadPool: fix regression with negative expiryTimeout
It's supposed to indicate a thread never expires, but following
a change where it stores the expiry with chrono we no longer considered
a negative expiry as 'forever', but rather it immediately expires!

More directly it is because we end up calling
QDeadlineTimer::setPreciseRemainingTime(0 secs, X nsecs), and it only
cares about negative seconds to set Forever. There are complications to
consider nsecs for this since several nanoseconds may pass between
initially calling the function and assigning the values...

Amends 1f2a230b89.

Fixes: QTBUG-129898
Change-Id: I9626de31810fb2751ff6d83165d7dce5258a9baf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c57027199996d0f0d2ac8ebc4505c78afa54ab5a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-15 12:45:00 +00:00
Mårten Nordheim 55ad2c33b1 QHash: Fix typo for heterogeneous lookup feature
searchable was missing an 'r'.

Change-Id: I9532fa4d849c48a16495fe1cbd924ab781d6366d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7a6ecc3e5d4d55709508d6c93414b4af57575a4c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-15 12:44:58 +00:00
Thiago Macieira d815b7d839 QMeta{Property,Method}: document that revision() is encoded since 6.0
Amends f64694647a.

Pick-to: 6.5
Fixes: QTBUG-129920
Change-Id: Ic42789eb08fc264bdce7fffdc6dcfbc8794070bf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 6c8368226e177b7385fc1c3e655df78aecb3d1f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-15 03:15:00 +00:00
Edward Welbourne 35a8223646 Avoid infinite recurision in time-zone abbreviation look-up with ICU
The base-class abbreviation() falls back to its displayName() which
starts by asking for data() for the relevant time. Unfortunately the
backend's data() was delegating (if ICU version is too old, or the
transition lookup failed) to abbreviation for one field of that. So
short-cut out to how the backend's displayName() gets abbreviations
(and how the look-up of transitions finds their abbreviations).

Task-number: QTBUG-129896
Change-Id: I10f15ad822d53b8292774d7093a531df694bb77b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit f38c0fd3fbdd96a2f91bf2890ebe9888fe1ad04c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-14 15:15:36 +00:00
Edward Welbourne a6b350acbc Pass string to ICU-wrapper as a QByteArray, not a QString
The definition of QtTimeZoneLocale::ucalTimeZoneDisplayName() said it
takes a QByteArray but the header-file's declaration said it takes a
QString. That was never going to end well.

Fixes: QTBUG-129896
Change-Id: I5c15f88370f2d15efe2055ff73388c22fdc4ef46
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 01219276fdd3c1b6c867e97f6b8337f46ac82e28)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-14 15:15:26 +00:00
Edward Welbourne ac6f080d16 Remove a duplicate inclusion of qlocale_data_p.h
In tst_qlocale.cpp there was a #include that caused the static data
tables to be duplicated, violating ODR. All it actually needed was the
ability to iterate all rows of the locale_data[] table, so export a
method to do that from QLocaleData and have the test run that instead
of pulling in a second copy of the tables.

Conflict resolution at 6.8 needed the declaration of locale_data_size
moved up qlocale.cpp, which happened after 6.8 as part of other work
that isn't included in 6.8.

Pick-to: 6.5 6.2
Task-number: QTBUG-128930
Change-Id: Ie5ebdf508a622eeca93f8785bc09b086502aa0e2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 96c07655c46afdd3e2da7ef7d339b518d36c83c5)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-10-14 17:15:03 +02:00
Zhao Yuhang 2e18882763 QOperatingSystemVersion: Add Win11 24H2
Windows 11 24H2 has been publicly released already, which can be
downloaded directly from Microsoft's official website [1].

[1] https://www.microsoft.com/en-us/software-download/windows11

Change-Id: I0394e8413c07ec902cadd43bd2fac8a3d4c42c7b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c846db292de94dda9dc58bf5e7697c75a0b0769f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-12 13:44:09 +00:00
Marc Mutz 9c9a1b37b4 QSharedMemoryPrivate: fix -Wshadow in create()
Rename the function argument from size (which is also a data member of
the class) to sz, a common abbreviation in Qt.

The code predates the start of the public history, but
eaa7528baa made create() an inline
function. Hopefully -Wshadow doesn't apply to mere argument
declarations, so not picking further than said commit.

Pick-to: 6.7
Task-number: QTBUG-126219
Change-Id: I637d731ba33247b7223b5d796bc170c0b87edcad
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io>
(cherry picked from commit 724a3cab887e4dcc455389e929ac2b97ebedb94a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-11 15:21:21 +00:00
Marc Mutz 729a30a9df De-inline dtors of QAbstractEventDispatcherPrivate subclasses
... pinning the vtables to a single TU each, instead of duplicating
them for every user.

Task-number: QTBUG-45582
Change-Id: I3b7bce14567dc8be89795a48f6871eb24fe908aa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io>
(cherry picked from commit 2e2f5093912faf612f0be72289180b167d6326a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-11 15:19:09 +00:00
Marc Mutz 94dab5c628 qxmlstreamparser_p.h: fix -Wshadow in parse()
The name `prefix` is also used for a data member, and the very next
rule actually assigns to it, so using the same name in this huge
switch is actually impairing readability.

Fix by abbreviating the local variable.

This code predates the start of the public history.

Pick-to: 6.7 6.5 6.2 5.15
Task-number: QTBUG-126219
Change-Id: Iece828a9303b5449397ac93e51f540bf890f7d08
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io>
(cherry picked from commit 2fda30053dcf13356d72f9a8116413d26bcb14a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-11 15:18:57 +00:00
Marc Mutz b1d325a9e0 QStringConverter/ICU: optimize NUL-termination of codec name
ICU unfortunately requires converter names to be passed as
NUL-terminated C strings. This means that the names that come in via
QAnyStringView have to be encoding-converted (assuming US-ASCII,
ie. Latin-1), and NUL-terminated.

The old code used the convenient toString().toLatin1() methods for
this. This, however, transforms L1 and U8 inputs twice: first to
UTF-16, then to L1. It also always allocates memory.

To fix, first change the temporary string container to std::string
(which has an SSO buffer into which most common charset names will
fit, avoiding memory allocation) and then skip the conversion to
UTF-16, going directly from the source encoding to L1, treating UTF-8
as L1 (because US-ASCII is a common subset of both).

Unfortunately, our L1-to-U16 converter doesn't allow to select a
replacement character other than '?' for out-of-range input
characters, but valid charset names should not contain question marks,
so here's to hoping that ICU doesn't strip them willy-nilly, causing
False Positive matches. The old code had the same problem.

Amends f6c11ac4f20a16d0b2113014e2dac63b95d946ae.

Conflict resolution for 6.8:
- ported from q20::cmp_less_equal to regular operator<

Fixes: QTBUG-126109
Change-Id: If1dd494cf4ee8e2d304a0648c22dc8806718f104
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 62108a08c12abfc1421c283cf34e75ffeded2c12)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-10-11 15:18:14 +00:00
Alexandru Croitor 25686af631 Don't load the lldb bridge from Qt Core script in a Qt Creator session
If a process is being debugged from within Qt Creator, the Qt Core
lldb helper script should not try to load the lldb bridges from each
Qt Creator installation that has been found, because the main
Creator's lldbbridge.py was already loaded, and trying to do it
again would just return early.

In some cases that could even silently break the dumper helpers if a
bridge of an older Creator is loaded, because of the side-effects of
importing lldbbridge.py.

Detect that lldb was launched by Qt Creator via either the
QTC_DEBUGGER_PROCESS or the QT_CREATOR_LLDB_PROCESS variables being
set.

The former is set by Qt Creator 14 and earlier, the latter is newly
introduced in Creator 15.

Add an opt in to force trying to load the bridge if the
QT_FORCE_LOAD_LLDB_SUMMARY_PROVIDER environment variable is set.

Fixes: QTCREATORBUG-31769
Change-Id: Id59ed71f1e59c6c430bc0c72eb30a075db5fa603
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 0806aee2bb355e54abcabe87a5fd97504f692ba9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-10 14:59:39 +00:00
Alexandru Croitor 2469cb7a12 Add more debug messages to the lldb QtCore debug_script.py
So that it's easier to troubleshoot why a certain bridge might not be
loaded.

To enable verbose debug messages, set the
QT_LLDB_SUMMARY_PROVIDER_DEBUG environment variable to 1 when
launching Qt Creator or lldb.

The informational message to set the env var is also shown if no
bridge was loaded successfully.

Task-number: QTCREATORBUG-31769
Change-Id: I53e7b26950fdd635e51d0458cb5fb90600b158a2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 8b01ea5261fdb97c949dc4b3d9a4ea902858bd08)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-10 14:59:37 +00:00
Volker Hilsheimer c9d31c70d8 QLocale: document that uiLanguages() might return multiple languages
Especially for the system locale, the list of UI languages might span
multiple languages, rather than just different variations of the same
language. That was not clear, and not covered by the test cases.

Test case augmentation in a follow up commit.

Pick-to: 6.5
Task-number: QTBUG-124898
Task-number: QTBUG-129434
Change-Id: I39dd7b35778a9ffe0bdce86b2f4c474f275f61b0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 8230c7d7af684aa8640c5566f0b19c3dd48c1ef0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-10 11:21:38 +00:00
Volker Hilsheimer fbdeec7098 QTranslator: add categorized logging
Add categorized logging to QTranslator to trace what QTranslator tries
to load based on the requested locale and the files present in the
search path.

Pick-to: 6.5
Task-number: QTBUG-124898
Task-number: QTBUG-129434
Change-Id: I32425e72623356820fa9b928418f52fac23fafa9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6a785ce90c1c31e1201c608511a6dc625623ccd9)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-10-10 11:21:35 +00:00
Edward Welbourne bcb2cd49e5 Document potential problems with empty timezone names
Make clear that QTimeZone::displayName() may return an empty string
and that Q(Date)?Time::toString() may consequently skip a zone text.

In the process, fix a typo in the QTime::toString() docs and add the
zone-naming formats to the mention of when applying
QLocale::toString() to the Q(Date)?Time may be preferred, moving the
earlier discussion of AM/PM that it joins to sit just after the table.

Pick-to: 6.5
Change-Id: I313b8b1b452078421252a05aa599bc5f91d43105
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5d18017213c110d5a99abeaf53cc4d29a6bfb660)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-10-10 13:21:35 +02:00
Edward Welbourne 450dd785c0 Tidy up QTimeZone documentation
Update to reflect changes in reality now that I can more faithfully
describe what's happening (thanks to lessons learned during L10n of
display names, though that work isn't in 6.8).

Pick-to: 6.5
Change-Id: I248c924af598c8e8d6cd84675ac04e1733927355
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 1dd785d10d69b0705f86e1580c058d8cd017798b)
2024-10-10 11:21:20 +00:00
Matthias Rauter 1212298fb4 Add note about Latin1StringView in UTF-8 source
Pick-to: 6.7
Task-number: QTBUG-77020
Change-Id: I903917a000b21bc7502bf257f759bbfc71f10d45
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit f4076f1058b97f92f65d668a274aa3bbd6d302f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-10 07:38:16 +00:00
Marc Mutz d9a8caca47 QStringConverter: de-pessimize lookup by UTF-16 name
Instead of converting the QStringView into a L1 string (allocating
memory), duplicate the matching code for char and char16_t.

Fixes a ### comment from the time we converted lookup to
QAnyStringView.

Amends b3edce58e5aea76d1d84c868f76171c2b40520a4.

Task-number: QTBUG-126109
Change-Id: I5ae6eb452e68af19b495b3790fe79ee583968d72
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c095f7fbf820ac944c5d3096f48dd18752a218b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-09 21:39:46 +00:00
Thiago Macieira ea4c74ccaf QFileInfoGatherer: Fix internal build (with Q_AUTOTEST_EXPORT)
I'm surprised that this passed the CI on Windows, because
Q_AUTOTEST_EXPORT is Q_DECL_EXPORT, which is __declspec(dllexport) and
all dllexport'ed functions must be defined in the current DLL, not
imported from elsewhere. This is similar on Unix systems with the
no_direct_extern_access mode, because then Q_DECL_EXPORT behaves like on
Windows.

That means Qt modules can't call a Q_AUTOTEST_EXPORT function
from another module (only tests can). Solve this by providing a function
that is properly exported with Q_CORE_EXPORT.

Amends commit 3d08816f4c4245f08a53307775fe3c4ed31a7a32.

Task-number: QTBUG-28246
Task-number: QTBUG-31103
Change-Id: I2ba317ab34bda8c18954fffd28395f7354cb54f2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit fbe61def33a2708e35e5e6a796e88976b04941f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-09 14:58:57 +00:00
Fabian Kosmale dd5c13d09e QMetaObjectBuilder: Fix construction logic for enums
We need to put metatypes in the correct place; this is especially vital
starting with Qt 6.9, given that we need it to query it to figure out
whether we have a 64bit value or not.

As a drive-by, replace some ugly casting when constructing the meta-type
array with a call to QMetaType::iface.

Change-Id: I4b1f42f974e9f7a21f6aa4c87c3f8919f6965d6e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d392d3b22c94f86fea50f26284bc9ac8b35f6851)
2024-10-09 08:48:13 +02:00
Santhosh Kumar be974c4855 Avoid referring to invalidated observer during binding evaluation
The property observer reference used during binding evaluation can
become invalidated as the container used to maintain the
the observer would invalidate the existing observers during its
resize, leading to referring to invalid memory.

Recognize that we do not need to store the observer, but only its
binding - the observer itself is not used later.

Therefore, change the PendingBindingObserverList to become a list of
QPropertyBindingPrivatePtr to avoid the issue.

Fixes: QTBUG-127596
Original-patch-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Pick-to: 6.5 6.2
Change-Id: I8c97721ca563083d6280194175f8a915dac2ff04
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit 275202215376238bf414d5008d3c727085e58a4c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-07 17:26:50 +00:00
Alexey Edelev 839695567f Trigger reconfiguring of android ABI projects when CMake files changed
Remove the stamp files of 'configure' step to ensure that we re-run
cmake for android ABI projects, otherwise the per-ABI projects do not
consider the changes in CMake files when re-running the build.

Task-number: QTBUG-129358
Change-Id: I5b5c682358052044a9e550587ed0457694857e09
Reviewed-by: Soheil Armin <soheil.armin@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 87930bb568018cc40ccd30babb42c8701e1d030c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-07 12:03:32 +00:00
Thiago Macieira 20bf08f012 QStorageInfo/Unix: reset the valid state when doStat()ing again
If the user calls setPath() or refresh(), we are going to stat the
storage again. But neither retrieveVolumeInfo() nor initRootPath() unset
the flag if the storage became invalid.

This can't be tested automatically.

Fixes: QTBUG-129689
Pick-to: 6.5 6.2 5.15
Change-Id: I8d4c5b4ed563e89f5723fffd2f550b169bb20884
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit e55d7fa1e09efc86e797efdf00656891f640d81d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-05 19:24:36 +00:00
Thiago Macieira 30d40a8890 Remove dead code in checkRdrndWorks() if __RDRND__ is defined
The only place where we call qRandomCpu() in qrandom.cpp is guarded by a
check using qCpuHasFeature():

    if (qHasHwrng() && (uint(qt_randomdevice_control.loadAcquire()) & SkipHWRNG) == 0)
        filled += qRandomCpu(buffer, count);

static inline bool qHasHwrng()
{
    return qCpuHasFeature(RDRND);
}

Since qCpuHasFeature() also checks if __RDRND__ was defined, we ignore
the result of checkRdrndWorks().

Users of CPUs without RNG must compile with an -march= flag that doesn't
enable it or must pass -mno-rdrnd to keep the runtime detection code.

Task-number: QTBUG-69423
Task-number: QTBUG-129193
Change-Id: Ib7819f80041fe330d033fffda7e7c160141d7dd8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 6543f50536f3547b43a27b32af59d68f28a60247)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-04 20:42:51 +00:00
Allan Sandfeld Jensen 68c22bd7d3 Avoid -Wstringop-overread by using a view with encoded length
For some reason the suppression stopped working for me, but using the
viewAt function is better in general as it doesn't depend on null
termination.

Amends da84941375 (viewAt() was added by
2c2c6de85a for 6.3, so we can use it in
all affected branches).

Pick-to: 6.7 6.5
Change-Id: Ic71bd559929a2cd0cdea4ed1cc1edcfc583865ff
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cec64aaf2a8e110421d61478b9ad0cb177ee0d1c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-04 15:28:19 +00:00
Alexey Edelev 348d56cca4 Reestablish the dependency chain between Android ABI-specific targets
Actual dependency chain doesn't consider the changes in Android
ABI-specific targets. To make sure we rebuild per-ABI targets this
changes the dependency chain, which looks as following now:

 - <target>_make_<apk|aar|aab>
 - <target>_copy_apk_dependencies (new proxy order-only target)
 - qt_internal_android_<abi>_<target>_copy_apk_dependencies
 - qt_internal_android_<abi>_<target>_copy_apk_dependencies_stamp
 - qt_internal_android_<abi>_<target>_build_stamp
 - <target>

So the <target> dependency on the per-ABI build targets is reversed,
to guarantee that per-ABI targets react on source changes.

Fixes: QTBUG-129358
Change-Id: Id4d5fb0d45a213cd49c8a6aefa72c5db6609d714
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Soheil Armin <soheil.armin@qt.io>
(cherry picked from commit 44149f9d8b62b5343a5d06628b0c9588f035ccc2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-03 13:12:18 +00:00
Thiago Macieira cff3026140 QMetaProperty: fix type-punning of QFlags in write() from QString
Amends commit 46f407126e ("MetaObject:
store the QMetaType of the properties"), from 6.0 cycle, which made
QMetaProperty::{read,write}() use the actual enum type in the
QVariant. But it missed the case where the input QVariant contained a
string with the enum's values.

Note this is *not* a type-punning in all cases: if the type of the
property was marked as a Q_FLAG, moc generates code to access it as
int. That is fixed in the next commit.

Drive-by compare QMetaTypes instead of their IDs, which avoids
generating a call to register them.

Pick-to: 6.5
See-also: https://lists.qt-project.org/pipermail/development/2024-September/045636.html
Change-Id: I1cfce869090c96bb41b6fffdc20855cfa7cb2a18
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 1f9ab3767ed625a090af45f26dffd10dcd05eef5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-03 03:42:30 +00:00
Tim Blechmann 29983de830 Core: add some commonly used QUniqueHandle types
QUniqueHandle allows us to write RAII types for non-trivial classes. We
can add some specialisations for 2 types of win32 handles, file
descriptors and FILE*

Change-Id: I4d6af274bcc7f84ae009d0cb3a2f3aec1b6bcaf9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0563862e23eda4a7b8def8c8afacf732b9a992ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-03 00:14:08 +00:00
Tor Arne Vestbø 42439087eb Darwin: Teach QFileSystemEngine how to resolve case-sensitivity
Both APFS and HFS+ can be both case-sensitive and case-insensitive
(the default), and the mounted file system may be any other file
system than these two as well, so hard-coding to case-sensitive
is not sufficient.

Task-number: QTBUG-28246
Task-number: QTBUG-31103
Change-Id: Ibdb902df3f169b016a519f67ad5a79e6afb6aae3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3d08816f4c4245f08a53307775fe3c4ed31a7a32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-02 21:36:48 +00:00
Allan Sandfeld Jensen e59b65f4c1 Add debug when skipping plugins due to new QPA version check
Change-Id: Id1fae6b455a4fa5a66bbae3d312a16b2c50d6ac0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit edacb741a96289280f8e4e59d13f29f796b8dd11)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-02 09:15:04 +00:00
Kai Köhne e5c1d02ac6 Revert "QTranslator: fix loading order when loading from locale"
This reverts commit 9a11273b745a30cebb5cd648c89eb224e9704492.

Reason for revert: The fix tried to find a sensible order if
the same language is listed multiple times in QLocale::uiLanguages().
Anyhow, it breaks for lists where entirely different languages are listed. This needs more thought.

Fixes: QTBUG-129434
Pick-to: 6.7 6.5
Change-Id: I8c074cbf1ddc2ddf223ec09aef38dfc1ef7fc85f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f3fc7b210f79e5eb427b0ff49c45c5d6d390fb34)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit a30c1bcd3c8b8eb4befeb254840224ca7bb52497)
2024-10-02 04:35:19 +00:00
Allan Sandfeld Jensen 4b5b6451f4 Fix crash with KDE's platformtheme plugin
Require QPA plugins to match qt major.minor rules

Change-Id: I78d40bb22d41b71db83c6a89c8ac8e319ec51d43
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit dfe71d1d23746223b7bd047108850d07f8caa6e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-30 07:21:19 +00:00
Marc Mutz 7df3f20b91 qstorageinfo_p.h: fix -Wunused-function
Make shouldIncludeFs() class- instead of file-static by moving it into
QStorageInfoPrivate. Ditto isParentOf().

Put the functions under Q_OS_UNIX.

Fixes Clang -Wunused-function, and removes a non-q/Q-prefixed name
from the global namespace.

Amends 543ae6e6a4.

Manual conflict resolution for 6.8:
- tracked a user of shouldIncludeFs() that needs a QStorageInfoPrivate::
  prefix added from qstorageinfo_linux.cpp to qstorageinfo_linux_p.h

Pick-to: 6.7
Task-number: QTBUG-77059
Task-number: QTBUG-126219
Change-Id: I4cc62ae044d74919d73d08f6ce3ad57f2e00b4c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5cd154de63c517728d42ed322cb5f2965ef5f6ec)
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io>
2024-09-29 19:14:38 +00:00
Mitch Curtis 2ea3abed01 QAbstractItemModelPrivate: add resetting member
This allows QQmlDelegateModel to know if a QAbstractItemModel subclass
is in the process of a reset, which it can't know if beginResetModel
was called in the model's constructor.

As an added bonus, it also allows us to warn the user if they call
endResetModel with a previous call to beginResetModel.

Task-number: QTBUG-125053
Task-number: QTBUG-127340
Pick-to: 6.7 6.5
Change-Id: I7d1fb983e9bf868c48472624ad945ae158115943
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 9d8663c18e88cb0b5a65f86cfd7726f3d31e04d6)
2024-09-27 09:09:54 +08:00
Axel Spoerl c20a382023 Send events as spontaneous in QWindowPrivate::forwardToPopup()
QWindowPrivate::forwardToPopup() sends key events with
QCoreApplication::sendEvent(), which sets QEvent::m_spont to false.
That makes key and pointer events sent to popups appear synthetic,
while they are sponaneous if sent to other widgets.

The method has been newly implemented in the course of moving
popup handling from QApplication to QGuiApplication.

Make current behavior consistent to the behavior prior to
e4ef0f03e6.
Since events are always spontaneous, use
QCoreApplication::sendSpontaneousEvent() instead.

Add a test function to tst_QComboBox to Verify, that key events
- are sent directly to the popup
- not seen by the window
- appear as spontaneous.

This amends e4ef0f03e6.

Fixes: QTBUG-129258
Pick-to: 6.8.0
Change-Id: Iff61b98b290f6483948007b5f12b19393759d9db
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3fbae61ea245291cb4c34e9126562c307741a600)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-25 19:59:42 +00:00
Allan Sandfeld Jensen 6fd43cbb09 Fix runtime detection of ARM AES extension on Darwin (iOS)
Is enabled unconditionally for all desktop processors already.

Change-Id: Iaf8508fabcf90b6e76692d07250679a1a6103dca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cda53f290fbe57403a9db473aed61ad13193a4ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-25 17:23:50 +00:00
Thiago Macieira ea5bff8feb qsimd_x86: disable the requirement that CPUs must have RNGs
Intel CPUs have had this since 2013 (Ivy Bridge), but some older
Bulldozer AMD CPUs appear to be missing it. This creates a mismatch
between when the __haswell__ macro gets declared in qsimd_p.h and the
runtime check using the CpuArchHaswell value. That in turn creates a
condition where qInitDrawhelperFunctions() in qdrawhelper.cpp leaves the
memfill pointers set to null.

#elif defined(__SSE2__)
#  ifndef __haswell__
    qt_memfill32 = qt_memfill32_sse2;
    qt_memfill64 = qt_memfill64_sse2;
#  endif
...
#if defined(QT_COMPILER_SUPPORTS_AVX2)
    if (qCpuHasFeature(ArchHaswell)) {
        qt_memfill32 = qt_memfill32_avx2;
        qt_memfill64 = qt_memfill64_avx2;

It does this so the qt_memfillXX_sse2 functions don't have to be defined
anywhere, so the QtGui build won't carry unnecessary dead code.

This is old code (from Qt 4.x) and several improvements I've made for
QtCore are not applied yet. My work for qSimdDispatcher[1] isn't
complete: it might have avoided this problem here, but it would also
have required major work for the draw helpers to work in the first
place.

[1] https://codereview.qt-project.org/c/qt/qtbase/+/537384

Pick-to: 6.7 6.5 6.2
Fixes: QTBUG-129193
Change-Id: Ia427a9e502b0fb46b2bdfffda8e2131b7091c9e9
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 54c24313fe1e4ed58b3260189cb623a7c852ab1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-25 14:43:21 +00:00
Edward Welbourne d802d268de Remove spurious #include from QJulianCalendar's implementation
The data tables are used to implement the locale-support methods,
which Julian inherits from Roman, so it doesn't need to access those
tables directly for itself - and doing so (potentially) duplicated
their static data in two compilation units.

Pick-to: 6.5 6.2
Task-number: QTBUG-128930
Change-Id: I313c14441c947daeb702aa17d85b4b6d4b5d3636
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 58ddd0ac31c1a9861463a77e31865e6249dfe2c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-23 21:15:56 +00:00
Edward Welbourne c7c64e7d0a QDateTimeParser: drop an invalid and largely pointless "optimization"
Now that the maximum and minimum might not be in local time, the day
might not be the same as the local time day. In any case, the "saving"
of checking for being past the end of that day is negligible compared
to all the other wanton costs of the date-time parser.

This is a follow-up to commit b6a11a4ee5319366f14c11c7cf3a4f1dbf33cfd5;
thanks to Tor Arne for reporting the resulting assertion failures.

Pick-to: 6.7 6.5
Change-Id: I1ba443df9340fa63b8765c25004b51467ca5244d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 070ab9e85208c467d2f59f7fdfc7afe627dc37e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-23 21:15:54 +00:00
Kai Köhne df74e52578 Doc: Fix documented compress-algorithm attribute in .qrc files
The command line option is compress-algo, but in XML, it's
compression-algorithm.

Fixes: QTBUG-126953
Change-Id: I5ac631a5f5984d1a80781e8c1a42719686dbf27d
Reviewed-by: hjk <hjk@qt.io>
(cherry picked from commit 766d395f77146d9b08ef8a50d15d21b1e279a9b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-23 16:57:34 +00:00
Alexey Edelev 4034c896de Add QT_BUILD_DIR to the cmake configure option list
The variable is required to calculate the inner CMake prefixes when
building the Qt CMake tests inside Qt CMake tests. Otherwise the prefix
path remain empty and CMake attempts looking for Qt by the system
paths.

This fixes Qt CMake tests when running them as part of non-prefixed
build tree.

Pick-to: 6.7
Change-Id: I8908ab0b47fe37044ccb2a950d8973790e4fd174
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit f80c0f1f944ab5af6efef71306692cb1e916930c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-21 11:50:43 +00:00
Marc Mutz 185a1e09f1 QtPrivate::CurrentCompatPropertyThief: add [[nodiscard]] to ctor
This is a RAII class, so it SHALL have a [[nodiscard]] ctor.

QUIP: 19
Pick-to: 6.7
Change-Id: I96728c04be3495d78a5c9c2ef105fbb4e53e58f0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 446e28926cbad9b5ff4b99e222a6bd4473b8c6fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-21 10:24:14 +00:00
Marc Mutz 3efd5950f3 QPropertyBindingPrivate: fix -Wshadow in sourceLocation()
This is preparation of applying headercheck to private headers, too.

Renaming the returned value to `result` also obsoletes the need for
the ugly this-> qualification, otherwise easily misread for a compiler
hint to look up the name in a template base class (which here does not
exist).

Amends 4d579851c8.

Pick-to: 6.7 6.5 6.2
Task-number: QTBUG-126219
Change-Id: Ib683f3deec492acdd2bc61806a8b0467f18f0fe8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 5cd3fec9f9a2bca8c27bdee6b185714983b5d11e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-21 10:24:08 +00:00
Marc Mutz 3acde1af11 QtPrivate::CurrentCompatPropertyThief: port to QScopedValueRollback
It's what the class is doing, with a bit of convenience on top, to get
from QBindingStatus* to its currentCompatProperty, so implement it
like that.

Simplifies the implementation and fixes a -Wshadow in the constructor.

Amends c4bfd32cca.

Pick-to: 6.7 6.5 6.2
Task-number: QTBUG-126219
Change-Id: I4ce32e6ae6e6794b578d967c3e22854091470a14
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 97cd2e384960a4e9951bd906ba4c52e07c0ea4c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-21 10:24:01 +00:00
Marc Mutz 1939eba8a3 Inline qcorecmdlineargs_p.h into qcoreapplication.cpp
... its only remaining user.

Amends 71b54cc244, which removed the
only remaining non-qcoreapplication.cpp user of qWinCmdArgs().

In the process, rename the function to non-public-API-looking
winCmdArgs(), and adjust its Q_OS_ protection to what its caller uses
(Q_OS_WIN; was: Q_OS_WIN32).

As a drive-by, change an old-style- to reinterpret_cast.

Task-number: QTBUG-126219
Change-Id: Id37e62e9df2a0c44bb1e446e409fd36e11cb77ce
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c59ebcfe72d1416897f251036db34902bbb39b1a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-21 10:24:01 +00:00
Soheil Armin 1f0cf1e6e5 Android: Fix QtAbstractItemModel proxy threading problem
This change sets the thread affinity of the
QAndroidItemModelProxy instance to the Qt main thread,
enabling its APIs to be called from both the Qt main thread
and Android threads. Synchronization between threads is
ensured by using the newly introduced
QAndroidItemModelProxy::safeCall(), which utilizes
QMetaObject::invokeMethod() with the appropriate
connection type based on the calling thread.

For void functions, Qt::AutoConnection can be used.
Functions returning values will either use a
Qt::DirectConnection if invoked from the same thread as
the QAndroidItemModelProxy instance, or a
Qt::BlockingQueuedConnection if called from a different
thread.

Pick-to: 6.8.0
Fixes: QTBUG-127701
Change-Id: I214bc43d20d8bdf301fc97920493415d503d26d8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 6c30a60a42800dd5d732d2c7018d87e8f3a9c6a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-20 17:38:32 +00:00
Ahmad Samir 78b35b6041 QTimerEvent: API docs: QChronoTimer doesn't have single-shot any more
Change-Id: I0c997befd752a1ca5c1bb12e4330970131d2f6e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 2b24ad04d3438b0ae58ea36faa6015fbd7e3266f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-20 15:28:56 +00:00
Tim Blechmann c5a27f4cfe QObject: disconnect - document behavior with queued connections
QObject::disconnect does not cancel pending events. This can cause hard
to find bugs in application code, so we explicitly document and unit
test this behavior.

Task-number: QTBUG-127675
Change-Id: I5e94d60c27b9ce2dd2bceb832eb817b7eaa9cdcd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0681e720a9851f1873ce5a5f99b5567d2b418261)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-20 01:30:56 +00:00
Marc Mutz ea855095a6 Remove unused qcorecmdlineargs_p.h from qcoreapplication_win.cpp
Amends 71b54cc244.

Change-Id: Ie4b83fa44956ec23615ddaea6bd4638be583318f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit f4e2c987300f5554c2125f05fad7bc6014b2d7c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-19 17:54:38 +00:00
Ulf Hermann a3df6c36db QUrl: Keep one trailing slash when normalizing "file:///b/."
Removing the slash would be a drastic change in behavior. We can expect
many people to rely on the trailing slash to string-append further path
segments without inserting an extra slash.

Amends commit e7bcf41c0b23d83cfb31f966454945c705589a99.

Pick-to: 6.7 6.5
Fixes: QTBUG-128940
Change-Id: I71dfc957f383e4648b3b47a40aeb796d7237fb00
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2addfa635d2f666d18ffc818f76eb673a6c787d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-19 15:09:46 +00:00
Volker Hilsheimer fd3482ea97 Android: iterate over const QJniArray
If/when we introduce mutable QJniArray iterators, then iterating over a
mutable array will be significantly more expensive due to the write-back
from the reference type.

Change-Id: I2e8eb357fdb6a9890699f5c61d49b635d303f301
Reviewed-by: Soheil Armin <soheil.armin@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 2d4f4220dd068c1253e701cdf6aefab17ef91c75)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-19 15:09:46 +00:00
Marc Mutz 1c3087b2e6 De-inline ~QDeviceClosedNotifier
This is weird, since Clang -Wweak-table didn't trigger here.

But -Wmarc did...

That's because the virtual functions behind the Q_OBJECT macro are
implemented in the moc file, so are actually out-of-line. And
~QObject() isn't the first virtual function in QObject...

Still define the destructor out-of-line, for consistency.

Amends ad265c55be.

Task-number: QTBUG-45582
Task-number: QTBUG-126219
Change-Id: Iada95966b7244873390f4c7ad42de9352311ca33
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 41c5856ffa6cac43c15a6a43261b6693e7b0566f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-19 12:41:49 +00:00
Kai Köhne 9a8835c0d9 Doc: Fix qt_import_plugins snippet to use Qt6::
The documentation text uses Qt6:: instead of Qt::, so let's
also use that in the shown snippet. This is also the style
we promote for targets in other documentation pages.

While at it, print the target names consistently in monospace
font.

Pick-to: 6.7
Change-Id: Ia4d67bad2790d6688ef8d5b4103453c5c40877bc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e836f8794403696a8467b69f0ab822d36b01a18c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-19 10:19:31 +00:00
Nils Petter Skålerud 3eecf663a4 iOS: Handle new contacts permission enumerator
iOS 18 added a new enumerator value for contact permissions,
"Limited". This value has not been added for any other permission
enumerator types such as camera. Currently we get compiler errors
for not explicitly handling this value in a switch case. This change
explicitly handles this enumerator and enables compilation.

Pick-to: 6.7 6.5
Change-Id: Idfc45902f9ae2e555fab8ba3d860a58d89651964
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 0bc5e5ad0e490a1d8e140855b23abbb087c6f9a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-19 09:30:06 +00:00
Marc Mutz 9fc8edb826 qendian_p.h: fix -Wshadow warning
Rename the private member to m_storage. That is more churn than the
alternative of just renaming the ctor argument name, but is more
idiomatic.

This is in preparation of applying headercheck to private headers,
too.

Amends 38002df206.

Pick-to: 6.7 6.5 6.2 5.15
Task-number: QTBUG-126219
Change-Id: Id638a4c286f7a0ef6649017904ed190aab2631b2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 7515c21f4badd80c09982901de8dfadf62401a3f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-19 09:00:29 +00:00
Marc Mutz 2143044682 qtextstream_p.h: fix -Wshadow in QDeviceClosedNotifier
Rename the data member to m_stream, as is idiomatic.

Amends 327b2ba3b7.

Pick-to: 6.7 6.5 6.2 5.15
Task-number: QTBUG-126219
Change-Id: I830e90e0a6c88acf95de8394e45cad075d4c924e
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit e585b937167b9746091c520e303657fbec2fe221)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-19 09:00:23 +00:00
Marc Mutz 339d339e9d corelib/time: fix (easy) -Wunused-const-variable warnings in _p.h's
Make the constexpr variables inline to silence Clang.

There's another batch of such warnings for the _data_p.h files, and
they are actually pointing to a real problem: If two TUs include these
headers, the static constexpr tables actually get duplicated. Created
QTBUG-128930 to track the issue.

Amends 6d97cf0e57 and
fa9244700e.

Pick-to: 6.7 6.5
Task-number: QTBUG-126219
Change-Id: Idb0cd55e424a870be6127fdf8399d01e9f3e9ac8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5064cb6feff6178cf3c307790ba028514c3d3040)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-19 09:00:18 +00:00