Commit Graph

18492 Commits (dcacb0be973cfc17f495fef6d2da73471c3360ea)

Author SHA1 Message Date
Alexey Edelev 1647193afa Make the android multi-ABI builds with Unix Makefiles pure sequential
Add the missing dependency between qt_internal_android_<abi>_configure
and the last target from previous ABI-specific step in the chain.

This slows the Unix Makefiles builds, but ensures that there is no race
condition when executing configuring step.

Also as a driven-by fix the _qt_android_abi_steps property list, by removing
the parazite -NOTFOUND entries.

Pick-to: 6.7 6.5
Fixes: QTBUG-127414
Change-Id: Ibb69dcdebd2052a7aa1d4bd0c3f657cdeb312f37
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 924dd10afc9f9137ce2da7643306d8df511c6ab9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-24 12:38:11 +00:00
Kai Köhne 5cd80af50f Doc: Make it explicit what QJsonParseError::offset refers to
Pick-to: 6.7 6.5 6.2
Change-Id: I278929f89e9e6f9f4461558dc0dd949d0455dcb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e00a032eac1a234c0846571a0e8a6ac1e5c411b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-24 09:19:00 +00:00
Giuseppe D'Angelo e358eb3bab QCompare: add more relational operator overloads
libc++ has a "poisoned" set of relational operator overloads for
the standard category types. A call like

  std::strong_ordering::equivalent == Qt::partial_ordering::equivalent

fails to compile, despite the presence of

  operator==(std::partial_ordering, Qt::partial_ordering)

This is viable after converting strong_ordering. But strong_ordering
itself defines a

  operator==(std::strong_ordering, CmpZero)

where CmpZero is poisoned and accepts Qt::partial_ordering, making
the call ill-formed.

I'm not 100% sure if libc++ is right here (cf. the linked upstream
bug report for some ruminations). We can work around this issue by
adding sufficient additional overloads to Qt::partial_ordering and
be a perfect match. For some reason this was already the case for
the other Qt's comparison types.

Notes:

1) I didn't test this. Only libc++-trunk defined the necessary C++
   feature macros to trigger the problem; I made a synthetic testcase
   and it worked.

2) I'm not sure why these operators are defined symmetrically instead of
   relying on C++20's reversed operators, but I'll follow the
   pre-existing ones.

Change-Id: I0937f40b7e685026d4677e7918948d47d2b7cec6
Pick-to: 6.7
Fixes: QTBUG-126541
Task-number: QTQAINFRA-6203
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit b892b39a7a6c50eb5bbf03f0c9f01bdd07756f13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 23:51:33 +00:00
Ahmad Samir f5971dc78a QDirListing: add API docs for DirEntry
It's part of the public API.

Drive-by change: add `\ingroup io` to QDirListing too.

Fixes: QTBUG-127152
Change-Id: Ic327cbb8742dfd323cae9f7135a7590d14819869
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8fc89a4637214a0724a2abb5f47c16487d4fffea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 14:47:54 +00:00
Alexandru Croitor 7dd7e5038c CMake: Fix invalid option passed to _qt_internal_generic_deployqt
EXECUTABLE is not a valid option name, EXECUTABLES is. The latter is
already passed.

Remove the EXECUTABLE option, and add a guard to show an error when
there are unparsed arguments.

Task-number: QTBUG-127404
Change-Id: I981f6e53925d9b4a9e7ee23f6e80c69dc41e42e8
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 869c6ee890ee740b9e99eca44730524d6a45d4b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-22 12:12:31 +00:00
Marc Mutz 853f7b661f QDebug: make toString() SCARY
Extract the non-template-dependent code into an out-of-line function
and pass the actual streaming operation as a callback.

Saves 4% (174811→167936) in executable size for tst_qdebug and 2.7%
(93639→91122) for tst_tostring on Linux GCC 9 AMD64 release builds.

