Commit Graph

62643 Commits

Author SHA1 Message Date
Tor Arne Vestbø
ed7c7a1458 iOS: Implement QPlatformWindow::setMask() for masking rendering and input
Same implementation as for macOS.

[ChangeLog][iOS] QWindow::setMask() is now supported for masking the
rendering and touch input of child windows.

Pick-to: 6.6
Change-Id: I2f9429f0f8fa278fdd8edc15c7b242c7c6bc0ff0
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-08-07 17:58:53 +02:00
Tor Arne Vestbø
546d4c9d33 tst_foreignwindow: Add basic test of foreign window reparenting
Pick-to: 6.6
Change-Id: I008fad0f6527503a13ded4818eec5cb280f65cf4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-08-07 17:58:53 +02:00
Ivan Solovev
f50e295680 QJniObject: remove unused private methods
These three private methods were introduced in
4e60681c87 together with the QJniObject
class.
Digging through the whole git log for the qjniobject.h header shows
that the functions were never used. Not in template or inline methods,
and not even in the out-of-line methods.
Considering all the above, removing these methods would not cause BiC
or SiC issues, so just do it.

Pick-to: 6.6
Change-Id: Iaeeefbc2f1002e9413fd16651abd71381362a536
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-08-07 13:37:29 +02:00
Marc Mutz
32e8b27285 tst_QFileDialog/2: port away from Q_FOREACH
These are all trivial: all are over (already or newly-made) const
local variables.

The only noteworthy point here is that, in order to mark it as const,
I had to move a container definition to the more narrow scope in which
it was actually initialized. There are no references to the container
outside the narrow scope that would require it to be defined in the
larger scope.

Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I20890f48a48ca662679f55fa5db759419d4db8c5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-08-07 13:28:20 +02:00
Marc Mutz
b8881ff280 tst_QComboBox: port away from Q_FOREACH
These are all trivial: all are over (already or newly-made) const
local variables.

Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: Idd6e65065ee27c2d29ce1b49607aadb2eaf5e15d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-08-07 13:28:10 +02:00
Kai Köhne
f350f69abe Doc: Remove link to removed example
Example got removed to tesets/manual in
8937169c19

Pick-to: 6.5 6.6
Change-Id: Ica1470b6b478f49e318ea51f244c599cd12bf5a3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-08-07 13:16:37 +02:00
Marc Mutz
a9982a3b63 Add copy(SlotObjUniquePtr), use it in QHostInfoResult & SlotObjSharedPtr
It's a free function, because a) it rhymes with move(ptr) and, of
course, SlotObjUniquePtr being a std::unique_ptr, b) we can't add
member functions to it (and no, inheriting from a type whose dtor is
neither protected nor virtual is nothing you will catch yours truly
doing).

Pick-to: 6.6 6.5
Change-Id: I2026126857a7bba204d683bad118e8a2c5cb2924
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-08-06 11:33:03 +00:00
Mårten Nordheim
5bb4020cbe QHostInfo: use SlotObjUniquePtr
Drops the direct deref'ing.

Pick-to: 6.6 6.5
Change-Id: I9f159244d50572659fa8e9cabfbef47e769ac54e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-06 09:05:03 +02:00
Marc Mutz
d7dc4d3ebb macdeployqt: port away from Q_FOREACH and mark the tool free of it
As a drive-by, fix a detach attempt in an existing ranged for-loop by
making the container const, and don't re-construct the same QDir three
times, just once, at beginning of the function.

Change-Id: I5031c4b63dd939ae93dd119b01d1cad5e655f733
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-05 22:42:20 +02:00
Marc Mutz
a631fef20f QtWidgets: use NO_PCH_SOURCES instead of manual no-pch handling
This is how all other libraries handle this, so use it here, too.

Amends 0c8b98774c and
09d1196281.

