Commit Graph

54462 Commits

Author SHA1 Message Date
Dimitrios Apostolou
63ffae3fa3 Introduce qt-testrunner.py
Script that wraps Qt test execution in order to iron-out flakiness.

Task-number: QTBUG-96353
Change-Id: Ie8ee780e3f4f8d086c080a7784f9f68fd1867be2
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2022-01-03 16:32:56 +01:00
Leena Miettinen
25406a6526 Doc: Add link targets for Qt Design Studio Manual topics
You can use these link targets in Qt docs to refer to
QDS topics.

Pick-to: 6.2
Change-Id: I4d4e288e1456ef92c5e8d9949390a431220eab75
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-03 15:32:56 +00:00
Laszlo Agocs
04cdde30d6 rhi: Enable exposing separate image and sampler objects from the shader
Adds the following in a QShader/QShaderDescription:

- a list of separate images
- a list of separate samplers
- a list of "combined_sampler_uniform_name" -> [
  separate_texture_binding, separate_sampler_binding ] mappings
  (relevant for GLSL only)

On the QShader (and qsb/QShaderBaker) level not having separate image
(texture) and sampler objects exposed in the reflection info is not
entirely future proof. Right now we benefit strongly from the fact
that Vulkan/SPIR-V supports both combined and separate
images/samplers, while for HLSL and MSL SPIRV-Cross translates
combined image samplers to separate texture and sampler objects, but
it is not given that relying on combined image samplers will always be
possible in the long run; it is mostly a legacy OpenGL thing that just
happens to be supported in Vulkan/SPIR-V due to some benefits with
certain implementations/hw, but is not something present in any newer
APIs.

In addition, before this patch, attempting to run a shader with
separate textures and samplers through qsb will just fail for GLSL,
even though SPIRV-Cross does have the ability to generate a "fake"
combined sampler for each separate texture+sampler combination. Take
this into use. This also involves generating and exposing a
combined_name->[separate_texture_binding,separate_sampler_binding]
mapping table for GLSL, not unlike we have the native binding map for
HLSL and MSL. A user (such as, the GL backend of QRhi) would then use
this table to recognize what user-provided texture+sampler binding
point numbers correspond to which auto-generated sampler2Ds in the GL
program.

Take the following example:

layout(binding = 1) uniform texture2D sepTex;
layout(binding = 2) uniform sampler sepSampler;
layout(binding = 3) uniform sampler sepSampler2;

Inn the reflection info (QShaderDescription) this (assuming a
corresponding qtshadertools patch in place) now gives one entry in
separateImages() and two in separateSamplers().  Assuming sepTex is
used both with sepSampler and sepSampler2, the GLSL output and mapping
table from QShaderBaker will have two auto-generated sampler2Ds (and
no 'texture2D' or 'sampler').

One immediate benefit is that it is now possible to create a shader
that relies only on separate images and samplers, feed it into qsb,
generate all the possible targets, and then also feed the SPIR-V
binary into a tool or library such as Tint (e.g. to generate WGSL)
that canot deal with combined image samplers.

Change-Id: I9b19847ea5854837b45d3a23edc788c48502aa15
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-03 14:57:01 +01:00
Marc Mutz
66a79287f1 [doc] QCoreApplication::installTranslator() doesn't take ownership
Document it.

Pick-to: 6.3 6.2 5.15
Change-Id: I25d305945bf29348d6ea5756fbf80c418f812d0f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-03 13:35:13 +00:00
Laszlo Agocs
5ae238f90f rhi: Add the basics for HDR swapchains
...backed by support in the backends for D3D11 and Vulkan.

Expose only what works in practice: scRGB with RGBA16F and HDR10 with
RGB10A2 (or A2BGRA10 etc.). For general use, e.g. to render 2D/3D
content, scRGB (i.e. extended sRGB linear) should be chosen because
that is a linear space.

On Windows with a HDR10 display (and an NVIDIA card) both of these are
known to work, as long as Use HDR is enabled in the Settings for the
display on which the window is created.

