Commit Graph

18936 Commits (724716ea335605dc1f9287c7cd9f88c709f6993c)

Author SHA1 Message Date
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
Rym Bouabid e99987329c QIODevice: remove unneeded resize(1) in QIODevice::readLine()
AFAIU, the resize(1) was merely there to have result.size() return 1
in the initial iteration of the do loop. Since resize(1) is always
followed by another unconditional resize() in the do-while loop,
remove it and use "1 + readBytes" instead of result.size() in the
follow-up resize() call inside the do loop.

Saves one resize() call and the corresponding executable size and
runtime overhead.

Pick-to: 6.7 6.5
Change-Id: I507acab2a6b7d55217cd454ecbbaf1df0e1d18e6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit d9579f0043a04e08b3954eb6bb58637fc25fba9a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-18 16:29:26 +00:00
Marc Mutz ea1da56f84 qwaitcondition_p.h: fix -Wunused-const-variable
Make the constexpr variable inline instead of static to shut up the
warning.

Amends fbc491230f.

Pick-to: 6.7
Task-number: QTBUG-126219
Change-Id: Ifa8db14dc28f039d0dc65eb779d715cd4a2c7240
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 743403cb6d9957c1bdb6ef7a1bb6f30377f578a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-18 13:19:38 +00:00
Marc Mutz e966f3189a QtCore: De-duplicate vtables, 2024 edition
This de-inlines destuctors of classes whose vtables are proven to be
duplicated by -Wweak-tables using the upcoming headersclean for _p.h
feature.

Since these are all private API classes, we can pick all the way back
to 6.2, and we don't need the comment that the dtor must always stay
empty, like for public classes.

Task-number: QTBUG-45582
Task-number: QTBUG-126219
Change-Id: I8c864c0d2ed3ca20d20d5cfc356290eb529edf6c
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3af20bd8eb8c75017c5d6d138d7c42914ee5bee3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-18 09:34:52 +00:00
Marc Mutz 8189baf26d Suppress -Wunused-const-variable in _data_p.h files
... until a more robust mechanism for adding these generated tables to
the build has been found, cf. QTBUG-128930.

Task-number: QTBUG-128930
Change-Id: I190e04aba345cdd3ca6c94be6d0f7c2550362ecc
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit 0988042c4742a85f1ea50eb1d7acfa84ef8e83e6)
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-09-18 09:32:51 +00:00
Allan Sandfeld Jensen ce8e5e7c1e Fix compile-time CRYPTO detection, and detection on MSVC ARM64
We had a mismatch of the naming of the Qt and compiler defines. Matched
the qt defines to the compiler define, and added detection support for
MSVC (ARM64).

Change-Id: I9abfbe8a96bc8c800e86dac3ab9a7abf9c1f7f9f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit bbdd20da04dd9d7a9a3250aef005e4549999a312)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-17 16:43:26 +00:00
Allan Sandfeld Jensen 4be72074a9 Clean-up MSVC ARM64 NEON support
Also fixing clang-cl support.

Pick-to: 6.8.0
Change-Id: If2130091edfadc0cc4d4cecd95c2256522efc69a
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 308bca94a72f83624e2e2c92449719e06940e77f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-17 16:43:20 +00:00
Marc Mutz 0260c0d9f5 Change QTimeZonePrivate::invalidSeconds() return type from qint64 to int
Inspected all in-tree callers, doesn't change semantics, but fixes a
few -Wshorten-64-to-32 Clang warnings (which we unfortunately didn't
enable globally upon s/int/qsizetype/).

Amends 48e2c3ac33.

Not picking back further than 6.8, because I don't want to review
historic callers.

Task-number: QTBUG-126219
Change-Id: I53c16d630dfffdba3801bf211f1b80d0346dd375
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 4bf1ed802151f8310b9adb56fac6de93f195cc44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-17 16:22:53 +00:00
Marc Mutz d96ce5eb0d qlocale_tools_p.h: fix -Wfloat-equal
Compilers _do_ grumble, after all:

  qlocale_tools_p.h:68:14: warning: comparing floating point with == or != is unsafe [-Wfloat-equal]
      return d == 0; // Amusingly, compilers do not grumble.
             ~ ^  ~

Fix by using the public qIsNull(double) function, which has
suppressions and was designed for this task.

Amends f645bb8880.

Pick-to: 6.7 6.5
Task-number: QTBUG-126219
Change-Id: I33f1fcb4c8c2ee30ad9a36cb46b806ef253e8062
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit aac83724013a1f226d2bf4b923447eb1b0e5c493)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-17 16:22:47 +00:00
Marc Mutz b291e7eb46 qtipccommon_p.h: fix -Wunused-function
Make isIpcSupported() non-static so Clang doesn't warn that it's
unused.

Amends f79b535f6b.

Pick-to: 6.7
Task-number: QTBUG-126219
Change-Id: I0c99d2196fcec8d7fcd1480d09fbbe176ce365b2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c0cd2c843c4c08e840e6629668bbf3aac7975e09)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-17 12:44:33 +00:00
Marc Mutz e2880c7d92 qsavefile_p.h: fix missing qsavefile.h include
This causes

  qsavefile_p.h:28:22: error: unknown type name 'QSaveFile'
      Q_DECLARE_PUBLIC(QSaveFile)
                       ^

when qsavefile_p.h is included before qsavefile.h was.

Make the header self-sufficient by incuding the Public class' header,
too, as is customary.

Amends e993df8771.

Pick-to: 6.7 6.5 6.2 5.15
Task-number: QTBUG-126219
Change-Id: I17eb2a357bf1ef7ef5b5e3a3e56c4a921ba30951
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ad6e4df580a2437cc69be416956f6128267ffbea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-17 12:04:48 +00:00
Marc Mutz adc73cf5b9 QPropertyBindingPrivate: prevent -Wshadow in qqmlpropertybinding_p.h
This is preparation of applying headercheck to private headers, too.

Changing the private data member name to m_error is the simpler change
here, since it touches a bounded amount of code vs. the alternative of
fixing an unbounded number of unknown users.

Amends 9f33ad904a.

Pick-to: 6.7 6.5 6.2
Task-number: QTBUG-126219
Change-Id: Ie0f6b5e711b35a12fadc9d8e642b885ce8b57315
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 9348212be3880ecd93111b7321043a53ab1df45a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-17 12:04:42 +00:00
Rym Bouabid 57f2dff05c QIODevice: improve QIODevice::readLine() documentation
Pick-to: 6.7 6.5
Change-Id: I252c0faf982ff8328475243fdbc86cc4d1462498
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit bbf980e43f16c99504d75998217b88855edd3365)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-16 20:58:39 +00:00
Marc Mutz 9ce6596394 QtCore: fix private header compilation under QT_NO_KEYWORDS
This is in preparation of applying headercheck to private headers,
too.

Task-number: QTBUG-126219
Change-Id: Iff5fd8e848d67b7edd9541b0e78740bc4b4ff7c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 55b5e78ac31171be61ceeb932d494d5060d1fa02)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-15 12:15:34 +00:00
Marc Mutz 7953546072 QBindingObserverPtr: fix redundant ;
Found by applying headercheck to private headers, not just public
ones.

Amends f1b1773d0a.

