Commit Graph

57728 Commits

Author SHA1 Message Date
Richard Moe Gustavsen
e2e4428f0f iOS: ensure we close inputpanel after clearing focusobject
Change 7f72622c0f caused a regression where the input panel
would not close automatically when the focus object was
cleared. The reason is that it's apparently not enough to
just release the first responder, we also need to
explicitly tell it to release it's first responder status.
Before the failing patch, we did this from within update().
This patch will instead/in addition do an extra check from
inside reset().

Fixes: QTBUG-105323
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I00bdd44fe54db69f44232226291e3c5715935749
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-08 18:32:05 +02:00
Morten Sørvig
964765f686 wasm: add event loop auto test
Add basic tests for timers and event processing, for
different use cases such as on the main thread, on
a secondary thread, and with asyncify.

Pick-to: 6.4
Change-Id: Ie0f82b5de97f639867b1e65dbb0ab8b11db86f85
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-08-08 18:14:28 +02:00
Mårten Nordheim
2a17034ddc QNetworkInformation: Add missing \since marker
The new name was introduced in 6.4, but the documentation stayed the
same since it was initially written.

Amends 8367be8ede

Pick-to: 6.4
Change-Id: Idb27b551760f0d0cb41220be18a4d87e5875baae
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-08-08 15:10:06 +00:00
Tor Arne Vestbø
8008fd3b75 cmake: Allow adding extra content to plugin pri file
Just like for module pri files.

Change-Id: Ie209784f1dbc5db5dcfdef2520bac178734d4894
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-08 16:30:36 +02:00
Tor Arne Vestbø
fb807f436d cmake: Use file instead of qt_configure_file for generating plugin pri
Matches qt_generate_module_pri_file and allows using genexes in the
content of the file.

Change-Id: I5ee7a973d3e27a721e31315d3ebe2c88ffa1db42
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-08 16:30:36 +02:00
Elias Hautala
89ce9a1c5a Basiclayouts: Add scrolling to example
Adds scrolling to basic layouts example because the user interface in
the example doesn't fit properly on smaller screen sizes.

Fixes: QTCREATORBUG-27634
Pick-to: 6.2 6.3 6.4
Change-Id: I61e6eac2b28e5b3ff0f984894fe38167b3f46a9c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Markku Nokkala <markku.nokkala@qt.io>
2022-08-08 17:30:35 +03:00
Tor Arne Vestbø
ca2979cc16 cmake: Move qt_install call into qt_generate_plugin_pri_file
The same way qt_generate_module_pri_file does it.

Change-Id: I42047ce7d23e8a289535041ccace8b0f0140ea12
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-08 16:30:35 +02:00
Tor Arne Vestbø
02a5b34c07 cmake: Defer generating plugin .pri file until finalizer
Allows adding additional properties to the target after the initial
call to qt_internal_add_plugin.

Change-Id: I7998c906e53699ec41b44b51aabbe480ae698b21
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-08 16:30:35 +02:00
Eskil Abrahamsen Blomfeldt
6fa2ce92af Freetype: Fix underline thickness for bitmap fonts
For non-scalable fonts, we calculate the underline thickness
based on the font size. To make the lines slightly thicker
for bold fonts, we also multiply a fraction of the weight of
the font into it. In Qt 6, however, the weight scale was
multiplied by 10, but the formula was not updated, hence
all underlines for bitmap fonts would be 10x too thick.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-105010
Change-Id: I108baed495048783b14afca6bd4c67dc83816c17
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
2022-08-08 16:30:35 +02:00
Mikolaj Boc
5a76837a7f Only manually expose the wasm window on raise/lower if it is visible
If the window is manually exposed and the window is invisible, the result
is blocking the visual sync and repainting of the window, which makes
the window 'dead' from user perspective until they click/activate it,
which again sends an expose event to the window, restoring its updates.

Fixes: QTBUG-105363
Change-Id: Iaa42f3ffeca179b8e6da19c9c02a6f01458ca66a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-08-08 08:31:02 +00:00
Allan Sandfeld Jensen
fa4db87706 Remove blacklist of tryAcquireWithTimeout on Windows
Hasn't failed on Windows in months

