Commit Graph

64188 Commits

Author SHA1 Message Date
Edward Welbourne
1022b0d111 Eliminate duplicate overrides of Converter methods in example
The Out-only converters shouldn't need to implement loadFile(), as it
shouldn't be called - a converter is not used for input unless it says
it supports input. At the same time, provide the "ground state"
implementations for optionsHelp(), outputOptions() and probeFile() to
save the trivial implementations the need to duplicate one another.

In the process, make the handling of loadFile()'s outputConverter more
consistent among those that do implement it.  Always set
outputConverter if it's initially null (the caller does assert this).

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I856d12c791d1f8e0accdb7dd1412d493117b2302
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-01 21:28:55 +01:00
Edward Welbourne
8b8fc42f2c Move Converter class, in eponymous example, to a file of its own
There's more details coming and it's good hygiene anyway.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ief3acf6e508bc93eaa8490f6c49300b25c1d3556
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-01 21:28:55 +01:00
Edward Welbourne
d57a78657e Break out the list of available converters to a static method
Mostly to pave the way for moving the class code to a file of its own,
but this incidentally saves the need to std::as_const() every use.
Moving the underlying object to a local static of a private method
also saves the need for heap allocation (which was leaked).

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I30f4bf3c46d39e04d0ac4e3e9ba431945ebb9193
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-11-01 21:28:55 +01:00
Edward Welbourne
0b1670134b Replace confusing member variable with a predicate
The Converter class, in the eponymous example, had a null member
variable that wasn't a nullptr - it pointed to an instance of
NullConverter - so that other converters could test whether a
Converter * they'd been passed was null (in the sense of pointing to a
NullConverter). This, however, was susceptible to misreading - I
misread one such comparison as a nullptr check and thus thought it
redundant with an earlier actual nullptr check. To spare future
readers similar confusion, replace the public static member variable
with a protected (since only other derived classes need it) static
predicate, to at least give the reader a clue that this is using the
word null in a class-specific sense.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I1e4f494b303d1bf90107f8c6fa3a4a22f6d81b90
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-01 21:28:55 +01:00
Edward Welbourne
0de55973d3 Amend #if-ery to exclude MS QTZP backend declaration when not in use
Since 2017 we've been using the ICU backend in preference to the MS
one, so there's no point declaring the MS one when it's not being
compiled.

Pick-to: 6.6 6.5
Change-Id: Ia7b770ec27bb627caace814b972967c4f7d63330
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-01 21:28:55 +01:00
Anton Kudryavtsev
ec8e3e535d qurlidna: port some internal functions to QSV
Change-Id: If9c0090589cd58738165f2fe71701dba6958575c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-01 23:05:39 +03:00
Anton Kudryavtsev
d0b90663a4 qarraydatapointer: use use std::exchange more
to simplify code

Change-Id: I7fc6dd92922eb30a16260544223c1dbfc3162188
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-01 23:05:39 +03:00
Anton Kudryavtsev
f331171dd7 QString::fill: port to char16_t
Change-Id: If91ea7b7ceedbf9ed109b064ea5ea5572e7c9b14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-01 23:05:39 +03:00
Anton Kudryavtsev
ebbd9ddf88 qhttpnetworkreply: use QBAV more
to reduce allocations

Change-Id: I89879a68626631970d34bbc0357528dcbb8b1c17
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-01 23:05:39 +03:00
Anton Kudryavtsev
d3ec9fd359 qhttpnetworkreply_p: port parseStatus and parseHeader to QBAV
Change-Id: Ib3bb2d29460827f9dfceb51975ce822d8a41aba0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-01 23:05:39 +03:00
Anton Kudryavtsev
8f6b30ec8d QNetworkReplyHttpImplPrivate: de-duplicate literals
While touching code, use CaseInsensitive compare more to avoid needless tmp allocation

Change-Id: I4fe8496133925887df6879b48c730c36f486fa9c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-01 20:05:38 +00:00
Anton Kudryavtsev
0bd9265867 network: use CIS compare more
to reduce allocations

Change-Id: I648518fd152a834bbdc6afcedb693f02c1b13af1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-01 23:05:38 +03:00
Friedemann Kleint
fcab2b88af QtDBus: Fix unity build on Windows
Exclude qdbusconnectionmanager.cpp which includes qt_windows.h,
clashing with the "interface" parameter name in qdbusinterface.h.

