qt5base-lts/tests/auto/gui
Eskil Abrahamsen Blomfeldt ca64365e3a Don't hide object replacement char except in rich text
The object replacement character (U+FFFC) is used to represent
inline objects such as images in rich-text. To enable this,
we have special handling of it in QTextEngine. For classes
where inline images are not supported, it will just be hidden
from the visual text, which is unexpected.

Instead of always special-casing it, we make this dependent
on whether the document layout has registered any object handlers.
If they have not, then there will be no visual representation of
the object, and it is better to show the glyph for it.

For anything based on QTextDocument, there will always be the
image handler, so U+FFFC will still have special handling there,
but for non-rich labels and plain text editors the glyph will
be shown instead.

Note that there was also a bug in QLineEdit, where the object
replacement character was always replaced by a space. This was
introduced in 2007, in a patch which replaced a !ch.isPrint()
with a check for "the most obvious non-printable characters"
to reduce the number of characters that were not shown. However,
U+FFFC is a printable character and would thus not have been
filtered by the !isPrint() condition, so I think this was a
mistake at the time. However, due to the special-casing of
the character in Qt, it would not have had any effect until
now.

This also changes the QTextLayout::cursorToXForInlineObject()
test to actually test proper inline objects, as this was
previously using a hack which depended on the inline object
code to be used even for plain QTextLayouts with no handlers
for these.

[ChangeLog][Text] The object replacement character (U+FFFC)
is now only filtered out in rich text controls, where they
represent inline objects. In other controls, its glyphs will
be shown as with other text.

Pick-to: 6.5
Fixes: QTBUG-101526
Change-Id: I7fcaf2b10918feb41589e1098016efbf79a0e62d
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-14 19:19:01 +01:00
..
image Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
itemmodels Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
kernel Detach event points when cloning pointer events 2022-12-10 06:38:58 +01:00
math3d Fix tst_QQuaternion's duplicate test tags 2022-10-11 11:20:58 +02:00
painting Use SPDX license identifiers 2022-11-15 07:50:17 +00:00
platform Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qopengl Revert "tests: XFAIL tst_QOpenGL::bufferMapRange() on Wayland" 2022-10-07 13:20:12 +02:00
qopenglconfig Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qvulkan Android: Skip/blacklist remaining tests for emulator bump to API 24 2022-11-15 01:01:54 +00:00
rhi RHI: QShaderDescription storage buffer qualifiers / run time stride 2022-12-11 11:05:24 -08:00
text Don't hide object replacement char except in rich text 2022-12-14 19:19:01 +01:00
util Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
CMakeLists.txt Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00