Commit Graph

62520 Commits

Author SHA1 Message Date
Ivan Solovev
7a33a08376 QSemaphore: add missing <chrono> include
std::chrono is still used in the header.
Do not rely on transitive includes, instead include the header
explicitly.

Pick-to: 6.6
Change-Id: I2cf5dc275c3272151efd655a4fa85936942c5708
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-18 15:53:07 +02:00
Edward Welbourne
d6dacfecb1 Fix warning in recently-added testlib snippet
Amends commit fa296ee1dc to implement
MyObject::startup(), mark it void (its return was ignored) and flag
its static wrapper as [[maybe_unused]] to calm a compiler warning.

As a drive-by, fix indentation of the class definition.

Change-Id: I3918bf8a4625a7e2b4e6d4e0cbfa68a337115865
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-07-18 15:28:07 +02:00
Kai Köhne
892448b6e0 Make Qt headers work with MSVC /W4
This requires explicitly marking constexpr if conditions to fix C4127
issues:

  qtbase/src/corelib/text/qstringbuilder.h(112):
  error C2220: the following warning is treated as an error
  qtbase/src/corelib/text/qstringbuilder.h(112):
  warning C4127: conditional expression is constant
  qtbase/src/corelib/text/qstringbuilder.h(112):
  note: consider using 'if constexpr' statement instead

Change-Id: I9787fb37099f811c52f93c94c9edb4da8aafdfe5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-18 14:48:19 +02:00
Marc Mutz
3bb488fb2a Use new QByteArray::assign() in QTlsBackendOpenSSL::dhParametersFromPem()
QBA::assign() re-uses existing unshared capacity(), if any, and is
therefore potentially more efficient than = QByteArray(.,.) (and never
slower).

Pick-to: 6.6
Task-number: QTBUG-106201
Change-Id: I2c45aa268c4c06396e9d7e0490666a13d8cfd532
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-07-18 12:14:09 +02:00
Marc Mutz
676087ef1f QSslDiffieHellmanParameters: fix mem-leak
Says ASAN:

    Direct leak of 524 byte(s) in 1 object(s) allocated from:
    #0 0x7f708f0a67cf in __interceptor_malloc ../../../../gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f707d94bf9e in CRYPTO_malloc crypto/mem.c:196
    #2 0x7f707d7bd248 in asn1_item_flags_i2d crypto/asn1/tasn_enc.c:65
    #3 0x7f707d7bd1b7 in ASN1_item_i2d crypto/asn1/tasn_enc.c:45
    #4 0x7f707d85b7be in i2d_DHparams crypto/dh/dh_asn1.c:54
    #5 0x7f7075a82223 in q_i2d_DHparams(dh_st*, unsigned char**) qsslsocket_openssl_symbols.cpp:435
    #6 0x7f7075a82223 in QTlsBackendOpenSSL::dhParametersFromPem(QByteArray const&, QByteArray*) const qssldiffiehellmanparameters_openssl.cpp:139
    #7 0x7f708ca9b588 in QSslDiffieHellmanParametersPrivate::initFromPem(QByteArray const&) qssldiffiehellmanparameters.cpp:285
    #8 0x7f708ca9b588 in QSslDiffieHellmanParameters::fromEncoded(QByteArray const&, QSsl::EncodingFormat) qssldiffiehellmanparameters.cpp:94
    #9 0x55fd8a545ebe in tst_QSslDiffieHellmanParameters::constructionPEM() tst_qssldiffiehellmanparameters.cpp:98
    [...]

The pointer returned in the out-parameter of a i2d_DHparams() call is
supposed to be OPENSSL_free()ed by the user (this is not at all
obvious from the docs¹, but an SO answer² indicates that's how it
should be (as well as asan stopping from complaining with this
patch applied)).

¹ https://www.openssl.org/docs/man3.1/man3/i2d_DHparams.html
² https://stackoverflow.com/a/53563669.

Amends 2cf63c71eb.

