Local8Bit is always UTF-8 except for Windows platforms.
Also add a Locale encoding to QStringConverter.
Change-Id: I8d729931fd4c1d7fc6857696b6442a44def3fd9d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Separate them from the qutfcodec, so that the codec
can later on be moved out of Qt Core.
Fix the QUtf methods to take qsizetype instead of int
for length arguments.
This also makes it possible to not build QTextCodec into
the bootstrap lib anymore.
Change-Id: I0b4f83139d61b19c651520a2f3a5012aa7e85cb8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The new QStringEncoder and QStringDecoder classes
(with a common QStringConverter base class) are
there to replace QTextCodec in Qt 6.
It currently uses a trivial wrapper around the utf
encoding functionality.
Added some autotests, mostly copied from the text codec
tests.
Change-Id: Ib6eeee55fba918b9424be244cbda9dfd5096f7eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When a QTextDocument is laid out, this is done in "chunks" to keep
programs responsive. During the layout process, blocks are split into
lines. When a full (re)layout is interrupted (e.g. because a
QHighlighter changes some formats before the layout for all chunks is
completed), later chunks are skipped. This results in invalid data
(e.g., blocks not split into lines).
This change ensures that full layout runs of the root frame are
completed even after interruptions.
Fixes: QTBUG-20354
Change-Id: I041c73a532a5abe74d577ca49810191b5594dca2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Recent version of xdg-desktop-portal got support for opening directories
through the portal, which means we no longer need to rely on opening the
dialog inside sandbox, hoping we have permissions to user directories.
[ChangeLog][Linux] QFileDialog will open directories through the portal
if required version of xdg-desktop-portal is running on the system.
Change-Id: Ifc9035e268f1cc8d9d6a93480e651e0d9e1e9929
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Also Extract Method isProhibitedOutput(), which, in order to preserve
history, is placed in the unnamed namespace and violates the
indentation rules. But this code is delicate enough to be left
undisturbed. At least for now.
By said Extract Method, we can static_assert on the invalidity of the
QStringIterator::next() argument, which we assume will be rejected, so
that we continue to reject malformed surrogate pairs.
Also fix a comment that suggested the function would actively remove
("strip") malformed content, when in fact it only detects it.
Change-Id: I4185cbac71fb147e2f2036dbaf052af20bd1003f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The code did not limit the length of hex and octal escape sequences,
but used an int as the accumulator, which causes UB on overflow.
Due to the use of the QChar(int) constructor when appending escapeVal,
only the lowest 16 bit of the value were appended to the result
string. An test case encoding this behavior explicitly suggests this
is intended behavior.
It therefore suffices to use an unsigned 16-bit value as the
accumulator (unsigned, because that doesn't cause UB on overflow, 16
bits, because that's all we care for).
For future-proofing, use char16_t as the accumulator.
Pick-to: 5.15
Change-Id: I07e7ebf1f312276b2bbcb08e4360c66a3b9522ca
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... in favor of existing char16_t* and char32_t* versions.
Swap the implementations around so the deprecated version is inline.
[ChangeLog][QtCore][QString] The fromUtf16(const ushort*) and
fromUcs4(const uint*) functions have been deprecated in favor of
the char16_t and char32_t versions, resp.
Change-Id: I94ff63ae98d190267da0b1c943d3d9c4e825ef10
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When Qt is configured with -qtlibinfix Foo then the prefix determination code
in QLibraryInfo crashed, because it still assumed the library name to be
"QtCore".
Fixes: QTBUG-83912
Pick-to: 5.15
Change-Id: I104e115ac6904fc0a04ac45d68d26d4e02aba721
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Handle wheel grabbing via wheel_widget in a single place, and
propagate events in the same way for all (spontaneous) events.
Handle ScrollMomentum the same way as ScrollUpdate to allow
partial sequences.
Fix the incorrect ignoring of wheel events by default; like all
other input events, they are now again accepted by default and
ignored in the default event handler implementation of QWidget.
This way, implementing the handle suffices to accept the event.
Note that QWidget::wheelEvent doesn't need to be changed, as the
event is ignored there today (an oversight of the change made in
f253f4c3, perhaps).
This also fixes changing of direction of a wheel event while
the event sequence is grabbed by a widget.
Change-Id: Ia0f03c14dede80322d690ca50d085898a0497dbe
Fixes: QTBUG-67032
Task-number: QTBUG-79102
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Use glPixelStorei where possible
Pick-To: 5.15, 5.12
Fixes: QTBUG-84189
Change-Id: Iadf039b5c6d8e7b6bb11d031a94683343dee0dc6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This is more readable, because it follows usual iterator patterns.
Change-Id: I56900286ddbca57a86aa499020f175e8add17fd9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Instead of converting the char or QChar to a QString, convert them to
a QStringView, saving the memory allocation.
Pick-to: 5.15
Change-Id: I023712ec00172f1c8570e762817bfc3a95e01125
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The former messes in bad ways with the overload set (it, fatally,
attracts char16_t, e.g.). The latter was probably added in response to
ambiguities between (char) and (QChar). While it's harmless now,
remove it, since it no longer pulls its weight.
The no-ascii warning is now coming from QChar(char), so the protection
isn't lost.
[ChangeLog][QtCore][QString] The += operators taking char and
QChar::SpecialCharacter have been removed as they cause adding a
char16_t to QString to call the char overload, losing information. The
append() function was not affected.
Change-Id: I57116314bcc71c0d9476159513c0c10048239db3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
QMacExtras no longer use them. Clients who need the functionality
should use QImage::toCGImage(), or qt_mac_toQImage() from QtGui's
private qcoregraphics_p.h, until we've made a public verion of it.
Task-number: QTBUG-83252
Change-Id: If74d05afe8f4ce6728d8c503bd97f7632583fbed
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
global\qlogging.cpp:1698:91: warning: 'constexpr QChar::QChar(char)' is deprecated: Use fromUtf8, QStringLiteral, or QLatin1String [-Wdeprecated-declarations]
Change-Id: I3c8a9499c9504bb6198dc187cb79239f705e2d39
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Will be useful when DecompressHelper gets taken into use for both.
Task-number: QTBUG-83269
Change-Id: Iaf253219bed193025c2b82d6609f4dcc4de33df8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Add snippet on how to use ANDROID_ABIS inside the .pro file.
Pick-to: 5.15
Task-number: QTCREATORBUG-24014
Change-Id: Id3bb960c04ea6480b06878121ad33f89c03e5642
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Also port its callees. These functions scream to the QStringView-ified...
Change-Id: I13c95d65941eb8d02223306d80efd1437b4bd9b7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The reference counter could only ever be -1, 0 or 1,
as an autoDeleted QRunnable can only be in a single
thread pool.
This commits keeps the reference counting for now,
but asserts sanity, simplifies locking and fixes a
leak.
Pick-To: 5.15
Fixes: QTBUG-20251
Fixes: QTBUG-65486
Change-Id: I4de44e9a4e3710225971d1eab8f2e332513f75ad
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit 891b60bbc8)
Port decode() to take a QStringView to isolate callers from char16_t.
Have it return qsizetype instead of int. Use QChar* as output pointer
internally, to avoid more casts.
Change-Id: Ia388361a281ee97c41b01d8e6fe2c00801d988c4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Follup to a37785ec76: this API
has been deprecated since 5.11.
Pick-to: 5.15
Change-Id: Ib143f3997f89fc71d37d740338dae7df52ff45b4
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
A reader of the code shoudn't need to know ASCII code points by heart,
so don't force them to.
Change-Id: I2c44fcf4a948b85dfbc02ac8b5b7b934e87b41a7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Allow the native file dialog to use remote locations like OneDrive,
Google Drive, etc.
Pick-to: 5.15
Change-Id: I67027f0da8e6bd759a4936e03b6c9e95f3f90e1a
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Requesting the debug layer is not something that succeeds at run time if
the corresponding SDK component is not present. Handle it gracefully:
simply retry D3D11CreateDevice without the debug device flag.
Relevant also for the Qt CI's Windows 10 VMs.
Task-number: QTBUG-84067
Change-Id: Ia7b2562917ec11ce04a75c052527bf526d1fe81b
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Before, we were setting those properties only for Qt modules.
Now, Qt executables and plugins have a full VERSIONINFORMATION
resource on Windows.
Also, extend the CMake API with the possibility to pass target
information to modules, plugins and tools. This will be used in a
subsequent commit.
Change-Id: I2bb8d3637569e0eaec76f56331bc23282285d872
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
I'm getting compile errors with gcc 9.3 without this, and it
makes sense to disable the JIT in bootstrapped builds anyway.
Change-Id: Ife867bd2d6fd0bf133edae4903bb6b6d295db547
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
We should search for the values of function names rather than
the mapping key.
Change-Id: Iedef7fcf4d716ff7f6d277d9626d9dc2dd781401
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This reverts commit 9802b93cc7.
The commit dbaf62033a allows using
nameFilters on Android platforms.
Task-number: QTBUG-83089
Change-Id: I7b57cd0423c41e7527ce7a650626b602ea9b587d
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
The subclass AnchorVertexPair is allocated and passed around as pointers
to AnchorVertex, and placed in lists that are then later cleaned up via
qDeleteAll. This very likely results in memory leaks, as the compiler-
generated ~AnchorVertexPair destructor is never called.
Add a virtual destructor. Since there now is a vtable generated for
AnchorVertex, remove the m_type member (which is only used for string
generation in debug builds) and make toString virtual instead.
Change-Id: I2cf184c0b1da1bd59b056a0f696a0e5479d4cb4e
Fixes: QTBUG-84094
Coverity-Id: 218707
Pick-to: 5.15
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Passing 0xA7 to a signed char causes a truncation warning with MSVC2017.
Make the cast explicit.
Change-Id: Ief1a97c52544b271556811816f7804074bd336df
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Even though QString::fromRawData() may not be as expensive as it used
to be, it's still and out-of-line call _and_ more characters to type,
so replace with QStringView construction where applicable.
Change-Id: I70662da1bd45284f67e117e92b25d242afb8aaf8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Instead of creating a QStringList from a static array anew for each
call, cache the result in a static variable. If we have to pay for the
overhead of implicitly-shared classes, we should at least reap the
benefits, too.
Use IILE to gain automatic thread-safety (thread-safe statics).
Change-Id: Ib92dd9cb85f84e013f98ca81565cc392bb39e76b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Be more specific about overriding behavior when using
the drawText overload that takes a QTextOption argument.
Fixes: QTBUG-41894
Pick-to: 5.15
Change-Id: I8b38cb383005f1a07f4c6d70050e0d2cbb551521
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Use the static global instance to call bounded() and fillRange().
Pick-To: 5.15
Change-Id: I91678b7c985ab9d0dcdf09aadad6cb8f495c02cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>