Change-Id: Id14eaead667dfba93807592a7e0cb4da7f91f16f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-08-07 16:05:03 +02:00
Marc Mutz
5ff7163796 qputenv: port to QByteArrayView
The vast majority of in-tree users pass simple and short C string
literals as the value. By porting to QByteArrayView, we document that
we'll accept non-NUL-terminated data, and do the NUL-termination
internally, using SSO'ed std::string, saving memory allocations in the
common case of short strings.

I didn't bother to check which direction std::string takes for
nullptrs these days (there was a change accepted in that area for
C++20 or 23), so play it safe and protect against them.

Follow-up to

Task-number: QTBUG-105302
Change-Id: I2369acc62f1d5cbc26135396cfe0602d8c75300c
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-06 14:21:46 +00:00
Liang Qi
5b62970b94 tests: add a textfield in qt-client-widget
To test drag and drop.

Change-Id: I609c7edebea3af7763ec53fdbb7257a4b89371b9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-06 01:24:41 +02:00
Liang Qi
cef9cbdd52 tests: make xembed/qt-client-raster better
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: Id45bcfb92eb24c4455cf50497e28312eb87e0f9a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-06 01:24:41 +02:00
Liang Qi
a0ec35d5f2 tests: make xembed/qt-client-widget better
See also QX11EmbedWidget::QX11EmbedWidget() in src/gui/kernel/qx11embed_x11.cpp in qt4.

https: //github.com/qt/qt/blob/4.8/src/gui/kernel/qx11embed_x11.cpp#L475-L477

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I47504a2d8f3e33c367f092d01ee5d7e1b16b5106
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-06 01:24:41 +02:00
Liang Qi
aef55501bc tests: replace gtk-embedder.py with a gtk3 app
All linux CI machines have gtk3 installed. And Python GTK things
are too complicate to setup.

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I3c0d967f61aebea508784df79569b9d0064f66e2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-06 01:24:41 +02:00
Axel Spoerl
8e9fdfec0a Declare logging category exported in tst_QDockWidget
The logging category lcQpaDockWidgets was explicitly declared in
tst_QDockWidget. That failed to complile on static builds.

This patch replaces the explicit declaration with
Q_DECLARE_EXPORTED_LOGGING_CATEGORY(lcQpaDockWidgets, Q_WIDGETS_EXPORT)

Pick-to: 6.4 6.3 6.2
Change-Id: I1cad0e672313be84297eeddf992f6cafe9a35977
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-05 23:37:17 +02:00
Marc Mutz
5f5c4598fe QMetaType: don't create a registry just to query its emptiness [2/2]
The previous commit, b0e4d53b63, missed
this one. Same rationale as back then.

Pick-to: 6.4 6.3
Change-Id: Ibad4c130e0d61c64808275fa7b97b58ebd479acc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-05 22:02:02 +02:00
Marc Mutz
f4b60a0850 QMetaType: make all atomic operations explicit
In one case, optimize away an unnecessary extra load.

Pick-to: 6.4
Task-number: QTBUG-103834
Change-Id: Iabbf58a09627dd2fd7a40c713a878d74cb522d60
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-05 22:02:02 +02:00
Marc Mutz
15422d191f qputenv: defend against non-NUL-terminated QByteArray values
The old code assumed that a QByteArray's data() is always
NUL-terminated. Due to the conflation of owners and non-owners in
QByteArray (but also in case we ever get efficient substringing), this
is not always the case, e.g. QByteArray::fromRawData() does not ensure
NUL-termination.

From QString::utf16(), we learn that the condition to check for is
QArrayData::isMutable(). After working around the fact that
QByteArray::data_ptr() doesn't exist for const QBAs and that empty
QBAs always refer to QByteArray::empty_, which is !isMutable(), we can
detect this situation and re-allocate without introducing new API.

This is the fix for Qt ≤ 6.4. For Qt 6.5, we'll port the function to
QByteArrayView.

