Commit Graph

59293 Commits

Author SHA1 Message Date
Giuseppe D'Angelo
b3b15f4caf QLoggingCategory: enable fatal messages if critical is disabled
The if constexpr chain assumed the "last case" was critical, when
instead we need to handle fatal as well.

Use the opportunity to have the compiler break compilation in case
someone adds a new enumerator in the future and doesn't handle it
(i.e. does not repeat the mistake that I just did).

Thanks to Kai for spotting the problem.

Amends eb63f2eb05

Change-Id: I21e1dfd0dd17ccf0d6403f1dcd6d56cc2a95ce26
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-06 06:30:55 +01:00
Giuseppe D'Angelo
21425c05e0 Add a centralized dependent_false type
The main use case is to static_assert on it at the end of a
if constexpr / else if constexpr chain.

See P2593 for a discussion about why this is pretty much the
only "allowed" way of doing so, short of running into IFNDR.

I'm actually adding two versions: one for TTP and one for NTTP,
as Qt code uses both.

Apply it in QFlatMap.

Change-Id: Iaff97e350784683d0c3994020b1352d5188931d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-06 06:30:55 +01:00
Giuseppe D'Angelo
3a449bbb69 Wait conditions example: code tidies
In no particular order:

* Clean up #includes.

* Document what is protected by the mutex.

* Use explicit, nullptr.

* Use lock managers, not manual calls to lock/unlock.

* Unlock the mutex before notifying the condition variables.

* Condition variables are always meant to be used in a while loop, and
  never with a plain if, because of spurious wakeups.

* Don't lock a mutex just to protect a plain integer. We have atomics
  for that use case.

* Remove an unneeded signal, therefore also the need of using
  Q_OBJECT and the inclusion of the moc-generated file.

Pick-to: 5.15 6.2 6.4
Fixes: QTBUG-108860
Change-Id: I2afc77955b95de8aa5fb88048cd9feb217f83b4f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-06 06:30:55 +01:00
Timothée Keller
8c33fe9ded Update list of windeployqt modules
Added DBus, StateMachine and 3DLogic modules to windeployqt module list

Task-number: QTBUG-105135
Pick-to: 6.4
Change-Id: Ied8624e87f62bd655db8b82cf9fe20d72873d823
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-12-06 01:19:44 +01:00
Mikolaj Boc
71c722c4a8 Fix the canvas element replacement for screen
The deprecated path in QScreen still allows to provide a
canvas as the screen element.

The order of parameters in replaceChild call was wrong there,
though.

Change-Id: Id499967e3c9cdc1652e2dc251e352b9564c99f70
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-12-05 23:14:06 +01:00
Edward Welbourne
8bd2368fd4 Improve documentation of QDateTime::toTimeSpec() and its family
Make explicit that the result is equal to the original.
Use less roundabout ways of saying what conversion was done.

Change-Id: Iec12223cca1ce166ed9767a63e6dec05ba2fa456
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-05 23:04:13 +01:00
Edward Welbourne
c4a0630e45 QDateTime::to{LocalTime,UTC}(): relocate to among related code
These two functions were a long way from their closest relatives.
Relocate to make it easier to compare and contrast within the family.

Change-Id: I30062c16b318f222b75b527c6af5b443770fe36a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-05 23:04:13 +01:00
Edward Welbourne
ec8253d5c7 Clean up QDateTime documentation
Various rephrasings in hopes of greater clarity.

Change-Id: I243e248c850d0da06851327fb0e45b3b817c6ba2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-05 23:04:13 +01:00
Edward Welbourne
396fa0fcd9 QDateTime::fromM?SecsSinceEpoch() docs: add missing note
The spec+offset overloads include a note about times outside the
supported range; however, this was missing for the time-zone
overloads. Also label all four as \overload.

Change-Id: I371ea8ff7d2fb26f679a078a1d8b5d70a6131c35
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-05 23:04:13 +01:00
Edward Welbourne
7a1e444735 QDateTime docs: use plainer language to talk about time since 1970
Going into the grungy details of when 1970 started is rather
incidental; it's the start, in UTC, of the year 1970, so phrase it as
such. Thanks to hjk for help with finding clearer phrasing.