Pick-to: 6.6 6.5
Change-Id: Id3b8fa1b834e2bebe5e6ddc1f67e43c66ccd9aab
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-08-05 20:21:16 +02:00
Thiago Macieira
81685b0ac0 QEXTRACTTESTDATA: include the errorString() in case of failure
In case we fail to copy or set the permissions, get the error string
from QFile. This necessitated fixing QFile so it would copy the error
from QTemporaryFile in case the latter failed to open.

Drive-by use %ls to avoid going through the locale codec in QtTest.

Change-Id: Ifbf974a4d10745b099b1fffd1777c7e6e00c25af
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-08-05 08:22:20 -07:00
Shawn Rutledge
17f61ddc63 QMutableEventPoint::update(): update the touchpoint uniqueId too
Most touch events don't have uniqueIds, but it happens with TUIO
fiducial objects.

Fixes: QTBUG-115758
Change-Id: Ibacce255898ce63090bc5b888c12242838603dd5
Pick-to: 6.5 6.6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-08-04 21:11:22 +02:00
Marc Mutz
693c9e6b1b QHostInfo: fix remaining slotObj leaks
We failed to delete the slot object when lookUpHost() was called in
these (exceptional) circumstances:

- on a thread with no event dispatcher

- after application shut-down, when the QHostInfoLookupManager
  Q_APPLICATION_STATIC was destroyed already

Fix by adding the missing destroyIfLastRef() calls into these code
paths, too.

Amends ad5eb297e1.

This would be so much easier if we had SlotObjUniquePtr...

Pick-to: 6.6 6.5 6.2 5.15
Task-number: QTBUG-115263
Change-Id: Ief8bf125bc196742c0ce59c1fd87ab93242fc0da
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-04 19:49:32 +02:00
Marc Mutz
47a0282707 [docs] Link from QtConcurent::run() to QThreadPool::start(Callable&&)
The latter is a better choice if you don't need the result QFuture.

Describe the QThreadPool::start() overload in prose, since the
signature changed in 6.6 from std::function<void()> to Callable
auto&&. The chosen wording is compatible with both.

Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-111875
Change-Id: I9f67c2f7e4b221602bf1c35b72e5d38898a4f0c9
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-04 19:49:32 +02:00
Marc Mutz
edcb8e901b Drag qstring.h out of the qstringbuilder.h guard
qstringbuilder.h needs qstring.h completely parsed. Without this
change, we won't be able to include qstringconverter.h even at the end
of qstring.h (needed for QTBUG-114208).

Picking back to 6.5 to reduce the diff with our LTS going forward.

Task-number: QTBUG-114208
Pick-to: 6.6 6.5
Change-Id: I83d5bcc0939b698209481793f60a0199aa95a06e
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-04 16:56:58 +02:00
Alexey Edelev
674134f08d Consider BUILD_SHARED_LIBS when adding libraries using _qt_internal_add_library
It does look safe to consider the value of BUILD_SHARED_LIBS in
_qt_internal_add_library. Current behavior might confuse users that
specify BUILD_SHARED_LIBS explicitly but get the library types
according to Qt build type.

[ChangeLog][CMake] qt6_add_library now considers the value of the
BUILD_SHARED_LIBS variable. If the variable is DEFINED it has
higher priority than the library type detecting logic in
qt6_add_library when adding the library targets.

Change-Id: I1c40e887c4e481424a596c870a8ff2784b08fcbb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-04 14:36:50 +02:00
Alexandru Croitor
ce8874fc3b CMake: Place resources into static libraries, not object libraries
During the Qt 5 -> Qt 6 and qmake -> CMake porting time frame, it was
decided to keep resources in an object file (object library), rather
than putting them directly into a static library when doing a static
Qt build, so that the build system can take care of linking the
object file directly into the executable and thus not forcing
project developers to manually initialize resources with
the Q_INIT_RESOURCE() macro in project code.

