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>
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>
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>
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>
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>
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>
Reading of Cbor streams is substantially more complicated than writing
as it requires float16 support. When writing Cbor, we can just choose to
always write 32bit floats, even if we could compress the numbers into
16 bits.
We need Cbor writing in the bootstrap library, but we cannot easily add
float16 support.
Furthermore, Cbor reading is required for plugin support, but not Cbor
writing. It might make sense for some users to build a custom Qt with
Cbor writing disabled.
Therefore, provide two features, cborstreamreader and cborstreamwriter,
split up the code in cborstream.{h|cpp} into several files, and enable
Cbor writing in the bootstrap library.
Change-Id: I15450afb0e328a84a22ebca9379cffc4f900a75a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The wait() functions with the unsigned long arg were marked for removal
for Qt6 but due to the high usage of this functions and the very small
gain, revert the deprecation.
Change-Id: I9c9b720d279a59d87730f51de0f321b3794aa88e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Some projects can be configured to have both qrcFiles and qml-root-path
included in the deployment settings file. The addition to qrc scanning
prevented the qml root directory from being scanned.
Change-Id: Idadb62f5572be45d0083294440bdb29740c2c47e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This flag is used in QSequentialIterable and QAssociativeIterable to indicate
that the data pointer in VariantData should be deleted after the variant has
been constructed.
The use case for this is
https://codereview.qt-project.org/c/qt/qtdeclarative/+/284151, where we have
a proxy iterator and cannot easily return a pointer to already owned data, as
it is hard to manage its lifetime in the iterator. In contrast, it is clear
that we can release the memory in the QSequentialIterable functions, as it has
already been copied into the QVariant there.
Change-Id: I2b33497d991cd4f752153e0ebda767b82e4bb851
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Update the instructions on how to build and distribute the mysql and
postgresql drivers on windows.
Change-Id: Ie4d50c1c34820680d7496b9544eb00fcee17f8e7
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
They have been marked as deprecated in the documentation for a while
Change-Id: Ia2b0b6dbd4c525e3e9c4bc835eee2c9da5a938cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The dropdown of a combobox is rendered using menu items when the style
request it to do so via the SH_ComboBox_Popup style hint.
In that case, checkable items were not supported; the QComboBox didn't
pass the checked state correctly to the style, and the delegate used
for rendering the items into the list view did not implement modifying
the checked state of the item.
However, the QStyleOptionMenuItem's checked state and checkType members
were set anyway, as on e.g. macOS style we use a checkmark to show
which item is currently selected in the combobox.
The QStyle::State enum defines State_On and State_Off for toggleable
things, so in addition to setting QStyleOptionMenuItem::checked, we are
now also adding State_On or State_Off if the model provides a valid
checked/unchecked state. Otherwise, we only set the checked state if
the item is currently selected.
In addition, we implement the delegate to support toggling of checkable
model data with mouse and keyboard, using a simplified version of the
QItemDelegate implementation. To avoid spurious item toggles when the
popup is opened, we only handle mouse releases when the press was on
the same row.
In the fusion style, we ignore the workaround to let QtQuickControls
render comboboxes if State_On or State_Off are set.
[ChangeLog][QtWidgets][QComboBox] Support checkable items in styles
that use a popup for the dropdown.
Change-Id: Ia01519694b0419d777dc66b1ef683482fb01754c
Fixes: QTBUG-60310
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
This ties our hands on what we can do in our implementations. I don't
care if you've depended on this in your code. It was wrong.
Fixes: QTBUG-80600
Change-Id: I568dea4813b448fe9ba6fffd15de8865a27f0a35
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This saves us from having to bootstrap rcc in regular (non-cross)
compilations, as it can now link to QtCore. Actually un-bootstrapping
rcc is left as an exercise for the reader.
This commit discovered that MSVC cannot handle constexpr arrays bigger
than 256 kB, at which point it simply starts claiming that the constant
expressions using it are not constexpr. ICC has a similar problem at
64 kB, but it tells you why ("note: type "const unsigned char [65537]"
too large for constant-expression evaluation").
Note also that this requires gzip or zstd to be in PATH for compression
to happen. RCC linked to zlib, which is always present due to the
bundled copy. gzip's presence is not likely to be a problem on Unix
systems, but could be for Windows users, especially MSVC ones. If gzip
is not present, QtCore's size will increase by about 1910 kB of
read-only (sharable) data.
Change-Id: I2b1955a995ad40f3b89afffd15a3e65a94670242
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Minor performance optimalizations:
- No need to check if the date and time are correct because the QDate,
QTime and QDateTime parsing functions already perform these checks
- No need to add minute part to the UTC offset before parsing the date,
because the QDateTime class can parse time zone offset both in form
±hh:mm and ±hh
Change-Id: Id74b7ae075135c5c8cf420247c49b5f12fe88899
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The callback should be named the same as the function expects
Change-Id: I4ca73958313c93c0d68e7205d8641c4104247e0c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This creates a define in the binary, as well as writing emscripten
version for qmake.
It also enforces app builder to use a certain known version.
Task-number: QTBUG-77745
Change-Id: I37691512171635cec66aa3ffa16258081f3f1e1b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
We have intentionally limited support for advanced things like
arrays in a uniform block. There is one very common case however:
a one dimensional array of a struct.
Typical example for Qt Quick 3D:
struct LightSource
{
vec4 position;
...
};
layout (std140, binding = 1) uniform cbBufferLights
{
int uNumLights;
LightSource lights[MAX_NUM_LIGHTS];
};
With GLSL (uniform blocks disabled) this gets turned into two structs
where one has a 'lights' member that is an array of the other struct.
Teach the OpenGL backend of QRhi how to handle this.
This makes the QRhi port of Qt Quick3D functional with the OpenGL
backend as well.
Change-Id: I6a09b93276794f7ecdd38f5bfbd3491a9ef58146
Fixes: QTBUG-80628
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
ISO date format doesn't allow spaces within a date, although 3339 does
allow a space to replace the T between date and time. Sixteen tests
added to check this all failed. So clean up the handling of spaces in
the parsing of ISO date-time strings.
[ChangeLog][QtCore][QDateTime] ISO 8601: parsing of dates now requires
a punctuator as separator (it previously allowed any non-digit;
officially only a dash should be allowed) and parsing of date-times no
longer tolerates spaces in the numeric fields: an internal space is
only allowed in an ISO 8601 date-time as replacement for the T between
date and time.
Change-Id: I24d110e71d416ecef74e196d5ee270b59d1bd813
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
As per std140 packing rules.
Change-Id: I85663d36a9fa617ea387e8f201677471b2ebd948
Fixes: QTBUG-80655
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
The xml_escape function must be part of resources_functions.prf, and the
qmake_immediate resource must not be created multiple times. Instead,
create another qmake_immediate resource with a number suffix.
This commit amends 577b6554.
Task-number: QTBUG-79672
Change-Id: Ibbe20c0fd1940f1fe7733cd1e5b0891f65689782
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
rcc currently always writes the namespace mangling macros in both the
initializer constructor and destructor. This patch add the missing
handling of the --namespace option for that part of the generated code.
[ChangeLog][Tools][rcc] rcc now generates correct code when using the
--namespace option.
Change-Id: I7e5e608eb0ad267d11d601fc69c1a87d3f655a6e
Fixes: QTBUG-80649
Reviewed-by: hjk <hjk@qt.io>
even if we are currently inside processEvents (apparently called manually
and not from QEventLoop::exec()). A carefully crafted application
(see, for example, the linked QTBUG or even updated auto-test)
can trigger itself into failing to exit the current (potentially nested)
event loop. We can harden our Cocoa event dispatcher to detect
such condition and properly propagate 'interrupt' to where it'll
do its job, indeed, interrupting the real event loop (aka [NSApp run]).
This mainly means we have to undo what bool blocker would erroneously do.
Also, long live (as people love to say these days) to another tricky
(somewhat) auto-test (surely, it's not flaky!).
Fixes: QTBUG-79477
Change-Id: I794f0cda23e24d36be67f2bb63d52b74be057c31
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The implementation for the X mask would accept any printable
character. Since that includes the blank character, there was no
difference in behavior between the requiring X and optional x: both
would allow the input to be unset, i.e. blank.
This change should be seen in conjunction with the doc improvement
da0af1e.
[ChangeLog][QtWidgets][QLineEdit] Inputmask X character now requires non-blank input.
Fixes: QTBUG-76320
Change-Id: I3e0363e9be5c13373a157cce69c99379615b5829
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Fix some tests in tst_QSqlQuery:
- make sure to use QSql::HighPrecision in tst_QSqlQuery::precision()
(needed for psql)
- remove outdated stuff for mysql 3.x
- psql_bindWithDoubleColonCastOperator: the placeholder are stored as
named placeholders in psql
- avoid some useless old-style casts
Change-Id: I54d29a7e24f17d853cce6baa09a67d9278098810
Reviewed-by: Robert Szefner <robertsz27@interia.pl>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
In order to allow screen readers to say checked/unchecked for checkable
menu items, this information has to be provided through UI Automation.
Checkable menu items should implement the "Toggle" UI Automation pattern.
The "checkable" state must also be supported by QAccessibleMenuItem, which
is being added by a separated change.
Task-number: QTBUG-80551
Change-Id: I661668310d1b6b4701d0c0efdb1dcfd15d0db729
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The information about whether a menu item may be checked is necessary
to allow the platform code (in particular, Windows UI Automation layer)
to make this information available to screen readers.
Task-number: QTBUG-80551
Change-Id: Ibfcc4f2da1ebc68e7dc5df2cd46bbfc0a177da12
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Using always EagerRequest type forces the application to provide the
data at copy or drag-begin time, even though the data might never be
requested (pasted or dropped into another application). For data that
is expensive to generate, this is wasteful, and on other platforms Qt
uses the functionality provided by the native clipboard to allow for
on-demand retrieval of data.
Changing the request type to LazyRequest for the cocoa clipboard works,
but then we need to make sure that we resolve all promises at shutdown
time so that the data is available (which is what the end user expects).
Commit ad0d2f463a disabled this for
lazy requests to prevent crashes when using drag'n'drop, where the
QMacPasteboard object is short-lived and stack allocated. We definitely
don't need to worry about lazy data that is not yet retrieved at the
end of a drag'n'drop operation, so limit the fix from the previous
commit to the drag'n'drop scenario.
[ChangeLog][QtGui][QClipboard] Support lazily provided copying of data
to the clipboard on macOS
Change-Id: Id2203999024a0d9d854d6933d39077cc4af925d0
Fixes: QTBUG-76263
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This allows user to utilize the application without having to click on
it first to cause the focus-in event.
Change-Id: Ibc9582254dda91eb14ebcdf4b8ea4a4f862aa88d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Clamp mode was being obliterated by not appending to EMCC_COMMON_LFLAGS
This fixes crashes of integer overflow
Change-Id: Icae757a7189de25db5ed41df6d41d86304c39830
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>