Pick-to: 6.7 6.5 6.2
Task-number: QTBUG-126219
Change-Id: I3998cd5875f989152c6bd6b24b04e61627959cc2
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 1d163e916c8da49f9f617ca1545b5f6ac9d6a0b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-15 12:15:31 +00:00
Marc Mutz 1fda161d69 QDuplicateTracker: fix redundant ;
Found by applying headercheck to private headers, not just public
ones.

Amends f21a6d409e.

Pick-to: 6.7 6.5 6.2 5.15
Task-number: QTBUG-126219
Change-Id: I8be52a04ae9d9af2e68a72f1128bfbd09fd85e8e
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8bfd696297b35684ee1c80127d7b0ce09a374d85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-15 12:15:29 +00:00
Marc Mutz ef7f9ba1e9 qmimetype_p.h: remove incorrect QMimeBinaryProvider fwd declaration
It was outside the QT_NAMESPACE, declaring a class different from
QT_PREPEND_NAMESPACE(QMimeBinaryProvider) in -qt-namespace builds.

Amends 4e9944e6c8.

Pick-to: 6.7
Change-Id: I8dec4d676fd774462ad63418ee8d82d1b0e44d1d
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 5820d54103d5c432ae8eaae180aefb1988f835ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-15 12:15:07 +00:00
Marc Mutz 5d6a204789 Fix -Wdouble-promotion in FP overload of convertDoubleTo()
Found by applying headercheck to private headers.

Says GCC:

  global/qnumeric_p.h: In instantiation of ‘[...]
  {anonymous}::convertDoubleTo(double, T*, bool) [with T = float;
  [...]]’:

  text/qlocale_p.h:312:51: required from here

  global/qnumeric_p.h:390:22: error: implicit conversion from ‘float’
  to ‘double’ to match other operand of binary expression
  [-Werror=double-promotion]

    390 |     if (std::fabs(v) > (std::numeric_limits<T>::max)()) {
        |         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Since we already checked that numeric_limits<T>::max_exponent <
numeric_limits<double>::max_exponent at this point (see constexpr-if
at the top of this function template), we can assume that the cast of
the RHS of the relational operator to double is safe. Use braced
initialization to statically assert that this is, indeed, the case.

Amends 1e43b64a7a and
a14bba6803.

Pick-to: 6.7 6.5 6.2 5.15
Task-number: QTBUG-126219
Change-Id: If2b53d9b8ea7ebfcecec603408681eeffb9aaff6
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit c38e58dcb02cd2273ba3c03c65a6f67b37100777)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-15 12:14:54 +00:00
Thiago Macieira 4f30a4426c QTypeRevision: fix support for 8-bit signed segments
The logic in the isValidSegment() function was failing for 8-bit signed
because for them Integer(SegmentUnknown) is -1, so
  (std::numeric_limits<Integer>::max)() < Integer(SegmentUnknown)
was always false (127 < -1) and the function would only return true on
the impossible condition of
  segment >= 0 && segment < -1

Fixes: QTBUG-128848
Pick-to: 6.7 6.5
Change-Id: I8d17b93afd6c2982a099fffdcaeccf126b7a9d02
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit ddfcc0734875cdee2c169bf2ecb1546bddba6e98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-14 16:38:08 +00:00
Thiago Macieira 23cf29ffdd QFileSystemEngine/Win: only .lnk files that exist can be symlinks
Fortunately, isDirPath() had an extra parameter to tell us whether the
path existed in the first place, making the fix very simple.

Pick-to: 6.7 6.5
Fixes: QTBUG-128800
Change-Id: I81482f87b594933158d0fffdbea0ea2a00494b6c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 329b05739d5d62f37464a5714ad87e7ca05693e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-14 16:37:55 +00:00
Thiago Macieira 16571ac456 QDir: change qt_{cleanPath,normalizePathSegments} to returning bool
Since qt_normalizePathSegments very often modifies the path, pass that
as pointer, and return a boolean with whether the path is attempting to
go up above the root.

Change-Id: I851fcb94db4606a6bd97fffd81910930dea8222a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 0314491abac092b20ebefc05e2e9f27fd038fc38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-14 16:37:12 +00:00
Thiago Macieira 2ce3153b83 QUrl::resolved: switch to using qt_normalizePathSegments
Commit 4b1547adc9b195e6acc90471fc48dec7ee0c429d rewrote
mergePathSegments() but got one thing wrong: that ".." on a "//" should
only remove one slash, not all of them. That behavior was introduced by
commit eaf4438b35 to match what browsers
do.

QUrl will use the local file behavior if the URL scheme is "file",
unlike the browsers.

Task-number: QTBUG-120396
Pick-to: 6.8.0 6.7 6.5
Change-Id: I8a96935cf6c742259c9dfffd17e8fd3cfde46e25
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit e7bcf41c0b23d83cfb31f966454945c705589a99)
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-09-14 09:37:12 -07:00
Thiago Macieira 7359d63209 Replace qt_normalizePathSegments algorithm with QUrl's removeDotsFromPath
Commit 4b1547adc9b195e6acc90471fc48dec7ee0c429d rewrote the latter for
simplicity and performance, so copy it over with intent to merging the
two together. In this copy, however, we keep the behavior introduced by
commit eaf4438b35, which made the
normalization match the behavior found in browsers, but didn't apply to
QUrl::resolved (that's the next commit)

Task-number: QTBUG-120396
Pick-to: 6.8.0 6.7 6.5
Change-Id: I2670423f6c6a5339771ffffdf15ebad46fd25cb4
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 78e2d24752d8b6652aac89d1e79f245bc88281c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-14 09:37:11 -07:00
Thiago Macieira 5eafba18e0 QUrl::resolved: remove the lambda in removeDotsFromPath()
I had made this change but didn't push it. Amends commit
09055d7211b1f8ba9fdec141a1e919faee1c1676

Pick-to: 6.8.0 6.7 6.5
Change-Id: I8a96935cf6c742259c9dfffd17e8fc87d41dd891
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 01fbb883ad8832808110e74a0c4b2724f1e38d6c)
2024-09-14 09:37:10 -07:00
Thiago Macieira 7b45dc49bb QUrl::resolved: avoid detaching from paths that don't have dot segments
This can happen in any number of cases where neither the base URI nor
the relative one had a "." or ".." segment. In particular, we want to
avoid detaching in the case where the new path is the same as either of
the base or relative URI's, which can happen when the other was empty
(and mergePaths() didn't have to prepend a slash).

Pick-to: 6.8.0 6.7 6.5
Change-Id: Iac1ff680887641888e00fffd17e14f3927e828ae
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 09055d7211b1f8ba9fdec141a1e919faee1c1676)
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-09-14 09:37:09 -07:00
David Faure d53c3809de QConcatenateTablesProxyModel: react to row and column moves
Fixes: QTBUG-128742
Change-Id: I6282c3c9f27c435da5d511c61fbb051da127229c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit b9ba28315d889d0b87ae048dffe33eac55efcda2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-13 17:44:05 +00:00
Michal Klocek 1ba89701fa Fix bogus QT_BEGIN_NAMESPACE for qandroidmodelindexproxy
This should be rather QT_END_NAMESPACE.
Fixes custom namespace build.

This amends 55fc15ce8272073b9b404762b83e3e7acee0111e.

Change-Id: I61d0ea24f8b0e3382fdfb4658b8a514dbaad8799
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit e94fefecfc47a6715d90ef8975f65d5702cc2477)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-13 17:44:04 +00:00
Friedemann Kleint e63847cab5 QtCore/MSVC: Fix unity build error
Exclude qassert.cpp, fixing:
error C2375: 'qAbort': redefinition; different linkage