Change-Id: If232e5b26c66981ffcb614f1bdb7007c71e879bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5cdd1f594d26e1d4f84b00741be1ab7231458512)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 23:06:54 +00:00
Marc Mutz c8771a3082 QDebug: make Stream ctors explicit
Their argument types are not faithful representations of a Stream
object, so ctors should not be implicit. Besides, the QDebug ctors
that delegate to these Stream ctors are explicit, too, with the same
arguments.

Change-Id: I8048e26e890009cc8f6bc3ce49e2c01af1e89514
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a9ab406a69f4edc4228cc2effbcde309fcdcf411)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 15:01:31 +00:00
Marc Mutz ae515c3f2e Fix signature of QDebug::toString() (again)
There are zero QDebug operators that take an rvalue RHS, so there's no
need to make toString() perfectly forwarding. It just causes four¹
different versions of the identical function to be instantiated. Not
all compilers can merge the binary representations and those that try,
violate the standard (same address for different functions).

¹ {rvalue, lvalue} × {const, non-const}

Fix by taking by cref.

Amends 4097653215.

[ChangeLog][Potentially Source-Incompatible Changes][QtCore][QDebug]
The toString() static function no longer allows the called
operator<<() to modify the argument. No Qt-provided operator<<() does
that, and operators that do are probably buggy.

Change-Id: Iac1ee9d29f93fd4840b75ffe363d354a2d19a96e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 13244eef6c913bb7f27cd8fbf459f5dfe9a0ed21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-21 15:01:31 +00:00
Volker Hilsheimer 5797326b16 JNI: Constrain QJniArray::toContainer to compatible target containers
We can populate a container with the contents of the Java array as long
as the element types are convertible without narrowing (taking various
special cases into account, such as jstring to QString). The container
has to be either support emplace_back, or be a contiguous container
if a primitive element type.

The template helpers need to be in QJniArrayBase in order for qdoc to
accept the input.

Add test coverage, including static compile time tests.

Change-Id: Id9372deed5cf33446ee1969dc284a88991db2aee
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8f04defa1e3973faec19a9cb1ab9bbf1ea7fb031)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:40 +00:00
Volker Hilsheimer c21612d246 JNI: Improve the constraint on QJniArray::fromContainer
We can create a QJniArray from any container that has a forward
iterator. A contiguous container can be used to optimize the code path,
as long as the element type is primitive (i.e. not an object type).

Fixes: QTBUG-126151
Change-Id: I21915f944d226d6d4f1113a54e5602ddc9cd727e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 71be7834e67216010dc74ed855dc7b513e302f1a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:35 +00:00
Volker Hilsheimer c4bd8a5492 JNI: clean up move semantics for QJniArray
Explicitly define (compiler-implemented) copy and move SMF's for
QJniArrayBase; we need to, as the destructor is declared, so without
them the compiler will implicitly convert an array to a QJniObject
and call that constructor.

Constrain the constructors and assignment operator from a QJniArray of
another type so that no narrowing conversion is allowed. Due to the
implicit conversion to QJniObject, we have to explicitly delete the
overload for narrowing conversions. Use the detector we have in
qobjectdefs_impl.h for that.

Make the detection helpers private, and add test coverage.

Change-Id: I1b2bb4435d52223567d20bb55ceb0d516e3b0b15
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ebbf7b0fdf866190cd20e62d6b13c7c6808101da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:28 +00:00
Volker Hilsheimer 43f0b1fcee QJniObject: specialize the QtJniTypes::Traits to treat it like jobject
It doesn't make a lot of sense to pass QJniObject instances into APIs,
but to be able to consistently treat QJniObject as an object type we
have to register it with the java/lang/Object signature.