Change-Id: I4be60441662d2ca4dcd8c5a448f609d6050f393b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-05 23:04:13 +01:00
Edward Welbourne
e94b0a0c9a QDateTime::set{TimeSpec,TimeZone,OffsetFromUTC}: s/will/may/
There is no guarantee that a change to time representation will change
the date and time of the result.

Change-Id: Ib2d481236ca95638e1258baf4fe660b2f38fa229
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-05 23:04:13 +01:00
Edward Welbourne
ca57d3f6d4 QDateTime::fromM?SecsSinceEpoch(): fix indent of doc
Use indent 4, same as the surrounding docs, instead of 2, for consistency.

Change-Id: If929b48e5f35379f389b47c531154c808610b823
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-05 23:04:13 +01:00
Edward Welbourne
3943ad8519 QDateTime docs: fix s/date-time/datetime/g for consistency
Change-Id: Ibd0af113915fe7d3bedcc4deb95c7525ad30ba8d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-12-05 23:04:13 +01:00
Edward Welbourne
6825487bc9 Add comment on fallback for system zone ID
Change-Id: I6a1eabf2894c549deace7d35bc18781c3fd3df4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-05 23:04:13 +01:00
Edward Welbourne
992b92d8c4 Document how to recognize an invalid QTimeZone::OffsetData
It's mentioned in some of the functions, but the type's documentation
should also mention it.

Change-Id: Ia8ceb21ff30df1b5933782ae7d8bebe9f436404c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-05 23:04:13 +01:00
Edward Welbourne
930f1cef78 Expand documentation of QTimeZone::M{in,ax}OffsetSecs
Also save some wanton line breaks in \value directives.

Change-Id: I16e0798d7474febb7946ece0ad57c80476f9d9e2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-05 23:04:13 +01:00
Edward Welbourne
e4528eb77d QTimeZone doc: mention the ICU escape from MS's bad APIs
Change-Id: Iccf2b6c05a1f3aaae600bb06fe8d62c20a94ee86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-05 23:04:13 +01:00
Mikolaj Boc
e50bc60e87 Resize wasm windows using a div outline
Introducing a div outline which handles the resize events by itself.
Manual computations in wasm compositor are no longer needed.

The outline reacts to setting css variables (border-width,
resize-outline-width), it sets the correct cursors using css and
always keeps the correct size.

Fixes: QTBUG-107498
Change-Id: I6b0564632af5e17e464fe93a3dfa20820c624292
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-12-05 22:26:59 +01:00
Volker Hilsheimer
f546f3700b Fix documentation of QAction's text property
The text of an action is used as the tooltip and iconText unless those
are explicitly set, and only then does an '&' mnemonic get stripped.
An '&' in the text will generate mnemonic shortcuts in some UI controls,
such as menubars, menus, or buttons. Document that in the text property,
and add a see-also from the constructor to the relevant properties.

As a drive-by, reduce the usage of "widget" in the documentation.
QAction now lives in QtGui and can be used by both widget and Qt Quick
UIs.

Fixes: QTBUG-109060
Fixes: QTBUG-109061
Pick-to: 6.4 6.2
Change-Id: I5e7c2a01b8029f519d7050187e486b667d3cd52b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-12-05 19:02:59 +01:00
Kai Köhne
ade429af33 Doc: Add documentation for qCFatal()
Change-Id: Iad9ea51285300eb06fdd7e68dd747702cb0a80e5
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-12-05 19:02:59 +01:00
Kai Köhne
f5f5a29bba CMake: Properly quote paths in FindPPS.cmake
PPS_LIBRARY and PPS_INCLUDE_DIR cannot be empty at this point (otherwise
PPS_FOUND would be FALSE). But it's arguably good practice to puth paths
in quotes.

Task-number: QTBUG-108930
Pick-to: 6.4
Change-Id: I87128da50f37cd6aa1a66811261a05ceb8c3e790
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-05 19:02:59 +01:00
Amir Masoud Abdol
d77ce33082 Move Some of the Private CMake Helper Scripts from bin/ to libexec/
After this change, private CMake scripts are mostly live in
`libexec/`, except the `qt-cmake` which will stay in `bin/`.
This doesn't affect the Windows configuration.

- `qt-cmake` stays in `bin/`
- `qt-configure-module` moves into `libexec/`
- `qt-cmake-private` moves into `libexec/`
- `qt-cmake-private-install.cmake` moves into `libexec/`
- `qt-cmake-standalone-test` moves into `libexec/`
- `qt-internal-configure-test` moves into `libexec/`