Amends 23877db5639deca70dc8cc1a7299b2cee629c7d8.
Introduced by 907e9a8b29.

Change-Id: I03d6d31eda138a411d1972f683f46c0437f8d839
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 673605110e3a33db9b58e0c514e9ec8e4da36d20)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-11 04:30:32 +00:00
Thiago Macieira b245808d97 QProcess/Unix: clean up QChildProcess before calling setErrorAndEmit()
QChildProcess' destructor may unwind the stack, due to the call to
pthread_setcancelstate(), which is why it's marked noexcept(false)
explicitly. To avoid a situation where it causes a stack unwinding while
a stack unwinding is already in progress, this commit makes QProcess
re-enable the thread cancellation state (which immediately processes a
pending cancellation) before calling anything else that may allocate
memory (thus throw). It also guards against calling
pthread_setcancelstate() twice.

The successful execution paths remain under disabled cancellation so C
library calls like close(), fcntl(), read(), and waitpid() will not
cause premature unwinding.

Change-Id: I009cf64012e167321aa6fffd609c603cf18b50e4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 6763b9f7ec2a7f8dd0bfc011ccd102316bb95e7a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-11 03:20:02 +00:00
Thiago Macieira 87fbcf438c QProcess/Unix: open the working directory before changing the thread state
This operation can fail and, in handling the failure, we call functions
that may allocate memory and thus throw. If that happens, our destructor
won't be called, so this commit avoids leaving the thread in an
incorrect state by not changing it in the first place.

In case there was a failure but no exception happened (a much more
likely scenario), the destructor will be called by startProcess() or
startDetached(). Therefore, we need to ensure it won't cause problems.

Change-Id: I091193bb945a2637f463fffdd93694e555401452
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 34edfe134403e331f0fa4550a074507a393bdc52)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-11 03:20:02 +00:00
Thiago Macieira fee6283b85 QUrl::toString: fix using of NormalizePathSegments and RemoveFilename
We were overwriting the normalization if RemoveFilename was used.

[ChangeLog][QtCore][QUrl] Fixed a bug that caused QUrl::toString(),
QUrl::toEncoded() and QUrl::adjusted() to ignore
QUrl::NormalizePathSegments if QUrl::RemoveFilename was set.

Fixes: QTBUG-127711
Pick-to: 6.7 6.5 6.2 5.15
Change-Id: I8a96935cf6c742259c9dfffd17e8e1f7fec44cb6
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit c9ff625865c355fb57c824b13f3cb4b26e53fbe7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-11 03:20:02 +00:00
Thiago Macieira 105c05dfb2 QProcess/Unix: restore the signal mask before re-enabling cancellations
That way we will restore the thread's signal mask even if a thread
cancellation is pending and thus forces an immediate stack unwind when
we re-enable them.

Change-Id: I36589f84c5f4d8929129fffdbb77b2020c6fa5a6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7400db0f82632a4bc41c1e6fc628ae4d4c1b9385)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-11 03:20:02 +00:00
Tor Arne Vestbø 4e66be84be Android: Return QAndroidApplication instance via nativeInterface() getter
The QAndroidApplication native interface wrongly uses static methods
instead of virtual functions, which has lead to client call sites not
using the preferred QCoreApplication::nativeInterface() API to resolve
the interface, and a lack of an implementation in QCoreApplication
for the resolveInterface function.

We now implement resolveInterface for Android, so that the interface
can be resolved via QCoreApplication::nativeInterface(), even if the
interface itself (for now) is based on static methods.

Task-number: QTBUG-128796
Change-Id: Id4d8b9a6fcc7d0e2cc76de07dc0742dc5917f3ca
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 60f07671e1770c4f6fd71bbad7cf88ca35ab4de0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-10 18:45:04 +00:00
Johannes Grunenberg 2f4680d143 Disable q(u)int128 for Clang with MSVC's STL
Clang supports q(u)int128, however, MSVC's STL doesn't have support for
it in <type_traits> and <limits>. MSVC's STL is used by Clangd on
Windows.

Fixes: QTBUG-128675
Change-Id: Ic0be6b9d2659477829c7b369385ef885dee8d355
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1f9a660eb2d5c6e3cb9c80dc292f3ec355296515)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-08 10:08:25 +00:00
Ahmad Samir 567eae56e7 docs: promote QBasicTimer usage by making it more visible
Deduplicate some API docs.

Mention that it's a RAII class, to make it more appealing to users.
Copied the "RAII" note and link from QSemaphoreReleaser's API docs.

Change-Id: I53ced6eb7c2ab55ffc04e70c250b5f5639406911
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit e1fdfe9da8ccdeed9af602897232a513884b0515)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-06 19:25:26 +00:00
Marc Mutz 799f6bf43f Q(Multi)Hash: Fix underconstrained heterogenous operator[]
If the key doesn't exist yet in the map, we need to be able to create an
actual Key object. Consequently, we require that the type is actually
convertible.
This doesn't fix any broken code, but avoids compilation errors in QHash
internals bubbling up.
Note that the existence of a comomn_reference does not imply
convertibility (so the concept version wasn't strict enough either).

Done-with: Fabian Kosmale <fabian.kosmale@qt.io>
Change-Id: I4ed46f343817932063084642093cac193fd9554f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a338f67dceed61009375a4a90a7fe32a06b443a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-06 15:55:13 +00:00
Marc Mutz 3dc6b37bae QVersionNumber: make iterator comparison non-noexcept again
When these iterators were originally added¹, their relational
operators, following the Lakos Rule, were not marked as noexcept
because they have preconditions (lhs and rhs must come from the same
QVersionNumber object).

d292648d0bbac50388dae035dc34782accb3807f then added the noexcept,
disregarding the Lakos Rule. Until the ongoing discussion regarding
the Lakos Rule on the project mailing-list² is concluded, don't add
noexcept. We can always add it in later, but we can't remove it once
released.

Requires manually working around the missing
Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE_NON_NOEXCEPT macro that we
don't want to add if there's no other user.

¹ 2188ca2c5d
² thread starting at
  https://lists.qt-project.org/pipermail/development/2024-August/045544.html

Change-Id: Ie88326519673166afe8cb44267c23944b27c68d2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit a84b79df0fb8a92b17a39bbf706714e93de9d6fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-06 15:55:11 +00:00
Fabian Kosmale 722c7edf03 QHash: Unconceptify heterogeneous search code
That allows the code to run in C++17 mode - at the expense of
significantly worse compile time error messages, potentially worse
compilation speed and harder to read code.

Adjust the test type to actually model
detail::is_equality_comparable_with (which requires all four
relational operators even in C++17).

As a drive-by, fix the return value of remove() from auto to bool.

Done-with: Marc Mutz <marc.mutz@qt.io>
Fixes: QTBUG-128470
Change-Id: I68df26db579c60812a18e09b76dd5712e73ccaa2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7fe3cee36352c74cbaaff52e863bd0da1170affa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-06 15:55:07 +00:00
Marc Mutz bd9e40b14c Fix compilation with QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST
You cannot direct-initialize a pointer variable with a comma
expression. Need to wrap it in an extra set of (). Instead of that,
wrap with {} on the outside, to make it look less like Lisp.

Amends 0ed039fd134fb8025236847295681f13f1775847. On dev, a follow-up
change has already removed the code in question, leaving only 6.8
affected.

Change-Id: I8d03093849d0bd7b868703218b48b5cb9d2a18f4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-09-06 13:05:16 +02:00
Soheil Armin c28225e469 Android: Add Void conversion support to QAndroidTypeConverter
Now the caller of toJavaObject() is be able to get
an object of Void type when the input parameter is QVariant<void*>.

Fixes: QTBUG-128586
Change-Id: I6eea670788461e4eb0d8f38a4a872c2c4759bdd8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
(cherry picked from commit e02813eeb5e3f3475541b50ba8d21a7bc724e698)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-06 10:19:22 +00:00
Marc Mutz b972361ec4 QtPrivate: add "defined in" comment to findByteArray/lastIndexOf(~~~, char)
It's customary to add such a comment when an inline function is not
defined in the same header it is declared.

As a drive-by, remove the pure attribute from lastIndexOf().
Q_DECL_PURE/CONST_FUNCTIONS are only useful for out-of-line functions.
For inline functions, the compiler sees the body and can determine
that they're pure or const (in the __attribute__((const)) sense)
itself.

Found in API-review.

Change-Id: I27aa5cfaf21b1015a6c8b9e4773a1c2c5134a226
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 3b812f0409c50c6a3fd1d66a9c18bc323e0a0ca3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-05 18:24:12 +00:00
Marc Mutz 1e86694501 QLatin1StringMatcher: use specialization instead of an is_same chain
Same result, but less templates to instantiate, so should be faster to
compile.

Found in API-review.

Change-Id: I43ebb94c73c6b4462441a7ae85a67909f6894ba3
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 13d2d55957c52c4f2270248be57dc18bea507236)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-05 18:24:05 +00:00
Ahmad Samir e960afffc9 QDirListing: flesh out API docs
- Let qdoc generate docs for const_iterator/sentinel
- Document pre- and post-increment operators
- Document const_iterators typedefs
- DRY API docs