This worked for most qmake and cmake projects, but it created
difficulties for other build systems, in the sense that these projects
would have to manually link to the resource object files, otherwise
they would get link time errors about undefined resource symbols,
assuming they kept the Q_INIT_RESOURCE() calls.
If the project code didn't contain Q_INIT_RESOURCE calls, the
situation would be even worse, the linker would not error out,
and the missing resources would only be discovered at runtime.

It's also an issue in CMake projects that try to link to the
library files directly instead of using the library target names,
which means the object files would not be automatically linked in.
Many projects try to do that because we don't yet offer a convenient
way to install libraries and reuse them in other projects (the SDK
case), so projects end up shipping only the libraries, without the
resource object files.

We can improve the situation by moving the resources back into their
associated static libraries, and only keeping a static initializer as
a separate object file / object library, which references the actual
resource initializer symbol, to ensure it does not get discarded
during linking.

This way, projects that link using targets get no behavior difference,
whereas projects linking to static libraries directly can still
successfully build as long as their sources have all the necessary
Q_INIT_RESOURCE calls.

To ensure the resource symbols do not get discarded, we use a few new
private macros. We declare the resource init symbols we want to keep as
extern symbols and then assign the symbol addresses to volatile
variables.
This prevents discarding the symbols with the compilers / linkers we
care about.

It comes at the cost of an additional static initializer per resource,
but we would get the same + a bigger performance hit if we just used
Q_INIT_RESOURCE twice (once in the object lib and once in project
code), which internally needs to traverse a linked list of all
resources to check if a resource was initialized or not.

For GHS / Integrity, we also need to use a GHS-specific pragma to keep
the symbols, which we currently use in qtdeclarative to ensure qml
plugin symbols are not discarded.

The same macros will be used in a qtdeclarative change to prevent
discarding of resources when linking to static qml plugins.

A cmake-based test case is added to verify that linking to static
libraries directly, without linking to the resource initializer
object libraries, works fine as long as the project code calls
Q_INIT_RESOURCE for the relevant resource.

Fixes: QTBUG-91448
Task-number: QTBUG-110243
Change-Id: I39c325aac91e36d53c3576a39f881949c3b21e3f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-04 14:15:05 +02:00
Axel Spoerl
86fe84f5f7 Fix link to platform window in QAndroidPlatformBackingStore::flush()
The Android QPA implementation requires a 1:1 link between a platform
window and a platform backing store, to correctly flush a backing
store to the screen. QAndroidPlatformBackingStore has a bool member
m_backingStoreSet, to remember if this link exists. It defaults to
false and is set to true, when setBackingStore() is called in the
constructor. It falsely remains true, when a platform window is
deleted, e.g. because a QWindow has been hidden. When the QWindow is
shown again, a new Android platform window is created. With
m_backingStoreSet still being true, this new platform window will
never be associated with a backing store. As a consequence, it will
never be displayed on the screen.

The 1:1 relationship of an Android platform window and an Android
backing store is neither ideal, nor in line with other QPA layers
(e.g. XCB). Changing the Android QPA implementation is complex and a
short term fix is  necessary.

This patch removes the member m_backingStoreSet. Instead of it,
QAndroidPlatformBackingStore::flush() directly checks, if the platform
window corresponding to the QWindow argument is associated to a backing
store. If that is not the case, setBackingStore() is called.

QTBUG-97482 has been fixed with another approach, which this patch
reverts.

The following commits are effectively reverted by this patch:
9a39ad8dfb
f91588923b
a4ca9e8065
dbb072eb28
959a8b3967

Fixes: QTBUG-97482
Pick-to: 6.6 6.5 6.2
Change-Id: Ic4344f8df2e954c057dd2705340f11dfd2d4c6fe
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-08-04 10:40:05 +02:00
Liang Qi
6f6e62650d tests: skip three tests in tst_QDockWidget on Wayland
Task-number: QTBUG-107153
Pick-to: 6.6 6.5
Change-Id: Iad2bc83db96c25508b54ecc5b7c74280cfe90270
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-08-04 09:09:47 +02:00
Thiago Macieira
bb0e994072 tst_QFile: restrict to running on Linux
My FreeBSD does not have /proc mounted, so this test doesn't run almost
ever. I have no idea about OpenBSD and no one has tested Qt on AIX in
over a decade.