In cases where `QT_GENERATE_WRAPPER_SCRIPTS_FOR_ALL_HOSTS` is set to
ON, e.g., ANDROID, WASM, both Batch and Bash files will be generated
and placed in `bin/` and `libexec/` accordingly; in both cases,
qt-cmake and qt-cmake.bat will be in `bin/` anyway.

[ChangeLog][CMake] The private Qt CMake scripts, i.e.,
qt-configure-module, qt-cmake-private, qt-cmake-private-install.cmake,
qt-cmake-standalone-test and qt-internal-configure-test were moved
into $prefix/libexec on Unix platforms.

Fixes: QTBUG-107621
Change-Id: Ic4f4ec85f64d2ede0e208bca928959e30be906a6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-05 18:02:59 +00:00
Aleksandr Reviakin
3b0ef74694 Use const reference in loop in JSON Save Game example
Fixes: QTBUG-108857
Change-Id: I503a3c9ebe145d0dae52b74435212807405f0247
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-05 19:02:59 +01:00
Tor Arne Vestbø
a62f49e736 Windows: Avoid triggering QPlatformWindow creation when setting app badge
Calling QWindow::winId() will create the platform window if it hasn't
been created yet, which is not what we want.

Change-Id: I9d4ecb863f961fd3cef6d13e27bf175bf55eabcf
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-12-05 16:05:39 +01:00
Tor Arne Vestbø
8eab4e4850 macOS: Remove shadowed variable in handleKeyEvent
Change-Id: Icf9f9ecf673a10a15a2d0156bcd5c1da3688b591
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-05 15:58:29 +01:00
Tor Arne Vestbø
b2e5d54726 macOS: Don't pass on key event text for function keys when IM is disabled
On macOS function keys such F1-F16 and the arrow keys result in NSEvents
with a character in the 0xF700-0xF8FF range of the private use area:

 https://unicode.org/Public/MAPPINGS/VENDORS/APPLE/CORPCHAR.TXT

We used to filter these out for all key events sent from the platform
plugin (4dbce2a469), but this had the side effect of breaking the
Unicode Hex Input keyboard's ability to explicitly input these
characters.

As of 705665957b we started trusting the
macOS text input system on whether a key event should include text or
not, which fixed both the hex keyboard and Russian keyboard input when
the key included the ^⌥ modifiers.

Unfortunately this didn't account for the case of non-IM enabled input,
so we started sending key events with text for arrow and function keys.
And since Arial Unicode MS provides glyphs for these code points, we
would end up with confusing characters in input fields when pressing
the arrow keys.

In general a client can not assume that the text() of a QKeyEvent is
printable, and the logic to determine if a character should be filtered
out or not depends on the font matching, since all code points can in
theory have a font that provides a glyph for it, but since we know that
the function key range on macOS is not supposed to have associated
glyphs we filter them out explicitly.

Note that we only do this for non-IM enabled text input, and otherwise
leave it up to the macOS text input system to determine if a event
should result in text insertion or not.

Task-number: QTBUG-106393
Pick-to: 6.4 6.4.2
Change-Id: I5498fbedee21b0720c56e99b26924959ade897bf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-05 15:58:26 +01:00
Joerg Bornemann
0c5f1beddc CMake: Clean up usage of the examples/widgets/painting/shared lib
Remove conversion artifacts.

Also, remove setting the include path. The library's interface takes
care of that.

Change-Id: Ib5043f15ede2171ab876ccbe603ed0b84de1bce4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-05 15:55:53 +01:00
Joerg Bornemann
c682d78ac2 CMake: Fix examples/widgets/painting/shared library
This library deliberately links PUBLICly against Qt6::Widgets and
Qt6::OpenGL. Same for the target_include_directories call.

This partially reverts a5de12f0d7.

This fixes the builds of examples using this library.

Change-Id: I2b5791044afc82e71df4a3bbfc26e5b1ab9afa76
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-05 15:55:53 +01:00
Yuhang Zhao
732d073351 Windows QPA: Always apply system background color for top level window
This is a follow-up patch of commit 2991c66b75

We can unset the window background brush and always draw the background
ourself. Qt always paint all pixels anyway when blt'ing the backingstore,
so it should be safe to do this.

