Commit Graph

35702 Commits

Author SHA1 Message Date
Lars Knoll
d4b206b246 Split QMutex and QRecursiveMutex
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>
2020-10-17 12:02:56 +02:00
Lars Knoll
77d812683f Refactor QMutexLocker to be able to handle recursive mutexes
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>
2020-10-17 12:02:49 +02:00
MagnaboscoL
f76530a617 Fix the initial cursor state for the VNC plugin
Ensure that we show a cursor directly after a client connects.

Fixes: QTBUG-85006
Pick-to: 5.15
Change-Id: Icb604beb1b0ca2e7efa42ac01c2aac0a3e002865
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-17 12:02:24 +02:00
Lars Knoll
2732231182 Cleanup remaining QVariant::Type uses in Qt Sql
Change-Id: Ibcaa678cd9f9c957392a75b477fa6821f9a69127
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-17 12:01:54 +02:00
Friedemann Kleint
9ed75b6716 QWindowSystemInterface: Add tablet event overloads without timestamps
On some platforms, tablet events do not have a time stamp.

Task-number: QTBUG-46412
Change-Id: I3cc820b1edaaf55511c000fefb805f5a3a7872a6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-10-17 11:56:41 +02:00
David Skoland
4a7280598b Fix Clang compiler warnings (-Wrange-loop-analysis)
In a macOS environment, Clang throws a number of compiler warnings
about loop variables when building qtbase.

See task for more info about the environment.

This changes a handful of loop variables,
like QJsonValue references into QJsonValueRefs.

Task-number: QTBUG-87216
Pick-to: 5.15
Change-Id: I26006efd7c75c2d56ebc7f7efb4c9bdcabe92e8b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-17 11:56:30 +02:00
Volker Hilsheimer
833a6e18bf Implement move and comparison operators for QEventPoint
QEventPoints are equal when all data values are equal, the
refcount is ignored.

Change-Id: I6ef70faf0b12129eaa22bfc1f0a45bab2422d421
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-10-17 08:21:52 +02:00
Andy Shaw
a9982e64eb sqlite: Upgrade to 3.33.0
[ChangeLog][QtSQL][sqlite] Upgraded to v3.33.0

Pick-to: 5.15
Pick-to: 5.12
Change-Id: I379d8c62b449d4c6b04e5154c8c1a86761e5466e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-10-17 08:21:52 +02:00
Giuseppe D'Angelo
32c68232a7 QColorConstants: code tidies
Change-Id: Ib4131a583529d2cd6a6d7d27513cca387cb1d722
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2020-10-17 03:04:42 +02:00
Andreas Buhr
df8489816b Fix compilation with optimization with g++-10.2
When compiling in RelWithDebInfo configuration with g++-10.2,
it complains:
qtbase/src/gui/painting/qdatabuffer_p.h:71:36: error: argument 1 range
[18446744065119617024, 18446744073709551612] exceeds maximum object size
9223372036854775807 [-Werror=alloc-size-larger-than=]
This patch disables this warning in this place.

Pick-to: 5.15
Change-Id: Id3154ce80a1921671031828aaa7144214adad5dd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-10-16 18:49:02 +02:00
Alexandru Croitor
1f9ec097b2 CMake: Rename some public API functions
Some of them have a different (hopefully better) name now.
Some are marked as Technical Preview.
Some are renamed to be internal.

Marking add_qt_gui_executable as TP with the intention to un-TP it
after we rename it and change its behavior as discussed in the API
review meeting.

Additional changes to add_qt_gui_executable and qt6_add_resources have
been filed as separate tasks that will be worked on separately.

See comments on PS1 for details.

Task-number: QTBUG-86827
Change-Id: I56a84a1943b0902bb807310dc620eb381824e8dd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-16 13:53:04 +02:00
Alexandru Croitor
c6b3680bcf CMake: Fix qt_add_plugin to be a proper public API function
When configuring an example like
widgets/tools/plugandpaint/plugins/basictools outside of a Qt build,
the configuration fails because it tries to call the internal function
instead of the public one.

This was needed some time ago to facilitate moving from qt_add_plugin
to qt_internal_add_plugin, so some compatibility code was added.

But we've now migrated to qt_internal_add_plugin across most repos,
so we should remove the compatibility code to allow examples to
configure successfully.