[ChangeLog][QtNetwork][SSL] Fixed a memory leak in parsing of
PEM-encoded Diffie-Hellman parameters.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I9ed4a26c4676db1c0d54a1945a4fb5014ce568cd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-07-18 12:13:54 +02:00
Marc Mutz
51edc438dd tst_QAbstractItemModelTester: fix mem-leak
QThreeWidgetItems that have been removed from their parents (or the
widget) must be deleted manually. The treeWidgetModel() test forgot
that, driving asan nuts.

Code predates the beginning of the public history, so picking to all
active branches.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I139549b0bd8baf4abfb90f926f6290119471046f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-07-18 12:13:30 +02:00
Marc Mutz
bad3b8f78b tst_QNetworkDiskCache: fix mem-leak
A caller of Q(Abstract)NetworkDiskCache::data() is supposed to delete
the returned value, and this caller forgot.

Do it now; better late than never.

Amends feb1afc782.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I1b27663df9ad49e0203172265d224fdb6ec06646
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-07-18 12:13:23 +02:00
Fabian Kosmale
90226018a9 Provide QStringConverter equivalent of QTextCodec::availableCodecs
A text editor commonly wants to display a list of codecs that are
supported. With the introduction of the ICU based QStringConverter, that
list is no longer statically known. So provide the necessary
functionality.

Fixes: QTBUG-109104
Change-Id: I9ecf59aa6bcc6fe65c8872cab84affafec4fa362
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-18 09:38:38 +03:00
Axel Spoerl
bc9ad7db6b tst_QXmlStream: Fix CMakeLists.txt
Remove non existing path from GLOB_RECURSE statement.

Pick-to: 6.6 6.5 6.2
Change-Id: Ie122bd062acf8cc26f2ddead808c101af4da9573
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-07-18 08:36:21 +02:00
Liang Qi
43c4d17e4d tests: blacklist tst_QGraphicsItem::itemUsesExtendedStyleOption() on Wayland
Task-number: QTBUG-115293
Pick-to: 6.6 6.5
Change-Id: I0a9251b5656a5d5a1048fa0cb1606df1c42dd85d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-18 08:25:41 +02:00
Marc Mutz
3a166fa45d SlotObjectGuard: mark ctor nodiscard
QUIP: 19
Pick-to: 6.6
Change-Id: Idaf8cda12fe2ca97a763d78ff4c8cd7304d178e5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-18 08:15:47 +02:00
Edward Welbourne
144e10eafb Treat simple spaces as equivalent in date-time format separators
The user might not be aware of, or able to see, the difference between
Unicode's assorted horizontal spacing characters, leading them to
expect their input to be accepted for a format despite differences in
spacing. So treat the various horizontal spacing (other than tab)
characters as equivalent when matching the separators in a date-time
format. Add a test-case that failed before this fix.

Fixes: QTBUG-114909
Pick-to: 6.6 6.5
Change-Id: I3e798d3e5b89adb8e86168ebd3954904b258d630
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-07-17 23:05:07 +02:00
Edward Welbourne
61b2a6f587 QDTP: Fix handling of no-digit numeric fields
A numeric field with no digits is Intermediate, since digits can be
typed into it. The testing for this was complicated by the fact that a
sign might be either a sign in the field or the start of a following
separator.

Break out the testing of separator matching at the start of a view.
This simplifies the existing checks for full separator match and we
can use it in the no-digit numeric field's handling to make the check
more robust (matching the whole separator, rather than only its first
character). It incidentally prepares the way for other changes.

Pick-to: 6.6 6.5
Task-number: QTBUG-114909
Change-Id: I5abfccbcae3cba0979b4723c400de038fe2bf324
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-17 23:05:04 +02:00
Li Yefeng
fbd259856d Fix wrong scan code values in key events obtained on Windows
The scan code (Windows) value depends on the extended-key flag
(KF_EXTENDED 0x0100) in the key message. This flag was kept in scan code
value, which is wrong. It is not part of scan code, and when it's on,
another byte 0xE0 should be prepended to scan code. See:
https://learn.microsoft.com/en-us/windows/win32/inputdev/about-keyboard-input#extended-key-flag

Change-Id: Iddcabb0aae92bb784883bddc9a34fe134d787b32
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-07-17 17:07:02 +00:00
Ivan Solovev
0b3c5816c6 Explicitly specify the alignment of QUuid::Id128Bytes union
... because otherwise the union can change its alignment based on
the presence of the data128 member.
For example, QtBluetooth explicitly #undef's __SIZEOF_INT128__ in
its removed_api.cpp, which leads to UB without this patch.

