Commit Graph

35702 Commits

Author SHA1 Message Date
Laszlo Agocs
63790184c7 rhi: Fix up vertex inputs with matrices
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>
2020-10-14 22:35:19 +02:00
Doris Verria
61dee37d66 Return false from canFetchMore for uninitialized QFileSystem models
Task-number: QTBUG-87273
Pick-to: 5.15
Change-Id: I1787e3dd26ec10cf161d8fa4e329972b6dd4aa6c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-10-14 21:43:49 +02:00
Doris Verria
b84852670d Fix infinite loop triggered when displaying model with QTreeView
For some models like the QFileSystemModel canFetchMore() returns true even though fetchMore() doesn't return anything if setRootPath is false. To prevent an infinite loop, add a check to make sure the model's rowCount was updated during the loop.

Fixes: QTBUG-87273
Pick-to: 5.15
Change-Id: I16275fc2765fd77badc1c5d265e8ba5cd250163a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-10-14 21:43:45 +02:00
Lars Knoll
fa93f1aeb0 Fix compile time type normalization code
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>
2020-10-14 21:37:39 +02:00
Sona Kurazyan
0599255fcf Simplify implementations of QtConcurrent::blocking* methods
Call non-blocking methods from the blocking ones.

Change-Id: Icf63637223533254b76826340334de35bca258b2
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2020-10-14 21:24:31 +02:00
Sona Kurazyan
9ded473914 Minor cleanups based on API review
- Be more more consistent when declaring type aliases.
- Re-group include directives

Change-Id: Ic521e9f7692e538cc98871bdeccd9644c9879089
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2020-10-14 21:24:26 +02:00
Fabian Kosmale
e1926e5060 QMetaType: fix warning message
Change-Id: I93c8b0d6b490cfed944a2a6a2b64361258a50141
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-14 21:10:52 +02:00
Allan Sandfeld Jensen
0e85647ccf General cleanup of qshareddata.h
Update the code to something more modern and make the two types more
consistent.

Change-Id: I524d33fea158e2ba7079fe836164eec03c45649b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-10-14 20:58:52 +02:00
Giuseppe D'Angelo
a095a999a3 Long live Q_IMPLICIT!
C++20 will give us explicit(bool). While we can't use it just yet
in its full potential, we can introduce a macro to start marking
our implicit conversions (aka `explicit(false)`), removing the need
for /* implicit */-like comments.

Port a few usages to it.

Change-Id: I336d5e4c8d51d8329627900d1059e59062c5cafd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-14 20:58:51 +02:00
BogDan Vatra
a8dc2a5b6d Fix Qt6 renaming
Fixes sha: 1907599bfd

Change-Id: I20ece75c321835f13a605ae4d56fee1a034ca7c8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2020-10-14 21:57:11 +03:00
Shawn Rutledge
b0cd3bcec4 Use QScroller in the Dir View example
We have never had enough examples that show how easy it is to install
a QScroller.  In this case, one line makes a QTreeView flickable.

Pick-to: 5.15
Task-number: QTBUG-86090
Change-Id: Idb8b4709617befb261f3b78d63ddbdaf5ad18d6b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-10-14 18:29:00 +00:00
Volker Hilsheimer
eed5514eaf Mark QApplication::fontMetrics as obsolete
It returns the QFontMetrics of the desktop widget, so just for the
default screen. Any usage of it is probably wrong, esp since code should
use QFontMetricsF instead.

Change-Id: I0b4b85a74a2c9b6cc023ffda0b2b399f9fc3c1c4
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-10-14 18:10:19 +02:00
Volker Hilsheimer
a8dd18252c Remove QApplication::desktop
It's been replaced with QScreen-based APIs.

There's some internal code left
depending on a QWidget representing a screen, so move the API into
QApplicationPrivate until that's cleaned up as well.

Change-Id: I851e0901832f2747af3bf2c16a9c4d815598bd08
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-10-14 18:10:16 +02:00
Volker Hilsheimer
5c097f895d Add \since 6.0 to new function
Also fix general style of the documentation.