Change-Id: Ic40e2676186bf327fa92764da51404985f74b565
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 82254fa836a21b5ec450a4ec7635e72403dded18)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:11 +00:00
Volker Hilsheimer 6c3513f514 QJniArray: implement operator-> for the iterator
The QJniArray doesn't store values, so at() always returns a temporary.
As we cannot hand out a pointer to a temporary, use a wrapper reference
struct that stores the value and implements operator->. It's all inline,
so we can move it out in the future to return mutable references, if we
ever want to enable write access to QJniArray elements.

Change-Id: I3962df6160db8c5b573d47ebb7975864f8ea7a8b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3d5af4b912e60beb791f874c2dbfef5597b9aad7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-20 01:13:06 +00:00
Volker Hilsheimer fe284006b2 Doc: link from non-categorized logging API to QLoggingCategory
The <QtLogging> documentation page is easily found, and from there it's
not easy to see that categorized logging is a feature. Add more links.

Task-number: QTBUG-125589
Change-Id: I214b9a561d6fc6b4c8600bc1b1eca04d856678d6
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7c344176d21e00a648bb504da735f174f70f0ad2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 12:33:09 +00:00
Volker Hilsheimer aabaf64c25 Doc: fix links to QMetaContainer members
QMetaContainer was not documented at all, so links from QMetaSequence
back to its parent class member functions failed.

Add generic class documentation for QMetaContainer. The QMetaAssociation
class is also undocumented, but since QMetaContainer's purpose is to
provide common APIs for both QMetaSequence and QMetaAssociation, mention
it anyway.

Fix warnings from incorrectly named parameters in the QMetaContainer API
documentation, which now gets generated.

Change-Id: I50a9f3ebf90b03f049804be2256ff135f57dab14
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 84be9b069c93afe62082ecd6aa5ec97ce44a8e0f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 06:32:08 +00:00
Marc Mutz c3477a7375 [docs] qvsnprint(): mention %a and %ls differences on WASM/Android
Pick-to: 6.7 6.5 6.2
Task-number: QTBUG-127110
Change-Id: I919170881846f3a08890ac0a8accfb859157d193
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1aedd4d7c9968054a1c2880000a5007bb826a179)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 13:32:03 +00:00
Marc Mutz 6c21f8103b q(v)snprintf(): mark the functions as \obsolete
We can't deprecate them, yet, because there are way too many users in
Qt and 6.8 is too close by now, but we should give users a heads-up
that better alternatives exist these days.

Pick-to: 6.7 6.5 6.2 5.15
Task-number: QTBUG-127110
Change-Id: Ic14e9d12fc746fdc65d6c0006756c37339aa25f0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3f54c71b78e4ed4ab513190bbcda89ae27256377)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 13:31:49 +00:00
Alexey Edelev 7b8cbbff76 Add the note about the runtime encoding in the QString-like classes and QT_NO_UTF8_SOURCE
Mention that QT_NO_UTF8_SOURCE has no effect on runtime encoding of
QString-like classes.

Amends 37e6159ab0c1456e8dc38f38f3b21643585c1273

Pick-to: 6.7 6.5
Task-number: QTBUG-126435
Change-Id: I3629b8af0e3eb7353c9268e23167dbef6802bb00
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit bba0150200e16e6e0a8926dac1f32b00b8b1493b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 10:26:00 +00:00
Marc Mutz fc4a3a8cfc qxptype_traits.h: include q20type_traits.h
A qNNfoo.h should always include qMMfoo.h, MM=NN-3, if that exists, to
avoid a user having to include both qNNfoo.h and qMMfoo.h, which later
become two <foo> includes on automated replacement. For the purpoes of
this argument, NN=xp is considered equal to max({MM : ∃qMMfoo.h}) + 3.