Change-Id: Ifbf974a4d10745b099b1fffd1777a598ee91eb5d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-03 20:49:51 -07:00
Thiago Macieira
01f58d7794 CMake: remove TEST_syslog but not FEATURE_syslog
This feature was already in AUTODETECT OFF. That means we only enabled
syslog() support if the user explicitly asked for it, which reasonably
means they have the API. The API is also POSIX.1-2001 and 4.2BSD, so
everyone has it.

Saves 350 ms of CMake time, because the test was compiled even though
AUTODETECT was OFF.

Change-Id: Ifbf974a4d10745b099b1fffd1777572e74a90043
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-08-03 18:47:33 -07:00
Thiago Macieira
5a51c2e8b5 CMake: remove check for statx() and replace with STATX_BASIC_STATS
We were already using this in qfilesystemengine_unix.cpp. In fact, the
only place where we had QT_CONFIG(statx) was in minimum-linux_p.h.

Saves 350 ms of CMake time.

Change-Id: Ifbf974a4d10745b099b1fffd177756e2edf2bf3e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-08-03 18:46:57 -07:00
Thorbjørn Lindeijer
233e7e6be3 Fix memory leak in QGtk3Interface::themeName
Pick-to: 6.6 6.5
Change-Id: Ib8c90f7ef66c095f0c1fc04f4cc72bf5eea72ddb
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-08-03 21:15:55 +02:00
Edward Welbourne
40b063cd74 Tweak lookup of en.xml names for languages, scripts and territories
Prefer stand-alone versions of the names when available. This saves
the need for a Han-specific kludge in the check for discrepancies
between our enum names and the en.xml names. Causes no change to
generated locale data.

Pick-to: 6.6 6.5
Change-Id: I162f3107d6ffc1f8b893b206e0b78b61cf7254f6
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-03 19:16:27 +02:00
Edward Welbourne
fd7fbaf887 XBEL stream reader: rework documentation
Document previously-undocumented methods. Document in terms of what
each thing achieves, not how it does it. The U+00B7 is not the period,
it is the centred dot. Fix various anachronisms; the existing docs
were out of date with the actual code.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I17da880e0afd7260aa6f3b7bdddb430c437f4562
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2023-08-03 19:16:27 +02:00
Edward Welbourne
c5ef6e1e68 Wrap QLocale's CLDR-derived string data tables to a 100-column margin
The string data tables have a mix of digit-length tokens, up to
four-digit hex; we can fit 12 of those per line within our margins.
Leave the one-row-per-locale tables as they are, though, despite long
lines.

Change-Id: I655fddecf24133c26d16187b7a5a8fbc25553e07
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-03 19:16:27 +02:00
Marc Mutz
15ff5bafa0 Don't protect qstringbuilder.h indirect includes
It's a) not needed, because qstringbuilder.h simply just defines op%
and not op+ when these defines are not set and b) surprising for users
that they have to include <qstringbuilder.h> if they want to use op%
without also setting one of these defines. Finally, it just throws
readers of the code off the track for no good reason.

So, drop the external guards for qtringbuilder.h in qstring.h and
qstringconverter.h.

Task-number: QTBUG-114208
Pick-to: 6.6 6.5
Change-Id: I00b3e405d905d319437c32a7253b39de1625d096
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2023-08-03 18:36:41 +02:00
Ievgenii Meshcheriakov
06397cc45f tst_qdbuscpp2xml: Remove unused variables
Change-Id: I131d7336e36d34f60fca0f37f76cd77ef674f405
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 16:09:17 +02:00
Ievgenii Meshcheriakov
8d89b4ef21 qdbuscpp2xml: Support MEMBER field of Q_PROPERTY
Emit properties with MEMBER field specified with 'readwrite'
access. Previously only READ and WRITE filed where used
for deriving the access value.