Change-Id: Ia559541118586ca0314cd5f618acda3f7c820659
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 68a06e99a8577d08e8b885f0b417b1c9f90a7459)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-05 18:24:03 +00:00
Ahmad Samir 28161ab42e QTimer: QChronoTimer isn't necessarily going to supersede QTimer
... since no consensus has been reached about what to do in Qt7 (whether
to fold QChronoTimer back into QTimer or let QTimer be as-is to not
break any existing code and use QChronoTimer in new code).

Task-number: QTBUG-128426
Change-Id: I7d09b803b4f0df3ea7f48a5d900d0ae4be721d7b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 87030778969165a285af2d919d6d7293e8078b6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-05 18:24:02 +00:00
Marc Mutz c92b1f294e QLocale: mark equals() noexcept
It effectively was, relational operators should be, and
comparesEqual(), which calls equals(), actually already was marked as
noexcept, so also mark the out-of-line function.

Found in API review.

Change-Id: I3fce2277f328284e098afeee40c319a7ba85fefe
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit e358f3158cc2d5c248b5626f15e556414fc0cd6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-05 15:50:25 +00:00
Mårten Nordheim 91730ecf3b Containers: correct documentation for QMulti(Map|Hash)
They're no longer just convenience subclasses.

Pick-to: 6.7 6.5
Change-Id: I80b52eeac4a68f6b546b635c792a17e975d3d7e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1666ce930b980ec73f01b038eb8d1a2a7b180ea4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-05 15:28:32 +00:00
Joerg Bornemann 21cca5bb93 Simplify the console detection for QT_WIN_DEBUG_CONSOLE
Instead of reading the PE header we can try to retrieve the stdout
handle, and if it's present, we have a console, or redirected output.

This amends commit 639437cf34783573e14d35ceb68ee8d9de495d7b.

Pick-to: 6.7
Task-number: QTBUG-127732
Change-Id: Ib6dd1a37552519fd867e7c39e588a085513f97e0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Zhao Yuhang <yuhangzhao@deepin.org>
(cherry picked from commit dfa52e3ae63432c1bfbb70b258ba96f7bfa5d3b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-05 15:28:31 +00:00
Marc Mutz a5752f4cb4 QUtf8StringView: fix missing inline keywords
This probably wasn't triggering anything, because the class happens to
be a template, but don't let the poor guy that will de-templatize this
come Qt 7 run into this.

Also add the customary "defined in qstring.h" comment.

Found in API-review.

Amends 3d0eaf863e,
9b945b381a,
4c93115504 and
b977ae371a.

Change-Id: I45b2a808dca5ea335a1771df9cfeb4e67bd185f3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
(cherry picked from commit 183a775f80a029136416c75a66f74e4c099e0d32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-05 12:34:55 +00:00
Milian Wolff ba6ffd99e2 Don't increase the refcount if qobject_cast failed
Follow the dynamicCast/dynamic_pointer_cast implementation for
objectCast/object_pointer_cast since a qobject_cast can fail
just like a dynamic dast.
Also see: https://eel.is/c++draft/util.smartptr.shared.cast#6.2

See commit this commit from 2013 for more historical context:
a094bf5a89

Pick-to: 6.7 6.5
Change-Id: I9a54af55a7a1cf106cace52e9cf3bc103ae0bd42
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7a65abb50eb638de445e24c2746d7f90c1b89f06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-05 12:29:51 +00:00
David Faure 9da25cc13c Doc: remove wrong \since for QDateTime::from[M]SecsSinceEpoch(qint64)
QDateTime::fromMSecsSinceEpoch(qint64) exists since Qt 4.7,

and Qt 5 had a fromSecsSinceEpoch(qint64 sec, Qt::TimeSpec spe = Qt::LocalTime, int offsetFromUtc = 0);
so writing fromSecsSinceEpoch(qint64) is backward compatible, "since 6.5" is confusing.

commit f46c18c627 erroneously added
\since 6.5 to these overload.

Change-Id: I91027dcc2e4f20bfc7af643c349131a7f53d8367
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 780d5a089c0fe1db8dc59d4c61d5bb86a4d97b5a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-05 10:18:24 +00:00
Jøger Hansegård f2a5284d94 Update tika-mimetypes.xml from upstream
This patch updates the tika-mimetypes.xml MIME types definition file to
version 5101bc7fb090ed7deffe56837d7633c9485a1e5d, which is currently the
latest on upstream main.

The reason for the change is to include audio/flac as an alias for the
nonstandard audio/x-flac MIME type, which enables QtMultimedia to
automatically determine a suitable file-extension for FLAC audio files.

[ChangeLog][Third-Party Code] Updated TIKA MIME types definition file to
add the audio/flac MIME type as an alias for audio/x-flac MIME type.

Pick-to: 6.7 6.5
Change-Id: Id2596f5aea55041a1cbbdcbfbd7500b652444bad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 265187518d13571ff2b991a00ec0011df61f7ae5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-04 14:00:44 +00:00
Nodir Temirkhodjaev 631a4285b4 Windows: Fix qAbort() definition for MSVC with unity build
src\corelib\global\qglobal_p.h(57): error C2381: 'qAbort': redefinition; 'noreturn' differs
src/corelib/global/qassert.cpp(24): note: see declaration of 'qAbort'

The error started after 1ef5f50e, when unity build source files changed.

Change-Id: Id90ee20976423b9ae6ec691ee15602256f7c1fe9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 23877db5639deca70dc8cc1a7299b2cee629c7d8)
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2024-09-04 10:37:48 +02:00
Ivan Solovev ea1a6d3ae0 QLocale: add (in)equality operators with QLocale::Language
We do have an implicit constructor which allows construction of a
QLocale from the QLocale::Language enum values. It will be used when
doing the comparison.
However, do not rely on the implicit conversions, and provide the
operators that explicitly do the right thing. This also allows us to
save an extra allocation of QLocalePrivate.

Found in Qt 6.8 API review.

Amends 71bbc35a37.

As a drive-by: fix the order of the test slots in the unit test.

Change-Id: I37f8f5881469b7734705e06e471746814dd2ddf0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 403b1abcad5f437c51dfabd7095b814e99e197a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-04 08:37:48 +00:00
Ivan Solovev 5c5bedd2a6 QLocaleData: make static methods noexcept
QLocaleData::c() simply returns a pointer to a static constexpr array,
so it can be noexcept. The Q_ASSERT there simply checks internal data
consistency.

QLocaleData::findLocaleIndex() uses a QVarLengthArray, but the size
is hardcoded at compile time, and the implementation does not add
more elements, so it will never allocate. The static
findLocaleIndexById() helper can be made noexcept, because we
already made most of the QLocaleId methods noexcept. This allows us to
make QLocaleData::findLocaleIndex() noexcept as well.

Resulted from 6.8 API review, so picking to 6.8.

Change-Id: Iaa9ccaa127f2ba13235b9c0f91a72048067266f5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 205c64bd112e074920557f34bef8a3807350f7e9)
2024-09-04 08:37:48 +00:00
Ivan Solovev 759065adff QLocaleId: make most of the methods noexcept
All inline methods simply operate on ushort members, so they can be
noexcept.
The withLikelySubtagsAdded() method operates on static constexpr
array of locales. It does not allocate and cannot throw. The asserts
are there to check the internal consistency. So, it can also be made
noexcept.
Consequently, withLikelySubtagsRemoved() can be made noexcept, because
it only calls withLikelySubtagsAdded(), and does some trivial checks.

