72351 Commits

Author SHA1 Message Date
Joerg Bornemann
25b040acc1 CMake: Don't unconditionally enable the ASM language
CMake MR #10626 doesn't consider the MSVC compiler as valid assembler
anymore, thus unconditionally requiring ASM breaks with CMake > 4.0.1 on
MSVC.

Enable ASM only on non-Android Unix.
Remove the ASM language where it's not needed.

Pick-to: 6.5 6.8 6.9
Change-Id: I5df71edfce0f4920e39262f722e4bf95a735f31b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-05-02 18:13:14 +02:00
Even Oscar Andersen
f016201b6d wasm: Update input field geometry on window geometry change
The location of the input field was wrong leading to empty space
inserted in the user interface.

Fixes: QTBUG-136233
Pick-to: 6.9 6.8
Change-Id: Ic8c9faf5c4dbb8cec43a43c25c1cce8d7809f140
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2025-05-02 18:13:13 +02:00
Nicolas Fella
81f8eee6a1 QCompleter: Set transient parent on popup
In order to properly show a popup the Wayland QPA needs a parent window.

Currently it has to guess the parent, which might not work in all
circumstances. To address that explicitly set the widget as transient
parent of the popup.

Fixes: QTBUG-130474
Pick-to: 6.9 6.8
Change-Id: I99ea14a1a9ec25ee8a929cf61a6744957a850374
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2025-05-02 18:13:13 +02:00
Juha Vuolle
197f07b4e7 Compile androidnotifier only if widgets are available
The example links against widgets => add proper build-time
guard.

Task-number: QTBUG-136101
Pick-to: 6.9 6.8
Change-Id: I9e279791de5adf4e8bc86a09cb11e96022f9e1ce
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-05-02 16:51:15 +03:00
Tor Arne Vestbø
ccce91461a Revert "iOS: Replace variable length array in event dispatcher with QVarLengthArray"
This reverts commit be93c06758260b1e0738ab17a2ecc4ee8f90e87e.

The assumption was that using a QVarLengthArray was equivalent to
the existing C-style VLA, as we initialized the QVarLengthArray
with defaultStackSize as the Prealloc template argument.

However we failed to take into account that we adjust the stack
size via Stack::computeSize(), by adding space for our memory
guard, so we would effectively always end up with the user-main
stack on the heap.

This caused problems for Qt Quick's V4 engine, because it checks
for C++ stack overflow by comparing the current stack pointer to
the base and limit given by pthread_get_stackaddr_np and RLIMIT_STACK,
resulting in "RangeError: Maximum call stack size exceeded." errors
and failure to load the QML.

We can't tweak what pthread_get_stackaddr_np reports for an already
started thread, so in practice we can not put the user-main stack
on the heap, so we revert back to the use of C-style variable length
arrays, which should be fine for this specific use-case.

Change-Id: I05a4bd32697abee71aa9e70f9f5a011cc338f915
Pick-to: 6.9 6.8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-05-02 13:17:52 +02:00
Even Oscar Andersen
981757189c wasm: call "focus" on window, not canvas
This is necessary to have correct focus handling on webassembly/ubuntu
without this change tabbing from text input to f.ex a button would
not work.

Change-Id: I78eaa6202d8bdb87b1195d5c38a3f73570a49c90
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2025-05-02 11:19:05 +02:00
Juha Vuolle
67ad781c05 Exclude tests that require future, when future is disabled (wasm)
qfuturesynchronizer and qresultstore both rely on QFuture. Guard
their autotests accordingly.

Task-number: QTBUG-136101
Change-Id: I84680fd3383ceaa486bff53ad04b4a39e9e20d51
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
2025-05-02 08:25:10 +03:00
Christian Ehrlicher
aed4307a1f WindowsVistaStyle: misc cleanup of QWindowsVistaStyle::standardIcon()
Clean up QWindowsVistaStyle::standardIcon a little bit by using
separate icons for SP_TitleBarMaxButton and SP_TitleBarNormalButton