Add a property using MEMBER to the test class used by
tst_qdbuscpp2xml.

Fixes: QTBUG-115631
Change-Id: I12351985a9fafd934ccc5e0b805077a9e44b6608
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 16:09:17 +02:00
Tor Arne Vestbø
3f3b2be870 macOS: Ensure foreign windows can be reparented via QWindow::setParent()
In b64b0c7947 we bailed out from
QCocoaWindow::recreateWindowIfNeeded() for foreign windows, as
we should not manage any NSWindows on their behalf.

Unfortunately QCocoaWindow::recreateWindowIfNeeded() also took care
of adding the view as a subview to the potential non top level view,
which we do want for foreign views.

Ideally we'd move the reparenting out of recreateWindowIfNeeded()
and into QCocoaWindow::setParent(), but this is a more intrusive
change, so for now just restore the original missing logic.

Pick-to: 6.6 6.5
Change-Id: Ic35ebf94d4adc2f19cedb1cb6a5d0215a1c9c2b4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-08-03 16:09:17 +02:00
Tor Arne Vestbø
5e6d46a9f7 tests: Move NativeWindow helper class to shared header
Pick-to: 6.6
Change-Id: Ia7dc54aa761fdfde42d49a41475a4fbc74036aeb
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-08-03 16:09:17 +02:00
Laszlo Agocs
547b9da7ad rhi: Enhance the hdr info struct and add a manual test
...while sharing the related code between the d3d backends.

The isHardCodedDefaults flag is not used in practice and is
now removed. Add the luminance behavior and SDR white level
(for Windows) to help creating portable 2D/3D renderers that
composite SDR and HDR content. (sadly the Windows HDR and Apple
EDR behavior is different, as usual)

The new test application is expected to run with the command-line
argument "scrgb" or "sdr". It allows seeing SDR content correction
(on Windows) in action, and has some simple HDR 3D content with
a basic, optional tonemapper. Also shows the platform-dependent
HDR-related screen info. With some helpful tooltips even.

Additionally, it needs a .hdr file after the 'file' argument.
The usual -d, -D, -v, etc. arguments apply to select the 3D API.

For example, to run with D3D12 in HDR mode:

hdr -D scrgb file image.hdr

The same in non-HDR mode:

hdr -D sdr file image.hdr

Change-Id: I7fdfc7054cc0352bc99398fc1c7b1e2f0874421f
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-08-03 12:17:25 +02:00
Paul Wicking
78bc1a9a25 Doc: Move \target command to inside table cell
`\target`s generate a span where they occur. If they occur outside a
table cell, QDoc generates illformed html. Fix such instances by moving
the offending line into the table cell they target.

Task-number: QTBUG-115247
Pick-to: 6.6 6.5
Change-Id: I677e909ec73a6d0af8195d88d23581d8dd97c6e5
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
2023-08-03 12:15:40 +02:00
Fabian Kosmale
4c1df115ec QDbus: Avoid memory leak in registerComplexDBusType
QMetaType does not own the interface from which it is constructed.
Consequently, we end up with a memory leak.
This is not a huge issue, given that the map of meta-types is static,
and the application is about to be close when can discard it anyway, but
it causes avoidable sanitizer warnings, which are annoying when
debugging more severe memory leaks.

Pick-to: 6.6 6.5
Change-Id: Ifee3f4e19835536f4a6cfa4f6866ab621581ad4f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 11:28:38 +02:00
Liang Qi
c41733b06b tests: blacklist tst_QWidget::render() on Wayland
which is flaky.

Task-number: QTBUG-115598
Pick-to: 6.6 6.5
Change-Id: Ibb0a0c6b1e225144e2ce796691c40bb7510bfd56
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-08-03 07:23:37 +02:00
Antti Määttä
74dd646e82 CTF: Add streaming support
Implement TCP server to stream trace data. Use the QTRACE_LOCATION
environment variable to configure the server address and port.

