It wasn't tested and behaves in a very particular way.
Change-Id: I60a31681e5b221cf9a86df77e410a76ee4c10864
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The result of createAlphaMask was mostly overwritten and then inverted,
we can write the right values directly instead.
Change-Id: I3cdddcc74218a4058bddd20178733688607c8a01
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Apply some minor fixes to the widget docs
- use nullptr
- use c++11 initializer list
- properly delete widget when cleaning the layout (QTBUG-29471)
- rework CardLayout example to make it work with Qt5
Fixes: QTBUG-29471
Change-Id: Ie2ee9f75eb8faf97d2bbd2c25e7013d4f30d8dd0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
After aa8d3f90a4 the default width of the
spinbox buttons is calculated from the spinbox width. This is wrong
because the initial width (e.g. when the spinbox is not yet shown) is
640 pixels which results in a too long width.
Therefore fall back to the old hard-coded value version but instead
using 20 pixels, use 16 to be in sync with the stylesheet style value
and honor the dpi of the screen by using QStyleHelper::dpiScaled().
Fixes: QTBUG-79806
Fixes: QTBUG-80814
Change-Id: I45786684575273f940e498df3b7639e626f00a7e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
There's no reason to use a class-static mutex object here.
Use a namespace-static QBasicMutex, port to qt_scoped_lock.
Change-Id: Ia9bd3c2fadbf1da25ef79bb393c899b678cbc182
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
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>
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>
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>
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>
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>
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>
Setting the CONFIGURATION_BUILD_DIR variable to tell Xcode where to
place the final application bundle confuses Xcode when archiving
a project, and the archive ends up without the dSYM files.
Unfortunately we can't leave it up to Xcode to place the build
artifacts wherever it wants, as Qt Creator's iOS support expects
to find the artifacts in a well-defined place. Until we've taught
Qt Creator to find the artifacts for deployment where Xcode placed
them we need to keep this logic.
We now avoid setting the CONFIGURATION_BUILD_DIR variable unless we
really need to due to in-source builds. As long as we're dealing with
a shadow-build it's okey to set SYMROOT.
Change-Id: I9661c1c57725dc8ba5a21f8467b8b61834f2e64d
Fixes: QTBUG-74841
Task-number: QTBUG-52474
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This patch fixes the QMetaObject::superClass hierarchy for Q_GADGETs
that inherit from a template which in turn inherits another Q_GADGET.
One common scenario where this is applied is for the CRTP. Without this
patch, moc would stop at the template and then sets the superClass
QMetaObject to a nullptr. For QObjects this works, since there moc knows
that every child must by definition inherit QObject. In order to support
this for Q_GADGETs too, we defer the judgment about the availability
of a staticMetaObject in the base class to compile time through the
existing QtPrivate::MetaObjectForType<Base>::value() helper.
[ChangeLog][QtCore][moc] Moc now correctly sets a non-null
QMetaObject::superClass for Q_GADGETs that inherit from a template which
inherits another Q_GADGET.
Change-Id: I103b5efd74ed24172dffce477ca2ed6d0f374d44
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This is a thing in Qt Quick: there are some types of image particles
that use uniforms like "float opacitytable[64]".
This should make all views work correctly in the Image Particles example
when running on the OpenGL backend of QRhi. (other backends should work
as expected already)
Change-Id: I64a04fbb98b97d81d257b00b428582e751d46b8e
Fixes: QTBUG-80667
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
It wasn't generating the "QPasswordDigestor" forward-header because
QPasswordDigestor is a namespace, not a class.
Fixes: QTBUG-80708
Change-Id: Ic6567271e2d2d948c0663017069eb26e2e95662c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The Quick3D-on-RHI PoC demonstrates a case which the Metal backend
fails to handle correctly: have an object with a lighting-enabled
material, but remove all lights from the scene.
Under the hood this means having a uniform block in the shader, but
without referencing it in any way in the actual shader code.
This leads to the resource being present (as far as shader reflection
is concerned), but with no native binding point available, meaning the
attempt to retrieve the Metal binding point for it returns -1, and that
is what the QShader carries in the nativeResourceBindingMap.
The backend should be prepared to silently skip the resource, whereas
currently we end up in an assertion due to attempting to batch the (native)
binding "-1", which is invalid.
Correct this.
Change-Id: I85ee58145f589aca45d46c23e0cdce837d598850
Fixes: QTBUG-80668
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>