This class is designed as C++20-style generator / lazy sequence, and
the new return value of QString{,View}::tokenize().
It thus is more similar to a hand-coded loop around indexOf() than
QString::split(), which returns a container (the filling of which
allocates memory).
The template arguments of QStringTokenizer intricately depend on the
arguments with which it is constructed, so QStringTokenizer cannot be used
directly without C++17 CTAD. To work around this issue, add a factory
function, qTokenize().
LATER:
- ~Optimize QLatin1String needles (avoid repeated L1->UTF16 conversion)~
(out of scope for QStringTokenizer, should be solved in the respective
indexOf())
- Keep per-instantiation state:
* Boyer-Moore table
[ChangeLog][QtCore][QStringTokenizer] New class.
[ChangeLog][QtCore][qTokenize] New function.
Change-Id: I7a7a02e9175cdd3887778f29f2f91933329be759
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Since the variable names in QShaderDescription are later compared to
QByteArrays we can gain some performance from not having to convert them
to QByteArrays later.
Task-Id: QTBUG-83706
Change-Id: Iaf80d0966f45cbb09e7c1000b7854bc488e57bb3
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Expose flagBits via a public function marked as internal.
Task-number: QTBUG-82670
Change-Id: Ia64d934d3dda3e718357cf4e3c32866a613a4722
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
The static observer can live in a union with the inline observers. We
only need to take care of calling the ctors and dtors manually then.
In order for any observers to be called in the presence of a static
observer, the static observer has to be called after the other
observers.
Change-Id: I2f56fa64f3fe6fcd7f06cc403929362da7d86f65
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This can lead to a deadlock if we block all the worker threads, waiting
for the worker threads to finish.
Pick-to: 5.15
Fixes: QTBUG-84619
Change-Id: I92b7f96007897d86ece0c34223bab0df4ccbed9a
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Map Latin-1 characters to the Winding unicode entries for symbol fonts
to render those fonts like Windows does.
Pick-to: 5.15
Fixes: QTBUG-84409
Change-Id: I60b81d93412d970d25a98606545773db6c8ab723
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Windows unexpectedly passes PM_NOYIELD flag in wParam parameter to the
hook procedure, if ::PeekMessage(..., PM_REMOVE | PM_NOYIELD) is called
from the event loop. So, to ignore undocumented flag, we should
interpret wParam as a bit field.
Thanks to Robin Lobel for research.
Pick-to: 5.15
Fixes: QTBUG-84562
Change-Id: Ib16d7d747aebc9a3628e4ee67478c4d3edeb96f1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Unexport the classes, plaster noexcept, and port to constexpr.
Change-Id: I5cc7928fb08e8e32c67cff2d84c1b0ed9d46a2fa
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Qml tests currently don't expose a CMake target, so no
dependency should be added to a non-existent target.
Make sure to add the check target only if the test was previously
added.
Fixes configurtion failure of qtdeclarative tests.
Amends 873aa682c5
Change-Id: Ic8bbfe668c00c1ce05f1e1dfe5494dafd91dd7b8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
On a plain X11 desktop, it otherwise ends up empty.
Pick-to: 5.15
Task-number: QTBUG-25351
Task-number: QTBUG-25718
Task-number: QTBUG-74252
Change-Id: I50a522a3e1761e422d5949d5338869ceb9e5e89d
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
The FreeType engine has moved out of the fontdatabases library,
so the .a file would be empty. This caused the error
"attempt to map 60 bytes at offset 72 exceeds size of file" when
building for Android on macOS.
Change-Id: I9d9afca67e7626d3b5c6a62fcde33fed029fe04c
Reviewed-by: Liang Qi <liang.qi@qt.io>
When adding the default AndroidManifest.xml to a project, Qt Creator
edits some pieces because of autoformat and shows that something is
changed, but the user changed nothing, and this can be confusing. Let's
make them on the same page.
Pick-to: 5.15
Task-number: QTCREATORBUG-23768
Change-Id: I76088358dc31be45adb766bed29e2c9d889a8f09
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
libraryList is modified in a code section that was not yet properly locked.
This was overlooked by 7ca66b1e66.
Task-number: QTBUG-42855
Change-Id: I028ad21a7df314133931f860ad49453bb2db9da0
Pick-to: 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This can be used to guard WebOS specific patches.
Change-Id: Ia770562b92c59fc3410d6254acd1313776d15a28
Pick-to: 5.15
Fixes: QTPM-1826
Reviewed-by: Johannes Oikarinen <johannes.oikarinen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Some fonts, like Segoe UI, have empty glyphs defined for
characters such as space. When there is a margin on the glyphs,
we would previously render them as 4x4 completely transparent
images. This is a waste of time, and in the case of DirectWrite,
we fixed it in bb67c3b68b so that
it will always return an invalid image when the glyph does not
have dimensions.
But since we did not account for this in alphaMapBoundingBox(),
the texture glyph cache did not detect this case and would
request the empty image and try to add it to the cache.
Fixes: QTBUG-84629
Pick-to: 5.15
Change-Id: I470a4a55577c5e9239bf77de81c2b381bf8e6a49
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
The request/reply pair is created out of QNetworkRequest, we set
autoDecompress data-member on the request, but not reply. As a result,
reply in its destructor fails to release memory, allocated by z-lib
(by failing to call inflateEnd). Since with H1 requests it does not
seem to be a problem (no leaks detected), I'm limiting this change
to H2 handler only. Later it will be retired by the stream decompression
change in Qt 6, but will be picked to 5.15.
Fixes: QTBUG-84560
Pick-to: 5.15
Change-Id: I82e19d2b0a83624b730edd20d7d45721e7001731
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The QTranslator owns its QResource and its sub-translators, so hold
them in unique_ptr to show what's going on.
Change-Id: I65dfa8c3b6dd774066a01de23ae6cff7449b363a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
We need this because without this patch you get bugs both
if you call QIcon::setFallbackThemeName before creating the QGuiApplication and
if you call QIcon::setFallbackThemeName after creating QGuiApplication
Why do you get a bug if you call QIconLoader::setFallbackThemeName
before creating the QGuiApplication:
* QIcon::setFallbackThemeName calls QIconLoader::instance
* QIconLoader::instance calls QIconLoader::ensureInitialized
* QIconLoader::ensureInitialized calls systemThemeName
* systemThemeName asks the current QPlatformTheme for its
QPlatformTheme::SystemIconThemeName
* But since we're calling this before creating the QGuiApplication
there is no current QPlatformTheme yet, so systemThemeName
is set to empty, which is obviously not what we want
Why do you get a bug if you call QIconLoader::setFallbackThemeName
after creating the QGuiApplication:
* QGuiApplicationPrivate::init calls
QGuiApplicationPrivate::createPlatformIntegration
* QGuiApplicationPrivate::createPlatformIntegration sets the
current QPlatformTheme and at the end of the very same function
uses QIcon::fromTheme
* Since we haven't called QIconLoader::setFallbackThemeName yet
there is at least one icon lookup that doesn't take
the fallback theme we would like to have into account
This patch makes it so calling QIconLoader::setFallbackThemeName
before creating the QGuiApplication works.
The only thing we want to do from QIcon::setFallbackThemeName is set
the internal m_userFallbackTheme, it doesn't care about doing
further initialization of QIconLoader, if it's done, great it's done,
if it is not initialized yet, great it will be initialized later
when someone actually tries to use the QIconloader.
So it's OK for ensureInitialized() to return early if there is no
platform theme yet, because it will be called again later.
Pick-to: 5.12
Pick-to: 5.15
Fixes: QTBUG-74252
Change-Id: I65268fc3d3d0bd282d76c76cf75e495bcc9d1a30
Done-with: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This patch allows tools to be built for the target platform when the
QT_BUILD_TOOLS_WHEN_CROSSCOMPILING parameter is set at configuration
time.
To avoid naming conflicts, the target tools are suffixed with "_native".
The qt_get_tool_target_name() function can be used to get the tool name
for both scenarios (cross and non-cross compilation).
Extend pro2cmake to refer to the right target name for tools.
The relevant write_XXX functions have a new target_ref parameter that
will be "${target_name}" for tools and literally the target name for
everything else.
Fixes: QTBUG-81901
Change-Id: If4efbc1fae07a4a3a044dd09c9c06be6d517825e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Create a QMetaTypeInterface for void. This allows us differentiate
QMetaType::Unknown from QMetaType::Void. In addition, this will enable
the usage of QMetaMethod::metaReturnType in QMetaMethod::returnType,
and will facilitate using metaReturnType in declarative, which needs to
distinguish between Unknown and Void.
Change-Id: I83296b49587f3deb7ec73e25a33f0d8c98cf8da0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This does the analog of 46f407126e for the
methods we care about (signals, slots, Q_INVOKABLEs). In addition to the
actual QMetaType, we store an array with offsets so that we later can do
a mapping from methodIndex to metatype.
The newly added QMetaMethod::{return,parameter}MetaType methods can then
be used to retrieve the metatypes.
This does however require that all involved types are complete. This is
unfortunately not a feasible requirement. Thus, we only populate the
metatype array on a best effort basis. For any incomplete type, we store
QMetaType::Unknown. Then, when accessing the metatype, we fall back to
the old string based code base if it's Unknown.
Squashes "moc: support incomplete types" and "Fix compile failures
after QMetaMethod change"
Fixes: QTBUG-82932
Change-Id: I6b7a587cc364b7cad0c158d6de54e8a204289ad4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Setting the logo to position at the top seems
to fix the issue.
Fixes: QTWEBSITE-928
Change-Id: I29336b4a1967a4676695b4f7f8560d01f3cf4fdf
Pick-to: 5.15
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Remove '/' as an example directory. We do not want to retrieve the
directory tree of the entire system.
Change-Id: I911f8eea12b4960319a9a4cbea820b910a35aede
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
In QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(),
pass the correct rectangle (reflecting the correction factor)
to the function fixAlphaChannel().
Amends e56b8e1e59.
Pick-to: 5.15
Fixes: QTBUG-84613
Task-number: QTBUG-75927
Change-Id: I5357bb8c55ed26a50cc322ea7a05df4487212fb8
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Given a test named "tst_qdrag", you can run "ninja tst_qdrag_check"
to build and run the test.
Change-Id: I47dccb39dd60fca9cb07ff9af9fb739b293c5aaf
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This is now possible because of the earlier commit that changed the
const arrays in qurltlds_p.h to constexpr arrays.
Change-Id: I37a6a64e250bbe33f7d34b5916595bf6a37aed4a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
calling emplace() on a std::vector with a reference
pointing into the same vector is undefined behavior.
Fix this by using a temporary inbetween.
Change-Id: I47c28700dffa2107fb0cba302168c86b659eafb3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
long and ulong where missing. Generalize the code so that it'll work
for all integral types.
Change-Id: I74591e9c8b375e0ecdcfdd856970ce355eb2d4ce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since QString::split() is not going away in Qt 6, we should aim
to provide API symmetry here, and ease porting existing code from
QString(Ref) to use QStringView.
This is easier than having to port everything to use tokenize() at
the same time. tokenize() will however lead to better performance
and thus should be preferred.
Change-Id: I1eb43300a90167c6e9389ab56f416f2bf7edf506
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
It was returning a lowercased suffix because it was extracting it from
the pattern (*.txt) rather than from the filename ("README.TXT").
This broke expectations on the application side, since this method is
documented to return a suffix from the given filename.
Ref: https://bugs.kde.org/show_bug.cgi?id=402388
Change-Id: I7dae13db31280249d3f592fa9592c4067804e22d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The idea is pretty simple -- add QRegularExpression matching over
QStringView. When matching over a QString, keep the string
alive (by taking a copy), and set the view onto that string.
Otherwise, just use the view provided by the user (who is then
responsible for ensuring the data stays valid while matching).
Do just minor refactorings to support this use case in a cleaner
fashion.
In QRegularExpressionMatch drop the QStringRef-returning methods, as
they cannot work any more -- in the general case there won't be a
QString to build a QStringRef from.
[ChangeLog][QtCore][QRegularExpression] All the APIs dealing
with QStringRef have been ported to QStringView, following
QStringRef deprecation in Qt 6.0.
Change-Id: Ic367991d9583cc108c045e4387c9b7288c8f1ffd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
advances and glyphIndices can be nullptr's as long as numGlyphs
is zero.
Change-Id: I29c3764792c1a0ffaafd3393c82a26af65699ab3
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This is doing the same as data(), but the method is widely being used in
Qt (e.g. in QString), so this will make it easier to change the type of a
variable from QString(Ref) to QStringView in a source compatible way.
Change-Id: Ic49bef688d3ce3c550336edf90130aa5cac8b497
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Make the API more symmetric with regards to both QString and QStringRef.
Change-Id: Ia67c53ba708f6c33874d1a127de8e2857ad9b5b8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Make the decoder fail early to avoid spending time and memory on
attempting to decode a corrupt image file.
Pick-to: 5.15 5.12 5.9
Change-Id: Ic556d4fbcb6b542fc110d10e48dac1a880e60697
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
From API 28 it is possible to clear the clipboard so we should ensure
that this is done if API 28 or later is being used. Otherwise it is not
removed, but that is due to limitations on the Android side.
Pick-to: 5.15
Change-Id: I1fe504d0e566c6923b39b2adf4540619c6b1daf7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>