Found during API review

Pick-to: 6.6
Change-Id: Ia17122cc9f3d422530cf722ea528591fce7ab7ff
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-17 18:49:16 +02:00
Ivan Solovev
0393fa6bf2 QUuid: handle quint128 and Id128Bytes data in the same way
The QUuid(quint128) ctor was handing the incoming data differently
from the QUuid(Id128Bytes) ctor. Same was valid for the return
values of QUuid::toUint128() vs QUuid::toBytes().
The provided test didn't reveal it, because it was treating the same
128-bit input value as BE in one place, and as LE in another place.

This patch fixes the test, and updates the implementation of
QUuid(quint128) ctor and toUInt128() method to verify that the
updated test passes.

This commit amends 8566c2db85

Pick-to: 6.6
Change-Id: I24edb8ba0c8f7fd15062ba0b2a94ad387c3e98b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-17 18:49:16 +02:00
Ivan Solovev
ef4e36aa3c QUuid: remove pointless inline keyword
constexpr functions are implicitly inline

Found during API review.

Pick-to: 6.6
Change-Id: I94daa0a67336fa99a1465115edb83e545580a78a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-17 18:49:16 +02:00
Mårten Nordheim
0b10808fb5 Network-chat example: update the screenshot
Change-Id: Ibdb9e242295766304c1c7a551d831fb796518496
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-07-17 18:49:16 +02:00
Mårten Nordheim
2a80adc2f6 Network-chat example: Use QHash for peers
We don't key it on IP address anymore so we can drop
the use of QMultiHash.
This also requires moving the connections for error and disconnected
to readyForUse so we don't remove an active connection when a second
connection attempt happens from the same peer process.
But since we still need to deallocate those connection attempts
if they error out or simply disconnect, we connect their signals to the
QObject::deleteLater slot. In some cases we might call deleteLater twice
but that's fine.

Change-Id: I48c27de1e51a52ef61cfb941a7a81b358ae9ce3f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
2023-07-17 18:49:16 +02:00
Mårten Nordheim
226d06402b Network-chat: Fix remote peer making multiple connections
The system was just treating IP (and optionally port) as a unique
identifier, so if a peer had multiple possible paths to a client they
would connect multiple times.

This fixes that by generating using QUuid in each client.
We then use this during broadcast, replacing the username we
sent before (which was not used), and as part of the greeting.
The greeting now is more complex, since we need to send both
username and the ID.

Change-Id: I6c6c2ffd5198406aad48445a68dd6aab36de69c0
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-07-17 16:49:16 +00:00
Edward Welbourne
5651be517a XBEL stream example: use constructor initialization
The treeWidget member of MainWindow could be initialized before the
body of the constructor, enabling it to be a *const variable.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: If4a3b04729bc7fa5859ca88183eec376f6992455
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-07-17 14:50:51 +02:00
Kai Köhne
d4d600d411 Testlib: Make QTEST_ASSERT usable in constexpr functions
Commit 8ea27bb1c6 adapted the definition
of Q_ASSERT already.

Adopt the same logic for QTEST_ASSERT.

Pick-to: 6.5 6.6
Change-Id: I5a5d0f62df79b18635d3b426a439c35b25d739c2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-17 08:33:40 +00:00
Piotr Wierciński
0493504f34 wasm: Render Qt::SubWindow borderless
Windows with Qt::SubWindow flag should not have platform decoration.

Fixes: QTBUG-115054
Pick-to: 6.5 6.6
Change-Id: I7111df6057a087080194c1d46e350df839bec437
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-07-17 10:33:36 +02:00
Axel Spoerl
959a8b3967 Adapt setBackingStore() overrides in QWasmWindow and QEglFSWindow
This is a follow up to a4ca9e8065,
adapting the backing store setters to become proper overrides of
the newly implemented QPlatformWindow::setBackingStore();