Following this logic, qxptype_traits.h should include q20type_traits.h
(q23type_traits.h doesn't, yet, exist).

It didn't, so fix.

Amends def2a3de37.

Pick-to: 6.7 6.5
Change-Id: I8153d241783dc4e505fddf2407d27990e5c522f4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 720ae32f79038a5db763a2371c0e8d25d32d93cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 08:42:51 +00:00
Marc Mutz 4c55f496d7 QThread::terminate(): don't depend on stack unwinding
Posix doesn't seem to specify whether the stack of cancelled threads
is unwound, and there's nothing preventing a QThread from
terminate()ing itself, so be extra careful to drop the mutex before
calling pthread_cancel.

We can't drop the mutex in general, as that would open a window for
the following race condition:

   T1                       T2
   t3->terminate()
     lock();
     read ID;
     terminated = true;
     unlock();
   ----------- t3 exits naturally -----------
                            t3->wait();
                            t4->start(); // gets ex-t3's ID
     pthread_cancel(ID) // oops, cancels new t4

But we can drop it when this == currentThread(), because said window
does not exist: While this_thread is executing terminate(), it cannot
at the same time exit naturally.

As drive-by, scope a variable tighter.

Pick-to: 6.7 6.5
Change-Id: I77a628e62d88e383d5aa91cfd97440186c997fc4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 272c0215c2058bc267abf0a247da878f652eaffa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 08:42:45 +00:00
Andras Mantia 7b9505eb86 Fix copy-paste error in the QMultiHash documentation
Pick-to: 6.7 6.5
Change-Id: I769a94710994a17160cca7f00243a634d8caf29c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6f70ab027e785590f61357f907002aa3b4fd1aca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-18 08:10:31 +00:00
Marc Mutz dabfdb5f2d QSingleShotTimer: de-inline [4/4]: clean up includes
Include what you need, don't rely on transitive
includes. Forward-declare what you need in-name-only.

Also port the one unchanged include in the header
(qabstracteventdispatcher.h) to idiomatic form. It's an unrelated
change, but it looked so lost among the QtCore/ headers, I felt pity.

Amends e0573e7364.

Change-Id: I4f25df7465f08378bc4e003bde12c28f4d231f14
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 49d5b0a5a10634841122bbbc5e986ce307e7017a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 13:40:56 +00:00
Kai Köhne 661ab8398e Doc: Fix typo in snippet
Change-Id: I1a93a5f58bc5edc07c5449f20eb2444ebc252a61
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 3e1f73aa30761533b5a897ee0ee6d7ce33f5b4bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 13:40:55 +00:00
Alexey Edelev 861664b9d9 Add documentation for the QT_NO_UTF8_SOURCE property
Add the missing documentation for the QT_NO_UTF8_SOURCE. The property
can be set directly or using the qt6_allow_non_utf8_sources function.

Fixes: QTBUG-126435
Pick-to: 6.7 6.5
Change-Id: I2a255e6d4f761f14a2fa30ae51b4f671ed75586f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 37e6159ab0c1456e8dc38f38f3b21643585c1273)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 13:40:55 +00:00
Edward Welbourne 6a0f00ac4e Update CLDR to v45, adding language Kuvi
This was in fact present in v44, but we overlooked it somehow. The new
version also fixes some inconsistencies in the data, that I reported
against v44.1; in particular, Tamil no longer claims to override the
root AM/PM markers (probably because it uses 24-hour time so doesn't
need them).

Add the test-file under util to the list of files containing generated
content.

Conflict at 6.8 resolved by regenerating the data; this only changed
the date of generation, not the data. Then hand-edited the date to
match the picked upstream commit, to avoid future conflicts.

[ChangeLog][Third-Party Code] Updated CLDR data, used by QLocale, to
v45.

Task-number: QTBUG-126060
Pick-to: 6.7 6.5 6.2
Change-Id: I81a5bcca49519b55091fc541de6b73b606661bb4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f79548e268a496698d77d0e78365334d0e507212)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-07-17 12:57:30 +02:00
Marc Mutz 4e26c36171 QThread: fix race condition between parallel terminate() calls
QThread::terminate() is documented to be thread-safe, but had a race
condition: If multiple threads call terminate() on the same thread,
the following could happen:

  T1                     T2

  t0->terminate();
    lock();
    read ID;
    pthread_cancel(ID);
    unlock()
                         t0->terminate();
                           lock();
                           read ID;
    (OS thread finishes)
  t3->start();
    (creates a new OS
     thread with same ID)
                           pthread_cancel(ID); // cancels new t3!
                           unlock();