Pick-to: 6.9
Change-Id: I876d41f0373268a0a8888f00392a8e32d0f413a1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-05-01 20:22:58 +02:00
Christian Ehrlicher
dbbe65fb26 SQL/MySQL: adjust check for MariaDB client library
The correct define to check for MariaDB C Connector is
MARIADB_PACKAGE_VERSION_ID, not MARIADB_BASE_VERSION (which is a string
describing the server version the c connector relates to).

Pick-to: 6.9 6.8
Task-number: QTBUG-136550
Change-Id: I844900d9b6622fd3a72db63298e5c34de8a2f3dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-01 20:22:40 +02:00
Even Oscar Andersen
fd09d6f5d5 wasm: a11y - add back incorrectly removed focus handler
Task-number: QTBUG-135024
Change-Id: Ia0b5dba60985e36899a5bee116ab2f6cb05c602c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2025-05-01 16:06:39 +02:00
Even Oscar Andersen
7f9a580872 wasm: Make sure cellphone keyboard does not show needlessly
The last fix for QTBUG-136050 did not set inputMode "none"
which causes the keyboard to be visible on cell phones and
tablets.

Fixes: QTBUG-136050
Change-Id: If8c97fb009c10ff5338ce7e6516ca2c5a992d0d0
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
2025-05-01 15:45:15 +02:00
Mitch Curtis
11c171553e Revert "XCB: set devicePixelRatio on backing store QImages"
This reverts commit c70fd79a178a1e9a186cf8b2f78986e0a39845b4.

Reason for revert: causes a regression.

Pick-to: 6.9
Fixes: QTBUG-135867
Change-Id: Ia9a9049da778749d657ab999edd777650e572b86
Reviewed-by: Liang Qi <liang.qi@qt.io>
2025-05-01 09:12:21 +00:00
Morten Sørvig
51c7503568 a11y: reduce the number of activation observer calls
Reduce the number of activation calls by calling the
observer callbacks on active state change only, instead
of on each setActive() call.

The accessibility backends typically make setActive()
calls on each accessibility event, which can result
in a large number (100k+) of activation calls if there
are many (hundreds) of installed activation observers.

This change keeps the following behavior compatibilities:

- Each observer is called at least once on setActive(),
  even if the active state has not changed since it was
  installed.
- Going from active to inactive is supported, though
  Qt currently does not appear to do this.

As a drive-by refactor, make it possible to activate
accessibility by calling QAccessible::setActive(), by
making it call QPlatformAccessible::setActive().

Change-Id: Iee17160f153b825be032b441923e3529c2f00242
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2025-05-01 02:44:18 +00:00
Christian Ehrlicher
e57fff6341 Widgets/Stylesheets: compile without FEATURE_style_stylesheet
Make sure to not compile the stylesheet sources when
FEATURE_style_stylesheet is disabled, also don't include the relevant
headers in this case.

Pick-to: 6.9
Fixes: QTBUG-136341
Change-Id: I4fc2de2fcba004b93140809ef79374401209f14a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-01 02:45:02 +02:00
Christian Ehrlicher
a1612886ba Widgets/Stylesheets: Remove double negations for stylehseet feature
Replace ifndef QT_NO_STYLE_STYLESHEET antipattern by
if QT_CONFIG(style_stylesheet).

Pick-to: 6.9
Task-number: QTBUG-136341
Change-Id: I8f5d5ff0b7b5cce010df167977214bc92a9443b7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-01 02:45:02 +02:00
Christian Ehrlicher
e19607611c Windows11/VistaStyle: use delegating ctor
Use delegating ctor for QWindows11Style and QWindowsVistaStyle to avoid
code duplication.