When requesting a HDR format and it is not supported, we will fall
back to the default SDR RGBA8/BGRA8 format. However, the behavior
seems to be a bit weird with Vulkan and NVIDIA at least when there is
a HDR display but Use HDR is set to Off: this seems to enable HDR mode
for the lifetime of the window (with the usual set of black screens
while switching over the entire display). Not sure why the driver does
this. With D3D/DXGI, with fewer abstractions in the way, we can check
upfront properly, so that will nicely fall back to the defaults
regardless of why HDR is not available.

Support can also be checked in advance via
QRhiSwapChain::isFormatSupported() as long as the QWindow is
available. (though with Vulkan, as said above, this also seems to
ignore the Use HDR setting of Windows)

Complications, such as moving a window from one screen to another, are
currently not known how they behave. To be seen how this is handled by
the Windows compositor. (from 1903 and up it is said to be able to
automatically downconvert scRGB to SDR so perhaps moving from a HDR to
a non-HDR screen would work - remains to be seen if this needs
something more involved)

When it comes to other platforms and potential future support:
- based on its docs Android 8+ may support scRGB with Vulkan as-is on
a suitable device/display, as long as the application declares
android:colorMode="wideColorGamut" in the manifest.
- for Metal the layer can be made EDR enabled and then
e.g. MTLPixelFormatRGBA16Float/kCGColorSpaceExtendedLinearSRGB should
work. However, this won't be added unless we can test it.
- Linux is unknown.

If one needs access to display specific values such as the min/max
luminance when implementing tonemapping or a transfer function, that
needs platform/API specific approaches, and sadly the kind of data
exposed seems to vary, potentially making it difficult to maintain a
single cross-platform logic. With D3D one can get the
DXGI_OUTPUT_DESC1 from the IDXGIOutput6. This has the min/max
luminances in nits and a bunch of other things. For convenience the
output object is now exposed from the swapchain's nativeHandles()
whenever the D3D backend is used at run time. For Metal one would
presumably access maximumExtendedDynamicRangeColorComponentValue and
co. in the NSScreen. Elsewhere one needs to rely on platform/winsys
specific approaches, if there are any. Remains to be seen longer term
if/how this needs/can be better supported.

Change-Id: I2e61a0e062282d4bfdfba39655941c0f9a795112
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-03 14:35:13 +01:00
Alexey Edelev
8e2f101a6b Exclude sources from HEADER_MODULE if cmake version is less than 3.19
CMake versions less than 3.19 don't support adding the source files to
the PRIVATE scope of the INTERFACE libraries. It looks like these
PRIVATE sources are only used by IDEs to display them in a project
tree. Skip them to avoid configuring issues.

Fixes: QTBUG-99316
Pick-to: 6.3
Change-Id: Id03f540ac9c94e920adfae5de4f364bd7aba4613
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-03 14:35:13 +01:00
Alexey Edelev
f90221d8cd Replace ANDROID_ABI argument with the QT_ANDROID_ABI target property
This change tries to make the API more user friendly and prevent wrong
use of multi-abi API. ANDROID_ABI argument of qt6_add_executable was
position-depend and needed to be placed after the executable 'sources'.
Using the target property we solve this problem and provide more
consistent and common way to enable multi-abi build for the single
target.

This meanwhile also requires to execute multi-abi build configuration
in the finalizer, since the property might be set at any point.

Also the priority of the QT_ANDROID_ABI target property now is higher
than the priority of the QT_ANDROID_BUILD_ALL_ABIS variable. So target
will only build packages with the ABIs specified in QT_ANDROID_ABI
property if both are set.

Pick-to: 6.3
Task-number: QTBUG-88841
Change-Id: I3515297ed267974498913c59619433dc234ec217
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-03 14:35:13 +01:00
Marc Mutz
612417ea70 QRingBuffer: optimize and simplify QRingChunk::toByteArray() futher
- use sliced() instead of mid(), since we know we call sliced()
  in-contract

- replace the manual memmove() with calls to QBA::remove(), but first
  resize() to tailOffset, and only then remove(0, headOffset), so we
  only move Chunk::size() bytes, as the old code did

- don't bother updating the offset members, as we're restricted to
  rvalues now, and we only need to leave behind a partially-formed
  object