Since a theme might not provide a palette (e.g. when desktop setting
awareness is disabled), always use the default application palette.

Change-Id: I4fdc2467b3cc3999dd1acfe9411cec077ca66bd3
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-05 15:55:53 +01:00
Volker Hilsheimer
b3dbfdd597 Windows: Reduce warning output when creating a new window
Amends f32aa06f4f, which called
setDarkBorderToWindow with false when creating a window if windows is
not running in dark mode. This generates warning messages on Windows 10.

We don't have to call the setter at all unless we want dark mode frames,
so skip it if we'd call it with 'false', as that is the default anyway.

At the same time, use categorized logging for these messages; they are
not the result of application developers doing something wrong, and are
only interesting when analysing specific issues.

Change-Id: If80028d71cc2cd9d6dd380976e00b736741287cb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-05 15:55:53 +01:00
Volker Hilsheimer
a874087504 QComboBox: hide the popup on keypress rather than ShortcutOverride
Qt sends a ShortcutOverride to the focus widget to evaluate whether the
widget's key event handling has higher priority than shortcut handling.
A KeyPress is then sent if the ShortcutOverride comes back accepted, or
if the Shortcut event returns ignored.

QComboBox needs to accept the ShortcutOverride for Cancel, so that
hiding the popup has priority over application shortcuts. But it should
only hide the popup when the KeyPress event actually arrives, as
otherwise the the focus widget changes (from popup to combobox), which
breaks event delivery on macOS.

Fixes: QTBUG-108908
Pick-to: 6.4 6.4.2
Change-Id: Ie9cce1c2041cbe0e41be301686d7c3b5683e9f10
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-05 14:55:53 +00:00
Morten Sørvig
01412ff16e wasm: add native QByteArray conversion functions
Add functions which converts to and from JavaScript
data arrays:

  static QByteArray::fromUint8Array(emscripten::val array)
  emscripten::val QByteArray::toUint8Array() const

with corresponding internal qstdweb API:

  static Uint8Array Uint8Array::copyFrom(const QByteArray &buffer)
  QByteArray Uint8Array::copyToQByteArray() const

Both functions will make a copy of the data, i.e. there
is no shared reference counting. They take and return
Uint8Array typed array views, via emscripten::val JavaScript
object references.

Unlike other native conversion functions, these have
the special property that the data referenced by the
native Uint8Array exists outside the heap memory area.

This means we can’t e.g. memcpy the data. However, the
heap is itself a JavaScript ArrayBuffer, and we can
create a Uint8Array view to the buffer owned by the
QByteArray, and then use JavaScript API to copy. See
the qstdweb::Uint8Array::copy() implementation.

That also means that a fromRawUint8Array() variant
(which does not copy) is not possible to implement,
since we can’t create a pointer to the source data.

The inverse toRawUint8Array() is implementable - it
would return a Uint8Array view which references the
heap’s ArrayBuffer. However, this may turn out to be
ill-advised, since Emscripten will create a new ArrayBuffer
if/when it resizes the heap. In any case this left for
a future expansion.

Change-Id: Icaf48fd17ea8686bf04cb523cc1eb581ce63ed34
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-12-05 13:04:51 +00:00
Nicholas Bennett
3aaf5975e4 Docs: Document the QT_ANDROID_SDK_BUILD_TOOLS_REVISION CMake variable
When updating Qt for Android platform documentation, it was discovered
that the CMake variable for setting a specific Android SDK Build Tools
Revision was undocumented.

Pick-to: 6.2 6.4
Change-Id: I5f1b4e9d10b9ce817f5529cf4897bd0423a84455
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-12-05 15:04:51 +02:00
Eskil Abrahamsen Blomfeldt
c9d991de1f Fix missing text when Harfbuzz fails to shape a substring
This amends fccd419dd6.

If Harfbuzz failed on one of the items in a string and returned
zero glyphs, then we would exit the shaping loop. The mentioned
change fixed a crash related to this when the ignored character
was the only character in the string, but it occurred in a
subitem of a longer string, then we would return and fail to
lay out the rest of the string.

This popped up recently because an update to Harfbuzz has caused
it to return zero glyphs when applying the Apple emoji font to
an isolated variant character (see bug report). When we matched
the symbol to the main font and only the variant character to
the emoji font, we would get in this situation, and end up
exiting the shaping early.