The only two methods that cannot be made noexept are:
* QLocaleId::name(), which obviously allocates a QByteArray
* QLocaleId::fromName(), because it end up calling a static
  isScript() helper, which allocates a QString.

The isScript() helper possibly can be rewritten to avoid allocations,
but that's an exercise for another patch.

Resulted from 6.8 API review, so picking to 6.8.

Change-Id: I9e98df31f9c13171bc005250024aa4ffb0faedb8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 2485aae3ff3fa56833009f4766e53068667a7435)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-04 08:37:47 +00:00
Marc Mutz 892012e5d9 QDirListing: Extract Method next() from const_iterator::op++()
Having the actual const_iterator::operator++() as an out-of-line
member function means that the implicit this pointer forces the object
onto the stack (registers don't have addresses that could be
passed). Since const_iterator is now merely a thinly-disguised
pointer, that would cause terrible codegen.

So, apply a technique originally developed for QStringView and make
the operator an inline function that re-sets the member dirEntry using
a call to a QDirListing static function that takes and returns by
value. Passing by value enables passing in registers, which means the
iterator object can now be a register value and doesn't require
spilling to the stack to call the function.

Found in API-review.

Change-Id: I9f4d5be5b72249b368ef3dea9d857178ca7e16aa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit aec8398d71d351e956683a695af51317fe65097e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-03 18:06:59 +00:00
Marc Mutz 46ec49894d QDirListing: make const_iterator move-only
The std::input_iterator concept does not require copyable, only
movable. This makes handling input_iterators safer, because copies of
input iterators since advanced zap into partially-formed state without
changing their bit pattern. If the iterator is, however, only movable,
no such zapping copies can exist.

Take advantage of this and make QDirListing::const_iterator
move-only. Its iterators are anyway no longer compatible with
classical STL algorithms, so we're not restricting their use further.

Found in API review.

Task-number: QTBUG-125512
Change-Id: Ic1dee22881893fdbf159bbfd335c10505eaffa9f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 29dfcc240b3e29d5d6149c2996cfdb9d71b776bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-03 18:06:54 +00:00
Marc Mutz a1d4c64715 Make QDirListing::const_iterator post-increment return void
std::weakly_incrementable doesn't require a std::input_iterator's
post-increment operator to return anything¹, so don't.

¹ https://eel.is/c++draft/iterator.concepts#iterator.concept.winc-14

The return value of post-increment on objects that model
input_iterator is partially-formed (as a copy of an iterator since
advanced), so any attempts to use it, apart from assigning a new
iterator or destroying it, are undefined, anyway.

Found in API-review.

Change-Id: If0c07250cec4e48c6e5176cd23864651e8ec3d27
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit fd89fc8c27460e2c11d9e3decc38cf61c186f984)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-03 18:06:45 +00:00
Marc Mutz 5cb51e4afe QDirListing: simplify const_iterator
There's no need to carry the same QDirListingPrivate* around
twice. Remove const_iterator's direct QDirListingPrivate* member and
re-use the one from its DirEntry member.

Requires adding a private const_iterator::atEnd() helper function,
because while const_iterator and its member functions are implicit
friends of DirEntry, friend functions of const_iterator are
not. Improves readability, too.

Found in API-review.

Change-Id: I82b9273950e174d7598ee531fbd5dfb472911b71
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 0ede7f541dfc6cba163e1452aee7239818a42c1b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-03 18:06:39 +00:00
Marc Mutz 089263fd4f QDirListing: make end() return a sentinel
This simplifies the implementation, and is more secure, because you no
longer can compare const_iterator with const_iterator and get a
non-sensical result (unequal, even though copies of each other).

Requires the STL algorithm test to be ported to C++20 ranges, because
classical STL algorithms can't deal with decltype(first) !=
decltype(last).

Found in API-review.

As a drive-by, make the reversed and inverted operators conditional on
!__cpp_impl_three_way_comparison.

Change-Id: Icd0e4dac277bd3b053f7b648f8c3f9d9f3753299
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 2569ca0f34fe15a2e5c828b708f1406be8d53836)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-03 18:06:32 +00:00
Ahmad Samir 0773176fc2 QTimer: fix calculation error in API docs
The range guaranteed by std¹ for nanosecond resolution is ±292 years,
not ±292 million.

¹ https://eel.is/c++draft/time.syn,
  https://en.cppreference.com/w/cpp/chrono/duration#Helper_types,
  std::cout << chrono::floor<years>(nanoseconds::max()) << '\n';

Since, in general, there is no integer type with ≥ 45 bits, but < 64
bits, the practical limit for milliseconds remains, indeed, ±292
million, so the QDateTime docs don't need fixing.

Change-Id: I5ae7f9706f147c6f490ba17b10cebe96426bbba2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 051488c5faf5410e938978d4c1609c7a85074c57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-03 16:52:24 +00:00
Morten Sørvig 98c1a46a7d wams: disable delayed onload/first frame features
requestUpdateHold was not getting enabled properly in some
cases, in particular when using a custom html file to load
the application.

The assert on g_mainThreadEnvetDispatcher is also asserting,
with a following dereference of a null pointer.