This code shows that we desperately need QBA::slice() and/or an rvalue
overload of QBA::sliced(), cf. QTBUG-99218. Add a comment to use these
functions when they become available.

Change-Id: I5d8c7363d443dff69338f6f6a7b4bff9957917ec
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2022-01-03 12:22:53 +01:00
Marc Mutz
ab24390804 tst_qtranslator: fix memleak
QCoreApplication::installTranslator() does not take ownership of the
QTranslator. The QTranslator dtor removes itself from QCoreApplication
again.

Pick-to: 6.3 6.2 5.15
Change-Id: I17eb7ab350631eb32fe76af29d9a576a0efa05d8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-03 11:22:53 +00:00
Marc Mutz
7c8126d909 QTestData: fix streaming of u8 string literals in C++20 mode
...fixing tst_QLocale:

  QDEBUG : tst_QLocale::formatDate() expected data of type 'QString', got 'char8_t [64]' for element 1 of data with tag 'unicode in format string'
  QFATAL : tst_QLocale::formatDate() ASSERT: false in file /home/marc/Qt/qtbase/src/testlib/qtestdata.cpp, line 105

In C++20, the type of u8 string literals changed from const char[] to
const char8_t[].

[ChangeLog][QtTest][QTestData] Fixed streaming of u8 string literals
in C++20 mode.

Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-99480
Task-number: QTBUG-99481
Change-Id: I53bd73522a4ebce307f360e225f25590f981d44a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-03 12:22:53 +01:00
Marc Mutz
591a35d6fd QThread: fix UB (invalid enum value) on Private::Priority
The Unix code stores an additional flag, ThreadPriorityResetFlag, in
the Policy enum, but ubsan does not approve:

  qthread_unix.cpp:303:30: runtime error: load of value 2147483648, which is not a valid value for type 'Priority'
  qthread_unix.cpp:304:75: runtime error: load of value 2147483648, which is not a valid value for type 'Priority'

Fix by making the variable of std::underlying_type_t<Priority>.

The masking and unmasking code can now be simplified, too.

In the Windows version, replace some switch targets with equivalent
ones to keep -Wswitch-like warnings, though I hasten to note that both
switches use a default case, so have anyway implicitly disabled said
warning.

Pick-to: 6.3 6.2 5.15
Change-Id: Ie4ea7d05e2928d2755ad12d36535197f85493191
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-03 12:22:53 +01:00
Marc Mutz
c953e5c417 QByteArray: avoid detach() in a no-op replace()
When the the replacement has the same size as the replacee, but that
size is zero, the whole operation is a no-op, and there's no need to
detach().

[ChangeLog][QtCore][QByteArray] A replace(pos, n, after) call no
longer detach()es when n == after.size() == 0.

Pick-to: 6.3 6.2
Change-Id: I1e8d7c7fb6383f8bfea3212e49fca8a128535564
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-01-03 11:22:53 +00:00
Lars Knoll
ce14b6c2d3 Avoid crash on app startup if the default font family is empty
Don't call first() on a potentially empty list of families. Fixes
a crash on startup on QNX for me.

Change-Id: I551d21dac8cfd104b774d6442bdbe1db35f8b75c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-03 09:00:04 +01:00
Björn Feber
68c4669ce4 Add PublicShare and Templates QStandardPaths
These directories are common on desktop operating systems. "Public" is
used for sharing files with other users and "Templates" lets you add new
files to the file creation desktop menu (for example in a file
manager). An example use in a Qt application would be KDE's KIO having
default icons for both directories.
This is where they point to:
Windows: C:/Users/Public, C:/Users/<USER>/AppData/Roaming/Microsoft/Windows/Templates
macOS: ~/Public, ~/Templates
Unix: ~/Public, ~/Templates