To fix, record that the thread was already terminated using a new
boolean flag.

An alternative would have been to fetchAndSet() the threadId to nullptr
and only let the thread that actually nulled it call pthread_cancel(),
but that would be harder to restore to the previous state in case
pthread_cancel() fails, and a null threadId might cause other problems
down the line, esp. if cancellation is currently disabled. The
explicit state is much simpler to reason about.

Fixes: QTBUG-127055
Pick-to: 6.7 6.5 6.2 5.15
Change-Id: Iec180bdfaaf913a3a1560210c781966dc99c0d42
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d8bd4c2306f2acfefc75f8163b58f2037596dc65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 09:30:17 +00:00
Volker Hilsheimer d2730bc303 Logging: use qCDebug/Warning/Info when for categorized logging
When building qt with QT_NO_DEBUG/WARNING/INFO_OUTPUT set, then the
qDebug/Warning/Info macros expand to `QMessageLogger::noDebug`. That
helper is not defined to take a logging category or category function,
so using `qDebug(lcX, ...)` breaks the build. The correct way to emit
categorized logging is to use the qCDebug/Warning/Info macros.

Task-number: QTBUG-125589
Pick-to: 6.7 6.5
Change-Id: I968b0e826871a09023c11fec9e51caa5a2c4dc0b
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
(cherry picked from commit 1e1c68017338c89265d6664a27f4137fc8960473)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-17 01:49:15 +00:00
Ivan Solovev 4cdb6991c5 Remove QBAV(QL1SV) and QBAV(QU8SV) constructors
They were added because of conditional noexcept on the relational
operators that was preventing the other constructors from being picked
up by the compiler.

Now when we removed the conditional noexcept on the relational
operators, we no longer need this constructors.

This patch reverts bd581e35e7485cf42fbefd250be7b146737d9d41 and
partially reverts fff6562f8c.

Change-Id: I22cb4507bff0a929a25d2f15caed66cc30d20dc9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6cafe0f2b48c5f07f07de52490b1d07c7325557b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-16 11:32:19 +00:00
Ivan Solovev 65ef677131 Rework comparison helper macros to get rid of conditional noexcept
The conditional noexcept in comparison operators is known to cause
problems in various cases.
For example, we had a problem in QBAV, where gcc and clang tried to
expand conditional noexcept before the class was complete, and, as a
result, discarded some of the QBAV constructors (see
fff6562f8c for a more detailed
explanation).
Other problem is related to the GHS compiler which tries to compile
the noexcept specification and provides a hard error instead of
SFINAE'ing out in case of failure
(see e1f45ad818 or
0ac0b412c754e53d167716f207be9d76a7fe16be as examples).

This patch reworks the macros to get rid of the conditional noexcept.
Instead, it demands that all operators are noexcept by default, and
adds another set of helper macros that can be used if it's not
possible to make the relational operators noexcept.
The new macros end with the _NON_NOEXCEPT suffix.

The patch also adds static_assert() to the generated operators to
verify that the proper macros are used. However, some platforms
(e.g. QNX and Integrity) fail to handle conditional noexcept on
lambdas, and so we have to use yet another macro to generate the
checks only on platforms that handle them properly.

This patch also applies the new approach to qtbase, adding noexcept
where possible, and falling back to the _NON_NOEXCEPT macros
otherwise.

As a drive-by: fix the macro implementation to use
QtOrderingPrivate::reversed() instead of manually reimplementing it.

I decided to pick the patch to 6.8, because it allows to fix some
questionable APIs (see QBAV story above).