Change-Id: Ibf77d90b84f8319a894e2df34a134d2e4265fe05
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit 10afdc339e08ce1e6a8173df97a3f2edeb27cb57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-03 10:57:33 +00:00
Ville Voutilainen 69d5d78ce9 Typo fix for doc of QJniObject::callMethod()
Change-Id: Ia13fe108526eb08b4fb1eefcc0f23aaa6f102793
Pick-to: 6.7 6.5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 77f1dbabb7b6a72ee5af19a0e7f0a0dc31a0afb5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-03 06:24:48 +00:00
Tatiana Borisova e5d96ae7d4 Revert "Convert a Qt ordering type to the weaker std ordering type"
This reverts commit 521e091bca1764d53ac06bb60707475d1032f5d5.

Reason for revert: The fix doesn't work with MSVC2022 compiler and block windows-11_23H2-msvc2022-developer-build integration. Need time to find proper solution.

Task-number: QTBUG-128498
Change-Id: Id938fa2119c7e4c053398b2a3693f3128e53f734
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 1017a0eaf1f9fd9cc37189f73840d85bf4a5664c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-02 18:10:39 +00:00
Ahmad Samir fbf052132e QObject: fix API docs
Should be just "timer" instead of QChronoTimer.

Change-Id: I76cb9ae712cfe9a9713a85888022e54300d308d3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a5f1cec8bf22f19bbf7ffe058c407d5045e4126a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-02 18:10:38 +00:00
Ahmad Samir c9fe636dfc QBasicTimer: port to Qt::TimerId
[ChangeLog][QtCore][QBasicTimer] Added id() method returning
Qt::TimerId.

Fixes: QTBUG-128144
Change-Id: Idbe29311cca3befb771dbf1ef976a42e65e59ce9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 751cbbd6b13d9899e31c19d9db80d1c64a72a8bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-01 10:51:01 +00:00
Ahmad Samir 0945ca9a01 QObject: code snippets cleanup
Use chrono literals; remove comment about C++14.

Change-Id: I1594780946dd3e646b5a4f68dad4996f0572f317
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 81e3d10ca5913a79f5e53043bfd33d03f25253f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-01 10:50:55 +00:00
Ahmad Samir 91ed5ddff5 QObject: use Qt::TimerId in the code snippets and API docs
Mention QTimerEvent::id(), which returns Qt::TimerId, instead of
QTimerEvent::timerId() which returns int in the API docs.

Task-number: QTBUG-128144
Change-Id: Id19aebd044fbd734872e5580efcb3842eb42b2b0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7595c21be86f247dd419d08d7d26327fe2d7a736)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-01 10:50:50 +00:00
Ahmad Samir 0bd6bbedea QOperatingSystemVersion: add trailing comma to last member in enum
Task-number: QTBUG-125859
Change-Id: I374d7e676765cc00788224d980a29c16a6330648
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 8c2dcfc79aaa812ae671304c39d006ed6782cb74)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-01 10:50:45 +00:00
Marc Mutz 0396def8ad Make Container::max_size() non-static member functions
... as is required by the standard.

We have already found that QAnyStringView::max_size() can also not be
static (because the size depends on the charset of the contained
data), so we have a second reason (besides STL compatibility) to
change the current static into non-static max_size() member functions:
Qt consistency.

Found in API-Review.

Amends 7ce6920aac.

Fixes: QTBUG-128450
Change-Id: Id5ee3fec82bc557bd83b6843838ccdd753442cd0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 6d5e39f4756945b8ada74d745bd949856c1b17f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-31 08:56:46 +00:00
Edward Welbourne bcd33276d1 Include relevant Unicode Inc. copyright line in generated data files
This amends commit 880d1aef99 and
extends it to cover the testlocales program under util/.

Pick-to: 6.7 6.5
Task-number: QTBUG-121653
Change-Id: I3efadc69ce08810876f8e20aa4636c7624728153
Reviewed-by: Lucie Gerard <lucie.gerard@qt.io>
(cherry picked from commit 00644f4b6d69d82a8d27f3b0619de88c0e4fdd6f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-31 08:56:42 +00:00
Ahmad Samir e97da8bc9d QChronoTimer: compare timer IDs to Qt::TimerId::Invalid consistently
Always `if (id != Qt::TimerId::Invalid)`.

Change-Id: If16e1cb54d3e7b4325019eb292263c25cd7d3805
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 637fcc69c87352c21658fea1083e93786f64fc37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-31 08:56:39 +00:00
Thiago Macieira cb35f1e858 Containers: add a static constexpr maxSize()
max_size() will be made non-static to strictly follow the C++ Standard
Library concept, but it makes no sense for the Qt containers to have
allocations limited per instance, as they are not allocator-aware. This
commit adds a Qt-style camelCase() function to the STL-style
snake_case() with the semantics we want.

Task-number: QTBUG-128450
Change-Id: I2e4aa228c71c821c01bafc0f37956d29fe652ef1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 6306ebe749e083126a39b9dd13d7060aa7bdacc2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-31 08:56:34 +00:00
Thiago Macieira 6978951d5e Fix users of static max_size()
Container::max_size() is a _non-static_ member function in the STL, so
we can't call it as C::max_size(). Instead, use the newly-added,
Qt-style camel-case maxSize(), which we will keep static constexpr.

Task-number: QTBUG-128450
Change-Id: I839df90a91cced85f000c7d2744ba547f629ed98
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 6c15f99853c4cecd9285e189a441392a397b0f82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-31 08:56:31 +00:00
Edward Welbourne 1d725c0094 Mention GMT-offset form of short-names for timezones
This fixes the documentation side of an issue with QTZ::displayName()
not doing what's documented. (The MS-eccentricities have been fixed by
earlier work.)

Fixes: QTBUG-84297
Change-Id: I3ec522aa81741fbf2d3dd247786310304e14f304
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit b3a00a38af1226ebd6617638872d540f1ecd76df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-31 08:56:29 +00:00
Ivan Solovev f5a2d34da8 Add max_size() and maxSize() to view types
That requires including qcontainerfwd.h to the headers, so that
we could get access to QtPrivate::MaxAllocSize.

The max_size() methods are added for compatibility with stl.
The logic for most of the views is similar. The only exception is
QAnyStringView, because its character size may vary, depending on the
contained data.

The maxSize() methods are the static equivalents of max_size().
QASV does not have it for the reasons mentioned above.

[ChangeLog][QtCore] Added max_size() to all string-view types.

Amends 7ce6920aac.

Found in 6.8 API review.

Change-Id: I467c7d64ec3d92eb424eb5b94a39ec3d45d63d1f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 2382bfb5b03f6f03a31981dc416121cf556b962a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-31 08:56:26 +00:00
Ahmad Samir 60ed64e1d6 QTimerEvent: port to Qt::TimerId
[ChangeLog][QtCore][QTimerEvent] Added constructor taking a Qt::TimerId.
Also added a getter for Qt::TimerId.

[ChangeLog][Potentially Source-Incompatible Changes] The protected
(and undocumented) QTimerEvent::id member variable has been renamed to
m_id to allow for the addition of an id() getter that returns a
Qt::TimerId.

Task-number: QTBUG-128144
Change-Id: Ia156f11e9e9347b6bf61b36e40da3ad551d23407
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 29b98eabf07b9e9d223039ec58b989acbaba844c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-31 08:56:23 +00:00
Fabian Kosmale df6d88ea2c QHash: fix constness for heterogenous lookup functions
Change-Id: I161237fc243ebcf48e1318dae045f2e812796786
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 205edd15070720ce94ef5ba7d7e32b0b715abcf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-30 13:47:33 +00:00
Ivan Solovev 48c8eef930 serialization: remove incorrect noexcept on comparison operators [2/2]
This patch is about removing noexcept on functions that use
Q_ASSERT. The argument is that in these cases Q_ASSERTs act as
precondition checks, so we should probably follow the Lakos rule.