Pick-to: 6.4 6.3 6.2 5.15
Fixes: QTBUG-105302
Change-Id: I3416535ab09d601e0e87b2767f2c024ba1217e64
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-05 19:42:05 +02:00
Timur Pocheptsov
6a5cadb955 macOS: Check m_platformWindow before processing key event after shortcut
Processing shortcut events may result in the window being deleted, so
we need to check if m_platformWindow is still valid before continuing
with the key press event.

Pick-to: 6.4 6.3 6.2 5.15
Fixes: QTBUG-105160
Change-Id: I9cd362873b19c078a4fced3ac3c815d70bfc7fbe
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-05 17:42:05 +00:00
Joerg Bornemann
d336cfba8a Doc: Fix return type of QLEInteger/QBEInteger post-in/decrement ops
Those operators return a value, not a reference.

Fixes: QTBUG-104940
Pick-to: 5.15 6.2 6.3 6.4
Change-Id: I117892f12d20c6bf32a12f37c1bdfec1817614c6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-05 19:35:46 +02:00
Laszlo Agocs
cb139dbdb8 rhi: gl: Unify end/finish behavior
Issue a glFlush in endOffscreenFrame. This matches endFrame which
flushes either implicitly (swapBuffers) or explicitly with SkipPresent
(glFlush). This will then benefit producer-consumer setups where a
context renders into a texture using begin/endOffscreenFrame and then
the texture is consumed in another context.

In addition, make finish() issue a glFinish().

Pick-to: 6.4
Change-Id: I0a3115255ad2ac82b730e26d1ca7e88377c5a28c
Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-05 18:10:00 +02:00
Alexandru Croitor
6423a657c7 CMake: Fix mockplugins test not to fail in a non-prefix build
Explicitly running the install step would fail in a non-prefix build.
Do it conditionally on the no_prefix feature.

Pick-to: 6.4
Change-Id: I78cd63f51c499a0df451b08290c6dfc84e52666c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-05 18:10:00 +02:00
Alexey Edelev
60e46790dc Allow specifying multiple header types in qt_copy_framework_headers
qt_copy_framework_headers now can accept all the headers in one call.
This is useful for upcoming changes when it will accept generator
expressions as the input instead of actual files.

Change-Id: I110b6d9e6de976b2a7581902e051e38571716c5f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-05 16:45:02 +02:00
Tor Arne Vestbø
b9a9edc52f macOS: Don't ifdef out code to resolve display name that might be used
The call to displayName is not guarded by the same ifdef.

Pick-to: 6.2 6.3 6.4
Change-Id: I169777130ec316a2d2f837621280acb061072501
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-08-05 16:45:02 +02:00
Alexandru Croitor
7fb25609a4 CMake: Fix examples to build as external projects when cross-compiling
We forwarded the compiler path to the EP but not the flags that might
have been set via the CXX environment variable.

Make sure to also forward the flags.

Pick-to: 6.2 6.3 6.4
Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: I0fbf9b595f7885014b1f09d158db52e56a3d5243
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-05 16:41:04 +02:00
Alexandru Croitor
0e2f218ee7 CMake: Fix Ninja Multi-Config dependency issues for top-level targets
When building qtsvg examples as external projects on Windows
with Ninja Multi-Config in a prefix build on the CI, the build would
fail with an error message like:

 ninja: error:
'C:/Users/qt/work/qt/qtsvg/lib/Qt6SvgWidgets.lib', needed by
'RelWithDebInfo/svgviewer.exe', missing and no known rule to make it

This can be reproduced locally on Windows if one calls
'ninja svgviewer' instead of just 'ninja'. I wasn't able to reproduce
it on macOS, although I have seen some peculiarities in the
dependencies there as well.

External project examples depend on the ${repo_name}_src custom
target to ensure all Qt modules are built, so one would expect that
dependency to be sufficient.

While trying to figure out what's going wrong, I noticed that running
'ninja -t query qtsvg_src:Debug' showed dependencies on Release
libraries, which should not happen. The :Release target looked fine
though.