Amends 6fbeef4c6b

Fixes: QTBUG-86858
Change-Id: Ib15f50351a8742c44d7a8be84be4e576cb48bddb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-16 13:53:04 +02:00
Volker Hilsheimer
f772b8e48c Document (some) Qt6 changes for QtWidgets
Change-Id: I8185e7c4d46f77fa80ad351e1e73d53ca30201a6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-10-16 13:53:03 +02:00
Volker Hilsheimer
1d49dad22c Fix warning, make sure temporary is moved into return value
Seen on clang 12; might be a compiler bug, but doesn't hurt
either.

Change-Id: I4aba8406c99951106e57fe9e61c688e649963cd6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-16 13:53:03 +02:00
Volker Hilsheimer
e2b3d42f94 Don't divide by zero when calculating number of items
Amends e74af68654.

If the model has children, then row 0 should have a non-zero size, but
it's not unthinkable that a delegate returns zero for size hint, so
protect against that case.

Task-number: QTBUG-87588
Pick-to: 5.15
Change-Id: Ia396f532d42ce5fad8757d629816c3cdc31d84ed
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org>
2020-10-16 13:53:03 +02:00
Volker Hilsheimer
0f1008a593 QAbstractItemView: don't lose items if model only allows MoveAction
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>
2020-10-16 13:53:03 +02:00
Giuseppe D'Angelo
aa442e9450 Q(E)SDP(V2): fill the API gap left by take()
take() returns a pointer to the shared data object *without*
decrementing the reference counter. The primary use case
is adopting the object from a Q(E)SDP into a different reference
counting mechanism. This is fine, but if we support the
"extraction" part, we shall also support the "adoption" part.
Also, the API for the shared data pointer classes should
match.

Add an adopting tag type and suitable constructors to the
shared data pointer classes, and add take() to the classes
lacking it.

Drive by, apply qExchange to take()'s implementation.

[ChangeLog][QtCore][QAdoptSharedDataTag] New class.
It is now possible to adopt pointers to shared data into
a QExplicitlySharedDataPointer or a QSharedDataPointer object
without incrementing the object's reference counter.

Change-Id: I62b8b005c1bfbe2add58566206fca27634bb7e70
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-16 13:53:03 +02:00
Ulf Hermann
7745b49b2d QMetaType: Silence float comparison warnings in QEqualityOperatorForType
We actually do want to invoke the original equality operator there. If
that is unsafe, we cannot do much about it at this point.

Change-Id: Iadb2eaba1156828d89022d282c41bda57b500b13
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-16 13:53:02 +02:00
Ulf Hermann
b3f3ebc2c0 Fix "variable set but unused" in qvariant.cpp
... how did that pass the CI?

Change-Id: I84baaf3632df0410d1fb25f24fd22f65daae13af
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-16 13:53:02 +02:00
Allan Sandfeld Jensen
382e3cb00f Add comparison operators to shared data pointers
To avoid they are compared as bools, or ambiguously.

Change-Id: I1495b3126a71c1379e72d4cf53b1a67590eb9f4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-16 13:53:02 +02:00
Andrei Golubev
59359f6782 Remove redundant duplicate of EnableForNonVoid in QFutureWatcher
qfuturewatcher.h includes qfuture.h, which includes EnableForNonVoid
through qfuture_impl.h header. Thus, there is never a need to keep
the same alias in QFutureWatcher as it always can use one from QFuture

Change-Id: I293fd087aea1a21ef5bcfdf50cdefc176a9703d0
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-10-16 09:48:10 +02:00
Andrei Golubev
db3d097db2 Fix subtle SFINAE problem in QPromise::addResult
Accidentally found out that we enable/disable QPromise::addResult based
on type deduced from input argument, instead of using "value_type" of
QPromise itself, which is wrong

Simplified the checks to a single one -
EnableIfSameOrConvertible<InputType, StoredType> as this is sufficient
to account for both cases: QPromise<void> and QPromise<T> with input,
convertible to T