Task-number: QTBUG-115352
Pick-to: 6.6 6.5
Change-Id: Id41910857cb203ec5a1b784fa171eeb189ca4eca
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-11-01 21:05:38 +01:00
Ivan Solovev
f5a5c59918 Extend QTestPrivate property tests - actual implementation [2/2]
This patch provides the actual implementation to detect binding loops
in property setters.

These test will help to catch all the existing binding loops that were
introduced when migrating to new bindable properties.

The logic of the new tests is taken from
tst_QObject::objectNameBinding(), but generalized to be applicable to
all bindable properties.

The original code from tst_QObject can now be removed.

The patch effectively reverts f791570b86
because a lambda returning a nullptr now means that the binding loop
test should be skipped, which is not a good default behavior.
Now when all the existing bindable properties are fixed, it's fine to
give a compilation error when adding new tests, if the class is not
default-constructible.

Task-number: QTBUG-116345
Pick-to: 6.6 6.5
Change-Id: I059d444d4bb023c050a22e5b1974565e4f581b5c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-11-01 22:05:38 +02:00
Anton Kudryavtsev
457309c9fa QHttp2ProtocolHandler: optimize updateStream
Use QBAV more to reduce allocations

Change-Id: I009144156fafa64dd241c446bd4081fe197aa2bf
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-01 22:28:24 +03:00
Michal Klocek
567e9b2026 Doc: Fix QTest::createTouchDevice docs
After the introduction of QInputDevice class the returned
QPointingDevice object from QTest::createTouchDevice()
call is no longer automatically deleted when the
QCoreApplication is deleted. Moreover, this function does
not really go thorough qpa but simply registers the device with
QWindowSystemInterface::registerInputDevice() (which is
actually also used from qpa plugins when new device is plugged)

Pick-to: 6.6 6.5
Change-Id: I3a0400288d76b7c95659d6b6ea260eff3233ebf1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-11-01 20:28:24 +01:00
Eskil Abrahamsen Blomfeldt
38ce08aa8e Update Harfbuzz to version 8.2.2
Pick-to: 5.15 6.2 6.5 6.6
Task-number: QTBUG-118615
Change-Id: Ifdf6023781c7202bc07f7cfb821c8cfefd2720a8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-01 15:00:13 +01:00
Volker Hilsheimer
a20d9a5700 Fix warning for 32bit builds
When building for 32bit platforms (e.g. Android armv7a), then printing
qsizetype value using printf's %lld format generates a warning because
qsizetype is just an int. This breaks the build, and can't be fixed
by using another placeholder without producing a warning on 64bit
builds. So fix it by casting the qsizetype always to 64bit signed int.

Change-Id: Ie7c0fa8b3a0fe6366ce6fd5b2947f42a3e67c381
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-11-01 15:58:47 +08:00
Volker Hilsheimer
daf15a4aaf Android: clean up error handling and native methods registration
Emit log output and return false immediately if we fail to get both the
Activity and the Service objects. Standardize the registerNative methods
to return bool and take a QJniEnvironment, and adjust the macros
accordingly.

Simplify the startup routine to use QJniEnvironment.

Change-Id: I11be35426520dc803f5a07bbb495e908592f254e
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-11-01 15:58:45 +08:00
Volker Hilsheimer
6735aa868f JNI: add a static getter for a JNIEnv pointer to QJniEnvironment
This further helps reduce the creation of temporary QJniEnivronment
instances (with allocated d-pointer) for cases where we simply need to
get the JNIEnv for the current thread.

Change-Id: I2eda238124be51c755d8910de9dbc9ca8eb92288
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
2023-11-01 15:58:42 +08:00
Volker Hilsheimer
e21d35b9f7 JNI: don't implement a signature for 'long' C++ type
On Android, `long` has the width of the system, while `jlong` is always
64 bit. If we support `long` as a signature type equivalent to `jlong`,
then it becomes possible to write code that fails to compile, or in the
worst case crashes at runtime, on a 32bit system.

Instead, support quint64, which is always the same size as jlong.

Change-Id: I60432ec7411e697b5f6e1f153216ceee0af7e0f1
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-11-01 15:58:40 +08:00
Andreas Eliasson
45c6ef02e7 Doc: Revise QWidget docs
Reviewing and improving the docs for QWidget is part of the objectives
for the 2023 Q4 OKRs.

Most of the work in this patch is fixing grammatical errors and typos.
It is tempting to move much, if not all, of the Detailed Description content from the QWidget class reference page (qwidget.cpp) into its own overview/explanation page, which would be more in line with the diátaxis framework. But I think that should be a different patch.