Task-number: QTBUG-86479
Change-Id: Ia46bb3ec02d6474dd79b8ac733e0c613abc5e0d8
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2020-10-14 18:10:01 +02:00
Mårten Nordheim
51faa0700d Schannel: TLS1.3 support
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>
2020-10-14 15:58:16 +02:00
Volker Hilsheimer
1c76aa077e Get rid of all usage of QApplication:desktop
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>
2020-10-14 06:38:43 +02:00
Giuseppe D'Angelo
772a10391e Drop qt_is_permutation
It was a workaround until we could depend on C++14's
std::is_permutation overload with 4 args. We now can, and the code
using it is gone anyhow, so drop it.

Change-Id: Ib9af71eeb767c83b1150c482441503288f1987d4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-14 00:59:10 +02:00
Volker Hilsheimer
456ba431e6 Document QApplication::desktop as obsolete
There is no function equivalent in Qt 5.15, but the entire QDesktopWidget
class is already documented as obsolete, so this method should implicitly
no longer be used in new code.

Qt 6 lifts QScreen up to support the various QDesktopWidget use cases,
and a follow up will remove this method from Qt 6.0, or at least mark it
as deprecated API as well so that it
generates warnings when used.

Change-Id: I9b205e6d4a636c22a95728695088233c898cbfc4
Pick-to: 5.15
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-10-14 00:44:37 +02:00
Andrei Golubev
ba511b2fa4 Reject overwrites by the same index in QPromise::addResult()
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>
2020-10-13 17:04:16 +02:00
Andrei Golubev
1ae15edd7e Remove nodiscard in QPropertyObserverNodeProtector ctor
Produced error in my GCC 7.5 on Ubuntu 18:
error: ‘nodiscard’ attribute applied to ‘QPropertyObserverNodeProtector<<anonymous> >::QPropertyObserverNodeProtector(QPropertyObserver*&)’ with void return type [-Werror=attributes]
     Q_REQUIRED_RESULT QPropertyObserverNodeProtector(QPropertyObserver *&observer)

Change-Id: Ic1f6c4f502bb4d5c764686d5521b92f655592bb2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-13 17:00:23 +02:00
Tor Arne Vestbø
705837771c Add a few missing Q_CLANG_QDOC for native interfaces
Change-Id: I5dbe2f7e7c03fb0a130b2da373f6f6a642d57575
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-10-13 16:39:32 +02:00
Assam Boudjelthia
13b4c332b4 Android: add missing new line to androidtestrunner help
Change-Id: Idba54c15af64b8dadcba9fa2125d6aae5e6c6bc9
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-10-13 15:32:33 +03:00
Timur Pocheptsov
4c251ac224 QSslSocket - replace NULL with nullptr
Change-Id: I3af7747f424ef7837c9c3d4af3e5cbd14922aeb6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-13 11:34:04 +02:00
Tor Arne Vestbø
12ef5a7344 doc: Add brief and group for native type conversions
Change-Id: I74608619201bf77e487fb986bf213b349cc22f6a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-10-13 10:44:02 +02:00
Giuseppe D'Angelo
f8076d6a5b QCborValue: streamline some code with qExchange
Change-Id: I79b68173a236ff1f28504a11ff182bdf48b2df0b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-13 10:28:54 +02:00
Lars Knoll
3e08154582 Mark the class QPropertyObserverNodeProtector as [[nodiscard]]
And not its constructor, as GCC at least doesn't like that.

Change-Id: I4aada7ca7135dd9c599980640588e7c98d398171
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-13 10:27:13 +02:00
Sona Kurazyan
d5c53554e5 Loosen the requirements on the container passed to QtConcurrent::map*
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>
2020-10-13 09:49:51 +02:00
Fabian Kosmale
1918c689d7 QObject: simplify part of connection logic
We do not require anymore that the metatypes are declared beforehand,
but can instead simply use QMetaType::fromType<T>().id().
This allows us to remove the templates containing the "metatype is
declared" validation logic.

