If moc is invoked with the --output-dep-file option, it will generate
a "moc_<source_file_name>.d" dep file which contains dependency
entries that can be consumed by a Makefile / Ninja build system.
This is useful for build tools (like CMake) to know when moc should be
re-ran.
In the future, it might also be useful for ccache (teach ccache not to
re-run moc when not necessary).
The dependency list contains: the original source file, the passed
--include files (like moc_predefs.h), the include files that
were discovered while preprocessing the source file, and the plugin
metadata json files listed in Q_PLUGIN_METADATA macros.
The file paths are encoded using QFile::encodeName, so using the local
8-bit encoding.
The paths are also escaped (so ' ' replaced by '\ ', '$' by '$$',
etc) according to the Make-style rules as described in
clang's dep file generator
https://github.com/llvm/llvm-project/blob/release/9.x/clang/lib/Frontend/DependencyFile.cpp#L233
For reference, the equivalent Ninja depfile parser source code can be
found at
https://github.com/ninja-build/ninja/blob/v1.9.0/src/depfile_parser.in.cc#L37
Additional options that can be passed:
--dep-file-path - to change the location where the dep file should be
generated.
--dep-file-rule-name - to change the rule name (first line) of the
dep file (useful when no -o option is specified, so output goes to
stdout).
Encoding story.
Note that moc doesn't handle non-local-8-bit characters properly when
processing include directives at the preprocessor step. Specifically
the content of the main input file is read as a raw byte array (which
can be UTF-8 encoded) and then each include directive is resolved via
Preprocessor::resolveInclude(), which calls QString::fromLocal8Bit().
Because moc uses the QtBootstrap library, only a limited set of codecs
are available: various UTF 8 / 16 / 32 codecs and
QLatin1Codec (ISO-8859-15).
This means that on Windows, if the source input file is UTF-8 encoded,
and contains include names with UTF-8 characters (like an emoji or any
character >= 127 that is not in the QLatin1 codec), moc will fail to
resolve and process that include, and thus no dep file entry will be
created either.
On macOS / QNX / WASM the main locale is UTF-8, so file content
and paths will be processed correctly (hardcoded via QT_LOCALE_IS_UTF8
in src/corelib/codecs/qtextcodec_p.h).
On Linux it will depend on the current locale / encoding set,
and if that encoding is one of the ones supported above. UTF-8 should
work fine.
[ChangeLog][QtCore][moc] moc can now output a ".d" dep file that can
be consumed by other build systems.
Task-number: QTBUG-74521
Task-number: QTBUG-76598
Change-Id: I5585631ff1bbbae4e2875cade9cb6c20ed018c0a
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The two static setPalette methods in QApplication and QGuiApplication
should have the same behavior in terms of what signals and events
they emit.
Change-Id: I54579d490e31f3783e2d4fea689ca799a070ff1d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
After 8fb881900c it's tracked by AA_SetPalette. Since the latter
is publicly observable we remove the internal flag instead.
Change-Id: Ie69799f1b45d68017cb9eaab2a9986cc9ac9ca38
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This change provides a way to disable the automatic showing of the native
Windows on-screen virtual keyboard when a text editing widget is
selected on a system without a physical keyboard, by enabling the new
AA_MSWindowsDisableVirtualKeyboard application attribute, allowing
applications to use a custom virtual keyboard implementation.
Fixes: QTBUG-76088
Change-Id: Id76f9673a2e4081e5325662f3e3b4b102d133b9a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Even though each line in the array passed to drawLines() should be
rendered as an independent line, some state was kept in the cosmetic
stroker from one line to the next. This could result in visible
rendering errors.
Fixes: QTBUG-80834
Change-Id: Ief7bf78eab83ae34459802bff5a57d6beec4a5e5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Remove documentation about QMIN, QMAX and QABS - they were removed
during Qt4 -> 5 porting.
Change-Id: I24e12e4f2bba635ff412e73dd1d0134bbab5247a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
QStringListMode::moveRows() had an issue when the destination was before
the source row.
Change-Id: Icf64e5b4cdd6a39faf3ba4ccc3883196b247ccbd
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: David Faure <david.faure@kdab.com>
The implementation of QTextDocument::print() is not available when
QT_NO_PRINTER is defined but the declaration was so when someone is
using this function (and QT_NO_PRINTER) a linker error will occur.
Fixes: QTBUG-56916
Change-Id: I49aaaa643c4d8587a66fc95733060cea11994872
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Make sure that when we call $$qtConfEvaluate("features.shared")
early, the result is not cached via the available key, so that
the value is properly re-evaluated further on when all features
are processed.
Fixes the error message when reconfiguring an Android build
"Unknown feature object shared in expression '!features.shared'."
Amends 4ac872639e
Task-number: QTBUG-79639
Task-number: QTBUG-80096
Change-Id: Ic1cbadac15c34468a9115cc8ec5ea07630185772
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
QListModel::moveRows() had an issue when the destination was before the
source row.
Change-Id: I4ce8b425451f2f53c7eb3b211e9590753dec618a
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: David Faure <david.faure@kdab.com>
Since commit 9ab043b6 we're checking for invalid file paths passed to
Qt's file system engine. When initializing the deployment tool for VS
projects we accidentally passed a file path containing '\0'. Fix that by
using an infix QString, not QChar.
Change-Id: Ieae066d20ac290354febd420abce68f28649b365
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This is not to be taken as supported and is still undefined behavior,
but I prefer we do not crash.
Change-Id: Icf4f3398bfd57fcbdc611a5a821a1f2de0838330
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Requires a third definition for the source-compatible but deprecated
version.
Change-Id: I260ae79f4547f99eed701b10e0b25222f81cd5ff
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Emscripten version 1.39.0 and above are based upon upstream LLVM, which
does not contain BINARYEN_TRAP_MODE
Fixes: QTBUG-80691
Change-Id: I6129f84a31a607c202e13847b50705ef1c809630
Reviewed-by: jian liang <jianliang79@gmail.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The previous implementation was *extremely* expensive. It
relied on loading a binary JSON file from resources (which
involved decompressing it), then extracting information out of
it to build a gradient. Already-loaded gradients were kept in
a local cache, which had to be mutex protected.
Instead, this patch extends the gradient generator to build
static arrays filled with the web gradient data, sitting in
.rodata.
These arrays are used when building QGradient objects with a
web gradient. No explicit mutex protection is necessary, since
accesses will just read from the arrays.
As benefits, this patch removes:
* the binary json representation from QtGui's resources (~4KB
compressed, ~50KB uncompressed)
* the overhead of reading from the JSON for each used web
gradient;
* the startup costs of registering the webgradients in the
resources;
* all the overhead of mutex locking when building such
gradients;
* all the runtime memory allocations to load, parse and cache
the web gradients (including the memory + CPU spike on first
load due to the uncompression of the JSON data, as well as a
couple of deep copies).
Change-Id: If5c3d704430df76ce8faf55ee75ebd4639ba09c4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QItemSelectionModel::columnIntersectsSelection() should honor the parent
according to the docs. For rowIntersectsSelection() this was fixed a
long time ago but columnIntersectsSelection() was forgotten.
Sync the both functions and use range-based for loops as a drive-by.
Fixes: QTBUG-80644
Change-Id: Iaf08f85e2225204d1e6564fa4bb0bc826352ed53
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Fix the links, remove section about Q_ODBC_VERSION_2 - it wasn't there
since Qt5.0.
Change-Id: I571f5c2cf0f0e2df38638299c26814b510d1a8af
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
When an existing item is replaced with a new one in
QStandardItemModel::setItem() then the persitent index is invalidated
which leads to some unexpected behaviors (like e.g the header size and
resize mode are reset).
Therefore we have to make sure that the invalidation does not happen.
This can be achieved by delaying the call to QStandardItem::setModel()
for the old item until the new is properly added. After this, the old
item no longer gets a valid QModelIndex from the model and therefore
can't invalidate the persistent index anymore.
Fixes: QTBUG-13605
Fixes: QTBUG-73000
Fixes: QTBUG-80586
Change-Id: I4e45e6feb81b7287c0859f638d7ab1a576fc2f0f
Reviewed-by: David Faure <david.faure@kdab.com>
In part, this is a continuation of
https://codereview.qt-project.org/c/qt/qtbase/+/227953. It also paves
the way toward implementing the EglDisplay integration resource needed
by QtWayland.
For the code that's being moved around and modified, switch from
!QT_NO_OPENGL to QT_CONFIG(opengl).
Change-Id: I5046e8caf5df7cf326f8e697d7d41cf802250414
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
The typedef "QOPENGLF_APIENTRYP" was incompatible to the one
in "src/opengl/qopengldebug.cpp" which used "QOPENGLF_APIENTRY".
Note the misisng "P " ending.
The type is meant to be a function pointer, not a pointer to a
function pointer, so remove the extra P.
Change-Id: I229b73ca8e7367f88a2b48e2728e615605f02da3
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
When fetching the bounding box of the alphamap for the glyph cache,
we would include the margins in the size, but we would not account for
it in the origin. We would therefore get a mismatch when copying the
alpha map into the cache.
[ChangeLog][Windows] Fixed a 2 pixel offset on glyphs when using
color fonts or any hinting preference other than the default (full)
hinting.
Fixes: QTBUG-71928
Change-Id: I9287df02de4f6e79c3b6c5ce92b73c284261ef5c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Its purpose was to track the default palette set by the programmer,
but after 8fb881900c this is tracked by the Qt::AA_SetPalette attribute.
The palette itself is always reflected 1:1 in the palette tracked
by QGuiApplicationPrivate::app_pal.
Change-Id: If3e84c8b3ae6070b6c50be7a33adb38799b3f3a5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
It's slow and we want to get rid of it. In this case,
it's just as easy to do the replacing manually using
a small loop.
Task-number: QTBUG-72587
Change-Id: I32e1cc89642bc0e5b6f500d072960cd8871e0684
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Allows running the example with -style foo or QT_STYLE_OVERRIDE.
No changes to documentation needed.
Change-Id: Id7cef450f13faabd118badde51afb7273439c9fc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The only effect calling QApplication::setPalette will have is the polish,
so opt for doing it explicitly instead of the weirdly looking no-op
assignment.
Change-Id: Ia80b3f60e3e513b68c2993ea8417966f9ab6721e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
QApplication::setStyle has quite a bit of logic to clean up from the
old style before setting a new one. If a style has been set before
the application is created, it's not enough to just delete the existing
style, we need to treat it like a normal style switch.
Change-Id: I2bcc2eb75567bf1bc8a32ac31467b22315a70a0b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
A style may have been set before the application was created, which
would have resulted in setting the system palette based on the style's
palette. Once the application is initialized and we have a platform theme
we need to reset the system palette.
Change-Id: Ia48f57d3983535c8633741d8027f75bc0c214018
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
We let initSystemPalette() do all the work, instead of leaving the first
time initialization of the system palette to the caller, which makes the
logic harder to follow.
This also means first time initialization of the system palette will
pick up a platform theme if available and resolve the palette using
that, which was missing from the original logic.
Change-Id: I84da557caf8ecedf6d96d87ebee93168ea9d73ba
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The call was added in c49c96fbb1, "Reinitialize system palette
when setting a new style", but adding it along with the palette code
seems like a mistake. The potentially dirty widget font hash needs
to be reset for all style changes.
Change-Id: I411f56bb833819213c5485d7585fc5e3e9bd8983
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Other code using these maps are not treating them like multi-maps
Change-Id: I3381fde3b3612a29110cfe890f20f96f3c0bd3a2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
None of the code I could see handles the map like a multimap.
Change-Id: I9d51da6dafed4317e801703599e83fb038c22a1d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
By casting it, these are situations where we cannot change the type
itself to QMultiMap. For QVariant it's a public define and for dbus
it's the type of an argument to the function.
Change-Id: I0f385dc857fce5de3e8254d18268fd84a6d7707c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
As opposed to unite(), this inserts one map into the other
without duplicating elements.
Task-number: QTBUG-35544
Change-Id: Ie8ab350b29148851a3176cef1007e8a4ca82c273
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
[ChangeLog][QtCore][QHash] insertMulti(), unite() and
values(const Key &key) are now deprecated. Please use
QMultiHash instead.
Change-Id: Ic14907fd5fd38d585708e2dcf2c0200d221ebb25
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This is a step towards deprecating QHash::insertMulti() and clearly
separating QHash and QMultiHash.
Change-Id: Ic2c7665673ff00d4f2186e94850710b70330f8ba
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>