This way we can actually modify the container. Previously the interface
was rather useless.
Change-Id: I278aae46999862ada115c9066a010d7de5cde4ff
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The high-level iterable interfaces should coerce the types of most
QVariants passed to the expected ones. To do this, move the type
coercion code into qvariant.{h|cpp} so that it is available to the
QVariantRef specializations.
The exception are variants passed to the find() functions of associative
iterables. Here, we should not coerce values we cannot convert to the
default-constructed keys. Instead we return end() in such cases.
Fixes: QTBUG-87687
Change-Id: I0bd4e5c4e4e270dd3bf36cb3fb115794828077f2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
QString::toUpper() now insists we use its return, so the benchmark
won't compile unless we do so. Also document the helper macro used by
the tests, to explain why it's even there at all.
Change-Id: I830f121d92867bcd09277ecdeb1c764413b34fa6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The test macro's first three parameters were given a QLocale:: prefix
by the macro, but the last three weren't. Save uses of the macro the
need to repeat the prefix in all parameters, thereby making the test
cases easier to read. Also, we can compare enum values, rather than
casting them to int; and, when a test fails, reporting the enum name
is far more informative than reporting the integer that represents it.
Change-Id: Ib0360c51049333b4a00ea84e271c99db6724334f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This revealed that the test was always broken; it had simply never
actually been checked.
Done-with: Andreas Buhr <andreas.buhr@qt.io>
Change-Id: I85ac7ba30738fa3b41bf8440a059ee3fabb4726b
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Added some tests that trigger an assert without this check.
(Drive-by: renamed one QTime test to match its QDate(Time)? counterparts.)
Change-Id: I3d6767605fdcca13a9b4d43a32904f584eb57cf9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
This simplifies code that would otherwise need to use the setter and
getter in addition to the bindable.
Change-Id: Iec6510b4f578f5b223c63b3a0719257a0cf2463d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This is useful in cases like error handling when you need to print the
name of the lock file.
Change-Id: Ife4901ed53ae81d19e68cce7f1c173ef3745d56f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We now require C++17 and thus C++11 features or standard headers
should no longer be conditional.
Change-Id: I6b72306e809f71ec77acf7ffb97e2ed2ccd96e9d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Silence the warning, and test event delivery in addition.
Change-Id: I59c49a2ac70ecd32429116b76643700a7ad5ce3e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
These classes should not inherit from each other
anymore in Qt 6. The reason is that this makes
the 95% case of using a non-recursive mutex
much slower than it has to be.
This way, QMutex can now inline the fast path
and be pretty much as fast as QBasicMutex is
in Qt 5. They actually use the same code paths
now. The main difference is that QMutex allows
calling tryLock() with a timeout, which that
is not allowed for QBasicMutex.
[ChangeLog][QtCore][QMutex] QMutex does not support
recursive locking anymore. Use QRecursiveMutex for that
purpose. QRecursiveMutex does not inherit QMutex anymore
in Qt 6.
Change-Id: I10f9bab6269a9181a2e9f534fb72ce65bc76d989
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since we're going to split QMutex and QRecursiveMutex into
separate classes, make sure QMutexLocker is prepared for that.
Change-Id: Id5e9a955d1db7c8ee663dd3811ad6448dad0aeae
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The return value can be ignored here, so make intention clear.
Change-Id: I116869c47039b159db96f133b5850a2215873c2f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The test helpers are used both in the qtconcurrentmap tests and in the
qtconcurrentfilter tests. In the future, they should also be used
in generated tests. This patch moves the function out of the
qtconcurrentmap folder as it is not specific to 'map'.
Change-Id: Ie79a7ae3040a7eab7364a3aabf934158c7527b5a
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Tests the move semantics of QImage in Qt6.
Change-Id: Ia4d95f0b88ca7dde0daf85a0f53049b42b5be1a5
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
For iterators that return a value, don't use reference in ranged for,
and cast numeric literal to correct size type for QCOMPARE.
Change-Id: Idfd09dbc2ef3ab1bf025c7859ea6e2e9572bc9a1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
If a model only allows MoveAction, then calls in the view/widget subclasses'
dropEvent implementation to set the event's drop action to CopyAction
will fail. QAbstractItemView will then remove the item when QDrag::exec
returns.
Instead of abusing the event actions for this, store explicitly that the
dropEvent implementation already moved the item. If the flag is set,
don't remove the item.
In QListView, which uses moveRow to move items in the dropEvent handler,
handle the case that the model might not implement moveRows. In that
case, or when dropping an item onto another item (to overwrite data),
fall back to the default implementation of QAbstractItemView. Sadly, it
is impossible to know whether a model doesn't implement moveRows, or
whether the move failed for other reasons, so this requires a bit of
extra special case handling. QListView in IconMode is particularly odd
in that it moves the item in the view, but not in the model.
This follows up on fd894fd68e and fixes
additional issues discovered during debugging. Extend the existing unit
test; since drag'n'drop runs a modal, native event loop on most systems,
it still only runs on the Xcb platform.
Change-Id: I6c5377e2b097c8080001afe904d6d3e4aed33df4
Pick-to: 5.15
Fixes: QTBUG-87057
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Proposed during API review
Change-Id: I9c43e1915c50803ab69bfe07a91c05d2224b86c4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Changed QPromise::addResult() to return bool value. True is returned
when result is added and false is returned when e.g. promise is in final
state (canceled or finished) or when addResult() is called twice with
the same index as argument (in which case new value is rejected)
Updated QFutureInterface::reportFinished() that accepts optional result
as argument to align with other result adding methods. This function
is "internal" only (as of now), so no documentation update is needed
Change-Id: I2d63069246e5e5c8cf04529c22bb296faaaae53d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Interesting, it only exploded now - initially we were too fast (faster than
500 ms) so never noticed. Now that more tests with the similar event loop
handling were introduced, the last one was catching a single-shot timer
signal, accessing long dead object).
Fixes: QTBUG-87612
Change-Id: I52446fa7b08ef90a4742af3662da7837a8602941
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Tag them as [[maybe_unused]] to silence compiler on platforms where they
are not used.
Change-Id: I12243c0409c66863617f073f968e50f913c58a67
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
It's no longer used; the only calls to QApplicationPrivate::desktop
pass the default nullptr for QScreen, so all we need is a Qt::Desktop
type toplevel widget.
Include changes documentation about both the class and QApplication::desktop
being gone in Qt 6.
Change-Id: I22d6e93cabc6aaaefffe5e96942886a2ef4e0609
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
When a peer closes the connection, the device remains opened for reading
purposes. However, we should disable writing on disconnected socket.
Otherwise, if the user issues a write() call, a new pipe writer object
will be created and the write call occurs with invalid handle value.
Pick-to: 5.15
Change-Id: Id136798c7663df1fce7ed0aa4e3c6f5c65218a11
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
In order to prevent too much voodoo in backends like D3D11, the input
layout is expected to specify the slice index for vecX that are part of
an unrolled matrix.
Also deoptimize the instancing manual test to exercise a matrix too
instead of just vectors.
Change-Id: If2dcbcbc483645ce2420b2f87dda765b95da6e80
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Use a simpler constexpr to generate type name on gcc This
works around an ICE on gcc in release mode when compiling
with PCH enabled. As the type we're getting from Q_FUNC_INFO is
already in a somewhat normalized form, this requires significanlty
less processing and esp. not a recursive constexpr method which
I suspect triggers the ICE.
Fix integer type conversions to also properly normalize long long
values (to q(u)longlong. Make sure the mapping also works on
MSVC, where long long types get mapped to __int64. Also, normalize
unsigned short and unsigned char to ushort and uchar, respectively, to
follow the convention set by uint and ulong.
Add some test cases to verify the mappings.
Change-Id: I3dec5764450bf22ab6f066597803c3f46c2cd5ac
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
It's not possible to connect to microsoft.com with Schannel TLS 1.3 for
some reason (also tested with Internet Explorer), but other sites work
fine. Must be something they have to iron out for later.
In my experience this needs a preview release of Windows. One of my
machines is opted into the dev channel of Windows where they enabled TLS
1.3 by default, and it works well in my tests except for the part above.
On my other machine, after enabling TLS 1.3 through the registry, I fail
to complete the handshake with any site. So around March/April next year
is when this code would activate for most people.
MinGW apparently defines NTDDI_VERSION as the one for Windows Server
2003, so it currently doesn't build the new TLS 1.3 code. In Qt (as a
project) we could consider setting this higher, but that's out of scope
for this patch!
Fixes: QTBUG-81294
Change-Id: If329959c3a30ecbfbb8c0d335cc39ccb6d012890
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
tst_QApplication::sendEventsOnProcessEvents() and
tst_QItemDelegate::editorKeyPress()
There is some issue with the glib event dispatcher.
Task-number: QTBUG-87137
Pick-to: 5.15
Change-Id: I79a983192edef3c3560a4296cc9dea2dfc2ee1b0
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
Use QScreen APIs instead.
Change-Id: Ie99af94fe4292223dbb165b3f5c1b74e8fe0498b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
One can call addResult(value, index) twice and consequently set the
value twice by the same index. This seems rather strange and probably
should not be allowed. This commit rejects setting results when there's
already a valid result by that index. Consequently, this fixes memory
leaks caused by N-times-called addResult(..., index)
Fixes: QTBUG-86828
Change-Id: I77494f2cb73ce727ffad721cfcdcaa420899eb25
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Using std::begin() and std::end() forces the user to have const begin()
and end() member functions being defined for the passed container. This
is because std::declval<T>() returns rvalue which forces the compiler
to select std::{begin, end}()(const Container &c) overloads and an test
for a presence of const {begin, end}() methods.
Change-Id: I9d96d9f73891ece53224f1741a1334500f7b35ad
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This reverts commit 7544c242cb, which
reverted the first removal of the parameter under the assumption
that it caused flakiness in tests.
The flakiness was instead caused by changes to the wait functions
in QTest, so remove the parameter again.
Change-Id: I98154d5d7268375aebbcb09de757e75d9b765c5f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit restricts operator<<(QDebug lhs, QVariant rhs) to only work
if rhs is actually of type QVariant (instead of any type convertible to
QVariant). This is especially important as
a) we check in QMetaType whether (slightly simplified) QDebug{} <<
std::declval<T>() is valid, and if so, register a function which
simply uses the operator.
b) In QVariant, we ask the metatype system for the contained types
registered debug function and then use it.
If a type now does not have its own operator<< for QDebug, but is
implicitly convertible to QVariant containing itself, this would lead to
an infinite recursion, when trying to use qDebug with that type. The
registered function in a) would just convert the type to QVariant, and
then ask the QVariant to print itself.
Disallowing implicit conversions in qDebug in general was considered
(i.e. adding template<typename T> operator<<(T) = delete in QDebug ),
but discarded as it breaks too much code relying on conversions.
Fixes: QTBUG-87122
Change-Id: Ib709297670cbc6cc307efd0dfd8e5b0279df9414
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If the difference between the families sizes is just 1 where one of them
is 0 in size then we can fallback to the family in that case.
Pick-to: 5.15
Fixes: QTBUG-87267
Change-Id: I62b25b06c88000b4d7defe91871c07873b1fc792
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
QtConcurrent::filtered test-cases for move-only containers were failing
to compile, because it is assumed that the passed container should have
value_type defined.
Change-Id: I3e9e5ebc07704cb98a15b125ae8bd5b5a84d497a
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
QFuture::takeResult() currently returns std::vector instead of QList,
because QList does not support move-only types. Disable this method
until QList is fixed to work with move-only types in Qt 6.1.
Also did minor doc-fixes.
Change-Id: I87feaf75d9433a3b540edd00039c3e21d6994985
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
As propertyobservers can execute arbitrarily complex code, they can also
modify the obsever list in multiple ways. To protect against list
corruption resulting from this, we introduce a protection scheme which
makes the list resilient against modification.
A detailed description of the scheme can be found as a comment in
QPropertyObserverPointer::notify.
Task-number: QTBUG-87153
Change-Id: I9bb49e457165ddc1e4c8bbdf3d3c9fbf5ff27e94
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Implement the better rounding mechanism that was previously blocked
by requiring C++14 to be constexpr.
Change-Id: I4e5b179ce0703f5c0b41c3f0ea00d28dfe53740c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The original restriction to UniformBuffer was due to the GL backend
where there is no GL buffer object for QRhiBuffers with usage
UniformBuffer. However, we can still implement this for cases when
there is a true GL buffer object underneath. With other backends it
should all work as-is already.
This becomes useful when one has buffers with usage Vertex that need
full updates every frame. (f.ex. instance data)
Unfortunately this involves renaming the function. But while at it, add
an autotest case as well.
Change-Id: Iff59e4509a8bae06654cc92fe8428bd79eb012fb
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
The qsb files seem to be out of date for those two.
Change-Id: Id832e872667cac4d364e13c440011109a6dbdc7f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Draw 25000 cubes while doing a uniform buffer update for each.
Change-Id: I2216641c8bf7c6ea147fe3edd679317b472e1f04
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Pending results were never cleared by result store. This led to memory
leaks when the results never transitioned to "visible" results
Change-Id: I674302eb51542ad5f4d918da68d616428c73ae9f
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
It was previously casting enum values to int, which produced unhelpful
answers when a test failed. Better to have them as enum values that
get printed as their names, which are actually informative.
Change-Id: I1bf2971b1426bdbbc321bb48f45ee3e5799e76ec
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
QDateTime's addDays(), addMonths() and addYears() neglected to check
for validity before doing their job, with the result that they could
produce "valid" (but wildly inappropriate) results if used on an
invalid date-time. Added tests for this case (and the boundary).
Change-Id: I7b0d638501cb5d875a678cde213547a83ed7529e
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>