Task-number: QTBUG-86106
Task-number: QTBUG-78092
Change-Id: Ifca60c7d2a6dc2109ec290e8fb109ee2d5ca4d38
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-01-01 18:34:30 +02:00
Marc Mutz
ffcf4f4001 Extract Header qforeach.h from qglobal.h
Task-number: QTBUG-99313
Change-Id: Ie89314ca7022e88c1fea957880c5aa4a41640744
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-30 17:45:08 +00:00
Marc Mutz
f0ffe35149 QThread/Unix: extract duplicate code
Extract function terminate_on_exception() that de-duplicates the
#ifdef'ery around the try/catch and the handling of the pthread
cancellation pseudo-exception.

Apart from de-duplicating complex code, it will also help suppressing
a ubsan false positive, which is why we're picking it all the way to
5.15.

Pick-to: 6.3 6.2 5.15
Change-Id: I99ad2c0618b8dc30801931df09400c6611d9f9e4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-30 17:45:07 +00:00
Marc Mutz
c760fba40e QWindow: use std::exchange when ... exchanging values
Replaces a three-liner with a more elegant, idiomatic one-liner.

Pick-to: 6.3
Change-Id: I57fbe5d808dffa44f6fceffb97c47f0c84ccd3df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-30 17:45:07 +00:00
Marc Mutz
c064b6bbfd QWindowPrivate: fix inconsistent inline on some methods
Two functions' implementations were marked as inline, when their
definitons weren't. This is non-sensical, bordering on dangerous, so
remove the inline keyword.

Pick-to: 6.3 6.2 5.15
Change-Id: Iece21f9552aede273fa1f5a7aef0c94307fa5142
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-30 17:32:09 +01:00
Tatiana Borisova
72ba7cb186 Exclude filesystem autotests for INTEGRITY
- There is no mounted partition, where we can create/delete files at runtime.
  Tests should be excluded for now.

Pick-to: 6.2 6.3
Change-Id: I1c4db13d35da7d570c4bf787299d829e08951195
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-30 15:38:14 +00:00
Nicholas Bennett
c90bb65926 Docs: Add other Unix paths to the Linux table in QStandardPaths
Added Unix to the title of the enum
QStandardPaths::StandardLocation docs Linux paths table as this
also aplies to Unix based OS's such as QNX.

Fixes: QTBUG-63695
Pick-to: 6.2 6.3
Change-Id: I37b1bb6167984ccf7877baf2e6e764337121a947
Reviewed-by: Tommi Mänttäri <tommi.manttari@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-30 14:54:58 +02:00
Marc Mutz
a5076c54fe tst_QStringList: check that join(u'\0') embeds NULs
... as opposed to QByteArray::toHex('\0'), which doesn't.

Picking to all LTSs because it's in a test.

Pick-to: 6.3 6.2 5.15
Change-Id: I392d5714c4865e530a246ed30a13cdac26b98e0b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-28 23:09:44 +01:00
Marc Mutz
1181af9452 Eradicate Q_FOREVER from header files
The qgenericatomic.h occurrences are getting in the way of splitting
up qglobal.h, so inline the define.

Task-number: QTBUG-99313
Change-Id: I0d6e3553c5ed4ac9e426bef2fe07d2672d73c671
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-28 23:09:41 +01:00
Marc Mutz
a6bca753c9 QLocale: replace use of append(QString(n, c)) with resize(size() + n, c)
Avoids a temporary QString creation.

Change-Id: Ibc87a3f1bf2979780e4a2cce7e1757f97c39a9be
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-28 23:09:39 +01:00
Marc Mutz
795df9cdda QLocale: replace a few getData() with viewData()
Both multi-arg as well as QStringBuilder support QStringView these
days, so there's no need for a temporary QString, even one
fromRawData(), with all its extra codegen, when QStringView can do the
job just fine.

Change-Id: Ie9031aef85c5f0b535e94d9e414b7bd71ad909f7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-28 23:09:37 +01:00
Tatiana Borisova
83906b8779 Exclude tst_qxmlstream test for INTEGRITY
- There is no possibility to unpack *.zip archive anywhere on test device or save any file.
  Currently we don't have mounted file system.

Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I8c8d272a92b4475a7548bd10d32fc4203672926b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-28 18:56:07 +00:00
Jarek Kobus
9453038921 Fix pattern type matching
Amends 3c747aafa4