Change-Id: I72f56778acb469f18b578b3418c0c41b4f6d62e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d292648d0bbac50388dae035dc34782accb3807f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-16 11:32:19 +00:00
Allan Sandfeld Jensen 646fb238e7 Add virtual stub to QAbstractEventDispatcherV2
To be implemented in 6.9, but added here to avoid a
QAbstractEventDispatcherV3.

Change-Id: If8bd98f6299e39999d09b2c8857565d5fd890eec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 404ad4e17d9d36566881e0f398e24ccbc2af4a72)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-16 11:32:18 +00:00
Joerg Bornemann c359af7bfb CMake: Fix exposing source files after target finalization
Calling _qt_internal_expose_source_file_to_ide after a target has
already been finalized did run the function's fallback code for targets
that are not finalized at all. That added the source files under a new
${target}_other_files target, which is a tad ugly in an IDE.

A situation where this occurs is for instance:
- qt_add_executable in a subdirectory
- adding additional files (licenses, documentation, .ts files) to the
  "main" target in the top-level CMakeLists.txt

The code flow is like this:
- enter subdirectory
  - qt6_add_executable(foo)
- leave subdirectory
  - qt6_finalize_target(foo)
    - calls _qt_internal_expose_deferred_files_to_ide(foo)
- _qt_internal_expose_source_file_to_ide(foo bar.txt)
  - sees that the target does not need finalization and runs the
    fallback code

Fix this by immediately running
_qt_internal_expose_deferred_files_to_ide if a target was already
finalized.

Task-number: QTBUG-127052
Change-Id: I1eda9acd48442ba35c6c61d9a185f6ed9ed6307f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 469533fe8108cc56e90201919126502235c5cee6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-16 09:14:43 +00:00
David Faure ed2f80b75d QMimeDatabase: pick up XML mimetypes from :/qt-project.org/mime/packages
[ChangeLog][QtCore][QMimeDatabase] QMimeDatabase can now pick up XML
mimetype definitions from :/qt-project.org/mime/packages. GPL-compatible
projects which provide self-contained binaries can use this to provide
a copy of freedesktop.org.xml that will be used instead of the TIKA
mimetypes.

Change-Id: Id363317f920ae2cb1e054f32feb732e0e9168de3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b12542c964c15d074393a7594c97a96d5c2b047d)
2024-07-15 14:47:41 +02:00
David Faure 2d2975bd9f Change the mimetype database embedded into QtCore
Instead of freedesktop.org.xml (which is GPL), use the tika mimetypes
definition (Apache licensed), as fallback on platforms where
shared-mime-info isn't installed.

[ChangeLog][QtCore][QMimeDatabase] For licensing reasons, QtCore
no longer ships a copy of the MIME database from freedesktop.org's
shared-mime-info project, but the one from the Apache Tika project.
The tika definitions don't have icons or translated descriptions, but
are sufficient for matching file types.

[ChangeLog][Third-Party Code] Added TIKA mimetypes and the corresponding
attribution file.

Change-Id: I360ed973f6d89a470dc2f17a21abdf5630c6d15d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 74ad4cbeef40b1f51a59b3168f8c0b62eb0b29c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-15 12:47:37 +00:00
Volker Hilsheimer 2a677940a0 JNI: add swap to QJniArray
It's a value type and should implement swap.

Change-Id: I811377843b6ede1d6d750a701ae7a6b12434f4e6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 0789dd8723b03d255ff203c717c5e12b6945015e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-13 23:00:28 +00:00
Volker Hilsheimer 92b1923e31 JNI: clean up move and swap semantics in QJniObject
QJniObject is a value type with move semantics, but didn't provide swap,
so add it.
Make it safe to check a moved-from QJniObject for validity, and to
compare it with another QJniObject. As before, two invalid objects
compare as equal.