[ChangeLog][QtGui][Text] Fixed a regression which would
sometimes cause text to disappear if the string contained
an unmatched variation selector character.

Pick-to: 6.4
Fixes: QTBUG-108799
Change-Id: I616ab1b2d33c2df731419c5ce06fbc578a625a32
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-05 07:55:43 +01:00
Eskil Abrahamsen Blomfeldt
64847a3930 Don't return empty glyph runs from QTextLine
The last (or only) QGlyphRun would be ignored if it did not contain
any glyphs, but we did not have the same conditions for substrings
represented by different font engines. This was an oversight and
we should be consistent.

Pick-to: 6.4
Task-number: QTBUG-108799
Change-Id: Idfa187f6198247d5cc94804a4e55d5de3ccd739e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-05 07:55:33 +01:00
Eskil Abrahamsen Blomfeldt
0dcd640a1f Don't return a visual glyph for ignorable characters
When Harfbuzz returns zero glyphs, this will typically be because
the character is ignored. We currently have no way to differentiate
this from actual error cases, so to avoid return the error glyph
for cases which are not really errors, we set the dontPrint flag
for this.

When we add a way to differentiate between error cases and non-error
cases later, we should revert this for the actual errors.

Pick-to: 6.4
Task-number: QTBUG-108799
Change-Id: I2a910d951b71c705fb4dd761fcfe3a942b3afa7c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-05 07:55:25 +01:00
Giuseppe D'Angelo
eb63f2eb05 QMessageLogger: make qFatal categorized and streamable
There is no technical reason why qFatal shouldn't support categorized
logging, nor have a streaming version.

There is perhaps an API issue, that is, a streaming syntax may encourage
users to do "too much":

  qFatal() << gatherLogs() << saveDatabase() << ...;

and that sounds like a bad idea in case the application is in an
unrecoverable state that requires immedate terminatation (indeed,
through qFatal). I'd err on the side of providing the extra convenience.

This commits adds overloads of QMessageLogger::fatal to support
categorized logging (note that fatal messages cannot be disabled),
the relative qCFatal macro, as well as overloads for streaming.

[ChangeLog][QtCore][QMessageLogger] QMessageLogger::fatal now supports
categorized logging, for instance using the qCFatal(category) macro.
Moreover, qFatal() and qCFatal() now support streaming of values
to be printed in the fatal message.

Change-Id: Ia57f25f5c85fca97e5fcf27eaa760dbde09cba0e
Fixes: QTBUG-8298
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-05 04:15:39 +01:00
Thiago Macieira
33e682f9af QString: use memcmp() in ucstrncmp() where it's acceptable
ucstrncmp() exists because memcmp() can't be used to sort UTF-16 code
units in little-endian platforms. But it can be used in big endian
platforms and when sorting isn't necessary.

Change-Id: I0e5f6bec596a4a78bd3bfffd16c908c46cc9af2d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-04 17:56:45 -08:00
Thiago Macieira
339aa99fec QString::toLatin1: do the same as fromLatin1 for sub-16 characters
Perform a pair of overlapped loads & stores, so we can perform the
contracting and inserting of question marks in vector code.

Change-Id: Ib42b3adc93bf4d43bd55fffd16c2f5e479b0f6fa
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2022-12-04 17:56:45 -08:00
Thiago Macieira
3ef43ca837 QString::fromLatin1: improve the sub-16-character case
For both the [4, 7] and [8,15] length cases, we can perform the same
technique: perform two overlapped loads, zero-extend, then perform two
overlapped stores. The 8-character case could be done in a single
load/store pair, but is not worth the extra conditionals. And it should
have the exact same performance numbers whether we use non-overlapping
4-character operations or completely-overlapping 8-character ones (I
*think* the full overlap is actually better).

The 4-character operation is new in this commit. That reduces the
non-vectorized, unrolled to at most 3 characters.

Change-Id: Ib42b3adc93bf4d43bd55fffd16c257ada774236a
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2022-12-04 17:56:45 -08:00
Thiago Macieira
2b9d4afc95 QString::{to,from}Latin1: add the ability to do overlapping tails
If the string length is larger than the number of characters we can
operate on with a single vector loop, we can transform the tail using a
vector too, just overlapping up to 15 characters with the last iteration
o the loop.