Pick-to: 6.3 6.2 5.15
Change-Id: I2753b627c269cbb50009ef5e9c2ffa274e0ccf5c
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Alex Richardson <arichardson.kde@gmail.com>
2021-12-28 13:45:42 +01:00
Eirik Aavitsland
61a136bf26 Remove unused internal flag from raster painting engine
Just a leftover from code that has been replaced long ago.

Task-number: QTBUG-95237
Pick-to: 6.3 6.2 5.15
Change-Id: I8b1b0f319683ecfb2c93cc51a047616fe29770f7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-12-28 11:20:13 +00:00
Tatiana Borisova
b076e84a7f Fix tst_qtextstream / tst_json run time failures on INTEGRITY device
- add test resources to binaries

Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: Ibeed93af43b4f951ca55f044fbfab00d4ab30468
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-28 09:24:58 +02:00
Jeremie Graulle
3162f04dee Windows: Fix handling of childGroups() when fallbacks are disabled
When fallbacks are disabled for QSettings then it should not be
falling back to any child groups or keys that might exist in a
fallback set of settings.

Fixes: QTBUG-85295
Change-Id: I563999293a103702035c8d3b027b59b94ca43c0e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-27 10:41:43 +01:00
Lorn Potter
be5508fad0 wasm: hardcode idealThreadCount for some browsers
Browsers like Safari do not support the hardwareConcurrency property.
Will hard code it to 2, as iOS only supports that amount.

Pick-to: 6.3 6.2
Change-Id: Icb35d3b698b28d8191a554167dc8cc262b806fb2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-12-24 09:45:58 +10:00
Tor Arne Vestbø
2c3198ab5f macOS: Sanitize scroll deltas for NSEventPhaseCancelled
On macOS 12.1 the NSEventPhaseCancelled phase can in some situations
report deltas, which causes the scroll to "jump". This happens for
example when initiating a momentum-scroll, and then putting two
fingers on the trackpad to cancel the momentum phase, which starts
a new NSEventPhaseMayBegin phase. When then lifting the two fingers
again, we get an NSEventPhaseCancelled event with deltas, but the
deltas seem like uninitialized data (has a x-value, after doing
a purely vertical scroll e.g.).

Task-number: QTBUG-97841
Pick-to: 6.3 6.2 5.15
Change-Id: I14e765b6111e53e7d3d0da219d4ac7fefe5243d0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-23 19:53:22 +01:00
Ievgenii Meshcheriakov
a7b70ee55b CMake: Add CryptoTokenKit framework for macOS
Set ${FWCryptoTokenKit} when the framework has been found.
This is useful for WIP card reader support in QtConnectivity.

Task-number: QTBUG-97946
Change-Id: I0e85e0fd2e0fc45fb3069bbdaa2d8b2c927a6c2d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-23 18:11:36 +01:00
Thiago Macieira
60db7a5dc1 Doc: QSysInfo::productType: remove the "will be" note about Qt 6
Fixes: QTBUG-99413
Pick-to: 6.2 6.3
Change-Id: Ib42b3adc93bf4d43bd55fffd16c360797871011b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-23 15:26:35 +00:00
Tor Arne Vestbø
cd2690dcbf iOS: Use generic simulator device for building apps via xcodebuild
If Xcode wasn't configured with any simulators the build would fail
since we had no device to build for. But we don't need to build for
a specific device, we can build for the generic simulator device,
just like we do for the non-simulator build. This likely didn't
work properly at the time it was first implemented, but now seems
to work fine, and is less fragile than the current solution.

Running tests still enumerates the available simulators,
as that needs a concrete device to run on.

Fixes: COIN-777
Pick-to: 6.2 6.3 5.15
Change-Id: I50e31c1b350cf83ce348275b467051263dea88a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-12-23 15:26:35 +00:00
Thiago Macieira
1ed19dc018 QString: reorganize some template functions
This is going to screw up the git blame functionality (which is why they
were forward-declared instead of implemented on-site) but the
alternative is that Qt Creator thinks qstring.cpp had almost no
functions inside.