Pick-to: 6.6
Change-Id: Id4f5ff8650ca4e4d3cab1d71d27041c6129bf4ea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-07-16 20:28:06 +02:00
Marc Mutz
ecab68989e QCborValue: fix memleak on Array to Map coercion
When converting from an array to a map, we double the number of
elements, spread the old elements out to make one free slot of space
in front of each, and then place Integer values counting from 0 into
the free slots.

The old code contained a loop that would add a strong reference to the
original elements that happen to be containers and thus are
ref-counted in the first place. But this additional strong reference
is not needed: In both cases, detached or in-place, the detach() call
that ensured unique ownership of 'map/dst' will have either directly
or indirectly updated the ref-counts of the elements correctly, and
the following loops just reshuffle the elements in the QList, they
don't create new copies (QtCbor::Elements doesn't by itself manipulate
container->ref, but even if it did, the copy would have increased, and
the assignment of the Integers would have decreased, the ref-count
again). Adding the strong ref without a user then caused the container
members to be leaked.

Fix by removing the loop.

[ChangeLog][QtCore][QCborValue] Fixed a memory leak when an array was
coerced into a map.

Amends ccea344640.

Not picking to 6.4 as it's closed at this time.

Fixes: QTBUG-115249
Pick-to: 6.6 6.5
Change-Id: I369c372e91c3f0cfe3c65f9b0ea8507d08fdaf48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-15 16:02:04 +00:00
Marc Mutz
8cb542c2d4 tst_QTcpSocket: fix mem-leak
earlyConstructedSockets is a QObject, but had no parent and was never
deleted, leaking all the data is holds.

Fix by giving it a parent.

The code predates the begin of the public history.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ibc5688afd6111e84f591c37e39b6bb618d76c47a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-15 15:06:58 +02:00
Marc Mutz
9f8449a054 tst_QSortFilterProxyModel: fix mem-leaks
tst_QSortFilterProxyModel::doubleProxySelectionSetSourceModel() leaked
_everything_, driving asan nuts.

Allocate objects on the stack instead; now it's asan-clean.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I721e797e02b1daec9e2b5e3d4ef612a42b2e3492
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-07-15 15:06:55 +02:00
Alexandru Croitor
53b6c88a25 CMake: Fix gc_sections genex evaluation in pkgconfig file creation
The gc_sections linker flag was recently wrapped in a
$<CXX_COMPILER_ID> genex to prevent adding it the command line when
using an incompatible compiler.

This causes an issue when generating .pc pkg-config files because
$<CXX_COMPILER_ID> can't be used in the output of a file(GENERATE)
call.

Record the flag in a global property, both the genex-wrapped and bare
forms, so that we can perform a string replacement when generating
the pkg-config file to remove the genex wrapping.

This is not perfect, in the sense that consumers of the .pc file
might get the wrong flag if using an incompatible compiler, but
it's better than outright failing the Qt build.

Distros will be expected to patch the .pc files if necessary.

Note the issue does not usually happen for regular Qt builds because
gc_sections is only enabled automatically for static builds, but for
static builds we don't currently generate .pc files.
So the issue only happens in shared Qt builds where the gc_sections
feature is enabled manually.

Amends a2b6c2f343

Pick-to: 6.5 6.6
Fixes: QTBUG-115243
Change-Id: I3f6bdf86c24ee90b6da04994e458b438cc41fc7a
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-07-14 18:40:44 +02:00
Axel Spoerl
a4ca9e8065 Implement virtual void QPlatformWindow::setBackingStore()
QWidget re-uses an existing backing store. Platform windows depend on
being associated to a backing store, in case they become toplevel
windows. If a platform window gets deleted and re-created each time it
is shown or hidden, it has to be manually associated to the re-used
backing store.

This patch partly reverts fbf0aeea7d3b38ced7a16fcd5c3e2e9b45536292.
It removes Android specific code from QWidgetPrivate::create(), which
has been added to suppress re-using backing stores in the absence of
the new API.

