Commit Graph

57004 Commits

Author SHA1 Message Date
Sona Kurazyan
c3f76a867b QDom: Clean-up warnings about old-style cast uses
Change-Id: I7cf2089f34e46a901f8b03987feed24773a72c00
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-22 02:26:33 +02:00
Shawn Rutledge
bd1ea2eb92 Replace a few more QString::fromLatin1() with _s literals
Wasn't done in 7d79b94db7

Pick-to: 6.4
Task-number: QTBUG-98434
Change-Id: Id9c26f6b58e2c96a1c5f72154b735b136c57debc
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-06-22 00:14:27 +02:00
André de la Rocha
ecd41111a3 Add ExpandCollapse UI Automation pattern to combo boxes
Also add support to expandable/expanded states to QAccessibleComboBox
in widgets. QtDeclarative will still require updates so that QML combo
boxes report the expanded/collapsed state and react to UIA actions.

Task-number: QTBUG-103591
Pick-to: 6.4 6.3
Change-Id: Iff8ba5e3143778ce17998dbe7f5f76cae658dc19
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-22 00:08:34 +02:00
Mate Barany
b9b5734559 Disable useless-cast warning for moc generated code
The useless-cast gcc warning is disabled in the files generated by
the moc. A typical warning is like

using_t = void(Counter::*)(int );
if (*reinterpret_cast<_t*>(_a[1]) ==
    static_cast<_t>(&Counter::valueChanged)) {
        *result = 0;
         return;
    }

Removing the static cast results in a compilation error
"address of overloaded function with no contextual type-of
information" in moc_myobject.cpp files.

Checking whether we have an overload set or a single function
might be too much effort for too little benefit and may not worth
it.

Fixes: QTBUG-71938
Change-Id: I6f67e163a3493b51fb95f54218ce6bf9a302f824
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-22 00:08:34 +02:00
Topi Reinio
0c82d6a75a Doc: Fix online macros for commercial template
qt-module-defaults-online.qdocconf includes online-specific overrides
for some of the documentation macros. This needs to happen also in
the commercial template to have equivalent behavior.

Pick-to: 6.4 6.3
Change-Id: I2ca3246fbf16cef502e8eada056df6e8db573d5d
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2022-06-21 22:08:34 +00:00
Mikolaj Boc
bc676a7d7a Document QMouseEvent::pos() as deprecated in 6.0
The API is deprecated, but the documentation does not state that.

Fixes: PYSIDE-1750
Pick-to: 6.4 6.3 6.2 6.1 6.0
Change-Id: I038ffeb958312d7648690743e06598a15dfb4cbc
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-06-22 00:08:34 +02:00
Shawn Rutledge
579f0a4cf2 Remove unused variable in tst_QTextEdit::setDocumentPreservesPalette()
Change-Id: I96c0f39c2ee1bd03cf0d7939624652ee008c9726
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-06-21 21:42:18 +02:00
Alexey Edelev
84e22f9e82 Fix concurrent access to files by androiddeployqt in multi-abi builds
'androiddeployqt' supposed to copy artifacts that may not have
abi-specific identifies. One example is Qt6Android.jar file. We need
to prevent execution of multiple androiddeployqt instances in
parallel. External projects now are divided into two steps. The
first runs the build and can be executed in parallel to the build
steps from the other external projects. The second one triggers
androiddeployqt and can only be run exclusively in relation
to the similar steps from other ABI-specific external projects.

To solve the issue we build the dependency chain between the all
ABI-pecific qt_internal_${target}_copy_apk_dependencies targets to
execute androiddeployqt sequentially. This is non-optimal, but
guarantees that androiddeployqt is not running simultaneously with
another instance in external projects.

Pick-to: 6.3 6.4
Fixes: QTBUG-104013
Change-Id: I39a25dd5f38ed988e0ca74b185024bc602ab81a1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-21 21:42:18 +02:00
Andreas Eliasson
ac171469a0 Doc: Revise Qt Test tutorial
- Make it explicit that each chapter can be run as a stand-alone test
application
- Add a CMake section on how to build the executable

Task-number: QTBUG-103730
Pick-to: 6.4 6.3
Change-Id: Id4c87c454521f698dcf16cfdc176318dd3e16786
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-06-21 11:08:49 +00:00
Ilya Fedin
56a33edf2a xcb: Port XSync call in QXcbWindow::create to xcb
QXcbConnection::sync is a full equivalent of calling XSync with false,
they both are sending GetInputFocus request and getting its reply