Pick-to: 6.3 6.2
Task-number: QTCREATORBUG-25594
Change-Id: Ib42b3adc93bf4d43bd55fffd16c1986f1a3c1574
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-12-23 11:41:32 -03:00
Tamas Martinec
d0908d0095 Document the State Machine Framework changes in the Core Migration Guide
Added section about having the State Machine Framework moved to its
own module.

Pick-to: 6.2
Pick-to: 6.3
Task-number: QTBUG-89285
Change-Id: I95d065230708d5b505d04309fd6ca21007d878dc
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
2021-12-23 16:14:54 +02:00
Morten Johan Sørvig
23964ce05f wasm: Use new event dispatcher for QtGui
The event dispatcher implementation is now in QtCore,
except for the call to QWindowSystemInterface::sendWindowSystemEvents().

Implement QWasmWindow::requestUpdate() using emscripten_request_animation_frame(),
instead of the previous registerRequestUpdateCallback() function
which now is removed.

Pick-to: 6.3
Change-Id: I7a13eb5391d48dba0f2afe4704ef3188b8daa74b
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-12-23 11:21:57 +01:00
Morten Johan Sørvig
e98f5de6e1 wasm: add virtual processWindowSystemEvents()
The QtCore event dispatcher will be used from QtGui
as well. Add virtual function where window system events
processing can be added.

Pick-to: 6.3
Change-Id: Ia6eda9ae18b2e91189ef9f60b6621d19a83313de
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-12-23 11:21:53 +01:00
Yuhang Zhao
054b814daa Add QObject::isQuickItemType() for convenience
Change-Id: Ibde4e919ba028117336974eb7a804aa11c1ee086
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-23 17:38:47 +08:00
Marc Mutz
50ad52d804 tst_qsharedmemory: skip readOnly() test under asan
The test helper is expected to crash, but when built with asan, it
just fails.

Skip the test in that case.

Pick-to: 6.3 6.2 5.15
Change-Id: I583142f5ec623895df62498100c1a30539b149ab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-23 08:14:02 +01:00
Oliver Eftevaag
b369dc6021 QTextHtmlParser: fix prefix lookahead and html comments
The hasPrefix() function would only use the second 'lookahead' parameter
to check if there was more unparsed text after the current character.
When it's obvious from the codebase that it should actually look ahead
of the current character being processed, and compare againt that future
character.

Html comments were also not handled quite right. Partially because of
the broken hasPrefix() function, but also because it would advance the
current index tracker by 3 instead of 2. Remember that the beginning of
an html comment is <!-- meaning that there are only supposed to be 2
dashes required, not 3. The result would be that something like this
<!----> would not automatically close, because the current index tracker
would jump over the first 3 dashes when it begins a comment, and the
remaining unprocessed string would be ->

Also, because of the broken lookahead in hasPrefix(), a comment could
actually be started with just <!- not requiring a second dash at all.

Pick-to: 6.3 6.2 5.15
Fixes: QTBUG-99147
Change-Id: I8f4d4a1107eaf2dae16d16b7b860525d45a1c474
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-22 15:56:30 +01:00
Volker Hilsheimer
0462d24dcd Deliver context menu event with correct coordinates to widgets in popups
If a popup is open, Qt delivers events to the popup child under the
mouse, so we need to correctly translate the local position of the
context menu event to that child's coordate system.

This is already done correctly for regular mouse events, so use the same
logic here.

Fixes: QTBUG-99371
Pick-to: 6.2 6.3 5.15
Change-Id: Ief24c755e76d4d1aa2304b06662ed26ae309f684
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-22 14:09:56 +01:00
Marc Mutz
58058794b1 tst_qmetatype: fix memleaks
We didn't delete the new'ed up QMetaTypeInterfaces, causing asan to
complain.

Fix by storing them in strong references alongside their users in a
statically-allocated container.

We use shared_ptr to hold them, because QMetaTypeInterface doesn't
have a virtual destructor, so deleting objects of the TypeInfo types
(plural!) derived from QMetaTypeInterface though a pointer to the base
class is UB. The shared_ptr constructor, however, is templated, so it
stores the correct call (~TypeInfo()) in its type-erased deleter.