Change-Id: I0b74c72643a233335689074091a38648f3e4f853
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-13 08:49:43 +02:00
Volker Hilsheimer
044231c4d2 Remove timeStep parameter from QAnimationDrive::advanceAnimation
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>
2020-10-13 08:44:42 +02:00
Allan Sandfeld Jensen
182760e84d Fix detach on bool check of QSharedDataPointer
We have a conversion to T* which would be triggered for a non negated
bool check.

Pick-to: 5.15
Change-Id: I543c66de6b4da64a3a63ee9a438fab6adcc58052
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-13 08:32:52 +02:00
Fabian Kosmale
b83225fcc3 qDebug: Avoid implicit QVariant conversion
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>
2020-10-13 08:06:18 +02:00
Alexandru Croitor
9aa2be236f CMake: Rename qt6_quick_compiler_process_resources to be internal
Task-number: QTBUG-86827
Change-Id: I9d97b53a8c85e0c488be312c8894a1d73397eb13
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-10-12 18:18:55 +02:00
Edward Welbourne
e2628b5f57 Minor refinements in QLocale
A loop's condition could be simplified.
Use std::size() rather than sizeof()/sizeof().
Clarify two comments.

Change-Id: Ideba2e0e1ba9c9656297aefb0a375cc122ee8626
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-12 16:54:01 +02:00
Edward Welbourne
57455543c5 Eliminate QLocaleId::fromIds() in favor of {...} construction
It's a value type, we don't need a pseudo-constructor to bypass constructors.

Change-Id: Ic4774c82e43ab7e2c54ac743026ce087e34c150f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2020-10-12 16:53:45 +02:00
Edward Welbourne
8b0e068847 Mark QLocale's Language, Country and Script enums as ushort
The code pervasively presumes their values can be held in a ushort, so
make sure the compiler knows we expect that to work (and doesn't
complain about narrowing when we do convert them to ushort).

Change-Id: Idde7be6cceee8a6dae333c5b1d5a0120fec32e4a
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-12 16:53:40 +02:00
Tor Arne Vestbø
71ad83529e rhi: Add missing \internal doc commands
Pick-to: 5.15
Change-Id: I09a69a04c6fcd406602e797cbeec59216fecd5d8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-10-12 15:27:46 +02:00
Tor Arne Vestbø
7e271686a7 Exclude all modifiers as candidates for shortcuts
If we're going to limit shortcuts to non-modifiers, we should
at least include all of the modifiers, otherwise we'll end up
passing through e.g. Key_CapsLock.

Change-Id: If11758f85d06f75e9b9c2d2a57d4a4915ff72317
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-10-12 15:23:15 +02:00
Lars Knoll
92b7122eda Remove dead code
This code has been deprecated in Qt 5.

Change-Id: Ia8e0bc791ac1f43df7124b4f30db3d0bb9966015
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-10-12 14:49:50 +02:00
Lars Knoll
feab484b8d Enable the Android style plugin for the cmake build
Change-Id: Ie6a82c47c92067fb22270891bb81cd75ed3c9212
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-12 14:49:24 +02:00
Timur Pocheptsov
4cfea12cb8 QtNetwork: add documentation about porting from Qt 5 to Qt 6
Fixes: QTBUG-87098
Change-Id: I91e9d644c6491abaa3bdfe2735aff4a43b545da5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-12 14:17:17 +02:00
Andy Shaw
bdc9d272ee Fallback to using the family when doing an exact match
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>
2020-10-12 14:08:06 +02:00
Sona Kurazyan
605bbe2011 Make QtConcurrent docs more readable
- Replaced 'auto' keyword in function signatures by the actual return
  type.

- Fixed signatures to not include enable_if statements.