Fixes: QTBUG-97482
Pick-to: 6.6
Change-Id: Iaa1b7652efa120ec1955914c0383e8ccd8a41429
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-07-14 18:40:43 +02:00
Axel Spoerl
dbb072eb28 QWidget: Don't re-use backing store on Android
QWidget re-uses backing stores created in QWidgetPrivate::create().
The Android platform plugin creates a new platform window, when a
widget becomes a toplevel window. When it is hidden, the platform
window is deleted. The link between QAndroidPlatformWindow and its
backing store is made in the constructor of
QAndroidPlatformBackingstore. When a new QAndroidPlatformWindow is
constructed and the backing store is re-used, there is no more link
between platform window and platform backing store.
This has lead to screen assets not being painted, when shown more than
once.

This patch forces QWidgetPrivate::create() to construct a new backing
store on Android. This way, toplevel windows always have a backing
store associated with it. It adds an assertion to
QAndroidPlatformScreen::addWindow(). That will make e.g.
tst_QWidget::visible() crash without the fix.

Fixes: QTBUG-97482
Pick-to: 6.6 6.5 6.2
Change-Id: Ib1b172068b03549df161ab93ac24a273221d5423
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-07-14 18:40:43 +02:00
Marc Mutz
7a1625abf1 modulecppexports.h.in: replace non-ASCII with ASCII characters
Qt 6 requires /utf-8 for user-projects by default, but allows users to
opt-out (cf. 0cdcbb40a1), so we shouldn't
use non-ASCII characters in public headers.

Amends 97f643faee.

Fixes: QTBUG-115229
Pick-to: 6.6 6.5
Change-Id: Ieb93ea9f3526e7bcc2e5aeffb5e69c68d10db792
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-14 16:02:12 +00:00
Paul Olav Tvete
631cb589bf Doc fix: Use correct initials for Porter and Duff
It's Thomas Porter and Tom Duff, not Xavier and Yoann.

Pick-to: 6.6 6.5
Change-Id: I2e9345c06c299e9c0475831e21c3b9b85c58a32f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-07-14 14:56:42 +02:00
Marc Mutz
d3c08df330 tst_QNetworkCookieJar: fix memleak
QTest::toString() returns a new[]'ed char array, which needs to be
manually deleted and QVERIFY2() doesn't take ownership of its second
argument.

Fix by wrapping in unique_ptr<char[]>(...).get().

Bug exists since the dawn of the public history.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I19ec09f46ec0ce5eacf1437f62dc625bc9343831
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-07-14 14:56:10 +02:00
Marc Mutz
e667624371 tst_QParallelAnimationGroup: fix memleak
Setting the parent of a QObject to nullptr means the ex-parent no
longer owns and deletes the object as its child, leaking it.

Fix by creating a scope-guard to defer deletion until the tests have
run.

This is simpler than the alternatives:

Putting it into unique_ptr would require a new variable name, or a
larger refactoring of the function, because the `test` variable is
being re-used for many different objects in the course of the
function, most of which should not be deleted.

Using QAutoPointer would drag in QtWidgetsPrivate, and the class is
probably not available in all active branches.

Finally, deleteLater() would require reliably returning to the event
loop, which may not happen if the test is run in isolation.

Bug exists since the dawn of the public history, and QScopeGuard is
available in all active branches.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ib4fcb44b0b68d4ccbcf5af144a18ffb378a72213
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-07-14 14:56:03 +02:00
Dennis Oberst
08605f0d78 QNativeIpcKey: add implicit default ctor
Add an implicitly callable default ctor, to enable default returns,
but still disallow implicit conversion whilst assigning:

  QNativeIpcKey k = QNativeIpcKey::Type::~~      // not allowed
  auto fn = []() -> QNativeIpcKey { return {}; } // allowed

Pick-to: 6.6
Change-Id: I0f8476a588b3931f0e1f41a6c3a3fd8f2eb75b93
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-14 09:31:04 +02:00
Dennis Oberst
ba95594ea2 QNativeIpcKey: make isEmpty() and isValid() noexcept
They have no preconditions and cannot throw.

Pick-to: 6.6
Change-Id: I9c3020e00cffc84dfc3a14469cbb80557a4df5cf
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-14 07:31:00 +00:00
Michael Weghorn
b8fb120384 a11y uia: Bridge newly added relations to UIA
Support UIA property IDs UIA_DescribedByPropertyId,
UIA_FlowsFromPropertyId and UIA_FlowsToPropertyId
by using the Qt relation types newly introduced in
f5358e5932.