We can't use std::make_shared(), because that doesn't support
aggregate initialization until C++20, so we manually new up the
TypeInfos.

5.15 is not affected.

Pick-to: 6.3 6.2
Change-Id: Ic7ec88c34e02a9e0dd3421848c0c0885f4756702
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-12-22 13:41:30 +01:00
Marc Mutz
b6239f70f5 tst_QStringBuilder: remove test that doesn't test anything
We now have a more reliable test for the case with freeSpaceAtBegin(),
so remove the old test, after we verified it actually doesn't even
test that case.

Task-number: QTBUG-99330
Pick-to: 6.3 6.2
Change-Id: Ic108a722cd2fef1e63a05085a76d7572d1f8c875
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-12-22 13:01:25 +01:00
Janne Juntunen
bd40e43695 Exclude tst_QLocalSocket::verifySocketOptions() on webOS
This test case fails on qemux86_64-webos-linux environment and based
on comment on the test case, it probably cannot be expected to pass on
webOS.

Fixes: QTQAINFRA-4717
Change-Id: Ifb34b0c85da2d180a59529791d1109185fef2665
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-12-22 09:58:21 +02:00
Volker Hilsheimer
41f96866ee Windows: Don't crash in mouse handling when QApplication is recreated
We store the primary pointing device in a static variable to avoid the
lookup for each mouse event. However, when QApplication is destroyed,
then the device is destroyed, and the pointer needs to be reset so
that QApplication can be created again by the same process without the
first mouse event crashing the program.

Use QPointer to prevent the pointer from becoming dangling.

Fixes: QTBUG-99319
Pick-to: 6.2 6.3
Change-Id: Ie534c5eee48afb83e3a4adf70fc6cb4a2c310a7a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
2021-12-22 01:34:56 +01:00
Tor Arne Vestbø
7bd243b3fb macOS: Don't read keyCode of non-key events when inserting newlines
When the system input method decides to trigger an insertNewline
message it might come from a synthetic NSEvent of type AppKitDefined,
which does not respond to the keyCode message. Accessing the keyCode
would result in an exception being thrown.

We guard for this scenario by moving the keyCode access into the
key-press and -release specific parts of the KeyEvent constructor,
making the KeyEvent usable with generic NSEvents (even if that
means it will only pull out the timestamp and modifiers).

We also prefer to use the currently interpreted NSEvent, if one is
available, when preparing the synthetic newline event. This ensures
that we get a valid timestamp and modifiers, since the synthetic
AppKitDefined event that the system IM generates does not provide
valid values for these.

Fixes: QTBUG-99186
Pick-to: 6.2 6.3
Change-Id: I050ae2aa2d8ded1be3541f746e6c052f3546e27c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-22 01:34:56 +01:00
Volker Hilsheimer
5d04c27a27 Stabilize tst_QGraphicsProxyWidget::scrollUpdate
The test waits a bit hoping that all paint events are delivered after
showing the widget so that we can count the rectangles that are getting
updated when scrolling.

Waiting for 20ms is too short unless the system is completely idle.
Based on testing on a local VM, 150ms produces reliable results.

Pick-to: 6.2 6.3
Change-Id: I7729e94eae41476be67291a2f664cff784f96c7d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-22 01:34:56 +01:00
Marc Mutz
6d4102729f QRingBuffer: remove QByteArray::resize()-shrinks work-around
QByteArray::resize() is now documented to not shrink capacity(), so
remove the extra reserve(0) work-around.

Change-Id: I3d5d944b9f01f8f84b31599548773198903aad4c
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
2021-12-21 22:56:00 +01:00
Marc Mutz
3552cf48e8 tst_QStringBuilder: verify a comment is actually misleading
The construction of the byte array doesn't actually yield
freeSpaceAtBegin() (anymore?), so the comment above it is misleading
(and the test didn't manage to catch QTBUG-99330, either).

Before removing the misleading test, verify that this assumption is
actually correct across all platforms.

Task-number: QTBUG-99330
Pick-to: 6.3 6.2
Change-Id: I2f497321abc26c4148ced5ac12a5880b9ff5ba9f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-12-21 22:56:00 +01:00