Change-Id: I7292e8e506fd50d22974a86448fa4e85e8f08dfb
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-12 13:52:01 +02:00
Sona Kurazyan
3069313492 Eliminate the extra copy in QtConcurrent's blocking methods
Use QFuture::takeResult() instead of QFuture::result() for returning the
resulting sequence from the blocking methods of QtConcurrent.

Change-Id: I0b623ee1ad8bda6789f329dcd63a46acda924539
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-12 13:51:49 +02:00
Sona Kurazyan
3d040267f4 Temporarily disable QFuture::takeResult() method
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>
2020-10-12 13:51:34 +02:00
Mitch Curtis
4897aa8b5f Fix build when configuring with -sanitize thread on gcc
There is no <sanitizer/tsan_interface.h> header when building with gcc,
at least on Ubuntu 18.04.3.

Fixes: QTBUG-87317
Change-Id: Ie933f6fa478f11b5062c665007e91be68e31ebe3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-12 13:47:40 +02:00
Alexandru Croitor
28ed9e3e2d CMake: Set some additional info variables in Qt6CoreConfigExtras
Add info whether Qt was an infix built, and whether the reduce_exports
feature was enabled. These variable were set before in
Qt5CoreConfigExtras.cmake.

Change-Id: Id077763cfffd5ee6f1a7a28d04cf92dc46390c54
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-10-12 13:35:50 +02:00
Alexandru Croitor
c6a5cdcee6 CMake: Introduce Qt6::Startup target
Add an abstraction over Qt::WinMain (aka qtmain.lib) and
iOS's runtime linker entry point (_qt_main_wrapper).

The Core target will now link against the Startup target on all
platforms, instead of just WinMain on Windows.

The creation and linkage interface definition of the Startup target
is done at find_package(Qt6Core) time via the private call of
_qt_internal_setup_startup_target().

This will add automatic linkage of WinMain to executables marked with
the WIN32_EXECUTABLE property on Windows.
As well as the addition of the '-Wl,-e,_qt_main_wrapper' linker flag
when linking iOS executables.

Qt users can opt out of this behavior by either setting the
QT_NO_LINK_QTMAIN property or variable. This is in line with
Qt 5 behavior.

Task-number: QTBUG-87060
Change-Id: I7d5e9f1be0e402cf8e67e6f55bfd285f9e6b04f4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-12 13:35:48 +02:00
Kai Koehne
7c12c8d113 Fix copyright year of tinycbor
[ChangeLog][Third-Party Code] Fix aggregated copyright information of TinyCBOR
component to reflect the years in the individual source files. Note that this
is not same as the Copyright year in the upstream MIT license text.

Pick-to: 5.15 5.12
Change-Id: I238d973d937fbfc3a81627c4c65491fbb5cb3c30
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-12 13:20:12 +02:00
David Skoland
b683d8727f Fix "Runing" typo in CMake config
Change-Id: I77f2970d70ab221e5d7d5c5d389041ed1b6c49f5
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2020-10-12 13:05:34 +02:00
Ulf Hermann
d9f9bc9bad QMetaType: Avoid combination of extern and declspec(__dllexport) on MSVC
MSVC does strange things with this, and it actually tells us so via a
warning. We can, however, attach the dllexport to the definition, rather
than the declaration of the symbols in order to resolve the problem.

Change-Id: I9971e13afc6d8840c49ec20d21820a72c5407200
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-12 13:04:27 +02:00
Tor Arne Vestbø
b1e234b224 macOS: Always include non-GL native interfaces
Change-Id: Idc8e76b5cb7af8b8df54820a4150ac7d1e3d8944
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-10-12 13:03:59 +02:00
Tor Arne Vestbø
2b14556a96 Rename QtGui native interface implementation files
Follows the naming convention used by the plugins as well.