Change-Id: I657998c0e26241b0fc5e70988622984ece8871df
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-10-16 09:48:10 +02:00
Andrei Golubev
7332d3937d Rename QPromise starting and finishing methods to start and finish
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>
2020-10-16 09:48:10 +02:00
Andrei Golubev
3ca600bd2d Make QPromise::addResult() return boolean status of operation
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>
2020-10-16 09:48:10 +02:00
Laszlo Agocs
696d94b132 Guard vulkan.h inclusion with __has_include
...and provide our dummy typedefs when vulkan.h is not available.

Originally this was there for qdoc, but from the qtdeclarative API
review it becomes clear that we need this also when an application
- that includes Qt Quick headers which in turn want to use VkImage
and co. for type safety - is built on a system without vulkan.h
against a Vulkan-enabled Qt build.

Also fix some of the typedefs which were technically incorrect. (not
that it matters much since the dummy typedefs still do not allow
calling exported Qt functions that use the real Vk* types since the
function signatures like won't match in some cases (would need to
replicate too much hocus pocus from vulkan.h for that), but that's fine
since our goal here is to keep application compilation going when it
encounters a Vk* type in a Qt header, not about enabling actually
calling those functions)

Task-number: QTBUG-87450
Change-Id: I855b4478c8707587b28db2408e282145129a0194
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-16 09:48:09 +02:00
Allan Sandfeld Jensen
ada6e4fbe9 Fix some bad uses of QSharedPointerData::operator T*
Avoid detaching where possible

Change-Id: I438d3e66689aeef05951af86a48af2a6910da7c2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-10-16 09:48:09 +02:00
Lars Knoll
b002c48cc7 Disallow promotion of bool and char in qMin and friends
Feedback on the API review. Make sure, qMin<true, 'a'> and similar
constructs don't compile.

Change-Id: I59a66348a4168fe306159ddaf2595838d4ed66d1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-16 09:48:09 +02:00
Lars Knoll
4097653215 Fix signature of QDebug::toString()
We don't need two overloads here.

Change-Id: Ia6a3bcd93491843e07b0295fefe8da42ae9d6519
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-16 09:48:09 +02:00
Laszlo Agocs
0461c535fc rhi: Further reduce copying in the command buffer
Change-Id: I2e2ff5f4b8aa91d0accb01108a5199b98c371455
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2020-10-16 09:48:09 +02:00
Laszlo Agocs
802d98d318 rhi: Unroll the res.binding factory functions
Trading typing in a few lines of straightforward code for a full
sizeof(QRhiShaderResourceBinding::Data) copy (with less fortunate
compilers that do not manage to optimize it away) is a bad deal.

Change-Id: If227320f8a9598508c1fe02c4f56e6d75f0a787b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-16 09:48:09 +02:00
Timur Pocheptsov
aa6b865899 QSslCertificate (generic) fill the extension's variant map
When parsing subjectAltName extension to make it more like OpenSSL
counterpart.

Fixes: QTBUG-86830
Change-Id: If1a4e72ee0b19f2cf40aa53632f9ec1468178c3b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-16 05:21:49 +02:00
Timur Pocheptsov
1ccd99187c Remove misleading comment
NSSegmentedControl is not of much use for us, due to different problems
it shows when rendered.

Change-Id: I57be237b33c226d0a84d18c76a4bffb92cea5274
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-10-16 05:21:43 +02:00
Volker Hilsheimer
4de8eefa80 Remove default parameter from QUnifiedTimer::updateAnimationTimers
After adjustments in Qt Declarative, this parameter is no longer needed.

Change-Id: I4b398748277aa29edd06ac122cfa8984575abf97
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-10-16 04:46:07 +02:00
Volker Hilsheimer
56332031a5 Document noteworthy change in QProcess
Change-Id: I4d9769901aef8255fc111f33eb141e05398f0ee3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-16 04:44:29 +02:00
Volker Hilsheimer
215594d664 Purge QDesktopWidget
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>
2020-10-16 04:44:13 +02:00
Giuseppe D'Angelo
ef1905aebc QMultiHash: fix operator==
An empty QMultiHash can still have an allocated dpointer, so we
can't desume that two hashes are different because one has a
dpointer and the other doesn't. Compares the sizes first, and
infer that equal size, and non-zero size, mean both have a dpointer.