Although, technically the change is fine, because the current
implementation of Q_ASSERT is marked as noexcept(true), there are
some ideas of changing that in future, so we should not be setting
in stone something we can't change later.

Found in 6.8 API review.

Change-Id: I1d4aa228c713821c0ebbfc0f3b956d29fe652ed8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 5ac15093dcbaf92ac166961f5e8bfe9418cc15c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-30 13:47:33 +00:00
Ivan Solovev 665aaf9f6a QDate: rework stdSysDaysToJulianDay()
Use !QT_CORE_REMOVED_SINCE(6, 7) to make the function a template
in new C++20 code. The removed_api.cpp will still compile the
exported version, keeping BC.

This simplifies the ifdef'ery around the functions and saves the
need for the QT6_{DECL,CALL}_NEW_OVERLOAD trick.

Picking this change down to 6.7, because the original patch was
also picked to 6.7.

Tested it on MSVC in C++20 mode, and verified that the symbol
is still there. Also tested the case from the linked bugreport,
and verified that it does not give linker errors.

Amends 88702cc87c
and effectively reverts 91f48cc4b77b1cfb5a4490c3bed3eb97edd2f85a.

Task-number: QTBUG-125610
Pick-to: 6.7
Change-Id: Idf49fd142cdc78ff8964a36f8c1e326357e1028e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit d23764c5a12e0d6d26dd54ee5613f7e5b1f9c8af)
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-08-30 09:19:08 +00:00
Marc Mutz 88e7b7e99c [docs] Separate two paragraphs in max_size() docs
Formatting indicates that this was how it should be rendered, but qdoc
won't paragraph-break unless there's an empty line.

Add it.

Amends 7ce6920aac.

Change-Id: Idfd3cbc9f075b5f206c2042dc7b22508735dcb38
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 02b436f2c5d7368827794e7ec1224419dca39e7f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 20:41:57 +00:00
Marc Mutz f8b3c1f0a7 QChronoTimer: remove static singleShot() functions
They match what QTimer already provides these days, and we want to
minimize porting for users come Qt 7, so we don't want users to first
write QChronoTimer::singleShot() (because it exists) and then back to
QTimer::singleShot(); we want them to continue to use QTimer.

The only reason QChronoTimer is a separate class from QTimer is that
the latter has an int interval property and we can't just port it to
milli- or nanoseconds chrono types if we want users to actually access
the extra range or precision afforded by the chrono types. But that's
not an issue for the singleShot() static methods, as they never return
an object that could be asked for its timeout.

(No ChangeLog needed, as QChronoTimer is new in 6.8)

Found in API-review.

Fixes: QTBUG-128426
Change-Id: Ief8b7c8d25380c0e9e9c5c36c90ce34c147557ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6e5eb082c934cb94c45f3e13b3f7c2deb2e7b2e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 20:41:50 +00:00
Marc Mutz 2fb422828e QTimer: make singleShot() have nanoseconds resolution [2/2]: new-style
Port the new-style singleShot() static methods from milliseconds to
nanoseconds resolution.

This matches what QChronoTimer provides, but we want to minimize
porting for users come Qt 7, so we don't want users to first have to
port to QChronoTimer::singleShot() and then back to
QTimer::singleShot(); we want them to continue to use QTimer.

The only reason QChronoTimer is a separate class from QTimer is that
the latter has an int interval property and we can't just port it to
milli- or nanoseconds chrono types if we want users to actually access
the extra range or precision afforded by the chrono types. But that's
not an issue for the singleShot() static methods, as they never return
an object that could be asked for its timeout.

The old-style static methods were already ported in the first step,
which also contain the ChangeLog common to both patches.

Task-number: QTBUG-128426
Change-Id: I1899465c3b852ab546983a0bf35853fdd3f91ef3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6991e848e3a0470e301d006a799b1351909884ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 20:41:43 +00:00
Marc Mutz 054270c717 QDirListing: make move SMFs noexcept and inline
This requires giving up unique_ptr for a raw d-pointer:
https://stackoverflow.com/questions/9417477/where-does-the-destructor-hide-in-this-code

That isn't much of an issue, because the class is move-only.

Also add a swap() member function.

Found in API review.

Change-Id: I2478bb5d05ff7bae0111ba97e788c88f7b4dded1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 71167b7982be4d7a9090aa6b0e0846d5e9bf303b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 20:41:38 +00:00
Marc Mutz e6ab7847a7 QTimer: make singleShot() have nanoseconds resolution [1/2]: old-style
Port the string-based singleShot() static methods from milliseconds to
nanoseconds resolution.

This matches what QChronoTimer provides, but we want to minimize
porting for users come Qt 7, so we don't want users to first have to
port to QChronoTimer::singleShot() and then back to
QTimer::singleShot(); we want them to continue to use QTimer.

The only reason QChronoTimer is a separate class from QTimer is that
the latter has an int interval property and we can't just port it to
milli- or nanoseconds chrono types if we want users to actually access
the extra range or precision afforded by the chrono types. But that's
not an issue for the singleShot() static methods, as they never return
an object that could be asked for its timeout.

The new-style static methods will be ported in a second step.

[ChangeLog][QtCore][QTimer] The singleShot() static methods now
operate with nanoseconds resolution, like QChronoTimer. The rest of
QTimer remains milliseconds; use QChronoTimer if you need a QTimer
with nanoseconds resolution of more than INT_MAX milliseconds
range. Beware overflow that may occur when passing large milliseconds
objects that may overflow nanoseconds::rep when converted.

Task-number: QTBUG-128426
Change-Id: I11e1ad8529c67b4018f6325ac408686799475823
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4e911bda295b53bc74cf1af26008b3e60181668d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 20:41:37 +00:00
Ivan Solovev cb6a3fe53e QArgumentType: remove the incorrect noexcept from comparison operators
The QArgumentType::name() getter evaluates the name lazily, which also
involves constructing a QMetaType. It's not entirely clear if adding
noexcept there is a good idea, so drop it.

Amends 5a0faa9198.

Change-Id: I73042f22df9615f570823a7745f04e9731c097fe
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e39eb34bc6585c5ec367727e86f70ce67c2d176a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 20:41:33 +00:00
Edward Welbourne d12b85ae0b Document the potential widening effect of upper-casing
In QChar we don't return the upper-case from when it's not
representable as a single QChar; for strings, the uppercase string may
be longer than the original.

Pick-to: 6.7 6.5 6.2 5.15
Change-Id: I57bb1412d79d579a9cc4dc6bdbb839e56f9ea0a8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 65eb1c5579ec56d15583b4af45b50fddd3c799a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 18:21:38 +00:00
Edward Welbourne 0b89eb6c6f Remove spurious and unused QUtcTZP::init() with too few arguments
QUtcTimeZonePrivate accommodates the custom time-zone API and, as
such, needs to know all of its details when constructed. The
constructor as a plain UTC-offset constructs the details to match a
custom zone, so that it also has those details initialized. As a
result, this backend never initialized a zone from only its IANA ID,
as all the others do, so does not need an init() with that signature
(which did not adequately initialize the instance anyway).