Pick-to: 6.9
Change-Id: Ia5048d989a1d6556b64a3ffc95da5d05624cd634
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-05-01 00:58:35 +02:00
Christian Ehrlicher
0d4e044165 Widgets: compile without features tabwidget/tabbar/toolbutton
Move the usage of the corresponding QStyleOption classes into a
QT_CONFIG() guard to fix compilation when these options are disabled.

Pick-to: 6.9
Change-Id: I68e791f20bbc8389974878e765b08a97eb347b92
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-01 00:58:35 +02:00
Christian Ehrlicher
69053eea3f Widgets: remove some unused includes
Remove some unused includes in source files.

Pick-to: 6.9
Change-Id: I5c43fd10fa1a179664ad8cbf4988f9bdb96d8af8
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-01 00:58:35 +02:00
Christian Ehrlicher
29238407af Tests/QTreeView: use QCOMPARE_foo instead QCOMPARE
Replace some QCOMPARE(value > x) with QCOMPARE_GE(value, x) to get
better output on failure.

Pick-to: 6.9
Change-Id: I3f7fc80cf25776adab40cd61c08c58a49f6af0c5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-01 00:58:34 +02:00
Christian Ehrlicher
33c2931429 QLaoyut: remove check for QT_CONFIG(menubar)
Even though the member is named 'menuBar', it's a plain QWidget. Also
the setter are not guarded so the functionality should not be guarded
too.

Pick-to: 6.9
Change-Id: I5fa19ab955d9794aa3d344ba0cfc8a0a3d22b61e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-01 00:58:34 +02:00
Allan Sandfeld Jensen
2b7ecfab7d Fix qRound(inf) assert
In some extreme cases we can return a finite float, and then turn it
infinite when multiplying it to calculate the index positions.

Avoid the whole thing by clamping to a brightness of +-32768 times the
white point standard, which is well within current HDR standards.

Credit to OSS-Fuzz which detected the assert.

Pick-to: 6.9 6.8
Change-Id: If007732a8d59ea27514f17674d318a099a057281
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
2025-04-30 20:51:40 +00:00
Mårten Nordheim
70d3293d72 Http2: Fix 'Received' typo
Missing 'e'.

QHttp2Connection is private API so the API can be changed.
No known external users.

Pick-to: 6.9 6.8
Change-Id: I4f3daab9deff3250ff66066dc3e088edfbbfc5ef
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2025-04-30 20:03:25 +00:00
Aurélien Brooke
3020aa0a1f rhi: vulkan: set object names on pipelines too
It helps debugging.

Change-Id: Ibb01bf9ebbeb06c05fd4be2ca17277dff8247c5f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2025-04-30 21:06:03 +02:00
Aurélien Brooke
a343d5fe58 rhi: vulkan: bail out if device loss occurs during vkWaitForFences()
The NVIDIA driver may become unstable (including kernel lockups) if
Vulkan API calls continue after a device loss.

Ensure we stop frame processing immediately when vkWaitForFences()
returns VK_ERROR_DEVICE_LOST. Also, don't try to vkWaitForFences() when
calling releaseSwapChainResources() after a device loss.

Change-Id: I2c35a7a7ad07830778b6dc4d40f1ce62535e988a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2025-04-30 21:06:03 +02:00
Juha Vuolle
cdeb245340 Skip UDP parts of tst_qnetworkinterface if UDP sockets not enabled
Task-number: QTBUG-136101
Pick-to: 6.9 6.8
Change-Id: Ib3be9ae7c3a261c606cf242a15279491304de6b6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2025-04-30 19:35:55 +03:00
Juha Vuolle
01e253e77c Put tst_qnetworkproxyfactory behind networkproxy feature
..as it heavily relies on it and fails to build without.

Task-number: QTBUG-136101
Pick-to: 6.9 6.8
Change-Id: Ie2ba55e485cf96d568b0b22f27e19ffa72f48da9
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-04-30 19:35:55 +03:00
Juha Vuolle
6816273f0e Fix tst_dnslookup compilation when udpsocket is disabled
Guard the UDP socket includes and uses with feature flag.