Change-Id: Icba62fc2aaa5acf0ab3c88599a63aab1f530a2ab
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-10-12 13:03:56 +02:00
Fabian Kosmale
75b8c4d75e QPropertyBinding: compare QMetaType directly
Change-Id: I36fbc8ebed096aa6f7be48456005395b65229359
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-10-12 13:01:49 +02:00
Fabian Kosmale
ed460ba7e2 QPropertyObserver: mark as noexcecpt
Change-Id: I2df75b35e42fa923c6cbf71a15569dc37140ee55
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-10-12 13:01:45 +02:00
Fabian Kosmale
f2f5e962b6 QUntypedPropertyBinding::QUntypedPropertyBinding: use member initializer list
No need to default initialize the std::function and source location.

Change-Id: I7d840376b16e7257386a4787dd06b7956fe37576
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-10-12 13:01:44 +02:00
Fabian Kosmale
901b2975dd QProperty: avoid needless std::function copying
Change-Id: Iea6280b12e7146a9ac92f071a4c21b373e9d3ab0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-10-12 13:01:43 +02:00
Fabian Kosmale
f912ad0a4d QProperty: make a few helpers constexpr
Change-Id: I1f3b2223530c311a7b40fd36c8162e32adbd9569
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-10-12 13:01:37 +02:00
Fabian Kosmale
2f3cd3b1a8 Handle notifier list modification during iteration
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>
2020-10-12 13:01:29 +02:00
Sona Kurazyan
64c9db2259 Remove an unneeded include
Change-Id: Iba171012955e475f51d6319a69d8cd351aa6131b
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
2020-10-12 13:00:43 +02:00
Allan Sandfeld Jensen
a0deaf42e2 Improve QRectF::toRect()
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>
2020-10-12 13:00:43 +02:00
Fabian Kosmale
927813fc95 QPropertyChangeHandler: mark as nodiscard
Change-Id: Ibf399b5aac732e8f80d0a37df711806c1c5550ac
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-12 13:00:43 +02:00
Mitch Curtis
98d65f2ff4 Add an example to the documentation of QImage::scanLine()
I couldn't find any examples in Qt's documentation of this when I was
trying to use it in a project.

Pick-to: 5.15 5.12
Change-Id: Ic7b7b71f219b2c1012829980866940b9a77bd11f
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2020-10-12 13:00:43 +02:00
Mitch Curtis
418389c3ed Link to qAlpha in qRgb() and qRgba() docs
Pick-to: 5.15 5.12
Change-Id: I5a3b8573123e82f4c8c92fa7a2e1af06e2e84eb2
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2020-10-12 13:00:43 +02:00
Mitch Curtis
8095829758 Improve QRgb documentation
- Add examples of how to create QRgb values
- Link to qRgba()

Pick-to: 5.15 5.12
Change-Id: I2a86b1c8e00137ba868426b8157a3aa0d924d7a6
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2020-10-12 13:00:43 +02:00
Allan Sandfeld Jensen
0aa8925f1a Protect QImage work on shutdown
If the thread pool was not created, or already deleted, make sure
the QImage routines can still run as they could before.

Fixes: QTBUG-87320
Pick-to: 5.15
Change-Id: I4105a68b6ae0637faf82cdda5f5ae44298759396
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-10-12 13:00:42 +02:00
Robert Loehning
1d778a59f7 Avoid heap-buffer-overflow
[ChangeLog][QCosmeticStroker] Avoid a heap-buffer-overflow found by oss-
fuzz as issue 25243.

Pick-to: 5.12 5.15
Change-Id: I36112f183241679e172ad1ee531e1b929d6f3815
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-10-12 10:14:52 +02:00
Jan Grulich
316bf12443 FileChooser portal: skip empty filters to avoid rejection from portals
Xdg-desktop-portal will reject any OpenFile request if there is an empty
filter. We will just simply skip it to avoid the rejection so users get
a file dialog.

Pick-to: 5.15
Change-Id: I85c056f46b22cdbc9e14010bc3c49206b6f8f002
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-12 10:14:52 +02:00
Laszlo Agocs
2189e0f2fc rhi: Make the new direct buffer update available for non-uniform buffers
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>
2020-10-12 07:55:37 +02:00
Allan Sandfeld Jensen
e7c456d339 Cleanup qshareddata.h noexcept status
Set noexcept on functions where it applies.