Change-Id: Ie08bb7c50da831f3e7e98e731e8ddbc0ebb3af78
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 3e0c21691dd2be6911c417f4cbfaf54d10b4d634)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-13 23:00:24 +00:00
Edward Welbourne 3f85834a47 Tidy up fix for calendar/locale data lookup
Save duplication of fetching and sanity-checking the locale-dependent
calendar index data by packaging it as a lookup function. This can
then take care of making the assertion of consistency with the
matching QLocaleData entry and also lets me add, without duplicating,
the slightly messy assert that m_data is what we expect (and are
relying on) it to be.

Task-number: QTBUG-126390
Change-Id: Ib514bee669956f432c007c858d01a9f7b6bbf86e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c9c498b5d1f5797c714fb07f06a84df881edb928)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-13 00:43:55 +00:00
Ahmad Samir fcfa245474 QTemporaryFile: clarify usage of the dynamic part of the file name
Pick-to: 6.7
Change-Id: I7d6b1b8a53f7b32bf223ac3435ec7c13c9326d10
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit b4bb4449aea7592afdb9b9134bb90c40fe29735a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-12 18:08:15 +00:00
Ahmad Samir ec349e0c00 QTemporaryFile: de-duplicate docs wrt. the file name relative/absolute
Make it clearer in fileTemplate() and fileName() that the returned path
will be relative or absolute depending on the specified file name
template.

Task-number: QTBUG-124653
Pick-to: 6.7
Change-Id: Iccb7a6d0ced2cadeacea7d14d3f6e924705b4d58
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9a5e3e1f4064e275da3370f5dd27e87900da8c45)
2024-07-12 21:08:02 +03:00
Marc Mutz 431ca49614 QSingleShotTimer: de-inline [3/4]: move fromMSecs to qtimer.cpp
Move the implementation of fromSecs() from the header to the
qtimer.cpp file and make it file-static. There are no callers of the
function outside qtimer.cpp.

Amends e0573e7364.

As a drive-by, rename the function to snake_case to indicate that it's
a file-static.

Change-Id: Ifa32df8a28816cd9cae44cdb9d481df94d33d741
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ba80845ed16b784ac00dcc9e7715e4605e3344ff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-12 17:36:28 +00:00
Kai Köhne 4e209c2188 Doc: List QRegularExpression classes in String Data overview page
Pick-to: 6.7
Change-Id: I25c052e779b7eef78e4dfd1234e0b9b8f71229d0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d44a0b6fdd1ddbbb3de67f076b01a3926ef71d0a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-12 11:45:56 +00:00
Kai Köhne 55d1a457c0 Doc: Mention QDirIterator, QLockFile in IO overview page
Pick-to: 6.7
Change-Id: I013fc221ea790b0f3bbc41ef6bf3f63c643cdab6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0e26a2d74a5117d1a6b25f5038ccb55cffb58ade)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-12 11:45:56 +00:00
Marc Mutz b174be2247 QSingleShotTimer: de-inline [2/4]: clean up header
Remove the inline keyword.

As a drive-by, mark the ctors explicit and the dtor override, and sort
the SMFs idiomatically (dtor _after_ ctors).

Amends e0573e7364.

Change-Id: I2496360e1f72a4ab54a7c090ca966e1c4828a314
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit b05022e8473d5517f0a8b0c8c4d5dff6e31c5a97)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-12 11:45:56 +00:00
Marc Mutz e3da82d3b6 QSingleShotTimer: de-inline [1/4]: add .cpp file
... and split code between header and .cpp file. The goal here is to
just sort the lines into header and .cpp, not to change them, so
temporarily define inline away. This allows git to reliably track
this as copy instead of independent changes. The inline define will be
cleaned up in a follow-up patch; fixing inline and re-indenting would
reduce the similarity score too much.

Also includemocs and move qsingleshottimer* to the (lexicographically)
correct position in CMakeLists.txt's SOURCES.