Fixes: QTBUG-117758
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: Ibb3f367c4677f7e6615bc0cd39d0ffe921862cb9
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-11-01 07:58:02 +00:00
Safiyyah Moosa
48c6f7250a Doc: Improve the QCombobox Documentation
The purpose of this commit is to improve the QCombobox documentation.

The following updates were made:
- The Combobox image was udated with a better quality image.
- The brief was updated to make it more understandable.
- The detailed description was updated with subsection titles.
- Full stops were added to the sentences that were missing them.

Fixes: QTBUG-117748
Pick-to: 6.5 6.6
Change-Id: I417a720299ac0eb2be3f080f2fc0f76a27242423
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-10-31 19:20:12 +01:00
Anton Kudryavtsev
5e158ee177 qvulkanwindow: use qimage rvalue overalods more
Pick-to: 6.6
Change-Id: I71bb0df5dbf1993284ec907f637a8696898dddb1
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-10-31 21:20:12 +03:00
Anton Kudryavtsev
9548118443 qpixmap_win: use qimage rvalue overalods more
Change-Id: I363b40ad8c797e0e554eca249347b5764d7dcfe8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-10-31 21:20:12 +03:00
Laszlo Agocs
aa4fe3286d Fix alpha channel logic in QRhiBackingStore
Mirror what other platforms such as Windows or xcb do.

Those all unconditionally upgrade a non-alpha format such as RGB32 to
something like ARGB32_Premultiplied (or whatever
qt_maybeAlphaVersionWithSameDepth returns).

Without this, there is a discrepancy between macOS and the other
platforms when using QOpenGLWidget or QQuickWidget (which trigger
the usage of QRhiBackingStore).

For example, attempting to have semi-transparent raster widget content
over the RHI-based widgets will render incorrectly. This is visible in
6.7 (dev) with the cuberhiwidget example as well: the red
semi-transparent overlay is rendered incorrectly on macOS since
QRhiBackingStore sticking with a QImage of RGB32 has far-reaching
consequences.

Upgrading to an alpha format is also required by the "hole punching"
mechanism the texture-based widget system relies on, although there is
a suspicion that that just happens to look correct with RGB32 as well
since there is an alpha channel technically with that format, and alpha
writes may not be masked out, depending on painting internals, ending
up with RGBA content in practice.
But in other cases, like in the report and the one mentioned above
this clearly breaks down.

Fixes: QTBUG-118553
Pick-to: 6.6 6.5
Change-Id: I4b5b7a4f720377d64903e948b866f8d1c443a2d2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-31 20:20:11 +02:00
Laszlo Agocs
522d9fcfe4 QRasterBackingStore: check format alpha presence in a more generic way
...instead of hardcoding a format such as ARGB32_Pre. A subclass may
override format() after all.

A few lines below there is the same check in fact, but this time
with hasAlphaChannel(). To be consistent, switch over to
hasAlphaChannel() in the first case as well.

Pick-to: 6.6 6.5
Change-Id: I7a5653863a72f8a0df98da66290f6d17e548b0a8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-31 20:20:11 +02:00
Timothée Keller
d53c0d721f Windeployqt: add options to deploy/block plugins
Some plugin types are pulled in by default by certain modules.
Give users the option to add/skip plugins and/or their types.

[ChangeLog][Tools][Windeployqt] Windeployqt now has options that allow for custom plugin deployment. Users can include or exclude them, either individually, or by type.

Fixes: QTBUG-117910
Pick-to: 6.6
Change-Id: I85235783dcd814396f184912269cd5976717b2dd
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-10-31 18:10:14 +00:00
Ahmad Samir
e90705687f QMetaEnum: refactor keysToValue
- Show warning messages for malformed keys string
- Use QBAV instead of QL1SV, some methods in the public API may get
  QU8SV overloads in later commits
- Extend unittests; also rename the unittest, it's really testing
  key(s)ToValue()

Change-Id: Iec944ef4c2c5d18ab038cb933e954cf50c912523
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-31 19:36:00 +02:00
Ahmad Samir
7c41f31efa QMetaProperty: simplify code
By using QBAV instead of dealing with const char*; now it's clearer it's
doing the equivalent of parse_scope() does (albeit without explicit malloc()
and strrchr() calls).

Change parse_scope() to take a QBAV to keep the code consistent (new
public method overloads will take a QUtf8String in later commits).