Task-number: QTBUG-136101
Pick-to: 6.9 6.8
Change-Id: I1fe27244e6aa029407b07ebc06de137ec8b280af
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-04-30 19:35:55 +03:00
Juha Vuolle
2f91439d05 Fix tst_noqteventloop compilation if localserver disabled
..by feature-guarding localsocket and localserver uses.

Task-number: QTBUG-136101
Pick-to: 6.9 6.8
Change-Id: Icc6327fa222edda31fe9e88ec38c916dcd359eb0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2025-04-30 19:35:55 +03:00
Thorbjørn Lund Martsum
3692f14a30 Remove semantic tests in QHeaderView auto (+avoid signed overflow)
When QHeaderView was optimzed+refactored a unittest was requested.
However, since behavior didn't change a semantic test of certain
qheaderview aspects was added instead (to compare to old behavior).
It was suggested as a manual test, but it was decided to merge
it into the unit test.
With the risk of testing something twice, these semantic tests have
now been modified to be actual unit tests. Certain aspects of
behavior in QHeaderView may actually be wrong
(also highlighted by these new unit tests)
and changing QHeaderView for the better
would be difficult having these tests.
Furthermore, the changes were motivated by the test having
integer overflow.

Fixes: QTBUG-135201
Change-Id: Iabfaf9b57de5cb11d98ea27f352b17ab0f6cc613
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2025-04-30 13:43:40 +00:00
Shawn Rutledge
b01fe1390c maybeSynthesizeContextMenuEvent: accept mouse event if CME accepted
Prior to 84a5f50c7766c99f62b22bb4388137e0aa8dd13d
QWidgetWindow::handleMouseEvent() did its own synthesis of
QContextMenuEvents. Then we moved it to
QWindowPrivate::maybeSynthesizeContextMenuEvent() and didn't preserve
the code to accept the QMouseEvent if the QContextMenuEvent was
accepted. It turns out that the WASM platform depends on checking
whether the QPA mouse press event was accepted: if not, it closes
all popups, including any context menu that was just opened by a
right mouse press.

Fixes: QTBUG-136241
Change-Id: Ibe01763a6af19d65629dc77eb61ffc1af581efbe
Pick-to:  6.8 6.9
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2025-04-30 13:00:26 +00:00
Kai Köhne
d1e030f6f5 configure: Bail out early if Xcode is not installed on macOS
Currently, configure fails late with

     Qt requires at least version 15 of Xcode, you're building against
     version . Please upgrade.

Pick-to: 6.9
Change-Id: Ic4f44d37429ac9def785a50909a25b0bcb4b72a5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-04-30 10:54:05 +02:00
Safiyyah Moosa
ae6ba06e55 Doc: Add alt-text for Qt Network examples
QDoc generates warnings for images that do not have an alternate-text
associated with it. Alt-text is required for to increase accessibilty
options.

This patch adds alt-text to images in the Qt Network

Fixes: QTBUG-135122
Pick-to: 6.9 6.8
Change-Id: I690f1d381ef5a9052e189dd1f3906243df557da0
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2025-04-29 22:54:13 +02:00
Edward Welbourne
2edd9286cf Fix long-form zone parts in date-time strings
Recent changes to date-time formatting arranged for time-zone names to
be localized appropriately. Teach the datetime parser to recognize the
long names that now implies, as well as IANA IDs, and ensure these
last are also used as a fallback when no localized long name is
available. Discrepancies between the platform time-zone backend and
our CLDR-derived name L10n (where needed, due to the backend lacking
it) make the naive approach to this (find any zone that matches,
expect them all to have the same offset history) fail, so take care in
this case to select as canonical an IANA ID for the named zone as we
can find. Add a round-trip test and adapt an existing test to
round-trip when it can.

[ChangeLog][QtCore][QDateTime] The tttt format specifier now uses the
full long name of the zone, falling back to its IANA ID only if this
cannot be determined. Both forms are now recognized when reading a
datetime from a string.