Fixes -Wweak-vtable (and therefore prevents this class from being used
outside QtCore (not exported atm)).

Amends e0573e7364.

Change-Id: Ia5304434fd1c9a56eb6f2f1988bd14a80ab61442
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1ef5f50e28edd1bdfcb3828c3858640ba347b2bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-12 11:45:56 +00:00
Edward Welbourne 23e0318d24 Reorganise QtTest 3rdparty to separate its various parts
In the process, update the Linux perf_event.h provenance details to
make it possible to find the latest version. Also, remove 3rdparty
headers from the module's CMakeLists.txt (where possible) so that
anything that includes them makes its 3rdparty dependence visible in
the relative path. That can't be applied to cycle_p.h, though, as it's
used by the tests.

Task-number: QTBUG-126080
Change-Id: I3a7099bc123ba7188ad096714cb7ed45ff35a392
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit b14906884c63b3f5f239d7d008eb23aba66836fa)
2024-07-12 13:45:55 +02:00
Volker Hilsheimer 2f319c889d QThread: initialize interruptionRequested atomic
Coverity complains correctly that the variable is not initialized.
std::atomic's default constructor doesn't do it, and we only do it
in QThread::start and QThread::finished. So initialize it using NSMDI.

Pick-to: 6.7 6.5
Coverity-Id: 466429
Change-Id: I36d4624d46718f50e10bec17ef5e437c60541fa9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d1f6d2258809ed7e2d7aa50de3b6d6f472cf1bd8)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-07-12 11:05:44 +02:00
Volker Hilsheimer 6ff2302a7f Doc: fix warnings from links by fully qualifying the target
The link to QChronoTimer::singleShot seems to ambiguous for qdoc, as
it's both a property and a method. But linking from startTimer to the
QChronoTimer (and QBasicTimer) class rather than singleShot makes
more sense anyway.

Change-Id: I499b1008b8460d9529b8afd00b5dafbb314ceea1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 6bbc9c714bf067d33ad2f487c552025aaa7278db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-11 19:19:49 +00:00
Volker Hilsheimer 0f62cc21f5 Doc: fix warnings from incorrect signatures in QJniArray
Amends a6b1f80cd6c833f6eb2fbfb778254cd7fcbc000f.

Change-Id: I40c7b6e756ddb7a4f4fe477e0ec2e42bc97ba027
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit dc2b94551c21c6957c4b266647e4aad7cce1e60c)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-07-11 10:57:30 +02:00
Volker Hilsheimer d9c38b66aa QJniArray: implement offset dereference operator
The last requirement for making the iterator random-access, so
change category type.

Based on review comments.

Task-number: QTBUG-126150
Change-Id: I617f38f92d0f9279781e62ea3ab1929dbf6a07cd
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e4b2d7607c0243f2a7ca3f38f59e8532c543fcc7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-11 10:57:27 +02:00
Volker Hilsheimer 0db64ca53b QJniArray: add arithmetic operators
Required for making the iterator random access.

Based on review comments.

Task-number: QTBUG-126150
Change-Id: I80ee8ed584747759acb17ee956551caba4d5bdaa
Reviewed-by: Soheil Armin <soheil.armin@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c4e406e3792405cfc0b8cc97a29f136c0fd44a2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-11 10:57:24 +02:00
Volker Hilsheimer 46ed4e47d2 QJniArray: make iterator strongly ordered
Required for making the iterator random access.

Implement compareThreeWay, add tests. Comparing iterators operating
on different containers is undefined behavior, so assert if they don't
match (even if they are different QJniArrays referencing the same
Java array).

Based on review comments.

Task-number: QTBUG-126150
Change-Id: Ib3b94558fc66fb9cff19139d2110c6bbd4ac14b5
Reviewed-by: Soheil Armin <soheil.armin@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit d04f38f6f5e49a81211ab598ba23049dc4ef1507)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-07-11 10:57:22 +02:00