I'm still not quite sure why the Release libraries are not built
on the first ninja run, despite the example having a proper dependency
on qtsvg:Release.

Running 'ninja svgviewer' a few more times ends up succeeding at one
point, because the SvgWidgets Release library does get built in
parallel with the failing example, and the next rebuild would
succeed.

While trying to fix the :Debug target to have proper dependencies, I
noticed that we add dependencies to the ${repo_name}_src custom target
via the DEPENDS option of add_custom_target(). That is incorrect,
that option should only be used for file level dependencies.

For target dependencies, add_dependencies should be used.

Doing that fixed both the :Debug dependencies as well as the Windows
issue, which is good enough for me.

Amends 08f46bb400

Pick-to: 6.2 6.3 6.4
Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: I1888681e2e9362d3237acbdacc83222d6a60b48e
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-05 16:41:04 +02:00
Dominik Holland
f9eb2a7bdb eglfs: Fix crash when painting the mouse cursor in a multiscreen setup
Always make sure to initialize the OpenGL functions. Instead of relying
on the shaderprogram initialization, which is bound to the current
context, check for the d_ptr and initialize when not already done.

With this fix QEglFSCursor::draw works regardless of which context is
current and checking for that is not needed anymore in paintOnScreen.
This is important as the basic render loop only uses one context for
painting on all screens, while the threaded render loop uses multiple
contexts.

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I4ac2f5184c2fce27421e92efe1b7f635c71c0e92
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-08-05 14:41:04 +00:00
Tor Arne Vestbø
1e97a44e76 Remove unneeded @available check for macOS <= 10.14 and iOS <= 13
All versions down to Qt 6.2 require macOS 10.14 or iOS 13.

Pick-to: 6.2 6.3 6.4
Change-Id: I5048921ea5a149346a0fa84228227d9156004675
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-08-05 16:07:26 +02:00
Tor Arne Vestbø
eb774dfc7b darwin: Remove unneeded SDK version checks for older versions
All versions down to 6.2 require at least Xcode 12, which ships with
the macOS 11 SDK, and iOS 14 SDK.

Pick-to: 6.4 6.3 6.2
Change-Id: I128321ec9e97b670b7c027f1233978e1b8856f88
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-08-05 16:07:26 +02:00
Sona Kurazyan
29049d23f0 Move Q_ASSUME and Q_UNREACHABLE to qassert.h
As a drive-by, add a link back to Q_ASSUME() in Q_LIKELY() docs.

Change-Id: I4a46e281d0fbf55c11001f15667fcc4faa3b0c5b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-08-05 15:54:06 +02:00
Sona Kurazyan
1d3fb690cc Move Q_CHECK_PTR and related helpers to qassert.h
Task-number: QTBUG-99313
Change-Id: Ia4152f0aad15975d8aebbbc506c8a76c8fbe144f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-05 15:54:06 +02:00
Sona Kurazyan
8b2145463b Fix generation of the forward header for QFunctionPointer
The forward header for QFunctionPointer was being generated by accident,
apparently syncqt is confused because of some of the preceding lines. If
the lines are rearranged or removed, the header won't be generated. Not
sure if there's much value in generating a header for it, but at least
one of Qt sources (qeglfsemulatorintegration.h) is using it in an
include statment, and there's a chance it's used in the user code as
well.

Change-Id: Iced505881ddb07e7a8336fcdfb7d3e5397c6466c
Pick-to: 6.4 6.3 6.2 5.15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-05 15:54:06 +02:00
Sona Kurazyan
b3fd4b8adf Extract header qassert.h from qglobal.h
For now qassert.h is included in the middle of qglobal.h, since some of
the code below needs it, but this will be cleaned up when that code is
moved in its own header.

Task-number: QTBUG-99313
Change-Id: I2cdfed44f5c8772c1dad4797cf8edc6cb4c964b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-08-05 15:54:06 +02:00
Sona Kurazyan
f9c73e540a Move qt_error_string to qlogging.h
qcontainerfwd.h was relying on the forward declaration of QString in
qglobal.h, so add the missing forward declaration there.

