Commit Graph

59214 Commits

Author SHA1 Message Date
Ahmad Samir
9d9c25e214 Use QString/QByteArray range erase()
Change-Id: I0fb81306ebe8fc7acd63bb62dc6720c734461da0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-07 15:03:03 +02:00
Aleksandr Reviakin
83be948833 Remove useless Q_OBJECT in Semaphores example
Fixes: QTBUG-108859
Change-Id: I1acf47b9dfd9c38546a2e965baa74067cedffc4a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-12-07 14:03:03 +01:00
Mikolaj Boc
4d07f84307 Fix the coordinate problems in wasm windows
The QWasmScreen's top left coordinate does not precisely translate
to correct page coordinates, especially when fixed position is used
and page margins are set. Also, this is wrong in complicated setups
with e.g. multiple nested elements.

Therefore, to get the correct coordinates in pointer event handlers,
we have to assume the local coordinates of the screen, and translate
those to the (possibly incorrect) coordinates that QWasmScreen thinks
it has in page.

It is another problem to fix the wrong coordinates QWasmScreen thinks
it has in the page.

This has been checked with complicated setups with screens in scroll
containers, screens with fixed position, screens with relative position,
with and without body margins etc.

Change-Id: I749f2507fec7ae278b6f9d7d13ae288e65472dba
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-12-07 13:03:03 +00:00
Mikolaj Boc
6d780fa0ab Fix the qwasmcompositor_main test
This got broken with the introduction of the compositor patch.

Change-Id: I7d85795eb537449855a4cce3c8b6b031095c3f7f
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-12-07 14:03:03 +01:00
Axel Spoerl
2f22a6e465 Mark static mm_load8_zero_extend [[maybe_unused]]
static Q_ALWAYS_INLINE __m128i mm_load8_zero_extend(const void *ptr)
is unused when compiled on Android.
This causes a compiler warning and blocks CI, if compiled with -Werror.

This patch marks the method [[maybe_unused]], in order to prevent the
warning.

Change-Id: Ife10c0a84ac34196405ce9c2356351d825751adb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-07 10:26:06 +01:00
Marc Mutz
68fd43212c corelib/QMakeLists.txt: fix order of files in in qNN section
They're supposed to be lexicographically ordered, so fix.

Pick-to: 6.4
Change-Id: I88acad048990b16b7e9dd073f55608a80e71c416
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-07 08:39:38 +01:00
Marc Mutz
6631444eb1 QString/QByteArray/QList: de-pessimize op+ [2/2]: overload on rvalue LHS
The + operator is left-associative, so a + b + c is (a + b) + c.

Apply the same trick C++20 applied to std::string's op+ and overload
for rvalue left-hand sides. This means that a + b + c is now
equivalent to

  [&] {
      auto tmp = a;
      tmp += b;
      tmp += c;
      return tmp;
  }()

removing a ton of temporary buffers (not objects, because CoW makes it
impossible for the compiler to track the single conceptual object
passing through the chain) when not using QStringBuilder (which isn't
available for QList).

This is BC, because the operators are all inline free functions or at
least inline members of non-exported classes.

Use multi-\fn to document the new operators. No \since is needed, as
this doesn't change the set of supported operations, just makes some
of them faster.

[ChangeLog][QtCore][QList/QString/QByteArray] Chained additions (a + b
+ c) now produce only one temporary buffer for the whole expression
instead of one per addition. Using += or QStringBuilder is still
faster, though.

Change-Id: I87e837d8803e79dc29c9268f73e6df9fcc0b09a3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-07 07:39:38 +00:00
Giuseppe D'Angelo
e7e3e4cf25 WASM: don't use a static_assert when an #error would suffice
No need to involve the compiler, make the preprocessor error out.

Change-Id: I37d3f241bd0879ba123fe26342aaaaff74c2fb6b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-12-07 07:24:14 +01:00
Thiago Macieira
04e668f6ba QFutureInterfaceBasePrivate: pack to remove padding
This structure was 216 bytes with 3 padding regions: 3 bytes between
continuationState and refCount, 4 bytes between m_progressValue and
m_progress, and 1 byte at the end after the booleans. The total of 8
bytes can be neatly reduced.

And since it's now a multiple of 16, we should get an effective 16 byte
reduction in malloc()ed size.

Change-Id: I69ecc04064514f939896fffd172e46d1d68cb28b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-06 22:24:14 -08:00
Thiago Macieira
e02933a17c QAnyStringView: move the two assertions to a central place
Move the assertions to qtypes.cpp, next to where one of them already
existed.

Change-Id: I51d12ccdc56c4ad2af07fffd172dae7c49d78273
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-07 06:24:14 +00:00
Thiago Macieira
8be744df8a QAnyStringView: move the tag bits to the LSB for Qt 7
This removes the TODO that was left in the file. It's also applied for
bootstrapped use of QAnyStringView, even though it's currently not used
in the bootstrap lib.

Along with the previous commit of inverting the order of the members,
the code generated by GCC 12 for a visitation compares as:

_Z1f14QAnyStringView:                                           _Z1f14QAnyStringView:
        movabsq $4611686018427387903, %rcx                    |         movq    %rsi, %rax
        movq    %rdi, %rdx                                    |         shrq    $2, %rsi
        movabsq $-4611686018427387904, %rax                   |         andl    $3, %eax
        andq    %rsi, %rax                                    |         cmpq    $2, %rax
        andq    %rcx, %rsi                                    <
        movabsq $-9223372036854775808, %rcx                   <
        cmpq    %rcx, %rax                                    <
        je      .L15                                                    je      .L15
        movabsq $4611686018427387904, %rcx                    |         cmpq    $1, %rax
        cmpq    %rcx, %rax                                    <
        je      .L16                                                    je      .L16
        jmp     _Z1fI20QBasicUtf8StringViewILb0EEEvT_                   jmp     _Z1fI20QBasicUtf8StringViewILb0EEEvT_
