QStyle::styleHint returns int, and that int was simply used to
build a QChar representing the "password mask" character.
Enforce that it actually fits and then do an explicit cast.
(In general, of course, this is an API flaw; styleHint should
somehow return a QString for this use case).
Change-Id: Ifb6181b229b91cc84859cb9b9d57e21d6748c31a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
A dependency was missing, causing qduplicatetracker_p not to be found.
Change-Id: I4076d6cf82d804354731c357bcdbfd03c3d42142
Reviewed-by: David Faure <david.faure@kdab.com>
There’s no need to convert the file name/path to QUrl,
and then back again to QString before calling qt_findAtNxFile().
Call qt_findAtNxFile first, and then convert to QUrl.
This makes sure the url-name and string-name stays
in sync.
Change-Id: I8b8939eabbdaff473945ebe31faafd408e9c4295
Pick-to: 5.15
Fixes: QTBUG-60793
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
We want to re-enable Android tests in QTQAINFRA-3867. However,
many tests are failing already preventing that from happening.
QTBUG-87025 is currently keeping track (links) to all of those
failing tests.
The current proposal is to hide those failing tests, and enable
Android test running in COIN for other tests. After, that try
to fix them one by one, and at the same time we can make sure
no more failing tests go unnoticed.
Task-number: QTBUG-87025
Change-Id: Ic1fe9fdd167cbcfd99efce9a09c69c344a36bbe4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use GrowsAt* and GrowthPosition as that is clearer.
Change-Id: I3c173797dec3620f508156efc0c51b4d2cd3e142
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
My endeavours figuring out why QList::append(elem) gives worst
performance compared to 5.15 ended up into this commit. After some
straightforward fixes, what was left is "everything is uniformly worse"
and takes more CPU cycles
Introduce emplaceBack implementation as append is quite a special case
that could be greatly simplified. This is a "straightforward" part of
the optimizations
While at it, change append(t) to use emplaceBack(t)
For workloads like:
QList<int> list;
forever {
list.append(0);
}
this gives huge improvement (roughly 30% for 10k+ elements),
movable and complex types also get a tiny speedup
Task-number: QTBUG-87330
Change-Id: I9261084e545c24e5473234220d2a3f2cd26c2b7f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Inline them into the one place they are called from
and remove duplicated code.
Change-Id: Ica88485e98625905083b16c24ee9eaf223a89ae0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Get rid of the allocation options inside the flags
field of QArrayData, they are really a completely
separate thing.
Change-Id: I823750ab9e4ca85642a0bd0e471ee79c9cde43fb
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Don't use QArrayData::GrowsForward/Backward anymore and replace
it with a simple 'bool grow'.
Change-Id: Ifddfef3ae860b11dda4c40854c71ef2aeb29df34
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
reallocate() should only ever call realloc(), and only be used to
create more space at the end of the data.
Change-Id: I2ac4dbc90d2afaa571bb620108d7984356712cb2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The while insertion logic will need further work to make it
more efficient. Currently it does use copy construction and
assignment for internal moving instead of move operations.
Change-Id: I7ae3094daa43a44629d8fa89ab6562c2a21b6cbd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Avoid moving data inside the array to create free
space at one end. This is a performance bottleneck,
as it required quite a lot of calculations for every
insert. Rather reallocate and grow in this case,
so we only need to do expensive work when we reallocate
the array.
Change-Id: Ifc955fbcf9967c3b66aa2600e0627aac15f0c917
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
It looks like we can drastically simplify the way QADP grows without
sacrificing much:
1. append-only use cases should have the same performance as before
2. prepend-only use cases should (with the help of other commits) get
additional performance speedup
3. mid-insertion is harder to reason about, but it is either unchanged
or benefits a bit as there's some free space at both ends now
4. mixed prepend/append cases are weird and would keep excess free
space around but this is less critical and overall less used AFAIK
Now, QList would actually start to feel like a double-ended container
instead of "it's QVector but with faster prepend". This commit should
help close the performance gap between 6.0 and 5.15 as well
As a drawback, we will most likely have more space allocated in mixed
and mid-insert cases. This needs to be checked
Task-number: QTBUG-86583
Change-Id: I7c6ede896144920fe01862b9fe789c8fdfc11f80
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Added some simple benchmarks for QList insertion of 1 element
Added same tests for QVector (within the same file) for 5.15
Task-number: QTBUG-87330
Task-number: QTBUG-86583
Pick-to: 5.15
Change-Id: I19a851c79cf5ce0329266883e99ecaf2d6b3df19
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QtConcurrent::blockingMapped was not able to determine the result
type in case of passing containers that have more than one template
argument. This should be fixed by the parrent commit.
Also fixed some unrelated compiler warnings.
Change-Id: I96618dc955c5e4c3792f28f6436d6851745dc01d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This makes it feature comparable with QAction, and makes it possible
to use as a backend for QAction, and fixes a few missing alternative
keybindings in qtwidgets.
Change-Id: Iaefc630b96c4743fc5ef429dc841870ddd99fc64
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
In 4e400369c0 we deprecated
normalizedPos() because we suspect it's a legacy feature that few
users will need. However Qt developers keep bringing up the continued
usage in autotests over and over. (It's IMO not wrong to keep testing
deprecated functions in autotests, but the warning keeps attracting
attention.)
Of course it will turn out that normalizedPos() has users; we just
don't know how many. One way to look at it is: why should they copy
a snippet of code to calculate it, when it costs us so little to
continue to provide this accessor.
It might also turn out that some users will complain that in Qt 5
it was passed through from the device driver (or at least from the
window system API) to the application, and perhaps the replacement will
not always work, for example if availableVirtualGeometry() ends up
wrong, or there is some strange scenario that generates events that are
out-of-bounds for the device that the event professes to come from, so
that the "normalized" coordinates also go outside the [0..1] range.
We reserve the right to put back the storage in QEventPointPrivate if
the need arises; so that's why this function is not inline.
We continue to hope that startNormalizedPos() and lastNormalizedPos()
are used even less and won't be missed much, because it would be
wasteful to store them all the time if only a few users need them.
Change-Id: I23ed78843e3f9e16133c5b6f462884a3845f91b6
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The existing logic broke down when we reentered the enumerator parsing
loop, and encountered a INCLUDE_MOC_END token in the first handleInclude
call. Fix this by restarting the loop in that case.
Amends d8a2456fbf.
Fixes: QTBUG-88125
Pick-to: 5.15
Change-Id: I87acaa986a81de53730eddc40bc7d48c15328aba
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
All QFontDatabase APIs are static, use them accordingly.
Task-number: QTBUG-88114
Change-Id: I0e4a7508646037e6e2812611262eed8b6d7ad3de
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
And add a QMultiHash::unite(const QHash &) method to avoid
a copy of the data when inserting a QHash into a multi hash.
Change-Id: I864aa9d2b9b7b2c367c3c4d140a2ce2f5408ae09
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The old code was trying to convert a multi hash to a QHash. While
that worked in Qt 5 it won't compile in Qt 6 anymore.
QHashCombineCommutative also can't be used with a std::pair.
ADL won't find the correct instance with a namespaced build,
as qHash(std::pair) is defined after QHashCommutative. Fix
the code to compile and work correctly.
Change-Id: Ice2bc3ab4244e310cbbb5e0f31fc11eb14f5faf3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This ensurse that we do not do dobule notifications in setValue.
Moerover we avoid needless notifications in markDirtyAndNotifyObservers
when the value did not change. Lastly, if the value did actually change,
we pass that information along to notify, so that we do not evaluate the
eager property twice.
Fixes a test-case which errorneously relied on the old behavior, and
adds a new test which verifies that the fix works.
Change-Id: I8ec6fa2fe8611565dfc603ceab3ba5f92999b26c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
std::function as a type is rather unfortunate for us, as its SSO buffer
makes it rather large, and we can ensure that the function is never
empty.
Considering that we do need to allocate memory for
QPropertyBindingPrivate anyway, we can get rid of the SSO buffer and
instead coalesce the allocations (similar to how std::make_shared works).
The memory looks then like
[--QPropertyBindingPrivate--][Functor]
and QPropertyBindingPrivate can get a pointer to the functor via
reinterpret_cast<std::byte>(this)+sizeof(QPropertyBindingPrivate).
To actually do anything with the functor, we do however need a "vtable"
which describes how we can call, destroy and move the functor. This is
done by creating a constexpr struct of function pointers, and storing a
pointer to it in QPropertyBindingPrivate.
As a consequence of those changes, we cannot use QESDP anymore, as we
now have to carefully deallocate the buffer we used for both the
QPropertyBindingPrivate and the functor. We introduce a custom
refcounting pointer for that. While we're at it, we make the refcount
non-atomic, as bindings do not work across threads to begin with.
Moreover, we can now make the class non-virtual, as that was only needed
to hack around limitations of QESDP in the context of exported symbols.
Change-Id: Idc5507e4c120e28df5bd5aea717fe69f15e540dc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
We'll need QContainerTraits as a class for changing properties
of our containers, so free up that name. This is not a problem,
as the namespace is new in Qt 6 and has only been used internally
so far.
Change-Id: I6d6b9d9c32b92b77e66323f1fc29b3ddd8baa98f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Let the new created embedded QLineEdit use the palette from QCombobox,
when calling [setEditable(true)]
Fixes: QTBUG-81533
Pick-to: 5.15
Change-Id: Ia406dd8122a348e185f0e94d027646b95eeaa76e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The tst_qtimer::zeroTimer unit test was relying on
QCoreApplication::processEvents processing all pending
events. However, for the glib backend, this is not the case.
For the glib backend, if there is an event of high
priority pending, low priority events are not processed.
This patch changes the test to use the overload with
timeout of processEvents, which does process events
until there are no more events or the timeout is reached.
Fixes: QTBUG-84291
Change-Id: I429141507b8603b57a191efa21f154493d75cc9e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Since the QVariant types are deprecated in Qt6, use QMetaType instead
Change-Id: I7bddea15a3f1a534d3c6f6b9e7ddf9585a8423bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
CMake builds are special and need to know the path to the source dir.
This is handled automatically by QTEST_MAIN, but tst_qapplication
doesn't use QTEST_MAIN. Thus we need to call
QTEST_SET_MAIN_SOURCE_PATH manually.
Task-number: QTBUG-87137
Change-Id: Ib2c461f0da0a3d9a2f571f37476b750a606065f7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The documentation states that QDate::fromString() accepts negative
year numbers, but it did not. This patch adds support for negative
year numbers to QDate::fromString() and corresponding unit tests.
Furthermore, tests are added for positive signs (+) in date strings.
Fixes: QTBUG-84334
Task-number: QTBUG-84349
Change-Id: I575291e7b8317055d4bb530011d7b10c9cd37ae1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
- Remove the casting operator of QFuture<T> to T. It calls
QFuture::result(), which may lead to undefined behavior if the user
has moved the results from QFuture via QFuture::takeResult() before
trying to do the conversion.
- Disable implicit conversion of QFuture<T> to QFuture<void>, by making
the constructor explicit. If the users really intend to do the
conversion, they should do it explicitly.
[ChangeLog][Source-Incompatible Changes][QFuture] Implicit conversions
of QFuture<T> to T and to QFuture<void> have been disabled. Use
QFuture::result() or QFuture::takeResult() where you need to convert
QFuture<T> to T. Use the explicit QFuture<void>(const QFuture<T> &)
constructor to convert QFuture<T> to QFuture<void>.
Change-Id: I153d4137d36365b1611ac934fb3ac2eb667fdd6c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Comparing QVariant's containing QDBusArguments does not work anymore in
Qt 6, where QVariant will simply use QMetaType equals. Thus we now do
the comparisons in a more manual way. This is currently only partially
implemented.
Additionally, adjust to changed warning message.
Fixes: QTBUG-87998
Change-Id: Ie63db4e8c8d03d7627234f3c892067d1557454af
Reviewed-by: Liang Qi <liang.qi@qt.io>
So far, the internals of QDateTimeParser and especially the handling
of 'Intermediate' values were only tested implicitly by
tst_qdatetimeedit. 'Intermediate' values are values which
are not valid according to the specified format, but could
become valid by adding more characters.
This patch adds unit tests which tests parsing of
these intermediate values directly.
These tests will help implement handling of negative
year numbers, where additional complications arise
because of possible ambiguities between the minus sign '-'
and the separator '-'.
Task-number: QTBUG-84334
Change-Id: Ia6ba08df198288b8b11d3b2d2052c194f04fe8a1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Test runWithPromise with "then" and "onCanceled" handlers.
Test the case when QFuture::cancel() is being called when
the task's thread already started, so that a call to
QPromise::isCanceled() from inside the running thread
returns different values in the same task's run. This nicely
proves that communication between QFuture and QPromise
works between different threads.
Task-number: QTBUG-84868
Change-Id: Icb2e0b1f99e2dcd919d881515f1ccd08e2f25b8c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
These operators don't do what the user might expect and may lead to
confusing results.
[ChangeLog][Source-Incompatible Changes][QFuture] The comparison
operators of QFuture have been removed. They were comparing the
underlying d-ptrs instead of comparing the results (as the users
might expect), which is not very helpful for the users point of view.
Change-Id: I80a887610eac38b60329128cca52cdb5fb515207
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
For the comparison of a QFuture<int> and an int, gcc creates code that
creates a qfloat16 instance, as can be seen when stepping through this
code:
QFuture<int> future;
int five = 5;
if (future == five)
return five;
Explicitly get the result of the QFuture to compare as a workaround.
Change-Id: Id2adc2268dbc0ccec7df3a9786c9d29dcdc04da3
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Requires subsequent re-numbering of the enum tables to eliminate gaps,
before locale data can be regenerated. However, it will work with the
present locale data, since it merely loses the means to use some names
for which the available data was just the name and code. This implies
a transient issue of recognising some codes for which there is no
actual enum member; but relevant code will work as before, finding
nothing but the code and its name. This shall be resolved by a coming
BiC change to resort the language, country and script codes, changing
the numbering (almost) completely.
[ChangeLog][QtCore][QLocale] Various obsolete language and country
codes have been removed. Some lacked locale data, others were obsolete
aliases. All have been deprecated in 5.15.
Task-number: QTBUG-84669
Change-Id: I45fc76a5f2f6c3b0ea3c1bb61e917da984183783
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Please note, that in case of run with promise it doesn't make
sense to provide the overload taking the FutureResult, as if we are
going to ignore the returned QFuture object, we can't communicate
with the passed QPromise.
Fixes: QTBUG-87083
Change-Id: I4066506736c2bbeea3e42030b9495f13e06cb27e
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Otherwise XOpenDisplay in a newly spawned process may fail with
a 'No protocol specified' message (as it recently happened in
CentOS 8.1 vm).
Fixes: QTBUG-87621
Pick-to: 5.15
Change-Id: Ib6c08c7f154fb2a126d32a4aa52b535e5daa1589
Reviewed-by: Liang Qi <liang.qi@qt.io>
As advocated in a ### Qt 6 comment.
[ChangeLog][QtCore][QItemSelectionRange] QItemSelectionRange no longer
supports ordering. The prior ordering was inconsistent with equality
and should not be needed.
Task-number: QTBUG-85700
Change-Id: I5eb372c203cae19db40fa67f706d911785652d5f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>