As described in f5358e5932
and afbfe30093 for AT-SPI,
the relation type needs to be "inverted" for UIA just the
same, since Qt's semantics is the other way around.

Task-number: QTBUG-105864
Change-Id: Id557389af6609197f4c3b37741e4201028627004
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-07-13 19:30:35 +01:00
Marc Mutz
22b3eca55d tst_QThread: Unbreak UBSan build
tst_QThread peeks into QThreadPrivate, which means that a UBSan build
needs access to QThreadPrivate's type_info, for which we need to
export the class.

Amends 268ff00ef5.

Pick-to: 6.6 6.5
Change-Id: Ic26df3d323d50b51d369d5f2bd78db7e047b5341
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-13 17:47:26 +02:00
Marc Mutz
3fb0208d4b QBasicFutureWatcher: get rid of the Private
It's not needed anymore, because the class is no longer part of the ABI.

Pick-to: 6.6
Change-Id: Idfacc6023288ce603b30ab5aa904106e8c850444
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-07-13 17:46:05 +02:00
Dennis Oberst
56a776da40 QNativeIpcKey: add missing noexcept to swap
Pick-to: 6.6
Change-Id: I57d5f22823597a56d93fc2f8f30b538684ce77ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-13 17:24:27 +02:00
Marc Mutz
3ad359d44f tst_QLineEdit: fix -Wsuggest-override
Amends 8afe4faf29.

Pick-to: 6.6 6.5
Change-Id: If2b87f8db3e1a60ff5f5d34c68b3ecd45ff25f96
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-13 16:19:06 +02:00
Giuseppe D'Angelo
96d67da420 String-like containers: add implicit conversions towards std:: string views
In C++20 std::basic_string_view has gained a range constructor (like
QStringView always had), but that range constructor has been made
explicit. This means we can't just pass a QString(View) to a function
taking a u16string_view. The consensus seems to be that that types that
should implictly convert towards stdlib's string views should do that
via implicit conversion operators. This patch adds them for

* QByteArrayView => std::string_view
* QString(View) => std::u16string_view
* QUtf8StringView => std::string_view or std::u8string_view, depending
  on the storage_type

QLatin1StringView doesn't have a matching std:: view so I'm not enabling
its conversion.

QByteArray poses a challenge, in that it already defines a conversion
towards const char *. (One can disable that conversion with a macro.)
That conversion makes it impossible to support:

  QByteArray ba;
  std::string_view sv1(ba);  // 1
  std::string_view sv2 = ba; // 2

because:

* if only operator const char *() is defined, then (2) doesn't work
  (situation right now);

* if both conversions to const char * and string_view are defined, then
  (1) is ambiguous on certain compilers (MSVC, QCC). Interestingly
  enough, not on GCC/Clang, but only in C++17 and later modes.

I can't kill the conversion towards const char * (API break, and we use
it *everywhere* in Qt), hence, QByteArray does not get the implicit
conversion, at least not in this patch.

[ChangeLog][QtCore][QByteArrayView] Added an implicit conversion
operator towards std::string_view.

[ChangeLog][QtCore][QString] Added an implicit conversion operator
towards std::u16string_view.

[ChangeLog][QtCore][QStringView] Added an implicit conversion operator
towards std::u16string_view.

[ChangeLog][QtCore][QUtf8StringView] Added an implicit conversion
operator towards std::string_view (QUtf8StringView is using char
as its storage type in Qt 6). Note that QUtf8StringView is planned to
use char8_t in Qt 7, therefore it is expected that the conversion will
change towards std::u8string_view in Qt 7.

Change-Id: I6d3b64d211a386241ae157765cd1b03f531f909a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-13 16:19:06 +02:00
Kai Köhne
c07a3f10ef Doc: Add remaining SQL examples to Data Processing & I/O category
Task-number: QTBUG-115174
Pick-to: 6.5 6.6
Change-Id: Idd8ba8504efb17f0e4a11b3c36b991739251f2ef
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2023-07-13 16:19:05 +02:00
Hatem ElKharashy
d5822981ee Static build fix for RenderDoc dependency
Modify configure.cmake to avoid breaking static builds
while using RenderDoc with QGraphicsFrameCapture.