.L16:                                                           .L16:
        movq    %rsi, %rdi                                    |         jmp     _Z1fI17QLatin1StringViewEvT_
        movq    %rdx, %rsi                                    <
        jmp     _Z1fI13QLatin1StringEvT_                      <
.L15:                                                           .L15:
        movq    %rsi, %rdi                                    <
        movq    %rdx, %rsi                                    <
        jmp     _Z1fI11QStringViewEvT_                                  jmp     _Z1fI11QStringViewEvT_

Fixes: QTBUG-109086
Change-Id: I51d12ccdc56c4ad2af07fffd172db128ca4105a5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-06 22:24:14 -08:00
Thiago Macieira
497275a8ba Q{Latin1,}StringView: invert members so the order is (data,size) in Qt7
Matches Q{Any,Utf8}StringView as well as std::basic_string_view in
Microsoft's STL and LLVM libc++, but not GCC's libstdc++. Interestingly,
it does match the order in libstdc++'s non-small std::basic_string.

Applied for bootstrapped use, so we ensure this works and keeps working.

Change-Id: I51d12ccdc56c4ad2af07fffd172db18254fff083
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-06 22:24:14 -08:00
Marc Mutz
1501f45c33 QFont: replace a QVLA with a C array
QVarLengthArray doesn't allocate, but is nevertheless dynamically
initialized, incl. thread-safe static overhead.

Turn the QVLA<QPair<int,int>> into a std::array<int,2>[] instead. This
container has constant initialization and the use of array<int>
instead of pair<int, int> means we can use the bool inverted argument
as an index into the array instead of having to switch over .first and
.second.

Saves ~600B in text size and ~100B in BSS on optimized Clang 15 AMD64
Linux builds, and the copying, under mutex protection, of the data at
runtime.

Amends 3558704ed5.

Pick-to: 6.4
Change-Id: Iad48eca4eef77011d4094125670ea302e8beae46
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
2022-12-07 07:24:14 +01:00
Marc Mutz
20d1477c14 tst_QString: fix custom QCOMPARE for strings > 2Gi characters
Same fix as in tst_qbytearray's QCOMPARE() in
cb9715557c.

Pick-to: 6.4 6.2
Change-Id: I2222d9015ae7121a2fbcf5b936b27de20e873064
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-07 07:24:13 +01:00
Marc Mutz
76cf4e67ab QCssParser: remove unused QPair include
Nothing uses QPair in this header, or the implementation file.

Change-Id: I59e37fd8d483a0b6da404e1093f0fbb7c35bc92e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-07 07:24:13 +01:00
Marc Mutz
e2c08b5f3a qcompilerdetection.h: de-duplicate feature test macro discussion
Both links are valid for both C++14/17 and C++20+ variants, they're
just sorted differently. Mention that.

Pick-to: 6.4
Change-Id: Id88ec05f935fd6d01c0f1e733ca42faaaa88dd25
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-12-07 07:24:13 +01:00
Amir Masoud Abdol
ca24ee14df Create the versioned variant of Qt tools in cross platform build
In cross builds, we are not creating versioned links for qt tools. This
patch addresses that. I've changed the signature of the
`qt_internal_install_versioned_link` such that it can be used for
non-target as well, so in cross build the qmake or qtmake.bat can be
processed with the same function.

Fixes: QTBUG-109024
Change-Id: I246621c18325d084622ca92b422e815ed06f1381
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-07 07:09:15 +01:00
Amir Masoud Abdol
d8abcc969b Remove the deprecated TYPE option from qt_add_plugin
As far as I can tell nothing uses TYPE anymore.

[ChangeLog][QtCore][CMake] The deprecated TYPE option of the
qt_add_plugin() has been removed. You can specify the plugin
type using the PLUGIN_TYPE option instead.

Change-Id: I786fbc772a23ae0037d9a4cf68018e3af5cb061d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-07 06:09:15 +00:00
Lorn Potter
924eec1daa wasm: add support for wasm64 build
This adds a new platform named wasm-emscripten-64
which sets the build and link argument -MEMORY64

 You may see this warning, please ignore at your own discretion:

 em++: warning: -sMEMORY64 is still experimental. Many features may not work.
 [-Wexperimental]

Fixes: QTBUG-104891
Change-Id: I8d3150d239ba72dbef5c2352e0171d6cfbe51b59
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-12-07 08:30:46 +10:00
Mikolaj Boc
310aecc94a WASM compositor, clear last mouse target if it is the removed window
m_lastMouseTargetWindow pointer may be kept even though the window
has been removed. This leads to memory access problems.

Change-Id: Ie83b607bf5a815540605671dd1d1ad37288074c5
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-12-06 23:15:02 +01:00
Markus Goetz
9329e4e8c7 tst_QNetworkReply: check whether we actually use six TCP connections in HTTP/1
Pick-to: 6.4 6.2
Task-number: QTBUG-25280
Task-number: QTBUG-108215
Change-Id: I5f94866e30f08465943922e3dee5150f37054225
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-06 07:02:53 +01:00
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