[ChangeLog][QtCore][QLocale] When serializing a datetime, the tttt
specifier now uses the localized full long name of the zone, falling
back to its IANA ID only if this cannot be determined. Both forms are
now recognized when reading a datetime from a string.

Pick-to: 6.9 6.8
Fixes: QTBUG-130278
Change-Id: Ia28529790c0f600930d55c92a606adbcdfa852b9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2025-04-29 16:04:33 +02:00
Edward Welbourne
ef5d9702a9 Move system locale later in uiLanguages(), when adding it as fallback
Place it after the last mutually intelligible entry (same language and
script), or at the end if none, rather than at the start. The fact
that we add it at all was prompted by macOS leaving it out, which can
happen if the user has specified custom preferred languages that don't
match what they've specified for locale.

Adapted various test-cases to match the new behavior.

[ChangeLog][QtCore][QLocale] When the system locale itself is missing
from what the system reports as suitable languages into which to
translate the UI, it is now inserted later in the list, where
previously it was added at the front.

Task-number: QTBUG-104930
Change-Id: I378d266d6f8894cb17df9d09e841a266da73ecee
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2025-04-29 16:04:07 +02:00
Edward Welbourne
55f69018b3 Fix minor details in QLocale::uiLanguages() docs
An illustration missed out an entry.
Technically truncations go after equivalents of their source.

Change-Id: Ia514c3e0991cbc552c6314a26c6d0569b38e9f16
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2025-04-29 16:03:54 +02:00
Juha Vuolle
5776865f7c Compile calendarbackendplugin only if widgets are enabled
The example links against widgets unconditionally => add
proper build-time guard

Task-number: QTBUG-136101
Pick-to: 6.9
Change-Id: I62ea42a04f7ff421753a0fc7a30cd969cfaff6e2
Reviewed-by: Magdalena Stojek <magdalena.stojek@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-04-29 17:00:12 +03:00
Juha Vuolle
3bbe9d8ec7 Fix tst_qlocale compilation when jalalicalendar is disabled
The 'syslocaleapp' test helper application was built only when
jalalicalendar is enabled. The tst_qlocale on the other hand
depends on 'syslocaleapp' if process-support is enabled.

Thus if jalalicalendar was disabled and process-support
enabled, the CMake configure fails because tst_qlocale won't meet
its 'syslocaleapp' dependency.

Fix by building a more limited version of the syslocaleapp when
jalalicalendar isn't supported, and adjust the testcase accordingly.

Pick-to: 6.9 6.8
Task-number: QTBUG-136101
Change-Id: Ic809b0124d47754105ca09b69e2b3c12856ba63a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-04-29 17:00:12 +03:00
Magdalena Stojek
776dbdce7b QXmlStreamReader: add support for retrieving raw inner XML content
This change introduces a new function, readRawInnerData(), that returns
the raw inner XML content of the current element, including nested tags,
comments, CDATA, and processing instructions.

[ChangeLog][QtCore][QXmlStreamReader] Added readRawInnerData() for
retrieving the raw inner XML content of an element.

Fixes: QTBUG-85141
Change-Id: I96dd0790d726cf8a196125384cbf8f8fa2587880
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2025-04-29 16:00:12 +02:00
Matthias Rauter
9319f79060 Add tests for QUtf8StringView
This is a port from QLatin1StringView to QUtf8StringView.

Some functions of QL1SV have no counterpart to QU8SV:
* first() and last()
* count()
* indexOf()
* toUtf8()
that were not included.

Tests for user defined literals have also been removed. Some tests were
extended for utf8 string literals u8"".