Change-Id: I5efa632bd1652e1215e9c6d3b06dc40c948420d3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-11 19:57:54 +02:00
Laszlo Agocs
8116df5331 rhi: d3d: Save a few cycles in bindShaderResources
Change-Id: Ib11ea33eb695d4599f4f040415d497aaf19cb15b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:59:05 +02:00
Laszlo Agocs
755f24f153 rhi: d3d: Calculate dynamic offset usage upfront
Also remove an unnecessary buffer type test.

Change-Id: I6f8312f03d3fe1729fa9b2eb95f6bfbeeccd0d4f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:59:02 +02:00
Laszlo Agocs
fe5f2c8bff rhi: vk: Avoid shadowing local variable
Change-Id: I7ad14ff05a1ff10113f5d3985662970d74e68ead
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:58:59 +02:00
Laszlo Agocs
22de21a26c rhi: vk: Skip buffer/texture registration on read-after-read
Change-Id: I22027cfc227d3c09e446d193e6b2903b8df34eb2
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:58:53 +02:00
Laszlo Agocs
8c9dfd7914 rhi: gl: vk: Pre-calculate the flags for dyn.offset
...instead of doing a loop in setShaderResources() just for this.

Change-Id: Iac8d4517783967c6b8bca4926cceca918f7dcdec
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:58:50 +02:00
Laszlo Agocs
b540c78355 rhi: gl: d3d: Reduce the size of the Command struct
Copied by value so the size matters.

Change-Id: I17eae99212801a4fb390a0e298b361123644d17d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:58:47 +02:00
Laszlo Agocs
9d804a54ae rhi: gl: Move some code out of the inner loops
Change-Id: I96c71ef45b93ab95250a2a3f0e9c10e8bc86d650
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:58:41 +02:00
Laszlo Agocs
2ac2809ec3 rhi: Add support for full, direct buffer updates
Change-Id: I02c1f8c32c08d39cde9845d20ba8b02541d9d325
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-11 10:58:37 +02:00
Allan Sandfeld Jensen
cd0b5bba9a Make the named QColorSpace constructor thread-safe
Avoid accessing the shared pointer table without using atomic.

Cleans up the shared table on exit for leak tracking utilities.

Pick-to: 5.15
Change-Id: Ia2d6d79dea1c8be02bae2d8111e290f49eedf409
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-10-10 15:52:07 +02:00
Sona Kurazyan
1613eff15e Add porting section for QtConcurrent and related classes
Task-number: QTBUG-87096
Change-Id: Ie143db6c0d1e81f7a089799996d468360c44e2ca
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-10-09 17:05:06 +02:00
Andrei Golubev
2bbbd47929 Make result finding procedure in ResultStore a free-standing function
Moved the logic of finding a result in ResultStore to separate function
and parameterized it with QMap<...>. This is a pre-step to make find
procedure uniform regardless of the storage we are looking in (either
visible or pending as of now)

Change-Id: I41641d70751925f223e992f52fbc7814085c452d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-10-09 16:26:05 +02:00
Andrei Golubev
c22aabe9bc Clear pending results in ResultStore
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>
2020-10-09 16:26:01 +02:00
Cristian Adam
27499d25fb MinGW: Fix static build using PCH
The value of NTDDI_VERSION is computed from _WIN32_WINNT. It makes
sense to keep these two in sync.

The value used to create the PCHs for _WIN32_WINNT is 0x601, and
qwindowspointerhandler.cpp requires for MinGW 0x603. Since the
precompile header value cannot be undefined while compiling the
source file, it's better not to use the PCH for this particular
source file.

These problems surface in a static build, in a regular build for
some reason the PCH for plugins is not used.

