Use QAbstractButton::click(). Refactor and polish the tests
to use QTRY_VERIFY() instead of qWait(), speeding them up.
Pick-to: 5.15
Task-number: QTBUG-81845
Change-Id: I119bede8143ec1db5f5250517dee38b576d5a8d2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
... and do a local code cleanup:
- add override
- port from foreach to C++11 ranged for loop
- remove dead code (`gestureEvent` (née event) was already
dereferenced when we check it for null'ness, so it cannot be
nullptr, so the condition is always true).
Pick-to: 5.15
Change-Id: Ica5e34fbe65c95f6573630f188582b90be15c8f7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Cleaning up those that are trivial to remove because they have direct
replacements.
Change-Id: I4f5c25884a01474fa2db8b369f0d883bd21edd5b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Those can be trivially removed as they have direct replacements, or
are completely unused.
The migration path for QCursor::bitmap and QCursor::mask is
QBitmap *pb = c.bitmap(); // up to 5.15, warns in 5.15
QBitmap vb = c.bitmap(Qt::ReturnByValue); // from 5.15, works in 6
QBitmap b = c.bitmap(); // from 6.0 on
Change-Id: I3b3acd1c7f09c4c8414e98b3ce11986f1ecd5eda
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
For kinetic wheel events, Qt tries to make sure that all events in the
stream go to the widget that accepted the first wheel event.
It did so by directing all events from the stream to the widget from
which the spontaneous event was returned as accepted.
However, that widget might have passed the event on to some other
widgets; e.g QScrollArea forwards wheel events from the viewport to the
relevant scroll bar. The event might then have come back accepted only
because parent propagation kicked in (the scrollbar might not accept
the event, so the parents get a chance, and some parent's scrollbar
ultimately accepts the event).
In this scenario, the wheel widget would be the viewport under the
mouse, when it should have been the scrollbar of the parent. The
next events from the stream were then delivered to a widget that didn't
scroll; and parent propagation is not (and should not be) implemented
for the case where Qt has a wheel widget.
Instead, make the first widget that accepts any initial wheel event
the wheel widget, even if the event was not spontaneous. With this
change, all events from the stream are delivered to the widget that
actually handled the event. That has the effect that ie. a viewport
of a scroll area only gets the first event; all following events are
delivered directly to the scrollbar.
The test case added simulates the different scenarios - nesting of
scroll areas, classic wheel events and a stream of kinetic wheel
events.
[ChangeLog][QtWidgets][QApplication] Wheel events from a device that
creates an event stream are correctly delivered to the widget that
accepts the first wheel event in the stream.
Change-Id: I5ebfc7789b5c32ebc8d881686f450fa05ec92cfe
Fixes: QTBUG-79102
Pick-to: 5.15
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
When hiding a popup by clicking outside of its area, a window is closed.
Depending on the platform specific implementation details, this can
result in multiple calls to QWidgetPrivate::setVisible(false). The first
one from the handling of the close event in QWidgetWindow::event; the
second from the destruction of the window in QWindow::event.
Since the first call already sets the Qt::WA_WState_Hidden flag before
calling QWidgetPrivate::hide_helper, we can test if the flag is set
and skip the second call if it is.
The included test does not reproduce the issue, as that issue only
reproduces if the close event is generated by the mouse event handling
in the Cocoa platform plugin (which doesn't call QWidget::close, but
rather sends a native close event to the platform window). However, it
verifies that the fix doesn't introduce any regressions.
Change-Id: Id0eda9326a8adf0cc1f6a3840f9ac0b635ab39a1
Fixes: QTBUG-79134
Pick-to: 5.15
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
In the declaration, leave them in as comments so that the gaps in the
numbering of the values doesn't create confusion.
Change-Id: I92ff299416896c471e7c7d80b988cd4642b6b756
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
[ChangeLog][QtCore][QString] Now supports appending, prepending
and inserting QStringViews.
Change-Id: I7538c050c67590f27d91443eda0b94a4b80b62f2
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Rather than have a fontChanged() signal which can be connected to for
tracking when the application font has changed, then it is better to
use the event that is sent to all windows and the application itself.
That way it is easy for a window/widget or item that cares about the
change to the application font to catch it in the event() function.
[ChangeLog][QtGui][QGuiApplication] Deprecated fontChanged() signal in
favor of QEvent::ApplicationFontChanged.
Change-Id: Iae8e832238fc85e385a52305bc04f16e597454b0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Added asserts to insure the invariant declared in the documentation.
Canceled future object is not valid, hence we don't need to handle
this case separately.
Fixes: QTBUG-83389
Change-Id: Ib0653ef40cd3135574a91740e4ce2c6dc4da8a71
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This follows up on commits 3e7463411e and
947883141d.
The changing of the pointer of QApplicationPrivate does not transfer
focus properly. It updates the pointer, but it doesn't deliver events
or update the widget hierarchy's focus chain. The result is that
multiple line edits might show a blinking cursor.
Instead, use QWidget::setFocus when the focus proxy has changed while
it had focus, and pass OtherFocusReason rather than NoFocusReason.
Add a basic test for QWidget::focusProxy, which exercises this code
path and verifies that pointers are consistent when focus changes as
a side effect of modifying the focusProxy.
Change-Id: I15a4d868bab2b590cfe4a1daa6a3c8cebc9c9ca2
Fixes: QTBUG-83720
Fixes: QTBUG-79707
Pick-to: 5.15
Reviewed-by: David Faure <david.faure@kdab.com>
The internal removeAt(index) method was implemented as taking cbor
indexes directly, in contrast to the other ...At(index) methods.
Fixes: QTBUG-83695
Change-Id: I16597eb6db1cf71e1585c041caa81bf8f7a75303
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Also extend autotesting, both for rendering into a given mip level
and for rendering into a given cubemap face.
Change-Id: Ida94b71150477ceb50a3b5616d8b7be13174558b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
When a date-time was parsed from a string, the result was equal (as a
date-time) to the correct value, but had (at least in some cases) the
wrong spec, where it should have had a spec reflecting the zone
specifier parsed.
The time-spec imposed for the benefit of QDateTimeEdit is now moved
from QDateTimeParser to QDateTimeEditPrivate, which takes over
responsibility for imposing it. QDateTimeParser assumes Qt::LocalTime
in member functions (where applicable) and uses the time-spec parsed
from the string when constructing the date-time.
QDateTime::fromString() and QLocale::toDateTime() are updated to
use the full QDateTime returned by QDateTimeParser.
Fixes: QTBUG-83075
Done-With: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: I8b79add2c7fc13a200e1252d48dbfa70b36757bf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Ensure they are handled as enumerations in QMetaType.
This is required for handling QFlag-type properties in Qt Designer
Fixes: QTBUG-83689
Change-Id: Ifbfb5c5b5cd34fce462e299505d063e22e725c2e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
When converting a text document to HTML, always convert it to utf-8,
as required by the HTML standard. This also means that we remove
the optional encoding parameter.
Change-Id: I0bd2fc9df2d06734e1c5b8053b964fbfbb6881e1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
After adding new tests, the source code of tst_concurrentmap
grows rapidly with copy/paste/replace pattern.
This intoduce the issue with maintaining the test.
Get rid of separate functions for testing blocking versions
of mapped/mappedReduced and test blocking versions in parallel
with non-blocking flavors. So again, get rid of duplicated code.
Task-number: QTBUG-83258
Change-Id: I4cac6f4e1bfd1b50363dc094610717674aebf2af
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Test the case where reduce function of the form:
V function(T &result, const U &intermediate)
has T and U types different. Make use of
numberSumReduce function and corresponding functor
that reduce Number class object to the result of int type.
Fixes: QTBUG-83258
Change-Id: I194d290988b48e7bca91228c0cd5d39efd1b4712
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Move tests with initial value next to their original version.
Join new lambda tests into a common functions
testing all possible 16 combinations of
functor / function / member / lambda, as they
test in fact the same function. There is no need
to distinguish lambda case over other cases.
This helps in test readability and maintenance.
Add missing tests for lambdas with a combination
of initial value.
Task-number: QTBUG-83258
Change-Id: I7a3d2bf87384d7feecffaaf39281cd626955b0a4
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
The CommonMark spec shows that it's not necessary to have a space
between the code fence and the language string:
https://spec.commonmark.org/0.29/#example-112
This also avoids a needless trailing space after a code fence that
does not include a language string.
Change-Id: I2addd38a196045a7442150760b73269bfe4ffb22
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The end of a code block nested in a list item is now detected;
and if the text of the list item continues after the code block,
it continues to be indented.
Code blocks should never be word-wrapped.
Fixes: QTBUG-80603
Change-Id: I4427f8b1d4807d819616f5cb971e2d006170d9be
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Use the move-only versions of result reporting and getting operations,
if the type of QFuture is not copyable.
Task-number: QTBUG-81941
Change-Id: Ic9fa978380e2c24e190e68d974051a650b0e5571
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
Cleaning up those that are trivial to remove because they have direct
replacements.
Change-Id: Ie9fecd8c4822ed1a8f378b210cc4c4d9a10f7e36
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Cleaning up those that are trivial to remove because they have direct
replacements.
The QLabel changes to the pixmap/picture getters provide the following
migration path:
QPixmap *ppix = l->pixmap(); // up to 5.15, warns in 5.15
QPixmap pval = l->pixmap(Qt::ReturnByValue); // new in 5.15, works in 6
QPixmap pixmap = l->pixmap(); // from Qt 6 on
The overload with argument can be deprecated after the first LTS or
so.
Change-Id: I8494ceeea55b2aeda0bd340640ad95cb7c91f7d6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This is a follow-up to commit ed2b110b6a
to fix indexing errors. Added the test that should have accompanied
that commit, which found some bugs, and refined the Indian number
formatting test (on which it's based).
Make variable i in the loops that insert grouping characters in a
number be consistently a *character* offset - which, when each digit
is a surrogate pair, isn't the same as an index into the
QString. Apply the needed scaling when indexing with it, not when
setting it or decrementing it. Don't assume the separator has the same
width as a digit.
Differences in index no longer give the number of digits between two
points in a string, so actively track how many digits we've seen in a
group when converting a numeric string to the C locale. Partially
cleaned up the code for that in the process (more shall follow when I
sort out digit grouping properly, without special-casing India).
Change-Id: I13d0f24efa26e599dfefb5733e062088fa56d375
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The QT_OPENGL_ES* macros are leftovers from an earlier,
ad hoc configuration system, which has since been
replaced by QT_CONFIG. To clean things up in Qt 6,
we use the new way instead.
Task-number: QTBUG-83467
Change-Id: I578dc7695bff9d5ee303b22e44f60fee22fe0c28
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
And remove a test failure when compiling with asan enabled.
Change-Id: I2b8e676665572adcbbac6a910983d5b209bf6d23
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Instead of requiring the implementation to do the compare dance, let's
do this in the library. This reduces the amount of duplicated code
slightly and makes it easier to generate binding code from qml files.
Change-Id: Ia3b16cf9769e74d076b669efe4119ab84af3cdf0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The pre-existing overload passes an int, but this can mean the
descriptor gets truncated in compilations where the descriptor
is 64-bit.
The old overload with int is visible when querying the metaobject system
so string-based connects still work as before, and connecting to it will
produce a deprecation warning in the output.
At the same time the PMF-based connect will, on recompile, pick the
QSocketDescriptor overload. As an added improvement it also comes with
the notification type, removing the need for separate slots where the
code would be mostly shared anyway.
The QSocketDescriptor type can be implicitly converted to and from
qintptr to ensure existing code still compiles. It can also be
constructed from Qt::HANDLE on Windows.
In this same patch I also update the existing string-based connects in
this module, which then includes updating the parameters for some slots
as well.
[ChangeLog][QtCore][QSocketNotifier] Added
QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type).
This replaces the activated(int) signal which in 64-bit environments
could truncate the socket descriptor. If you use "activated" with the
string-based connect() then you need to update the parameter type of the
signal and slot if it had one. If you use it with the pointer to member
function based connect() then all you need to do is update your slot's
parameter type if it has one. If you need to compile your source code
with multiple versions of Qt then connect() to this function using
pointer to member function and update the slot's parameter type if
needed.
Task-number: QTBUG-70441
Change-Id: Ic43d6bc4c5bcb4040867b2ffad8d36fb01eed8af
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
And a few cleanups of out-dated comments and dead code.
Change-Id: I59c6b9129a21b8953626cb63c3ebbf9b6c49a657
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The context—which lives in QtGui—now knows nothing about versioned functions.
This changes the public API for getting version functions for a context.
[ChangeLog][QtGui][OpenGL] QOpenGLContext::versionFunctions() has been removed.
QOpenGLVersionFunctionsFactory::get() from the QtOpenGL module should be used
instead.
Previously one would call
context->versionFunctions<QOpenGLFunctions_4_0_Core>();
Which now becomes
QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_4_0_Core>(context);
The rest of the API should be identical.
Since glgen no longer compiles, and the links to its input (gl.spec and gl.tm)
are dead, I've edited the previously generated files manually. If glgen is
fixed, it should be quite easy to make it generate the new way.
Task-number: QTBUG-74409
Change-Id: I800527e0af16a79005b276eeb74417770193c62f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Use P0608's trick to detect convertibility without narrowing;
and now that we can depend on C++17, use its features.
First, this moves the burden of detecting a narrowing conversion on
the compiler, rather than us maintaining a complicated series
of checks. Of course, this exposes
* bugs in compilers (e.g. GCC < 9 thinks that float->bool is not
narrowing;
* behavior still not (widely) implemented (pointer to bool
conversions are narrowing, P1957);
* interesting compiler choices, e.g. GCC 9 thinks that unscoped
enumerations are non-narrowing convertible to a datatype big
enum to contain all the _enumerators_, even if the underlying
type of the enum (and/or its sizeof()) is wider than the target
datatype.
Second, it allows to detect conversions that have a narrowing
conversion as an intermediate step. Given a type like
struct Bad { operator double() const; };
then an object of type Bad is implictly convertible to a type
like int via a narrowing conversion. Therefore, a connection
is possible between a signal carrying a Bad and a slot accepting
an int. We can now detect and block this.
Tests regarding scoped enumerations have been dropped,
for the simple reason that a scoped enumeration is not
implictly convertible to an integral type, so we don't have
that detection (it would constantly fail). Scoped enumerations
do not take part in narrowing conversions anyhow, cf. [dcl.init.list].
[ChangeLog][QtCore][QObject] The detection of narrowing conversions
when calling QObject::connect() when
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT now takes also
into account user-defined implicit conversions that undergo
through a narrowing conversion.
Change-Id: Ie09d59203fe6283378b36dfbc54de1d58098ef51
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Map setFilterWildcard() and setFilterFixedString() to now use
QRegularExpression.
Change-Id: I2dff2015234decb2badfd306975dcff8553cdd7f
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Following the deprecation of the signal overloads, the remaining signals
did not provide equivalent functionality for connecting a slot expecting
an integer. The mapping from QAbstractButton* to the ID is comparatively
cumbersome to do in the connected slot.
Add uniquely named signals that emit the ID of the button directly.
[ChangeLog][QtWidgets][QButtonGroup] Added signals
idClicked/Pressed/Released/Toggled that replace the deprecated signal
overloads.
Change-Id: I77215e4f815c4fb7dd6326e1f431230e6601e8f8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* support lambda expressions
* remove the need to specify result_type
* use std::invoke to apply map|filter function
* remove usage of FunctionWrapper* and createFunctionWrapper
Task-number: QTBUG-33735
Task-number: QTBUG-82646
Change-Id: Ibcbe4278f0742c29182bd506081db0abb516f85f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
The double-swap technique I used was flawed and broke on
self-assignment. What I had meant to use was the move-and-swap
technique. Thanks to Peppe for pointing it out.
This also fixes a compiler bug in the Green Hills compiler. It was
finding the wrong "swap" function in qSwap:
using std::swap;
swap(value1, value2);
It's supposed to find swap(QCborValue &, QCborValue &) due to argument-
dependent lookup. It's instead finding std::swap<QCborValue>, which
recurses.
Fixes: QTBUG-83390
Change-Id: Ibdc95e9af7bd456a94ecfffd1603e1bee90cd107
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Some test cases are sensitive to the exact ordering inside
QHash, and need adjustments when we change QHash or the
hashing functions.
Some rcc tests now also need 32bit specific data, as the hashing
functions for 32 and 64 bit are different now (as we use size_t).
Change-Id: Ieab01cd55b1288336493b13c41d27e42a008bdd9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The old implementation was either using CRC32 on modern processors
or a trivial, but rather slow implementation.
We can't continue with CRC32, as that implementation can only
give us 32bit hashes, where we now need to support 64bit in Qt 6.
Change the implementation to use MurmurHash, as public domain
implementation that is both very fast and leads to well distributed hashes.
This hash function is about as fast as the SSE optimized CRC32 implementation
but works everywhere and gives us 64 bit hash values.
Here are some numbers (time for 10M hashes):
14 char 16 char
QByteArray QString float
old qHash (non CRC32) 127ms 134ms 48ms
old qHash (using SSE CRC32 instructions 60ms 62ms 46ms
new qHash 52ms 43ms 46ms
Unfortunately MurmurHash is not safe against hash table DoS attacks, as
potential hash collisions are indepenent of the seed. This will get
addressed in followup commit, where we use SipHash or an SSE optimized
AES based hashing algorithm that does not have those issues.
Change-Id: I4fbc0ac299215b6db78c7a0a2a1d7689b0ea848b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
At the same time use the opportunity to refactor the
insertion code inside the implementation of QHash to
avoid copy and move constructors as much as possible
and always construct nodes in place.
Change-Id: I951b4cf2c77a17f7db825c6a776aae38c2662d23
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This is required, so that QHash and QSet can hold more
than 2^32 items on 64 bit platforms.
The actual hashing functions for strings are still 32bit, this will
be changed in a follow-up commit.
Change-Id: I4372125252486075ff3a0b45ecfa818359fe103b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Make use of the new features available in QHash and do a more
performant implementation than the old one.
Change-Id: Ie74b3cdcc9871cd241aca205672093dc395d04a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A brand new QHash implementation using a faster and more memory efficient data
structure than the old QHash.
A new implementation for QHash. Instead of a node based approach as the old
QHash, this implementation now uses a two stage lookup table. The total
amount of buckets in the table are divided into spans of 128 entries.
Inside each span, we use an array of chars to index into a storage area
for the span.
The storage area for each span is a simple array, that gets (re-)allocated
with size increments of 16 items. This gives an average memory overhead of
8*sizeof(struct{ Key; Value; }) + 128*sizeof(char) + 16 for each span.
To give good performance and avoid too many collisions, the array keeps its
load factor between .25 and .5 (and grows and rehashes if the load factor goes
above .5).
This design allows us to keep the memory overhead of the Hash very small, while
at the same time giving very good performance. The calculated overhead for a
QHash<int, int> comes to 1.7-3.3 bytes per entry and to 2.2-4.3 bytes for
a QHash<ptr, ptr>.
The new implementation also completely splits the QHash and QMultiHash classes.
One behavioral change to note is that the new QHash implementation will not
provide stable references to nodes in the hash when the table needs to grow.
Benchmarking using https://github.com/Tessil/hash-table-shootout shows
very nice performance compared to many different hash table implementation.
Numbers shown below are for a hash<int64, int64> with 1 million entries. These
numbers scale nicely (mostly in a linear fashion with some variation due to
varying load factors) to smaller and larger tables. All numbers are in seconds,
measured with gcc on Linux:
Hash table random random random random reads full
insertion insertion full full after iteration
(reserved) deletes reads deletes
------------------------------------------------------------------------------
std::unordered_map 0,3842 0,1969 0,4511 0,1300 0,1169 0,0708
google::dense_hash_map 0,1091 0,0846 0,0550 0,0452 0,0754 0,0160
google::sparse_hash_map 0,2888 0,1582 0,0948 0,1020 0,1348 0,0112
tsl::sparse_map 0,1487 0,1013 0,0735 0,0448 0,0505 0,0042
old QHash 0,2886 0,1798 0,5065 0,0840 0,0717 0,1387
new QHash 0,0940 0,0714 0,1494 0,0579 0,0449 0,0146
Numbers for hash<std::string, int64>, with the string having 15 characters:
Hash table random random random random reads
insertion insertion full full after
(reserved) deletes reads deletes
--------------------------------------------------------------------
std::unordered_map 0,4993 0,2563 0,5515 0,2950 0,2153
google::dense_hash_map 0,2691 0,1870 0,1547 0,1125 0,1622
google::sparse_hash_map 0,6979 0,3304 0,1884 0,1822 0,2122
tsl::sparse_map 0,4066 0,2586 0,1929 0,1146 0,1095
old QHash 0,3236 0,2064 0,5986 0,2115 0,1666
new QHash 0,2119 0,1652 0,2390 0,1378 0,0965
Memory usage numbers (in MB for a table with 1M entries) also look very nice:
Hash table Key int64 std::string (15 chars)
Value int64 int64
---------------------------------------------------------
std::unordered_map 44.63 75.35
google::dense_hash_map 32.32 80,60
google::sparse_hash_map 18.08 44.21
tsl::sparse_map 20.44 45,93
old QHash 53.95 69,16
new QHash 23.23 51,32
Fixes: QTBUG-80311
Change-Id: I5679734144bc9bca2102acbe725fcc2fa89f0dff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add a new QRangeCollection type to store and manage
multiple page ranges. This moves out the parser and validator
logic from the platform dependent (UNIX) dialog and makes it
publicly available from QPrinter.
This improves the usability of QPrinter in those applications
which doesn't use print dialog to configure printer.
(e.g.: QTextDocument, QWebEnginePage)
Change-Id: I0be5a8a64781c411f83b96a24f216605a84958e5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Clear Linux containers running as root may have no /etc/passwd. But
they'll have /etc/machine-id because systemd creates that. Also test
/proc/version (a Linux-specific file) because that isn't writeable even
by root.
Take the opportunity to check with access() instead of assuming root and
only root can write to the file.
Change-Id: Ibdc95e9af7bd456a94ecfffd1603e8359604752b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This was never tested. The infinite loop in QCborContainerPrivate::grow
is the proof.
[ChangeLog][QtCore][QCborArray] Fixed an infinite loop when operator[]
was called with with an index larger than the array's size plus 1.
Change-Id: Ibdc95e9af7bd456a94ecfffd1603df3855c73f20
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Similar to the QJsonObject issue of the previous commit (found with the
same tests, but not the same root cause). One fix was that copying of
byte data from the QByteArray to itself won't work if the array
reallocates. The second was that
assign(*that, other.concrete());
fails to set other.d to null after moving. By calling the operator=, we
get the proper sequence of events.
[ChangeLog][QtCore][QCborMap] Fixed some issues relating to assigning
elements from a map to itself.
Note: QCborMap is not affected by the design flaw discovered in
QJsonObject because it always appends elements (it's unsorted), so
existing QCborValueRef references still refer to the same value.
Task-number: QTBUG-83366
Change-Id: Ibdc95e9af7bd456a94ecfffd1603df846f46094d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The refactoring to use CBOR missed two places where we could assign from
the same object and thus cause corruption. In fixing this issue, I found
a design flaw in QJsonObject, see Q_EXPECT_FAILing unit test and task
QTBUG-83398.
[ChangeLog][QtCore][QJsonObject] Fixed a regression from 5.13 that
incorrect results when assigning elements from an object to itself.
Fixes: QTBUG-83366
Change-Id: Ibdc95e9af7bd456a94ecfffd1603df24b06713aa
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Avoids ASAN warning of ODR violation:
SUMMARY: AddressSanitizer: odr-violation: global 'typeinfo name for
QSocketEngineHandler' at ../../../../../src/network/socket/qabstractsocketengine.cpp
This trick has not been needed since we got Q_AUTOTEST_EXPORT. The main .pro
file has:
requires(qtConfig(private_tests))
Change-Id: Ibdc95e9af7bd456a94ecfffd1603e598932b88ad
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Replaces the, only internaly used, implementation of template
class Median with a fixed size none templated version.
* Replaces BlockSizeManager with an updated BlockSizeManager V2,
but keeping the original name.
* adapt the auto-test to take the fixed size array into account
Change-Id: If76cb944676c4a06a7566ad0bc37ded25b81c70c
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Normally people shouldn't create temporary files on /, but if you're
running as root, why not?
Caught when running tst_qtemporaryfile as root:
openat(AT_FDCWD, "", O_RDWR|O_CLOEXEC|O_TMPFILE, 0600) = -1 ENOENT (No such file or directory)
Change-Id: Ibdc95e9af7bd456a94ecfffd1603ebfc17cea220
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
In Coin when provisioning for Android, we download and configure
the OpenSSL package, but don't actually build it. This means that
find_package(OpenSSL) can find the headers, but not the library,
and thus the package is marked as not found.
Previously the openssl_headers feature used the result of finding
the OpenSSL package, which led to it being disabled in the above
described Android case.
Introduce 2 new find scripts FindWrapOpenSSL and
FindWrapOpenSSLHeaders. FindWrapOpenSSLHeaders wraps FindOpenSSL,
and checks if the headers were found, regardless of the OpenSSL_FOUND
value, which can be used for implementing the openssl_headers feature.
FindWrapOpenSSL uses FindWrapOpenSSLHeaders, and simply wraps the
OpenSSL target if available.
The find scripts also have to set CMAKE_FIND_ROOT_PATH for Android.
Otherwise when someone passes in an OPENSSL_ROOT_DIR, its value will
always be prepended to the Android sysroot, causing the package not
to be found.
Adjust the mapping in helper.py to use the targets created by these
find scripts. This also replaces the openssl/nolink target.
Adjust the projects and tests to use the new target names.
Adjust the compile tests for dtls and oscp to use the
WrapOpenSSLHeaders target, so that the features can be enabled even
if the library is dlopen-ed (like on Android).
Task-number: QTBUG-83371
Change-Id: I738600e5aafef47a57e1db070be40116ca8ab995
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Conflicts:
examples/opengl/doc/src/cube.qdoc
src/corelib/global/qlibraryinfo.cpp
src/corelib/text/qbytearray_p.h
src/corelib/text/qlocale_data_p.h
src/corelib/time/qhijricalendar_data_p.h
src/corelib/time/qjalalicalendar_data_p.h
src/corelib/time/qromancalendar_data_p.h
src/network/ssl/qsslcertificate.h
src/widgets/doc/src/graphicsview.qdoc
src/widgets/widgets/qcombobox.cpp
src/widgets/widgets/qcombobox.h
tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
tests/manual/diaglib/debugproxystyle.cpp
tests/manual/diaglib/qwidgetdump.cpp
tests/manual/diaglib/qwindowdump.cpp
tests/manual/diaglib/textdump.cpp
util/locale_database/cldr2qlocalexml.py
util/locale_database/qlocalexml.py
util/locale_database/qlocalexml2cpp.py
Resolution of util/locale_database/ are based on:
https://codereview.qt-project.org/c/qt/qtbase/+/294250
and src/corelib/{text,time}/*_data_p.h were then regenerated by
running those scripts.
Updated CMakeLists.txt in each of
tests/auto/corelib/serialization/qcborstreamreader/
tests/auto/corelib/serialization/qcborvalue/
tests/auto/gui/kernel/
and generated new ones in each of
tests/auto/gui/kernel/qaddpostroutine/
tests/auto/gui/kernel/qhighdpiscaling/
tests/libfuzzer/corelib/text/qregularexpression/optimize/
tests/libfuzzer/gui/painting/qcolorspace/fromiccprofile/
tests/libfuzzer/gui/text/qtextdocument/sethtml/
tests/libfuzzer/gui/text/qtextdocument/setmarkdown/
tests/libfuzzer/gui/text/qtextlayout/beginlayout/
by running util/cmake/pro2cmake.py on their changed .pro files.
Changed target name in
tests/auto/gui/kernel/qaction/qaction.pro
tests/auto/gui/kernel/qaction/qactiongroup.pro
tests/auto/gui/kernel/qshortcut/qshortcut.pro
to ensure unique target names for CMake
Changed tst_QComboBox::currentIndex to not test the
currentIndexChanged(QString), as that one does not exist in Qt 6
anymore.
Change-Id: I9a85705484855ae1dc874a81f49d27a50b0dcff7
This requires mostly making moc a bit more permissive, which has the
advantage that it also simplifies the code a little bit.
The newly added test case demonstrates how to connect such a property
with a change signal.
One test case needed to be changed regarding the callback as the
publicProperty member now has a (permanent) observer and therefore
re-assigning the binding will re-evaluate it as the value might have
changed.
Change-Id: Ia7edcec432de830bdd4e07d943c5d4550c175ca4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
When a class has multiple QProperty members to implement functionality,
it is common to have functions in the class that react to changes. For
example to emit a compatibility signal, in case of Qt Quick to mark the
scene graph as dirty, etc. etc.
To faciliate this use-case, this patch adds an internal
QPropertyMemberChangeHandler template that allows connecting a QProperty
field to a member function callback.
At the moment that callback is still 3 * sizeof(pointer). This could in
theory be reduced to 2 by eliminating the back-pointer (prev) as the
observer lives as long as the property. That however belongs into maybe
a future patch.
In order to get a pointer back to the surrounding object that holds the
QProperty as well as provides the callback function, the property system
was changed to pass through the address of the QProperty member at
run-time, and at compile time the delta from the QProperty member to the
beginning of the surrounding class is calculated. Through subtraction we
obtain the pointer to the owning object.
Change-Id: Ia2976357053f474ff44d0d6f60527c3b8e1f613a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
std::function does not have deduction guides in older libc++ (presumably older
than version 10). Omitting the template parameter isn't essential for the test,
so just give it.
Change-Id: Ia9bb91f961b0928203737ec976913effd06433e0
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Use QTRY_COMPARE in the flaky tests instead of waiting.
Change-Id: Ic18fc5fde3fa47f3b3ef21e6acd876bd6990981d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 0ae6803d39)
All remaining pieces are gone, configuration included.
Relevant CMakeLists and configure.cmake were regenerated.
Fixes: QTBUG-76502
Change-Id: I667b5da7e3802830d236d50b5e9190c2ee9c19e2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The name of the option may cause confusion due to the fact
that it's not _fully_ anchoring the match, only anchoring it
at the offset passed to match() -- in other words, it's a
"left" anchoring. Deprecate the old name and introduce
a new one that should explain the situation better.
[ChangeLog][QtCore][QRegularExpression] The AnchoredMatchOption
match option has been deprecated in favor of
AnchorAtOffsetMatchOption, which should better describe
that the match is only anchored at the offset.
Change-Id: Ib751e5e488f2d0309a2da6496378247dfa4648de
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Show and activate the widget, otherwise we can't rely on geometry
and gesture event delivery. Use QTRY_ macros in a few more places.
As a drive-by, fix coding style.
Change-Id: If3a13732ae6b07a137fec89e78b7e6b39e066bed
Fixes: QTBUG-82947
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
DeleteLaterWidget is a main application window of the test. So, its
show() function should be called explicitly before starting the main
event loop. Otherwise, it remains hidden for the whole time, which
causes an incorrect emission of QApplication::lastWindowClosed signal
when a dialog window is closed in the middle of the test.
Also, fix synchronization between deferred deletion and timer event.
Change-Id: Id3ce5adbcd9e5e22508825c52025eeea70202354
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In particular, this changed the US currency formats for negative
amounts to be parenthesised versions of the positive amount forms,
rather than having a minus sign after the $ sign. Test updated.
[ChangeLog][QtCore][QLocale] Currency formats are now based on CLDR's
accounting formats, where they were previously mostly based (more or
less by accident) on standard formats. In particular, this now means
negative currency formats are specified, where available, where they
(mostly) were not previously.
Task-number: QTBUG-79902
Change-Id: Ie0c07515ece8bd518a74a6956bf97ca85e9894eb
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
The tst_QSplitter::replaceWidget() is testing that if you
replace a longer QLabel with a shorter one in a horizontal
splitter layout, then we *only* get a resize for the new,
shorter label (expanding it horizontally to match the
replaced widget, as documented).
But the test accidentally triggered the QTextDocument backend
for the QLabel by including HTML tags in its text. Due to
QTBUG-82954, it is possible that the QTextDocument height
includes the leading of the font in the last line, so if
the default font has a leading, the new label will be higher
than the QSplitter, and the splitter will expand its height,
causing resizes for the other labels as well.
Since this is not the case we are testing here, and it is
currently blocking the fix for QTBUG-80554, we simply make
the new label use the same plain text backend as the others.
Task-number: QTBUG-82954
Change-Id: I6bfa1f3648b0fc9758c57ab2fa95be2451995df3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Added QFuture::onFailed() method, which allows attaching handlers for
exceptions that may occur in QFuture continuation chains.
Task-number: QTBUG-81588
Change-Id: Iadeee99e3a7573207f6ca9f650ff9f7b6faa2cf7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Replaced the internal ExceptionHolder for storing QException* by
std::exception_ptr. This will allow to report and store exceptions
of types that are not derived from QException.
Task-number: QTBUG-81588
Change-Id: I96be919d8289448b3e608310e51a16cebc586301
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
QRegExp is deprecated in Qt6 and will get moved to the Qt 5 compat
library. As such we need to remove all API and usages of QRegExp
in Qt.
Change-Id: I33fb56701d3d7c577f98a304c1d4e6f626fcb397
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
We should not implicitly convert a QString to a QLocale object. It can
easily create unwanted side effects.
Change-Id: I7bd9b4a4e4512c0e60176ee4d241d172f00fdc32
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Quit the event loop once the object is destroyed.
Change-Id: I6df1cfe867daacb6af56eb84646be91d98a2f545
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The test can trigger timeouts in COIN, split into subtests.
Change-Id: I1fa5d52422275f89b2858d90c5979632aa7058e2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
QFuture's original design pre-dates C++11 and its
introduction of move semantics. QFuture is documented
as requiring copy-constructible classes and uses copy
operations for results (which in Qt's universe in general
is relatively cheap, due to the use of COW/data sharing).
QFuture::result(), QFuture::results(), QFuture::resultAt()
return copies. Now that the year is 2020, it makes some
sense to add support for move semantics and, in particular,
move-only types, like std::unique_ptr (that cannot be
obtained from QFuture using result etc.). Taking a result
or results from a QFuture renders it invalid. This patch
adds QFuture<T>::takeResults(), takeResult() and isValid().
'Taking' functions are 'enabled_if' for non-void types only
to improve the compiler's diagnostic (which would otherwise
spit some semi-articulate diagnostic).
As a bonus a bug was found in the pre-existing code (after
initially copy and pasted into the new function) - the one
where we incorrectly report ready results in (rather obscure)
filter mode.
Fixes: QTBUG-81941
Fixes: QTBUG-83182
Change-Id: I8ccdfc50aa310a3a79eef2cdc55f5ea210f889c3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>