Change-Id: Id0f39304b20ab3a98bfb0206cf5b52031d38f0ab
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-13 14:59:14 +03:00
Marc Mutz
d41db62154 Move QBasicFutureWatcher behind the ABI boundary
... and out of QtPrivate.

No inline API requires it anymore, so move it into the only TU using
it. Can't move it into the unnamed namespace because of the friend
declaration in QFutureInterfaceBase.

Pick-to: 6.6
Change-Id: I27452960492bc1193a4d0eaeb2acd913d4dd02a5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-07-13 08:24:02 +00:00
Joerg Bornemann
7c82a49e6f CMake: Fix error in qt_generate_deploy_app_script
...when using a Qt cross-built for embedded Linux and
NO_UNSUPPORTED_PLATFORM_ERROR set.

Attempting to install such a project will now give the following output:

-- Skipping runtime deployment steps. Support for installing runtime
dependencies is not implemented for this target platform (Linux, shared
Qt libs, cross-compiled).

Pick-to: 6.5 6.6
Fixes: QTBUG-114069
Change-Id: Idd2af2135d2ca3cc0e5eeafb7701e891f8a0cc25
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-13 09:53:28 +02:00
Marc Mutz
dfd07205e5 QFuture: Extract Method watchContinuation() (DRY && SCARY)
The old code violated the following principles:

- DRY: the same code occurred 3× in the code-base

- SCARY: the vast majority doesn't actually depend on template
  arguments, causing template bloat

Solve both with a tiered Extract Method.

We cannot change the order of the operations performed on
QBasicFutureWatcher, in particular not the connect() to the
contination w.r.t. setFuture(), so we cannot leave the connect to the
continuation lambda outside the function, as it would mean to also
leave the setFuture() call outside.

Thanks to Volker's makeCallableObject(), we can, however, type-erase
the lambda using QSlotObjectBase, which is what connect() internally
creates, anyway, therefore bringing the whole function behind the ABI
boundary.

As a non-QObject, non-QMetaObject friend, we're lacking support for
actually doing something useful with a QSlotObjectBase, but that can
be fixed in the implementation now. The interface is stable, which is
what matters for 6.6 now.

This will allow a subsequent commit to drag QBasicFutureWatcher behind
the ABI boundary, unexporting it.

Saves a whopping 8KiB in tst_qfuture text size on optimized C++20
Linux AMD64 GCC9 builds.

Pick-to: 6.6
Done-with: Fabian Kosmale <fabian.kosmale@qt.io>
Change-Id: I0e5c2564907d92f6938689ab249be11fc0332ba5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-13 09:50:42 +02:00
Marc Mutz
0ecf8a2158 QVariant: make customConstructShared() SCARY¹
Extract Method non-template customConstructSharedImpl() to avoid
instantiating std::unique_ptr with a different per-F Deleter over and
over again.

Not picking to 6.5 because the function was confined to the
qvariant.cpp TU in those versions.

Cf. 11791e2a50 and
d783363f60 for similar issues.

¹ https://www.open-std.org/jtc1/sc22/WG21/docs/papers/2009/n2911.pdf

Pick-to: 6.6
Change-Id: I73d21d929a7db2ab47f62a3246cf913d82e3db75
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-13 07:50:25 +00:00
Mårten Nordheim
93fe8cb305 QRecursiveMutex: remove QDeadlineTimer::Forever leftover
Amends 5f531ae2ac
The overload taking QDeadlineTimer::ForeverConstant was required,
prior to making it an enum class, because the conversion preferred
'int'. It was made an enum class for 6.6 and most overloads were
removed, including the one for QMutex, but QRecursiveMutex was
missed.

Pick-to: 6.6
Change-Id: I4490dd3d7641c06346ea502f10c09915411319ad
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-13 07:49:47 +00:00
Marc Mutz
df96d39c04 ThreadPoolThreadReleaser: add Q_NODISCARD_CTOR
QUIP: 19
Pick-to: 6.6
Change-Id: I465a2ef8edc103f0655a7732f3aaaf18748854c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-13 00:15:33 +02:00