Change-Id: Id724490deb9c695ac00b26cd300f9d2382019ea2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-09 16:15:17 +02:00
Kai Koehne
4de97909b2 CMake: Do not use versionless targets in examples (Qt Core)
This is confusing, especially because it's not used in the whole snippet.

Pick-to: 5.15
Change-Id: Ibd59646da2c77ac19a38441021c5e99f52015c95
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-09 14:17:27 +02:00
Lars Knoll
c2fde55976 Fix a compile error on Android in debug builds
Android uses -Werror,-Wsign-compare.

Change-Id: I4e861ebd6ea00914223358629f8e898c2aa67cd0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2020-10-09 12:52:23 +02:00
Alessandro Portale
23189a9068 Fix warning: 'open' has superfluous mode bits; missing O_CREAT?
Adding mode flags doesn't make sense if you don't create a file
but only open if for reading.

Change-Id: I9307b07cbbcddea565fff9258de7f7beb373a8ad
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-09 12:52:14 +02:00
Paul Olav Tvete
cb1004f94a Disable spurious warning with gcc 9.3
gcc 9.3 gives a warning when compiling with -O2:
‘strlen’ argument missing terminating nul [-Werror=stringop-overflow=]

This seems to be caused by a gcc bug that is not present in gcc 8
and fixed in gcc 10:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91490

Change-Id: Ice3c18efb7a41097521ecee22d060f175083c579
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-10-09 06:15:15 +00:00
Friedemann Kleint
1f2e6062d2 Windows Vista/XP Styles: Remove XP-specific code
WindowsXPStyle cannot be instantiated via style factory
since 5.0. The derived class QWindowsVistaStyle still uses
much of its code, though.

Remove the XP-specific code as determined by
- Adding debug output with the enums added to WindowsXPStyle's
  functions
- Run the widgets gallery example in Vista style
- Run the widgets gallery example in XP style
- From the lines not appearing in both logs
  (comm -3), remove the code present in WindowsXPStyle

drawComplexControl() QStyle::CC_ComboBox
drawComplexControl() QStyle::CC_ScrollBar
drawComplexControl() QStyle::CC_SpinBox
drawControl() QStyle::CE_ComboBoxLabel
drawControl() QStyle::CE_HeaderSection
drawControl() QStyle::CE_ProgressBarContents
drawControl() QStyle::CE_PushButtonBevel
drawPrimitive() QStyle::PE_FrameLineEdit
drawPrimitive() QStyle::PE_IndicatorBranch
drawPrimitive() QStyle::PE_IndicatorProgressChunk
drawPrimitive() QStyle::PE_PanelItemViewItem
drawPrimitive() QStyle::PE_PanelLineEdit
sizeFromContents() QStyle::CT_SpinBox
standardIcon() QStyle::SP_CommandLink
standardPixmap() QStyle::SP_ArrowRight
standardPixmap() QStyle::SP_CommandLink
styleHint() QStyle::SH_Header_ArrowAlignment

Change-Id: Ic6a19cabf39d1089328a7cb1afdc282a60a7cf21
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-10-09 05:36:48 +00:00
Edward Welbourne
92f0f99c23 Check validity before adding to a QDateTime
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>
2020-10-09 01:11:20 +02:00
Edward Welbourne
2a6f2fe9ef Check against {und,ov}erflow in more QDateTime methods
QDateTime's range of possible values is wider than anyone generally
needs, but let's not do confusing things when someone does overflow
it.

Change-Id: Ifbaf7a0f02cd3afe7d3d13c829bf0887eba29f7f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2020-10-09 01:11:00 +02:00
Edward Welbourne
cb0ecd6b6d Check value is in range when setting a QDateTime
Previously, a QDate representing more than about 0.3 gigayears before
or after the epoch would overflow the millisecond count and produce a
"valid" date-time that didn't represent the date and time passed to
its constructor.  Changed to detect such overflow and produce an
invalid date-time instead, if it happens.