Pick-to: 6.4
Change-Id: I4f91b9447a02def41a8693a54312856b56e74811
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-06-21 11:07:47 +00:00
Liang Qi
a79e2aafd6 xcb: set primary screen more correctly
For example, when having virtual monitor which includes two real
monitors, the primary information in xcb_randr_monitor_info_t
is normally false, because user can only set it for output.

Kudos to Jiang Wu for his first patch and details of the issue.

Done-with: Jiang Wu <wujiang@kylinos.cn>
Pick-to: 6.4 6.3
Change-Id: I6af443ff69d347a6d86efc9c8ea7a5d18f4c3e24
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Jiang Wu <wujiang@kylinos.cn>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-06-21 04:05:53 +02:00
Jiang Wu
fd9aeb1b38 xcb: clear m_singlescreen before update
Pick-to: 6.4 6.3
Change-Id: Iafff57be82b5beb1f5702c00e0b6d7d0dd3ccdc2
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-06-21 02:05:53 +00:00
Nils Jeisecke
03e76ac23d xcb: fix missing initialization of m_cursor
Regression introduced in 9a4c98e556:

m_cursor is not initialized and never set when monitorInfo is not
available in QXcbScreen::setMonitor. This seems to happen when running
in VNC, e.g. on a Raspberry Pi.

This usually results in crashing the application pretty soon.

Using a unique_ptr solves both the initialization and a possible leak
when setMonitor is called multiple times.

[ChangeLog][Linux/XCB] Fixed crash when no monitorInfo is available (e.g. VNC).

Fixes: QTBUG-104443
Pick-to: 6.3 6.4
Change-Id: If13493c177121a1994b5d00dfbd64f1da694df2e
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-06-21 01:04:12 +02:00
Joerg Bornemann
fc2e40e88d qmake/MinGW: Install separate debug info of DLLs next to the DLL
...instead of next to the import library.

If separate_debug_info is enabled then we would create an install rule
that puts the .dll.debug file next to the .a file.  GDB however expects
the file to be next to the .dll.

Fix the installation rule in separate_debug_info.prf accordingly.  This
affects the MinGW packages of Qt 5.15 and user projects targeting MinGW.

Pick-to: 5.15 6.2 6.3 6.4
Fixes: QTBUG-86790
Change-Id: If91c356e7e7f7f4330ebc43691e414929f9beb4b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-21 01:04:12 +02:00
Lars Knoll
9c1f3b6d4d Add QStringDecoder::decoderForHtml()
Now that QStringConverter can handle non UTF encodings through ICU,
add a way to get a decoder for arbitrary HTML code.

Opposed to QStringConverter::encodingForHtml(), this method will
try to create a valid string decoder also for non unicode codecs.

Pick-to: 6.4
Change-Id: I343584da1b114396c744f482d9b433c9cedcc511
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-21 01:04:12 +02:00
Thiago Macieira
d531c4b65d qsimd: don't enforce shstk (CET) feature on launch
Clang with -march=tigerlake or -march=sapphirerapids pre-defines
__SHSTK__, which QtCore require the feature, even if the OS does not
have support for it. That's of no consequence because the compiler does
not generate shadow stack operations on its own.