Change-Id: I462f537c9d48e09f05f91aae0ff6c7a317b421c1
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Magdalena Stojek <magdalena.stojek@qt.io>
(cherry picked from commit 70b680502997678b7c9964acef6569b18b6a65bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 18:21:35 +00:00
Łukasz Matysiak d563ec3fba Introduce QT_COMPILER_SUPPORTS_INT128 in qsystemdetection
c661dbd42d injected `QT_NO_INT128` into
every TU when compiling for VxWorks.
VxWorks uses a custom stdlib implementation that does not support 128bit ints
and at the same time they use an off the shelf Clang that defines
`__SIZEOF_INT128__` which is used to detect if 128b ints are available.
This resulted in Qt falsely assuming that 128b ints are available.

Detect if 128bit are available instead of injecting `QT_NO_INT128` and
define `QT_COMPILER_SUPPORTS_INT128`, use it instead of directly
checking `__SIZEOF_INT128__`.

Task-number: QTBUG-115777
Change-Id: I7531ebe780b4bdd78b42daf8dae0e522a316a88e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 5a10744bb4afc0c95b1b7bbba8848cf14b0bad00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 18:21:34 +00:00
Ivan Solovev 790a52b7e0 Register Qt::TimerId with the meta-object system
By using Q_ENUM_NS macro.

Amends 4bc0834bc1.

Found in 6.8 API review.

Task-number: QTBUG-128144
Change-Id: Icb3b4e76e0c36066d480b1f756c5a9c8aa5cb43f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 6e2705bbc891d5ddd4924815a641830d2a0ccf4b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 17:57:27 +00:00
Ivan Solovev 571a4a3efb QDirListing: unexport the class
This is a non-polymorphic class, so we should export only individual
out-of-line methods.
Same for the nested DirEntry class.

Amends c39a0d1e89.

Found in 6.8 API review.

Change-Id: Ifde785d9ece1641351501159963d8cc065d8e140
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7394f7151404e0649eb59d8fa84eb7061635ee70)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 17:24:15 +00:00
Marc Mutz 6dfb013b62 DRY QT_FOR_EACH_STATIC_CORE_TEMPLATE()
Use the same technique used elsewhere in qmetatype.h to deal with
missing features: define a new macro to either contain the types
controlled by the feature or be empty, and then call that macro from
the larger-scale one.

DRYs the list of types to not repeat QByteArrayList and QStringList.

Amends cdbc76360a.

Change-Id: I767452aa33c1a2404315a0c3cd02f7102b9d6653
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fbc80ee163f16baafcc236b533ea7ccc3376fa2f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 17:24:14 +00:00
Ahmad Samir 679ae93507 QDirListing: fix typo in header guard
Was missing an `R`.

Change-Id: Iefdb373c152c31baf3e6769a5e2814c0d9800e60
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 61a3ca6f635c86b91fe3a2ac481e7de138447523)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 04:16:53 +00:00
Marc Mutz 514e244913 qFuzzy(Compare|IsNull)(): mark as noexcept
These all cannot fail, so can and should be noexcept. Most were
already.

Found in API-review.

[ChangeLog][QtCore/QtGui] All qFuzzyCompare() and qFuzzyIsNull()
overloads are now noexcept.

Change-Id: I67a2981ea4af9be0370becf84103822fd766ab5e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 6a3a28236c6a0c34d37a614ca4e68ccd136d90e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 04:16:52 +00:00
Marc Mutz 99f8efd0ef QStringTokenizer: clean up Q_STRINGTOKENIZER_USE_SENTINEL
The macro was unconditionally defined since
44a7412795 and, despite being named like
a public Qt macro, never documented, so just remove it.

Also means we can remove the ODR protection from end() and cend() now.

[ChangeLog][Potentially Source-Incompatible Changes] The undocumented
Q_STRINGTOKENIZER_USE_SENTINEL macro was removed. It was
unconditionally defined since Qt 6.0.

Change-Id: I8ba2aeddea79ad89cef8912e9cf34098f2793f1b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 799e16149ce9d34419da9ea35f790412202ce7a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 04:16:40 +00:00
Marc Mutz f85f5b35bb qhashfunctions.h: unindent <concepts> include
Qt will at some point require C++20 and then the indented include will
have to be un-indented, anyway, so might was well do it now to have
less work later.

Also sort the <concepts> header in with the other C++ headers.

Amends 52abff8cc1.

Found in API-review.

Change-Id: Ic092d3c0d47e9ecab0492d533b6a10c2a8227e88
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3ac48281d9971998882612a43cbcf923104ee592)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 04:16:37 +00:00
Jøger Hansegård 2f7d52a9ba Update tika-mimetypes.xml from upstream
This patch updates the tika-mimetypes.xml MIME types definition file to
version 5ea8bbf1644a593ed22ee5c7608ba33aff949d5d, which is currently the
latest on main.

The reason for the change is to include audio/aac as an alias for the
deprecated audio/x-aac MIME type, which is useful in QtMultimedia to
determine the file extension for AAC media files.

In addition, the update adds the application/x-java-keystore MIME type,
similar to the one in the old freedesktop.org.xml MIME type definition.

[ChangeLog][Third-Party Code] Updated TIKA MIME types definition file to
add the audio/aac and application/x-java-keystore MIME types.

Pick-to: 6.7 6.5
Change-Id: I14fa331c5c57e4fae8f8b31880dc66d6ca559f62
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 5774aa2560b65a67e72f98cf2f776325b6760950)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 04:16:36 +00:00
Marc Mutz abcee9eb99 QStringTokenizer: update docs for a world in which C++17 is required
Remove mentions of pre-C++17 behavior.

Don't recommend against qTokenize() any longer (it's shorter than
"QStringTokenizer") and mention it in the QStringTokenizer class
documentation, too.

Pick-to: 6.7 6.5 6.2
Change-Id: I8cf3310fc9de80db0a89aecfdf695a49d390da47
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c1fc85df109a4dff57d7615a353bfcc7e172b0c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-29 04:16:34 +00:00
Marc Mutz 5a9e93630e QXmlStream: actually make the (in)equality operators noexcept
Do not use the getters, as they are not noexcept. While they could
probably be made noexcept, we're too close to release to make a hasty
change there. Directly access the data members instead.

Found in API-review.

Amends cd5dd8b95b.

Change-Id: Ic3a6b0f933956d57d2c3b4ebdd5ad40ec4736fb0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 23784ec9d6eca9b138cd2528389e8150ebc66667)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 23:03:33 +00:00
Marc Mutz 1f129d1589 QXmlString: add a few missing operations
... namely isNull() and op==/!=().

These will be needed for porting comparesEqual() from public getters
to direct data member access, in order to make them earn their
noexcept tagging.

Change-Id: Id8677d39dc581d03adfd3d0d420907ff60c0423a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e0ae91bd5880d1f8ab36d42cff428bb8246f73c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 23:03:27 +00:00
Marc Mutz 92597843d6 Make from_msecs a QTimer class-static again
It will need to be called from removed_api.cpp once we widen
QTimer::singleShot() from ms to ns.

Don't use the QAbstractEventDispatcher::Duration typedef in qtimer.h
to avoid including the resp. header. Keep the typedef as the return
value on the definition of from_msecs(), though, as a static assertion
that they're identical.

Task-number: QTBUG-128426
Change-Id: Ib59895f4441e92813fe39778bb3836b039fdfbf0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 65a249715941bf6b6ecc980d3f865f367f66522d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-28 23:03:22 +00:00