Corrected some tests that wrongly expected to be able to represent
extreme date-time values with every time-spec.  The (milli)seconds
since epoch are from UTC's epoch, so converting to another offset,
zone or local time may give a value outside the actual range.  Added
some tests for the actual exact bounds.

Task-number: QTBUG-68855
Change-Id: I866a4974aeb54bba92dbe7eab0a440baf02124f0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2020-10-09 01:09:42 +02:00
Lars Knoll
4ba3d67ee7 Fix a compiler warning on Android
Change-Id: Ia3d1ee6dccfbf335d689513d51c3920cfa102166
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2020-10-08 22:32:59 +02:00
Allan Sandfeld Jensen
e5e89d17b3 Avoid double pixel-ratio scaling of dbus tray icons
QIcon::pixmap does automatic scaling to DPR by default, so
use QIconEngine API to access internal pixmaps directly instead.

Pick-to: 5.15
Task-number: QTBUG-83806
Change-Id: I3ccbed8387811a87bbea3f5d4ad9963e1be28a49
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-10-08 21:31:56 +02:00
Fawzi Mohamed
f69144471b Allow getting a const pointer out of a variant containing pointer
Currently
  A a;
  QVariant::fromValue(&a).value<const A*>() == nullptr;
Still casting non const to const is safe, and worked in Qt5.
After this change
  A a;
  QVariant::fromValue(&a).value<const A*>() == &a;

Change-Id: I257049d084c712b00a338a2943d379aa478e0981
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-08 18:13:34 +02:00
Andrei Golubev
6c7ed4c013 Make QADP capacity functions use qsizetype instead of size_t
Change types returned and accepted by capacity-related QArrayDataPointer
functions to qsizetype:

1) QArrayData (underlying d-ptr) works with qsizetype
2) QArrayDataPointer::size is of type qsizetype
3) All higher level classes that use QADP (e.g. containers)
   cast capacity to qsizetype in their methods

Additionally, fixed newly appeared warnings through qtbase

Change-Id: I899408decfbf2ce9d527be7e8b7f6382875148fc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-08 16:52:28 +02:00
Mårten Nordheim
335c5a8a6b QNetworkRequest: Close gap in enum
It was there for binary compatibility reasons, but it's not needed anymore

Change-Id: I659dadc710a5bcdbcba74f13fd4db6044a497cd2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-10-08 16:35:31 +02:00
Laszlo Agocs
56af9fb917 rhi: gl: Silence incorrect compiler warnings about uninitialized use
Change-Id: I09bd22f3ccb1231ad4ef123f581459ef5c1ac37c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-10-08 11:01:11 +02:00
Laszlo Agocs
14ddbba298 rhi: gl: Drop the unused WRAP_R member
If we do not use it for anything, do not spend time on comparing
and copying it either.

Change-Id: I3632792847010e5b73c48eb1ca88f5806f3ccd45
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-08 11:01:11 +02:00
Laszlo Agocs
ea227fb915 rhi: gl: Fix missing texture bindings
The block to update the cached state needs to be run also
when the texture parameters have changed.

Change-Id: Ifa80c142c6ff31c95a718a1a900ff3db0bbfe4bc
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-08 11:01:11 +02:00
Allan Sandfeld Jensen
96eea43d3b Do not trigger actions disabled directly or on group level
Only allow actions disabled due not being visible to trigger, when
enabled is not true.

This matches QQuickAction behavior, and doesn't apppear to affect QtGui
or QtWidgets.

Change-Id: I1a00b80213598ef1560be4c9ee9e65cd6fa6d760
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-10-08 09:01:11 +00:00
Lars Knoll
8ccae33a81 Fix compilation on MSVC with /std:c++latest
Inline the definition of QMetaTypeForType::name and make it constexpr.
The old code was conflicting in it's definition (only const in the
declaration, constexpr in the definition), something MSVC didn't like.

Fixes: QTBUG-87225
Change-Id: I7182c421c9f7612e4ff3d538829b2daee0fe4c5c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-08 08:21:48 +02:00