Change-Id: Ib42b3adc93bf4d43bd55fffd16c2dcab115e50f7
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2022-12-04 17:56:45 -08:00
Thiago Macieira
3b528670e6 QString::toLatin1/SSE: simplify the code to merge question marks
Just move the test of Checked into the lambda, so we can call it
unconditionally.

Change-Id: I0e5f6bec596a4a78bd3bfffd16c9b84ff4a31bb9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-04 17:56:45 -08:00
Thiago Macieira
23f1d68b09 QString: improve the SSE2 qustrlen to calculate the length as we go
Instead of updating the pointer that we're reading, update the offset
(which is the length). The number of variables we're operating on is the
same (2), but this simplifies the calculation at the end.

BEFORE                             | AFTER
        tzcntl  %edx, %edx         |         tzcntl  %edx, %eax
        subq    %rdi, %rax         |
        sarq    %rax               |
        shrl    %edx               |         shrq    %rax
        addq    %rdx, %rax         |         leaq    (%rax,%rcx), %rax
        ret                        |         ret

We remove one subtraction and one shift. I don't know why it decided to
use LEA instead of ADD... The shift changed from 32- to 64-bit because
we cleaned up the constant 2 (an int) in the file with sizeof(char16_t)
(a size_t), but that has no effect in performance.

Change-Id: I0e5f6bec596a4a78bd3bfffd16c9650a60289f4c
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2022-12-04 17:56:45 -08:00
Thiago Macieira
1acd028b0c QString: move the body of qustrlen's SSE2 implementation
Change-Id: I0e5f6bec596a4a78bd3bfffd16c96189533ad94e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-04 17:56:45 -08:00
Thiago Macieira
40083f380f QString: extract qustrlen's attribute to a macro
I'll need it for the rest of the algorithms.

Change-Id: Ib42b3adc93bf4d43bd55fffd16c1a2b31ac41c6d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-04 17:56:45 -08:00
Thiago Macieira
9d0c29b882 QString: remove the GCC 7 + ASan warning
GCC 7 is not supported in Qt 6, and I really don't expect
anyone would be using it in 2023 with ASan anyway.

Change-Id: I76216ced393445a4ae2dfffd1729a7b82a8776cc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-04 17:56:45 -08:00
Thiago Macieira
23555d9ac4 QString: reorganize the SSE2 helper functions
I'm going to need add a couple more, so move the block up.

Change-Id: Ib42b3adc93bf4d43bd55fffd16c1942ca56a395b
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2022-12-04 17:56:45 -08:00
Thiago Macieira
0cd105079f QString: replace #if with if constexpr for the x86 ISA extensions
Because it looks like it works in all our compilers and gets us at least
basic syntax checking. This is important for me because I usually
compile with a very high -march= flag (currently, tigerlake) and would
not see any syntax errors I may introduce.

Whenever possible, this uses a return inside the if constexpr and then
has the fallback code simply eliminated, but still fully compiled.

Almost all changes are basic reindentation, except for a few variables
that must be declared above the block in question, plus some shenanigans
with the variables in qt_to_latin1_internal(): we want to avoid emitting
multiple loads for the same constants, so we force the compiler to reuse
the shrunk version of the 256-bit registers.

The non-AVX2 code will receive a few minor face-lifts in the next few
commits. Those don't intend to actually improve performance by much. The
real work will happen in the AVX2 code later. I dropped the -Os code
because I don't have the spare time to test it and maintain it; if
there's interest, we can simply disable the entire set vector
optimization set.

Change-Id: Ib42b3adc93bf4d43bd55fffd16c1128c1a4d4875
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2022-12-04 17:56:45 -08:00
Christian Ehrlicher
9d27c07e28 SQL/MySQL: fix handling of json column
Add handling for MYSQL_TYPE_JSON by treating it the same as
MYSQL_TYPE_BLOB (which is used by current MariaDB Server for a json
column)

Pick-to: 5.15 6.2 6.4
Fixes: QTBUG-101680
Change-Id: I4d4b0cdad73cd12e0db4df4021fddbd6a649c8ed
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-05 01:56:45 +00:00
Cristian Adam
676506a3d5 Warn about WinRT only on WIN32
Amends 040aef5b2f which removed the MSVC
condition.

By testing for WIN32 all compilers are taken into consideration.

Change-Id: I8323fa8e866fe04063cfe30875e563524beae6c2
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-12-04 22:11:33 +01:00