Fixes: QTBUG-87575
Change-Id: I2e206bd071c02fb8970a4e77f8b0d29ad7e58bbe
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-16 01:08:00 +02:00
Giuseppe D'Angelo
9f1e1eb552 QHash: code tidies
Apply std::exchange. Remove a wrong comment about MultiNode
-- the compiler isn't generating any move operations, the
move constructor is user-provided and there isn't a move
assignment operator...

Change-Id: Idd69458c69cc93e4575c119daba564e0046452c1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-16 01:07:57 +02:00
Giuseppe D'Angelo
9fa848dcaf QOverload helpers: further cleanups
constexpr inline means we can remove [[maybe_unused]].

Change-Id: I034b6e742ef750dc1ebeca1d9cc7a2463f8c7b70
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-16 01:07:55 +02:00
Giuseppe D'Angelo
1261f391cc Floating point function helpers: code tidies
Change-Id: Id87390734f4ccb28fb83d25788ca600747c2e2a8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-16 01:07:53 +02:00
Giuseppe D'Angelo
b652f5a703 QtPrivate::Deprecated_t: code tidies
Change-Id: I08ae749b32aa9a302937691c76b7910175c8a71a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-16 01:07:50 +02:00
Giuseppe D'Angelo
bc4bd3c1bc QESDP::take(): document that it doesn't deref
Change-Id: Iba6c1caf4a7681815559db7c06691d02108ae855
Pick-to: 5.15
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2020-10-16 01:07:48 +02:00
Giuseppe D'Angelo
56475926e6 Port QColorTransform to QESDP
Remove the hand-rolled refcount management code, and
cleanup the existing constructors.

Change-Id: I1b91dbf888feff25d67310637d42dcdc3acaac13
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2020-10-16 01:07:45 +02:00
Giuseppe D'Angelo
35c565e965 Port some more /*implicit*/-like comments to Q_IMPLICIT
Change-Id: Ib70ad3f29365153af647deea54fc45467c413cb9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-16 01:07:31 +02:00
Giuseppe D'Angelo
2ded340d55 QTimeZone: drop an implicit conversion comment
The constructor isn't selected for conversions anyhow (it has
more than one argument), and in Qt we don't mark such constructors
as implicit (or explicit) anyways.

Change-Id: I4203b946b9c6934aef9eead2db96154f9851ab9a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-16 01:07:23 +02:00
Fabian Kosmale
86d2f7f365 QVariant::compare: handle numerical values and pointers as documented
[ChangeLog][QtCore][QVariant] Comparing two QVariants containing
floating point numbers for equality no longer uses fuzzy comparisons.

Change-Id: Iaba40a66d8fa566a432547fa1a30d5ea191c7fc0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-15 21:58:03 +02:00
Alex Trotsenko
53b4556332 QLocalSocket/Win: prevent writing to broken pipe
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>
2020-10-15 22:56:35 +03:00
Assam Boudjelthia
3d8447de59 Android: fix path issue with backslashes on Windows
The androiddeployqt tool wasn't handling dependencies with backslashes
properly, some dependencies like libplugins_platforms_qtforandroid was
written into libs.xml as
plugins\platforms\libplugins_platforms_qtforandroid_armeabi, the the app
won't be looking for the correct path of the lib to load.

Task-number: QTBUG-87574
Change-Id: Iad8c74d30d090adf69a17f2dafb455dff50b3d99
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-10-15 18:37:25 +03:00
Giuseppe D'Angelo
871392790e QOverload helpers: code tidies
Remove pre-C++14 code paths; and mark as `inline` the qOverload
helper objects (constexpr variables at namespace scope aren't
automatically inline).

Change-Id: Ieb2a9f06e39720d0c7215a3d1273c3a5996d0bc7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-10-15 02:35:55 +02:00
Karsten Heimrich
79889a91a1 Doc: Migration Guide for QString related changes
Task-number: QTBUG-87097
Change-Id: Idcdeaea5a65e91b99a08c2af03c7e76bbe5913bb
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-10-15 00:57:50 +02:00
Volker Hilsheimer
2cc8d801aa Unwrap private QPalette data member
Following 556511f9f3, there is only one
data member in addition to the shared QPalettePrivate, so we don't need
a data struct anymore.

Change-Id: I8d7f33ed042e47464eb5f60a048956f8bf70e0b9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-14 23:43:38 +02:00