The rest of the configuration is done in the client TraceRequest.
The user can configure the compression level, buffer size and
whether the server is buffering when client doesn't have connection.

The server responds with basic response and then begins sending packets
until the client disconnects or the app closes.
Each packet contains stream name, stream data and whether to overwrite
the stream, which is used with metadata streams.

Task-number: QTBUG-105976
Change-Id: I41c708a4c7988666d59f0c6093dd41e8ccd88441
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-08-03 08:23:36 +03:00
Antti Määttä
c6ab516f71 CTF: Clear output location at startup
Remove old files from the output location before saving new ones.

Pick-to: 6.6 6.5
Change-Id: I75181126c6c920e13951e9a46a6be1c666d457fe
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2023-08-03 08:23:30 +03:00
Ahmad Samir
7fe1198f6e QAbstractSocket: remove a redundant stack variable
Just use the static const int directly.

Change-Id: Icf37ac5db4457bbc8631659e175d038cfeed46e4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-08-03 02:12:22 +03:00
Ahmad Samir
8ed2bc9194 QByteArray: change append(QByteArray) to match QStringBuilder behavior
I.e. concatenating a null byte array and an empty-but-not-null byte
array should result in an empty-but-not-null byte array.

This matches the behavior of QString::append(QString) too.

Fixes: QTBUG-114238
Pick-to: 6.6
Change-Id: Id36d10ee09c08041b7dabda102df48ca6d413d8b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 02:12:22 +03:00
Ahmad Samir
d1da83002d QByteArray: remove a unittest
It relied on an implementation detail of operator+=(), that the latter
wouldn't just use assignement (e.g. if `this` is empty/null).

It also had undefined behavior, when the char array used with
fromRawData() went out of, the nested, scope, the code was pointing to a
dangling stack pointer.

Thanks to Thiago for the explanation in code review.

This ties in with further changes in this series, where append() is
changed to preserve null-ness; there is no way to preserve null-ness in
append() while keeping this unittest passing.

Change-Id: I43b9f60db9ce2d471f359f32bcc48e7b4cfceeab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 02:12:22 +03:00
Ahmad Samir
c168172ea9 qstringalgorithms: make trimmed_helper_positions [[nodiscard]]
Change-Id: Ic3a3ed29b2472487634715ee7b447b36d04b377f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 02:12:21 +03:00
Marc Mutz
f141108887 Port QCoreApplication::requestPermission() to SlotObjUniquePtr internally
Well, except that the ownership of the slot object here is actually
shared between the PermissionReceiver and the lambda passed to
QPermission::Private::requestPermission(), which eventually may hand
ownership over to QMetaCallEvent, so we can't really use
SlotObjUniquePtr.

While we can, of course, manually copy and call ref(), even if the
slot-object is stored in a SlotObjUniquePtr, unfortunately, the lambda
is subsequently stored in a std::function, which infamously cannot
hold move-only objects, so we actually need something copyable.

So grasp the nettle and implement a SlotObjSharedPtr.

I was originally planning to just make this a typedef for
QIntrusiveSharedPointer, but that's not in dev, yet, let alone 6.5, to
which we're picking this, and there was always this nagging impedance
mismatch between the QIntrusiveSharedPointer behavior, inherited from
it's Q(Explicitly)SharedPointer roots, on the one hand, to always
ref() in the constructor from raw pointer, and, OTOH, QSlotObjectBase
starting its life with a ref-count of one (1) (not zero (0), like
QSharedData).

I eventually found the (elegant, if I may say so myself) solution to
just not provide a constructor from raw pointer, only one from
SlotObjUniquePtr, which, granted, has the same issue, but which is, by
now, probably, hopefully, more fully grasped by QtCore regulars, and so
we can piggy-back on that for SlotObjSharedPtr's constructor
semantics.