Pick-to: 6.2 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16fa1ad910f008b8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-06-20 16:04:12 -07:00
Sona Kurazyan
da0d7f61c8 QDom: Stop treating non-BMP characters as invalid
According to https://www.w3.org/TR/REC-xml/#NT-Char unicode characters
within the range of [#x10000-#x10FFFF] are considered to be valid, so
fix the check for valid characters accordingly. This requires changing
the loop over the input QString to iterate over code points (instead of
code units).

Fixes: QTBUG-104362
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I7dcf5cad05265a54882807a50522d28b647e06ee
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-20 21:29:04 +00:00
Mårten Nordheim
3d73aa660b function_ref test: Don't take reference of temporaries
When assigning the lambdas directly to a function_ref their lifetime is
limited to that of the expression. Store them on the stack first to
avoid the UB.

Fixes: QTBUG-104419
Pick-to: 6.4
Change-Id: I3c85ac683b0bd7768b646dc9d0a1ed4dd173e6f3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-20 19:52:01 +00:00
Tor Arne Vestbø
7d2488280e Windows: Avoid accidentally copying QWindowsScreenManager
Pick-to: 6.2 6.3 6.4
Change-Id: I60b219e9a3ea62a96c369ee910eacf06d61f4f71
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-06-20 20:56:59 +02:00
Alexandru Croitor
91fd8bdb11 CMake: Warn when using qt6_add_big_resources on iOS
qt6_add_big_resources works by calling rcc to generate a resource
.cpp file, compiling it into an object file, then passing the
compiled object file to rcc again for further manipulation.

The path to the object file is passed to rcc using the
$<TARGET_OBJECTS> generator expression.

This generator expression does not work when used in
add_custom_command / file(GENERATE) when targeting iOS, because
CMake claims it does not know where the object file will be on-disk
(presumably because the location is controlled by Xcode itself and it
can vary based on the active architecture and sysroot).

The following error is shown at generation time:
 Error evaluating generator expression:

    $<TARGET_OBJECTS:rcc_object_foo>

  The evaluation of the TARGET_OBJECTS generator expression is only
  suitable for consumption by CMake (limited under Xcode with multiple
  architectures). It is not suitable for writing out elsewhere.

More details about the issue can be found at
https://gitlab.kitware.com/cmake/cmake/-/issues/20516

Trying to work around the issue by manually invoking the compiler
instead of using a genex so we know the location of the object file
hits similar issues in that we don't know the active arch and sysroot
for which to compile the object file.

Until the CMake limitation is lifted or we find a different fix, warn
that qt6_add_big_resources can't be used when targeting iOS and
fall back to using qt6_add_resources instead.

Note that qmake CONFIG+=big_resources also falls back to non-big
resources mode when targeting Xcode (mac-xcode) and doesn't even show
a warning.

Another note is that using CMake + Xcode + qt6_add_big_resources does
work when targeting macOS, although it generates some warnings

 warning same member name (qrc_assets.o) in output file used for input
 files: qrc_assets.o qrc_assets.o
 (due to use of basename, truncation, blank padding or duplicate input
 files)

So there is some hope this could be fixed for iOS in the future.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-103497
Change-Id: I91152247651ecd35e8110b8874399cb1b8b394bd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-06-20 20:56:59 +02:00
Volker Hilsheimer
2e12479e06 QGraphicsScene: respect that items can override selection changes
QGraphicsItems may override itemChange to prevent certain attribute
changes. Overriding ItemSelectedChange this way is explicitly documented
to be allowed.

However QGraphicsScene::clearSelection did not test whether items were
in fact deselected after the call to setSelection, and always cleared
the stored set of selected items.

Fix this by checking the actual selected state of the item as we iterate
over them, and store those items that are still selected in a set that
becomes the new selectedItems set (which will be empty if no item
overrides, which is the default).

Add a test that also checks that clearing the selection emits the
selectionChanged signal correctly (and does not if all selected items
block being deselected).

Fixes: QTBUG-85474
Pick-to: 6.4 6.3 6.2
Change-Id: I665afc132876e02e6e1061b7be37f4f6e4be418f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-06-20 20:44:23 +02:00
Heikki Halmet
bb674adb25 BLACKLIST tst_qfont for Ubuntu 22.04
Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-84248
Change-Id: I2978cd2a6ed07bb6fc5769b174d0a897dfa3566d
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2022-06-20 17:06:20 +00:00
Allan Sandfeld Jensen
0bd2876275 Avoid misleading bindingStatus
Set it to nullptr on clear, and deal with possibly null bindingStatus.

Task-number: QTBUG-101177
Task-number: QTBUG-102403
Pick-to: 6.4
Change-Id: I66cb4d505a4f7b377dc90b45ac13834fca19d399
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-20 19:06:20 +02:00
Heikki Halmet
903bde19a4 BLACKLIST: tst_QGlyphRun::mixedScripts for Ubuntu 22.04
Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-68860
Change-Id: I79c085c7321e0bee78e8cb31daa8c7992d3a3ec6
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2022-06-20 20:06:20 +03:00
Heikki Halmet
a3c43394bb BLACKLIST tst_QApplication::sendEventsOnProcessEvents for Ubuntu 22.04
Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-87137
Change-Id: Ib09382af7504f5ee078d23cc021c1b0faf051e23
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2022-06-20 20:06:20 +03:00
Heikki Halmet
5aca1fe1d0 BLACKLIST tst_QMenuBar::check_menuPosition for Ubuntu 22.04
Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-68865
Change-Id: I1eda9789a30737104c6e97de583a9f3022ae0bf6
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2022-06-20 20:06:20 +03:00
Ilya Fedin
c3e624eb50 Port QXlibEglIntegration::getCompatibleVisualId to xcb
In combination with EGL_EXT_platform_xcb support, this allows xcb_egl
to be used without xlib. Without EGL_EXT_platform_xcb support, this
still reduces amount of code using xlib.

Pick-to: 6.4
Change-Id: I29e2b29f7ef8ea34320887f62697f84232b86fba
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-06-20 15:53:33 +00:00
Giuseppe D'Angelo
1c106b37c7 QXdgDesktopPortalFileDialog: fix C++20 build
In a lambda, capturing of `*this` by reference via `=` is deprecated,
and breaks the build. Capture everything needed instead.

Amends fb981a0954.

Change-Id: I5d3d192e71662b96154cb5979898277bd0720a90
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-20 17:53:33 +02:00
Giuseppe D'Angelo
a7203a8920 QWindow: fix C++20 build
In a lambda, capturing of `*this` by reference via `=` is deprecated,
and breaks the build. Capture everything needed instead.

Amends e7477e8934.

Change-Id: Ibdbf51cb7a5ec54004b14b719dfd44e86d6f0893
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-20 17:53:33 +02:00
Louis du Verdier
d7068eaad7 Fix tst_AndroidAssets, broken by recent changes on assets load speed
Recent changes on load speed of individual assets made
AndroidAbstractFileEngine use a cache for basic information in order
to avoid to have to open assets every time a QFileInfo is created,
which was very expensive for older phones.

However, size() method was forgotten and continued to expect that the
asset would be opened first, and therefore QFileInfo().size() would
always return -1.

This change fixes this by caching as well the information about the
size of the asset, and also reverts a part in open() to close() first
in case asset would already be opened, in order to keep previous
behavior (even if this did not cause any known issue).

Fixes: QTBUG-104412
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I992f31b8f9e14dfec44cec78d0c1a2a3e18bdb7f
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-20 16:18:34 +02:00
Laszlo Papp
4679d16db8 QAbstractItemDelegate: Remove a duplicate doc entry
Pick-to: 6.4 6.3 6.2
Change-Id: I02887e6bf5892b4697af2aabcd1f1335e15b4f06
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-20 14:08:35 +00:00
Volker Hilsheimer
145bfe6054 Document QJniObject::construct
Added for 6.4. Not extremely useful as long as the macros that allow
the declaration of new class and type strings also being documented.

Pick-to: 6.4
Change-Id: I9ee466fdd0aaccec1e627ceb313b5a5c17e3f3fa
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2022-06-20 16:08:35 +02:00
Volker Hilsheimer
e0a729dfd2 Make the new setCurrentId the writer for the respective property
Amends 2140edaaab.

Pick-to: 6.4
Change-Id: Idc1ace4229b8706d9b44f1727105cc9aaab1a86d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-06-20 16:08:35 +02:00
Richard Moe Gustavsen
20a40035fa QTableView: set correct clip on QPainter when using spans
As it stood, QTableView would sometimes show drawing
artifacts when sections (rows or columns) where
rearranged, in combination with spans.

The reason is that the current code would go through the
currently visible cells in the viewport to check if any of
them where affected by a span. But the stored spans (in
QSpanCollection) is kept in sync with the column layout in
the model, and doesn't know anything about the rearranged
columns in the view. But a column with spans that is moved
to the left of the viewport can affect the painting of
the viewport as well, and needs to be taken into consideration.
For that reason, the current solution that uses
QSpanCollection::spanAt(x, y), will in that case fail.

Since it seems sensible that QSpanCollection is kept in sync with
the model (it makes model changes that affect spans easier to
handle), this patch will not change QSpanCollection. Instead, it
will iterate through all the spans (which is assumed to normally be
a limited size), convert them to the column layout of the view
(visual instead of logical), and find the ones that overlap.
Overlapping spans will, like before, be added as clip rects
to the QPainter.

Fixes: QTBUG-91896
Pick-to: 6.4 6.3 6.2
Change-Id: Iabe20df13cbd41a68f1104d3d9e24b89c4b88913
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-20 14:03:26 +02:00
Fabian Kosmale
c15714191c tst_qthread: Fix compilation under ubsan
We missed the terminating ";" in the QSKIP lines.
Amends ea4d6b987a

Pick-to: 6.3 6.4
Change-Id: Ibda43b8a84230c243dbcc74e157f4c3f8ef3891d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-20 12:12:07 +02:00
Yuhang Zhao
7225ed749d QOperatingSystemVersion: Add new Windows version
And also update some docs to provide more detailed info.

Pick-to: 6.4
Change-Id: I7b51fcb6613399cb4f1dd5d75cf3168df195577b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-20 16:29:29 +08:00
Thiago Macieira
23bf260f10 Fix improper moc includes inside the Qt namespace
Pick-to: 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16fa1b1413fd0d41
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-19 21:32:48 -07:00
Volker Hilsheimer
ea4d6b987a Skip tests that terminate threads under ASAN
Thread termination might prevent stack unwinding, which then
generates ASAN errors such as

ERROR: AddressSanitizer: stack-buffer-underflow on address
0x7f3c1d7858b0 at pc 0x7f3c243d8918 bp 0x7f3c1d7857f0 sp 0x7f3c1d7857e8

Skip such tests so that we can enable blocking CI runs under ASAN.

Fixes: QTBUG-104421
Pick-to: 6.4 6.3
Change-Id: I169235a12190e3f72525cddfe1a44a4bee19eca1
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-06-19 12:16:00 +02:00
Yuhang Zhao
797a493f50 Network: make Public Suffix List constexpr
Upstream PR: https://github.com/rockdaboot/libpsl/pull/182

The repo owner denied the PR because the library only
produces C89-compatible code and constexpr is a C++ feature.

Pick-to: 6.4
Task-number: QTBUG-100485
Change-Id: I9e01705b27022a636a98ac67b19169677d7c7652
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-06-19 16:27:16 +08:00
Yuhang Zhao
11e6e9bccd CMake: Mark chosen C++ standard as required for building Qt
Change-Id: I7d3187e74251059c7536f3e34d8c87f54c673146
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-06-19 14:45:07 +08:00
Yuhang Zhao
1e71071c92 Windows QPA: Fix indention
It seems this block of code was originally copied from elsewhere
so the original indention is preserved.

Pick-to: 6.4
Change-Id: I53ab8e58b4304dfc768bd6472255a6c2d0471d5e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-19 10:29:56 +08:00
Fabian Kosmale
122270d6be Long live the ICU-based QStringConverter interface!
This adds support for additional codecs to QStringConverter when ICU is
available.

We store the converter in the state (d[0]), and its canonical name in
d[1]. We need the name there, as in the clear function we close the
UConverter, and set the pointer to null. Consequently, the actual
conversion functions might need to re-open the converter again. The
advantage of this approach is that clear is used in the destructor of
State, and with this approach we properly clean up the state.
There is however a disadvantage: The clear function was so far also used
for resetting the state when QStringConverter::resetState . Discarding
the whole Uconverter for that is however rather costly. For that reason
we modify resetState to call a new function, State::reset. For existing
converters, it behaves the same as clear; for the ICU based converter,
we call the more efficient ucnv_reset. Code compiled against Qt 6.4 can
benefit from this more efficient version; code compiled against older Qt
versions will continue to work, as the conversion functions can just
recretate the converter from the name.
We can distinguish between ICU and non-ICU converters by checking if the
UsesIcu flag is set.

QStringConverter::name is changed to return the name stored in d[1]. The
interface of the ICU converter has a dummy name, so code using the old
name function from QT < 6.4 still returns something, namely a message
asking the user to recompile.
The function is moved out of line, as we need to check for the private
ICU feature, and want to avoid having that check in the public header.

As the QStringConverter ctor taking a name now can allocate memory, it
can no longer be noexcept. Removing the noexceptness is safe, as it was
only added after Qt 6.3.

Note that we cannot extend the API consuming or returning Encoding, as
we use Encoding values to index into an array of converter interfaces in
inline API.

Further API to support getting an ICU converter for HTML will be added
in a future commit.

Currently, the code depending on ICU is enabled at compile time if ICU
is found. However, in the future it could be moved into a plugin to
avoid a hard dependency on ICU in Core.

[ChangeLog][Corelib][Text] QStringConverter and API using it now
supports more text codecs if Qt is compiled with ICU support.

Fixes: QTBUG-103375
Change-Id: I7afb92fc68ef994179ebc7a3aa73beebb1386204
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-06-19 00:41:12 +02:00
Tor Arne Vestbø
d350373133 Windows: Replace lcQpaWindows logging with lcQpaScreen in screen code
Pick-to: 6.4
Change-Id: I1d2fd586aac1163aa449f813ce3b7244c6ebaee0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-06-18 21:08:08 +02:00
Tor Arne Vestbø
fa0b2ef81c Windows: Decouple screen change monitoring from top level QWindows
The WM_DISPLAYCHANGE message it sent when displays are added, removed,
or update their properties such as the scale/DPI.

We were processing this message as part of QWindowsContext::windowsProc(),
which meant that we would only react to display changes if there was a
QWindow on screen. Just creating a QGuiApplication was insufficient to
pick up changes to screens after startup.

In addition, despite being documented to post messages to child windows,
WM_DISPLAYCHANGE only ends up in top level windows. Presumably it's the
top level window's responsibility to post the message to child windows.
As a result, if a QWindow was a native child window of a foreign window,
such as in audio plugins being hosted in a DAW, we would again fail to
pick up display changes.

We solve both these cases by decoupling the WM_DISPLAYCHANGE handling
from QWindowsContext::windowsProc(), by creating a dedicated window
for listening to WM_DISPLAYCHANGE. This is similar to how we already
handle tray icons, power notifications, clipboard, etc -- the only
difference being that since purely HWND_MESSAGE windows do not
receive WM_DISPLAYCHANGE it's an actual invisible WS_TILED window.

This also lets us remove the workaround for QTBUG-79248, which was
doing screen updates in response to WM_DPICHANGED when detecting
that there were no QWindows.

Task-number: QTBUG-103383
Task-number: QTBUG-79248
Fixes: QTBUG-102343
Pick-to: 6.4
Change-Id: I905d8253069ec339b193edf05c052d21361ca3e9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-18 21:08:02 +02:00
Marcel Kummer
e457aeec38 QBoxLayout: Add assertion that catches out of bounds insertion indices
As of Qt6, QList will assert that an insertion index is in range of
existing values. QBoxLayout interprets negative indices as "append at
the end". That part is covered.
Indices larger than the number of items in the layout would trigger the
assertion in QList, but after the insert method had returned. That would
make it hard to debug. This change asserts the index range before
inserting, thus making it easier to spot the problem.

Fixes: QTBUG-103775
Change-Id: Ida099f785263fe8a5c8a1d0a48c4ff87713549b4
Pick-to: 6.2 6.3 6.4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-06-18 21:07:51 +02:00
Thiago Macieira
f23d83c43e qmetatype.h: remove #undef for something that was never #define'd
Pick-to: 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f976868e3ab448
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-18 08:44:06 -07:00
Thiago Macieira
4c1b1f2ad8 QMetaType: use explicit load/store operations on QBasicAtomicInt
QBasicAtomicInt::operator int() does loadAcquire() and operator=() does
storeRelease().

Pick-to: 6.2 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f9a1ece6823777
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-18 08:43:53 -07:00
Lorn Potter
ff0c7dfc6e wasm: Fix up namespacing in wasm platform plugin
Pick-to: 6.4
Change-Id: I2fdbb6688b252743578dfcd58f9259eb5ac3cca8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-06-18 09:16:55 +10:00
Lorn Potter
87c2a401da wasm: fix unicode input
also remove duplicated function call to get Qt key for event

Pick-to: 6.3 6.4
Fixes: QTBUG-78826
Change-Id: Ibaf0dd3eb428b65280ed1f840a4849b44f2868e0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-06-18 05:50:25 +10:00
Alexandru Croitor
81b5395aef CMake: Android: Fix 'qmldir file not found at' warnings
androiddepployqt calls qmlimportscanner to find qml modules.

Due to an issue in a generator expression, CMake did not write out the
android default qml output directory to the deployment json file,
which in turn means that qmlimportscanner did not get that
information.
When the scanner scanned the sources, it found some relative imports
but couldn't find relevant qmldir files because they were in an
android-specific directory.

This caused warnings like 'qmldir file not found at /some/path'
repeatedly.

Fix the generator expression to use $<COMMA> instead of , so that the
genex condition is evaluated successfully and the extra qml import
paths are passed along to qmlimportscanner.

Amends 76665f2a72

Pick-to: 6.4
Fixes: QTBUG-102595
Change-Id: Ia74c3c80f12d05b0a9cd0978df1a58bb5582198a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-06-17 20:59:22 +02:00