Pick-to: 6.9 6.8 6.5
Task-number: QTBUG-132097
Change-Id: I0ceee00a7457360b430d13c3199f642f8e4c0036
Reviewed-by: Mate Barany <mate.barany@qt.io>
2025-04-29 15:11:05 +02:00
Tobias Koenig
e016730b93 Schannel: Fix import of PKCS12/PFX files with CSP bag attribute
Use the PKCS12_ALWAYS_CNG_KSP flag instead of PKCS12_PREFER_CNG_KSP
when importing a PKCS12/PFX file to make sure the private keys are
stored in the Key Storage Provider, so that the
CERT_NCRYPT_KEY_HANDLE_PROP_ID property is set on the associated
certificate and the subsequent query for it succeeds.

Background: If the PFX file contains a Crypto Service Provider (CSP)
bag attribute and PFXImportCertStore is called with the
PKCS12_PREFER_CNG_KSP flag, then the private keys are stored in the
CSP that is referenced in the bag attribute and the key is only
accessible through the deprecated API.

Change-Id: If2ad2fa6a7b20f02e40fc49c98e3a72b68d832f2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-04-29 11:14:10 +02:00
Even Oscar Andersen
a27bc0a70d wasm: Make sure typing with window focus does not produce characters
contenteditable on the window caused characters to be inserted.
Instead create a div as a child element, and set  contenteditable
on that.

Fixes: QTBUG-136050
Change-Id: I4ccf3589ea19876f68bb9c7077c3a13ae5f989e6
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2025-04-29 06:39:42 +02:00
Tor Arne Vestbø
6f67925799 macOS: Add native interface API to manage visual effect view
NSVisualEffectView is the only supported way to add effects to
views, such as showing a blurred representation of the content
under the window, or within the window.

Now that we render the content of our QNSView into a sublayer
of the view's root layer, we can add NSVisualEffectViews as
child views without obscuring the view's own content, by making
sure that the NSVisualEffectView layer has a lower Z order in
the layer tree of our view's root layer. This works because
adding a layer-backed or -hosted view as a subview will also
add its layer as a sublayer of the view's layer, making the
effect layer and our content layer sibling layers.

Change-Id: Iab822e8462f54025559b3e3f26c7df668c885d75
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-04-29 04:02:52 +02:00
Volker Hilsheimer
db7e2d6fd0 QGIM: fix test coverage for gadgets-that-are-tuples
The test data for SingleColumn and MultiColumn disambiguation types
was incorrectly removed in 7803e6c000cc0fddba392bcbaefdc3a93ff4b26c.

Inserting rows of a MultiColumn wrapper around a pointer doesn't work,
so QEXPECT_FAIL that test for now.

As a drive-by, remove an obsolete QEXPECT_FAIL; we never add a table of
pointers in multiple value categories, as they all reference the same
data.

Change-Id: Ief4750094f8262f01ff81aa41d113971abd37307
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
2025-04-29 03:04:50 +02:00
Volker Hilsheimer
25f5bd5f66 QGIM: simplify new/deleteRow for tables
Conceptually, a table can deal with rows that are a pointer type,
and nullptr. We test for validity before accessing the row element, and
can return gracefully from e.g. data() or setData(). This is also
acceptable for lists, where a newly constructed row will hold a nullptr
element as the item. Client code that wants to initialize new rows
explicitly can provide their own protocol, or connect to rowsInserted()
and rowsAboutToBeRemoved().

However, we might end up violating the requirement that in a table, all
rows have to have the same number of columns: if the row-type is a
pointer to a struct or gadget, and we don't instantiate the element,
then we end up with an index that is de-facto invalid even though
it is in range. setData() cannot do anything but return false, and
data() can only return an invalid QVariant.
And if the row type is dynamically sized, and the new row is inserted
at index 0, then we end up reporting that the model has 0 columns, as we
use row 0 as the reference for the column count.

To fix this, implement new/deleteRow consistently for pointers (and
smart pointers): if the row type is a (smart) pointer holding
a default-constructible object, then we can instantiate a new object.
The deleteRow implementation takes care of deleting raw pointers (as
otherwise the `delete row` expression is invalid); for smart pointers,
the smart pointer takes care of memory management.