Task-number: QTBUG-99313
Change-Id: Id3ecaed5ce3b64dabb8454647a43d1520d30e713
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-05 15:54:06 +02:00
Laszlo Agocs
800465a7c4 rhi: metal: Defer also compute pipeline releasing
Change-Id: Idca8020b5acc026e19beaa297017731deb92e1bb
Pick-to: 6.4
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-05 15:14:19 +02:00
Marc Mutz
7cf2684e6a QStringIterator: fix UB [2/2]: use std::less to compare pointers
The relational operators <, >, <=, >= do not form a total order for
pointers. In particular, they are only defined for pointer pairs that
point into the same array (incl. one past the array's last element).

Other uses are undefined behavior.

The iterators the class works on are user-supplied, so we cannot
assume that they are pointing into the same array. In fact, we have a
check in setPosition() that tries to catch such misuses, but similar
checks are absent from the ctors, e.g.

In addition, the implementation itself is checking for next-but-one
and prev-but-one in an unsafe way.

std::less can be used to provide a total order, so use that
everywhere.

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I32fb0ef9f768d9336ae12cc0542ca18d1bf23adf
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-05 07:07:49 +02:00
Fabian Kosmale
245da0762e QBindingObserverPtr: add noexcept
QVarLengthArray checks for is_nothrow_move_constructible_v, though only
uses that information for its own noexceptness.

Pick-to: 6.4
Change-Id: I03c81e4da75fbe287d491843716d26e1acac8310
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-05 00:40:20 +02:00
Marc Mutz
a17d6f869b tst_QFocusFrame: fix -Wparantheses
Says Clang 10:

tst_qfocusframe.cpp:73:28: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    QTRY_VERIFY(focusFrame = window.findChild<QFocusFrame *>());
                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[...]
tst_qfocusframe.cpp:73:28: note: place parentheses around the assignment to silence this warning
    QTRY_VERIFY(focusFrame = window.findChild<QFocusFrame *>());
                           ^
                (
tst_qfocusframe.cpp:73:28: note: use '==' to turn this assignment into an equality comparison
    QTRY_VERIFY(focusFrame = window.findChild<QFocusFrame *>());
                           ^
                           ==

Amends f1812aad89.

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I3920ab0da725b76fb6c19bbc7cde7920f351af4a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-08-04 23:33:36 +02:00
Marc Mutz
0beb58cf58 Pull some processing out of environmentMutex critical sections
Move most string handling code out of the environmentMutex critical
sections to increase parallelism (Amdahl's Law).

I drew the line at temporarily dropping the mutex to allocate memory
for the return QByteArrays, as that would have meant to loop over
obtaining the size, allocating it, and then copying the data which
would have overly complicated the code.

Pick-to: 6.4
Change-Id: I980cbf7fda76fc8057f84b2539b4a299e06cae82
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-04 23:33:35 +02:00
Marc Mutz
c25cc34a05 Port qenvironmentvariables.cpp to qsizetype
I don't expect environments to allow values or names > 2 Gi
characters, so this is just for consistency (int is a code smell these
days).

As a drive-by, replace

   QString buffer;
   buffer.resize(n);

with

  QString buffer(n, Qt::Uninitialized);

Task-number: QTBUG-103527
Pick-to: 6.4 6.3 6.2
Change-Id: I0e41a6e7e9c44ff1ec22377329735538d5f95181
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-04 21:33:35 +00:00
Øystein Heskestad
15368fb31b Add Latin 1 case-insensitive Boyer-Moore searcher
The std::boyer_moore_searcher is buggy for older verions of Microsoft's
STL, and missing in AppleClang's libc++ with an inefficient fall back.

Fixes: QTBUG-100236
Change-Id: Ic3cc916946546d2ef78456cd15e1425d957b989d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-04 23:12:39 +02:00
Sona Kurazyan
26a73e1b31 QDomDocument: Add a way to enable spacing-only text nodes
Added a parse option that can be passed to setContent(), to specify that
spacing-only text nodes must be preserved.

[ChangeLog][QtXml][QDomDocument] Spacing-only text nodes can now
be preserved by passing the ParseOption::PreserveSpacingOnlyNodes option
to setContent().

Fixes: QTBUG-104130
Fixes: QTBUG-89690
Task-number: QTBUG-90003
Change-Id: Id43730ce5b79a856c4b434d1f1d4dd7c49c25f31
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-04 22:17:05 +02:00
Thiago Macieira
7ceba9c472 moc: use C++ constexpr to generate the meta object string data
This avoids having to rely on moc precalculating everything and getting
its sums right, as the main integer table only has a string index
(unlike my original 5.0 plan which would have stored the offset).

For example, for:

  struct Object : QObject { Q_OBJECT signals: void changed(const QVariant &v); }

moc now generates:

  struct qt_meta_stringdata_Object_t {};
  static constexpr auto qt_meta_stringdata_Object = QtMocHelpers::stringData(
      "Object",
      "foobar",
      "",
      "v"
  );

Notes on the implementation:

* the old code is retained because we need moc 6.5 to generate code
  compatible with QtCore 6.2-6.4. It's marked for removal in Qt 6.9.
* the struct qt_meta_stringdata_%s_t remains because we need a
  TU-specific type for QtPrivate::is_complete (via
  qt_incomplete_metaTypeArray). This can be cleaned up.
* after this change, GDB complains while loading QtCore:
    warning: internal error: string "StringData<long sequence of numbers>" failed to be canonicalized
  but debugging does not appear to be impacted. It's just annoying
  because it shows up when QtTest detects a crash too.

Change-Id: Id0fb9ab0089845ee8843fffd16f9d5493e9bd708
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-04 12:50:12 -07:00
Thiago Macieira
c23b595769 moc: move some of the helpers into a header dedicated to it
Change-Id: Id0fb9ab0089845ee8843fffd16f9d080029f2f7f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-04 12:50:12 -07:00
Thiago Macieira
a8ebadac59 Fix several more improperly placed #include moc
Like commit qtbase/638893bea083b619b73b33a7dd5589fb2c4c4242.

Script to find them:

 git grep -l '#include.*moc' \*.cpp \*.mm | \
   xargs awk '/QT_BEGIN_NAMESPACE/ { i=1 } /QT_END_NAMESPACE/ { i=0 } /#include.*moc/ && i { print ARGV[ARGIND], $0 }'

Pick-to: 6.4
Change-Id: I6f936da6f6e84d649f70fffd17058fd05cfc5c6d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-04 12:50:12 -07:00
Marcus Comstedt
d2fcccd3f1 Fix composition of render-to-texture widgets on big endian
Converting from QImage::Format_ARGB32 to QRhiTexture::RGBA8 requires
texture swizzling also on big endian.  But unlike on little endian it
is not a red/blue swap that is needed, but a rather rotation of the
alpha channel from the first component to the last.

Add a new swizzling mode to the backingstorecompose fragment shader,
and rename the uniform to reflect that it no longer covers only
red/blue swapping.

Pick-to: 6.4
Change-Id: I001d275abdc88faaadea16e396ebe032b34e83f0
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-08-04 21:50:12 +02:00
Edward Welbourne
dcaa05f697 Fix a date-time with invalid QTime to use a valid one
Using QTime(), which is null and invalid, as the time field of a
QDateTime is supported, but is ill-advised. Use the start of the day
instead.

Change-Id: If30db046218926f7634bbcfcf35cd000d7f6535f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-04 20:39:52 +02:00
Edward Welbourne
607c5a90c5 Fix initialization of QDateEdit and QTimeEdit
Since 6.3 these use Qt::UTC as time-spec but I neglected to take that
into account in QDateTimeEditPrivate::init()'s construction of a
QDateTime from the QDate or QTime. This amends
commit c00ee2f310.

Fixes: QTBUG-105322
Pick-to: 6.3 6.4
Change-Id: I11dec9808a54cf7da401b1734a9a2812f5fd2e63
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-04 20:39:52 +02:00