Add a comment nevertheless.

Inside the lambda, we could theoretically move the slotObj into
QMetaCallEvent::create(), after adding such conversion to
SlotObjSharedPtr, but that would require making the lambda mutable,
and seeing as it's stored in a std::function and copied around, I was
not ready to make that change just yet.

As a drive-by, make PermissionReceiver's constructor explicit.

Pick-to: 6.6 6.5
Fixes: QTBUG-115330
Change-Id: I4e0cec13d19a19eeec31e4101ce289d07c92ce46
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-02 22:11:12 +02:00
Marc Mutz
902063628f QSlotObjectBase: fix return value of ref()
QAtomicInt::ref() returns bool, not int, so do the same in our ref().

As a drive-by, drop the superfluous inline keyword.

Pick-to: 6.6 6.5
Change-Id: I60712df3640b67dfd857355d364e0fc5a3a40650
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-02 22:10:33 +02:00
Thiago Macieira
3e2b3c094e CMake: remove TEST_glibc
Commit aa82d295c8 changed from using
minimum-linux.S to qlibraryinfo.cpp, so we no longer need this. Saves
350 ms of CMake time.

Change-Id: Ifbf974a4d10745b099b1fffd177754aa5a4096ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-02 12:36:18 -07:00
Thiago Macieira
4a5f3c8b93 CMake: remove check for cxx11_future
Everyone must have this by now. This test was 1193 ms of CMake time.

Since this was a PUBLIC feature, I've left it around with a constant
condition.

Change-Id: Ifbf974a4d10745b099b1fffd177754538bbff245
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-02 12:36:18 -07:00
Thiago Macieira
f44072ca43 CMake: remove test for cxx11_random
Everyone has it, without exception. QRandomGenerator uses the Mersenne
twister without checking, so you can't have Qt without this. This test
was here only to produce an error at CMake time instead of at build
time, but that test costs 650 ms for everyone running CMake without
cached results.

Change-Id: Ifbf974a4d10745b099b1fffd177753b6d4fc89d4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-02 12:36:18 -07:00
Alexey Edelev
d7a3733056 Fix standalone headersclean_check targets
If module depends on some module Private part only the sync_headers
dependencies from this public part of this Private module is skipped.
Check if the module is Private and use the public module to read the
_qt_internal_sync_headers_target property.

Amends 0006a564c8

Fixes: QTBUG-115712
Pick-to: 6.6
Change-Id: I4678e2a6c9ec8f80862a97d48f0a3b4214ae2307
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-02 20:22:52 +02:00
Tor Arne Vestbø
4ede419533 tst_foreignwindow: Run test with high-DPI disabled
To avoid having to take high-DPI scaling into account for geometry
calculations/comparisons.

Pick-to: 6.6
Change-Id: I941b74781264455b70520df8d1e6e91592e00310
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-02 19:36:13 +02:00
Dennis Oberst
d7d15c1a47 Use new QBA::assign in QXcbMime::mimeDataForAtom
QByteArray::assign() re-uses existing unshared capacity(), if any, and
is therefore potentially more efficient than '= QByteArray(~)' (and
never slower).

Task-number: QTBUG-106201
Pick-to: 6.6
Change-Id: I5e5114064c8aaa23892e95c235335632d7c5cd0a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-02 17:11:45 +02:00
Dennis Oberst
da5f2fc6be QFreeList: Resolve symbol ambiguity in unity build
Remove 'qfreelist.cpp' from the NO_UNITY_BUILD_SOURCES section
and fix the underlying problem of the clashing symbols with
'qabstracteventdispatcher.cpp', by wrapping the unnamed enum in
a namespace.

Amends: a07426d23a.

Task-number: QTBUG-109394
Pick-to: 6.6 6.5
Change-Id: I585ab06a33d46a11a48220f504c53a5f4fa91d7e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-08-02 15:11:45 +00:00