All other row types can be instantiated by default constructing. This
covers MultiColumn/SingleColumn wrappers as well, which can hold a
nullptr while still reporting the correct column count.

Remove the special handling from canInsertRows() - if newRow() is
available in the protocol, then we can insert rows.

But one ambiguity remains: if we operate on a copy of a container that
has pointers for rows, then adding new rows might allocate (in the
model's copy), resulting in a mixed situation. The client code can not
delete those new rows (they don't exist in the original container),
while the model must not delete rows it didn't create (those do exist
in the original container and might still be used).

Perhaps that cannot be solved, other than by documenting: either move
your range in the model (then ownership is clear), or pass a reference
or pointer the model (then ownership is also clear); or use smart
pointers for the row type.

Change-Id: I18a2e929473d118dcdb9d1f2ed67a7890f681974
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
2025-04-29 03:04:50 +02:00
Marc Mutz
4d839093b4 qDecodeDataUrl(): fix precondition violation in call to QByteArrayView::at()
It is a precondition violation to call QByteArrayView::at() with
size() as argument. The code used that, though, as an implicit
end-of-string check, assuming == ' ' and == '=' would both fail for
null bytes. Besides, QByteArrays (but most certainly QByteArrayViews)
need not be null-terminated, so this could read even past size().

To fix, use higher-level API (startsWith()), consuming parsed tokens
along the way.

Add a test that would crash in debug mode before the fix.

Amends the start of the public history.

[ChangeLog][QtCore] Fixed a bug in the handling of data: URLs that
could lead to a crash if Qt was built with assertions enabled. This
affects QNetworkManager and links in QTextDocument.

Pick-to: 6.9 6.8 6.5 6.5.9 6.2 5.15
Change-Id: I4331c88051dfbb0a18fe7da4f50858c707785d09
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2025-04-28 23:54:58 +00:00
Tor Arne Vestbø
0bdbf4688e macOS: Use dedicated content CALayer for Metal/Raster content
By making the content layer a sublayer of the view's root layer (our
container layer) we open up the possibility of manually managing the
z-order between the content and other sublayers of the view's layer,
for example sublayers added as a result of adding NSVisualEffectView
child views to our view.

[ChangeLog][macOS] Metal and Raster windows no longer render
their content directly to the root CALayer of the window's
NSView, but to a sublayer of the root layer. This is an implementation
detail that should not be relied on, but may affect client code
that pokes into the NSView of the QWindow in unsupported ways.
To opt out of the new mode, set QT_MAC_NO_CONTAINER_LAYER=1.

Change-Id: I7053d7530b6966ed7dd4d1a4d1b7e94754767c57
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-04-28 19:52:26 +02:00
Alexey Edelev
d60930be38 Fix typos in qt_internal_add_plugin in the TEST_PLUGIN related warning
Amends 40def717978f832027542dad507e7873ccc0e1f6

Pick-to: 6.9
Change-Id: I807b1b7db8c2d473355759c1db12cc2a9ead802d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-04-28 19:36:26 +02:00
Tim Blechmann
7491628061 Network: avoid interface as parameter name
`interface` is used by win32 headers. avoiding it fixes unity builds on
windows.

Pick-to: 6.8 6.9
Change-Id: I1d3f89a201f44f6e4eed5977d1b80f675078d430
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-04-29 00:09:40 +08:00
Even Oscar Andersen
bc2c963510 wasm: Install cut/copy/paste handlers on window for not chrome
This is how it used to be.
More changes are needed to fix cut/copy/paste.

Change-Id: Ib5073b82a568a391581f0b4d8369eaab57fd8f19
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2025-04-28 17:27:40 +02:00
Volker Hilsheimer
3c46f2ef96 QGIM: standardise detection of metaobject, also for smart pointers
Change-Id: I01acbfecfad582dd663c9ae2540be277414935db
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
2025-04-28 17:27:40 +02:00