Change-Id: I9cb0d7d45fd5f7689010c0684a094e6e98be1d74
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-10-31 19:36:00 +02:00
Amir Masoud Abdol
a83b450dbc Use configure_file instead of file(COPY
As mentioned in comments, file(COPY causes rebuilding of the file every
time the project is re-configured, so, we replace it with configure_file
to avoid that.

Amend 1dcc14f2d0

Task-number: QTBUG-118191
Change-Id: I893b36fa26168f460f3ab1320a3194561c66e5df
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-31 18:36:00 +01:00
Kai Köhne
e45937c22d Highlight some examples for 'Data Processing & IO' category
Pick-to: 6.5 6.6
Task-number: QTBUG-117220
Change-Id: I1bf8d36ae93b96da55d18c9545c942707834c114
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-10-31 19:35:59 +02:00
Kai Köhne
675f380c4d Doc: Fix name of example to highlight
Since commit  d3526c16, the example is just named 'Secure Socket Client'.

Change-Id: Iba15a04aa8c6ab3cd7e933903154575c15a5a81b
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-10-31 19:35:59 +02:00
Mårten Nordheim
ce4531a490 QNetworkInfo: if no builtin defaults are found, load anything
As a fallback before picking the dummy backend.

[ChangeLog][QtNetwork][QNetworkInformation]
QNetworkInformation::defaultBackend() will now load any available
backend with Reachability support if the default ones are not available.
If none are available it will create a backend that always returns the
default values for each property.

Change-Id: I40889eeb51929e81f77ec2d84999932b095baf0b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-10-31 11:37:38 +02:00
Tor Arne Vestbø
bafeffff9d QMessageBox: Detect modifications to standard button text
The addButton(StandardButton) and button(StandardButton) APIs return
a QAbstractButton, that the user can in theory modify to their heart's
content. This causes problems when the native dialog backend is not
aware of these modifications.

We documented this limitation in e9a1c5321, but it turns out to be
more common than we first though. In particular, a typical case is
modifying the text of the button.

We now try to detect if the button has a non-standard text, and if
so turn it into a custom button when passing it on to the native
backend. From the point of view of QMessageBox it's still a standard
button, and will be reported as such in the result of exec().

To make this work the QMessageDialogOptions::CustomButton needs to
learn about custom button identifiers, so we can pass the original
standard button though.

This moves us closer to a world where the QMessageDialogOptions
represent both standard buttons and custom buttons using the same
structure, which is what we want anyways, so that we e.g. respect
the added order of standard buttons with the same role.

Pick-to: 6.5 6.6
Change-Id: Ifb7f7bd537fe71293f14ef6a006999e350bd0b52
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-10-31 11:28:10 +02:00
Tor Arne Vestbø
db17487c93 Fix tst_QWidget::hoverPosition blacklisting for x86_64
The blacklist just uses 'x86'

Pick-to: 6.6 6.5 6.2
Change-Id: I9279e4c497e566f59be54b5cc71a7671d3a3370f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-31 10:27:19 +01:00
Morten Sørvig
13bb9fcdae no-thread: add QProcess config check
Disable QGraphicsFrameCapture for the no-thread (and
no-process) configuration.

Change-Id: I7767098efff78338a763ff192512d484cd300c1d

Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-31 11:21:53 +02:00
Morten Sørvig
3fc1951f41 no-thread: don't build macdeployqt
macdeployqt requires multithrading support.

Change-Id: Ie561434d68f46bc82ec603aee2c36cd43597073a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-31 11:21:52 +02:00
Morten Sørvig
73feb5184e wasm: fix null-argument warning
That's "null passed to a callee that requires a non-null argument".

Pass EMSCRIPTEN_EVENT_TARGET_WINDOW instead of NULL to
emscripten_set_wheel_callback. The function is never called
here, so it does not matter which non-null value it
gets.

Pick-to: 6.6
Change-Id: I10187a222513820158a938bf05cde60f489956f1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-31 10:21:52 +01:00
Santhosh Kumar
58a6a92f68 Fix margin issue in wizard for windows
The patch set 8dbc482489 extends support in calculating margins when ExtendsContentIntoTitleBar() is used. But this affects existing QWizard that sets custom margins through Aero style. This is because, the custom margins set by Aero style excludes top margin (titleBarSizeDp()) and excluding it once again cause slicing in the client window area.

This patch set fixes it by considering top margin only when system margins is used in windows.

Fixes: QTBUG-117428
Pick-to: 6.6 6.5
Change-Id: I6d6eefc691f26474257b58304dac169fba20b5e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-31 09:21:52 +00:00
Morten Sørvig
63fc3175b4 wasm: Add QLocale backend
This is a simple backend based on navigator.languages,
which gives us a prioritized list of languages in the
form '["en-US", "zh-CN", "ja-JP"]'.

Use this to implement QSystemLocale::query() for UILanguages
and QSystemLocale::fallbackLocale().

Register an event handler for the native QWindow:languagechange
event in the QSystemLocale constructor. This event handler
stays active for the lifetime of the QSystemLocale object.

Task-number: QTBUG-116613
Change-Id: Ibd176748377e891b63a3f1d57605af0c2a49edb3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-31 08:09:23 +02:00
Tor Arne Vestbø
adf39eff44 Blacklist tst_QWidget::hoverPosition() on macOS 14 x86_64
It relies on moving the mouse, which is likely related to this
failing in CI.

Pick-to: 6.6 6.5 6.2
Change-Id: Ib4a3ba7a9e874c9c2ef2d6d16143adf072e47588
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
2023-10-31 00:16:28 +00:00
Anton Kudryavtsev
11a68f13e9 qnetworkcookiejar: optimize validateCookie
Use string view more to reduce allocations

Change-Id: Ib73fb9607438c7da115406f61653641163370122
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-30 22:33:15 +03:00
Anton Kudryavtsev
0774a9c556 qnetworkcookiejar::deleteCookie: port raw loop to algorithm
Use std::find_if with const iterators to avoid unconditional detach

Change-Id: Ibc9d05586a1926fefba5c6fd73c5b15ee815cd6d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-30 22:32:44 +03:00
Anton Kudryavtsev
08fff11232 qnetworkcookiejar: optimize cookiesForUrl
Check cheap conditions first.
Use string view types more
Don't insert in the middle of list, just append and then sort

Change-Id: I1ad7c3459eab45b2289bfe044314eec7130d8153
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-10-30 22:32:28 +03:00
Mårten Nordheim
d8d5922f16 QLocal8Bit::convertFromUnicode[win]: handle trailing high surrogate
The win32 API doesn't give us much choice. _Some_ code pages have
support for returning some error if we pass a specific flag, but not
all of them.

Anyway, since the code pages might not support all that UTF-16 provides,
we can't reasonably make it error out on characters that cannot be
converted.

So, the most reasonable thing we can handle is a unpaired high surrogate
at the end of a string, assume that the rest of the string was fine, and
that the low surrogate will be provided in the next call.

Pick-to: 6.6 6.5
Fixes: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: I1f193c9d8e04bec769d885d32440c759d9dff0c2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-30 21:25:35 +02:00
Mårten Nordheim
e34ee8e88a QLocal8Bit::convertFromUnicode[win] use local array for buffer
To match convertToUnicode, we use a local array as a temporary
buffer, then if any growth is needed we work directly with a QBA.

As a drive-by: explicitly cast to int where we pass int

Pick-to: 6.6 6.5
Task-number: QTBUG-105105
Task-number: QTBUG-118185
Change-Id: I1efff318eea41d87d558599d737b64107af4ae17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-30 21:25:35 +02:00
Mårten Nordheim
36a6522b48 QLocal8Bit::convertFromUnicode[win]: Drop UsedDefaultChar argument
We don't use the value, and the docs[0] say that we get the best
performance if we don't pass the argument.

[0] https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte#remarks
See table

Pick-to: 6.6 6.5
Task-number: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: I3eb5e023a936fe3def5169e3fb492a62708bbf44
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-30 21:25:35 +02:00
Mårten Nordheim
ab009f2f03 QLocal8Bit::convertFromUnicode[win] move cast earlier
So we don't have to do this multiple times when calling the function.

Pick-to: 6.6 6.5
Task-number: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: Ifa72eedd5f71365618ec6b67fa3047f90f4eb541
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-30 21:25:35 +02:00
Mårten Nordheim
94214fe100 QLocal8Bit::convertToUnicode[win]: handle more than one octet state
Both to store and to restore.

Without this a 3 or more octet sequence would cause errors or wrong
output. This can be seen with GB 18030.

Pick-to: 6.6 6.5
Fixes: QTBUG-118318
Task-number: QTBUG-105105
Change-Id: Id1f7f5f2fba4633b9f888add2186f4d8d21b7293
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-30 21:25:35 +02:00