Commit Graph

11529 Commits

Author SHA1 Message Date
Lars Knoll
3ef8ec2ee1 Constrain the data stream operators for containers
Check that we can successfully instantiate the data
stream operator for a container before we actually try.

This is required so we can automate registration of debug
stream operators with QMetaType.

Change-Id: Ib100a5242470d7fc8067058cc4d81af2fa9354b0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-15 14:43:30 +02:00
Lars Knoll
8ad9e81694 Constrain the debug stream operators for containers
Check that we can successfully instantiate the debug
stream operator for a container before we actually try.

This is required so we can automate registration of debug
stream operators with QMetaType.

Change-Id: I3943e7a443751d250c33b2ca1b9cf29207cfe6c4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-15 14:43:23 +02:00
Lars Knoll
67f04fa060 Deprecate QVariant::Type uses in QSqlField
Add metaType()/setMetaType() methods to be used instead
of the type() methods taking a QVariant::Type.

Change-Id: Ieaba35b73f8061cd83288dd6b50d58322db3c7ed
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-08-15 10:56:33 +02:00
Lars Knoll
8929c0a355 Remove QVariant(int type, void *data, ...) constructor
It was marked internal anyway. Use the constructor taking a
QMetaType instead.

Change-Id: I15b9cd0911aac063a0f0fe0352fa2c84b7f7c691
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-15 10:56:29 +02:00
Allan Sandfeld Jensen
6f0df02d00 Replace Qt CONSTEXPR defines with constexpr
Both normal and relaxed constexpr are required by our new minimum of
C++17.

Change-Id: Ic028b88a2e7a6cb7d5925f3133b9d54859a81744
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-08-14 15:52:58 +02:00
Mårten Nordheim
d40f88e8d2 QDecompressHelper: Introduce zstd support
Also take this opportunity to reshuffle the content-encodings in the
intended ordering since the ordering is used to signify priority.

Task-number: QTBUG-83269
Change-Id: I022eecf1ba03b54dbd9c98a9d63d05fb05fd2124
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-14 13:17:11 +02:00
Edward Welbourne
9ee554ac1d qglobal.h: remove deprecated global functions
Since 5.0 - qMalloc(), qFree(), qRealloc(), qMemCopy(), qMemSet()
Since 5.15 - qsrand(), qrand()

Change-Id: I74fa3d17b05521271c3dc563fc85a5b133289ce3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-14 09:59:36 +02:00
Allan Sandfeld Jensen
d4a73d4255 Another round of using noexcept instead of pre-C++11 defines
A few new files were added with old-school defines.

Change-Id: Ieb2c71e094e55102f3f39fb9551823f36863f5f4
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-08-13 19:58:40 +02:00
Frederik Gladhorn
d12afeff40 Set default redirect policy to NoLessSafeRedirectPolicy
Not following redirects is not a feature, but just a hastle for everyone.

The main issue with switching this default is that applications that
actually do manual redirect handling will break in various ways.

FollowRedirectsAttribute was removed as it no longer serves any
purpose beyond duplicating the default value.

[ChangeLog][Network] QNetworkAccessManager now follows redirects by
default with the NoLessSafeRedirectPolicy.
[ChangeLog][Potentially Source-Incompatible Changes]
QNetworkRequest::FollowRedirectsAttribute was removed and has been
superseded by QNetworkRequest::RedirectsPolicyAttribute

Fixes: QTBUG-85901
Change-Id: Ic5b776180a4b84ac4fc895158bb5a66a3c91a042
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-13 19:58:19 +02:00
Sona Kurazyan
1df02b5f98 Fix conversions to JSON from QVariant
After reimplementing Qt JSON support on top of CBOR, there were
unintended behavior changes when converting QVariant{, List, Map} to
QJson{Value, Array, List} due to reusing the code for converting
QVariant* types to CBOR types, and from CBOR types to corresponding JSON
types. In particular, conversions from QVariant containing QByteArray to
JSON has been affected: according to RFC 7049, when converting from
CBOR to JSON, raw byte array data must be encoded in base64url when
converting to a JSON string. As a result QVariant* types containing
QByteArray data ended up base64url-encoded when converted to JSON,
instead of converting using QString::fromUtf8() as before.

There were also differences when converting QRegularExpression.

Reverted the behavior changes by adding a flag to internal methods for
converting CBOR to JSON, to distinguish whether the conversion is done
from QVariant* or CBOR types. These methods now will fall back to the old
behavior, if the conversion is done using QJson*::fromVariant*().

Additionally fixed QJsonValue::fromVariant conversion for NaN and
infinities: they should always convert to QJsonValue::Null. This works
correctly when converting from variant to QJsonArray/QJsonObject, but has
been wrong for QJsonValue.

Added more tests to verify the expected behavior.

[ChangeLog][Important Behavior Changes] Restored pre-5.15.0 behavior
when converting from QVariant* to QJson* types. Unforeseen consequences
of changes in 5.15.0 caused QByteArray data to be base64url-encoded; the
handling of QRegularExpression was also unintentionally changed. These
conversions are now reverted to the prior behavior. Additionally fixed
QJsonValue::fromVariant conversions for NaN and infinities: they should
always convert to QJsonValue::Null.

Fixes: QTBUG-84739
Change-Id: Iaee667d00e5363906eedbb67948b7b39c9d0bc78
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-13 19:36:58 +02:00
Lars Knoll
048debe8f9 Restrict QVariant::isNull() behavior
isNull() would forward to the contained type and check that type's
isNull() method for some of the builtin types. Remove that behavior
and only return true in isNull(), if the variant is invalid, doesn't
contain data or contains a null pointer.

In addition, implement more consistent behavior when constructing
a QVariant using the internal API taking a copy from a void *.
isNull() should return true in both cases. This mainly changes behavior
for some corner cases and when using our internal API.

[ChangeLog][Important Behavior Changes] QVariant::isNull()
no longer returns true when the variant contains an object of some
type with an isNull() method, that returns true for the object;
QVariant::isNull() now only returns true when the variant contains
no object or a null pointer.

Change-Id: I3125041c4f8f8618a04aa375aa0a56b19c02dcf5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-13 08:48:32 +02:00
Lars Knoll
4a69cd7f72 Restrict comparison of variants
Comparing two variants will not try to convert the types
of the variant anymore. Exceptions are when both types are
numeric types or one type is numeric and the other one a
QString. The exceptions are there to keep compatibility with
C++ and to not completely break QSettings (which needs automatic
conversions from QString to numeric types).

[ChangeLog][Important Behavior Changes] Comparing two
variants in Qt 6 will not try attempt any type conversions before
comparing the variants anymore. Instead variants of different type
will not compare equal, with two exceptions: If both types are numeric
types they will get compared according to C++ type promotion rules. If
one type is a QString and the other type a numeric type, a conversion
from the string to the numeric tpye will be attempted.

Fixes: QTBUG-84636
Change-Id: I0cdd0b7259a525a41679fb6761f1e37e1d5b257f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-13 08:48:19 +02:00
Lars Knoll
50c96c17b6 Use the new support for comparisons in QMetaType for QVariant
Remove the compare method in the QVariant::Handler struct. Rely
on the generic support provided by QMetaType instead.

[ChangeLog][Important Behavior Changes][QVariant] QVariant will now use builtin support in
QMetaType to compare its content. This implies a behavioral change
for some graphical types like QPixmap, QImage and QIcon that will
never compare equal in Qt 6 (as they do not have a comparison
operator).

Change-Id: I30a6e7116c89124d11ed9052537cecc23f78116e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-08-13 08:48:03 +02:00
Thiago Macieira
99ce02f692 QCborValue: add support for QCOMPARE string output
Change-Id: Ibdc95e9af7bd456a94ecfffd16066c47ea9766d0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-08-12 21:05:06 -07:00
Ulf Hermann
3e25d09b08 QDecompressHelper: Change order of encodings
Before the introduction of QDecompressHelper gzip was preferred over
deflate. The change seems to be accidental. Amends commit
7b76379a89.

Change-Id: I70f33d551912465d63f49ea3db1ac3575d19a92d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-08-12 08:27:09 +00:00
Thiago Macieira
e790af0e0a QJsonDocument: fix comparison of valid vs default
[ChangeLog][QtCore][QJsonDocument] Fixed a bug that caused
QJsonDocument's equality operator to crash if one of the operands was
default-constructed and the other wasn't.

Pick-to: 5.15
Fixes: QTBUG-85969
Change-Id: I5e00996d7f4b4a10bc98fffd1629f835f570ef6b
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-08-11 13:00:47 -07:00
Laszlo Agocs
a99cee1c7b Remove old CBOR-based format from QShader
We only support version 4 and 5 in Qt 6.0. 1 and 2 are already gone
(due to being based on binary JSON), now we remove 3 as well.

Task-number: QTBUG-81346
Change-Id: I3627dcc0587f1e36f11e93edf7172889e911d64e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-08-11 13:45:09 +02:00
Edward Welbourne
fed97b9264 Sort out the overflow cases in tst_QDateTime
Use the actual minimum value, rather than minus the maximum, and adapt
the overflow expectations so that they're correct west of Greenwich as
well as east.

Change-Id: I7a5f4510db0fdea3855b5b2bd4c4a86882030efd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-11 11:21:46 +02:00
Edward Welbourne
72d14fe32f Fix handling of last second in 1969
Due to a limitation of mktime(), we would have declared it invalid.
Tidied up qt_mktime() slightly in the process.

Change-Id: I25469e314afee6e0394e564bc69a98883005d4ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-11 11:20:43 +02:00
Fabian Kosmale
7b3a2f5e3d cmake support for tst_moc
We use qt_wrap_cpp instead of AUTOMOC so that we can easily find the
json files.
Getting autorcc to run only after json file has been generated was
deemed too tricky.  Therefore the test is slightly modified to check for
the json files in its directory instead of the resource, if the qrc file
does not exist.

Change-Id: Id1aabb117c8bab3ff81156da1f66d64e796bf18b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-10 12:59:46 +02:00
Edward Welbourne
fe6a1d34dc QFileInfo: purge deprecated API
Since 5.10: created()
Since 5.13: readLink()

Change-Id: I9722f81750dd92315a67a1c38df41a95ae63e0db
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-07 17:44:51 +02:00
Edward Welbourne
5a682b04ce Purge QResource of some deprecated API
Removed isCompressed(), deprecated since 5.15, and (since 5.13)
addSearchPath() and searchPath().

Change-Id: I4b6fb8077c02bbe322334e474eaf0a2a7caf0004
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-07 17:44:13 +02:00
Edward Welbourne
7ce27430a7 tst_QStringConverter: fix some deprecation warnings
QString's fromUtf16() prefers char16_t data over ushort.

Change-Id: Ib20c5afa09ceabb4e91fe434b6a057edb4739a53
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-07 17:44:01 +02:00
Giuseppe D'Angelo
3f6afac6b1 QPolygon: streamline constructors and special member functions
Employ RO0; inherit the constructors from the base class; and
do some code tidies as a drive by.

The inherited constructors bring in goodies like initializer_list
support.

Change-Id: Ia00a3f9b0ccbf182bf837bc65ba2305110c8dc60
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-07 15:01:26 +02:00
Mårten Nordheim
ad1a5bf63f QDecompressHelper: Add brotli support
Task-number: QTBUG-83269
Change-Id: If23b098ee76a4892e4c2c6ce5c635688d8d9138d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-06 20:56:42 +02:00
Alexandru Croitor
92ee9bd6b8 CMake: Properly handle CONFIG += thread aka Threads::Threads
mkspecs/features/qt.prf adds a dependency on the system threading
library if the Qt Core thread feature is enabled. Because qt.prf is
loaded by any public or internal Qt project, it's essentially a public
dependency for any Qt consumer.

To mimic that in CMake, we check if the thread feature is enabled, and
and set the Threads::Threads library as a dependency of Qt6::Platform,
which is a public target used by all Qt modules and plugins and Qt
consumers.

We also need to create a Qt6Dependencies.cmake file so we
find_package(Threads) every time find_package(Qt6) is called.

For the .prl files to be usable, we have to filter out some
CMake implementation specific directory separator tokens
'CMAKE_DIRECTORY_ID_SEP' aka '::@', which are added because we call
target_link_libraries() with a target created in a different scope
(I think).

As a result of this change, we shouldn't have to hardcode
Threads::Threads in other projects, because it's now a global public
dependency.

Task-number: QTBUG-85801
Task-number: QTBUG-85877
Change-Id: Ib5d662c43b28e63f7da49d3bd77d0ad751220b31
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-08-06 19:15:39 +02:00
Giuseppe D'Angelo
4fc539bd84 QMap: fix insert() rvalue overloads
Receiving an rvalue still requires to check whether the parameter
is detached, otherwise we can't steal its backing std::map.

Change-Id: Ie88dbf39fd777112ad7bb20a46d5c2d65be8eb3d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-06 19:15:39 +02:00
Giuseppe D'Angelo
14090760a8 Long Live QMap as a refcounted std::map!
... and QMultiMap as std::multimap.

Just use the implementation from the STL; we can't really claim that
our code is much better than STL's, or does things any differently
(de facto they're both red-black trees).

Decouple QMultiMap from QMap, by making it NOT inherit from
QMap any longer. This completes the deprecation started in 5.15:
QMap now does not store duplicated keys any more.

Something to establish is where to put the
QExplictlySharedDataPointer replcement that is in there as an
ad-hoc solution. There's a number of patches in-flight by Marc
that try to introduce the same (or very similar) functionality.

Miscellanea changes to the Q(Multi)Map code itself:

* consistently use size_type instead of int;
* pass iterators by value;
* drop QT_STRICT_ITERATORS;
* iterators implictly convert to const_iterators, and APIs
  take const_iterators;
* iterators are just bidirectional and not random access;
* added noexcept where it makes sense;
* "inline" dropped (churn);
* qMapLessThanKey dropped (undocumented, 0 hits in Qt, 1 hit in KDE);
* operator== on Q(Multi)Map requires operator== on the key type
  (we're checking for equality, not equivalence!).

Very few breakages occur in qtbase.

[ChangeLog][Potentially Source-Incompatible Changes] QMap does not
support multiple equivalent keys any more. Any related functionality
has been removed from QMap, following the deprecation that happened
in Qt 5.15. Use QMultiMap for this use case.

[ChangeLog][Potentially Source-Incompatible Changes] QMap and
QMultiMap iterators random-access API have been removed. Note that
the iterators have always been just bidirectional; moving
an iterator by N positions can still be achieved using std::next
or std::advance, at the same cost as before (O(N)).

[ChangeLog][Potentially Source-Incompatible Changes] QMultiMap does
not inherit from QMap any more. Amongst other things, this means
that iterators on a QMultiMap now belong to the QMultiMap class
(and not to the QMap class); new Java iterators have been added.

Change-Id: I5a0fe9b020f92c21b37065a1defff783b5d2b7a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-06 19:15:39 +02:00
Eskil Abrahamsen Blomfeldt
76068d0114 Make QFontDatabase member functions static
QFontDatabase is a singleton and all instances would share
a single, mutex-protected global data pointer. But some functions
were implemented as non-static functions. This caused a lot
of code on the form

	QFontDatabase().families(...)

since there was no static access. Other functions were implemented
as static.

To consolidate, we make all functions static. This should be
source-compatible, but not binary compatible.

[ChangeLog][QtGui][Fonts] Some functions in QFontDatabase were in
principle static, but previously not implemented as such. All
member functions have now been made static, so that constructing
objects of QFontDatabase is no longer necessary to access certain
functionality.

Fixes: QTBUG-83284
Change-Id: Ifd8c15016281c71f631b53387402c942cd9c43f6
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2020-08-06 11:43:24 +02:00
Shawn Rutledge
6d6ed64d6c Add QPointerEvent::is[Press|Update|Release]Event accessors
QQuickPointerEvent had them, so despite how trivial they look,
it's very convenient to keep using them in QQuickWindow rather than
duplicating these kinds of checks in various places, and for multiple
event types too.

Change-Id: I32ad8110fd2361e69de50a679ddbdb2a2db7ecee
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-06 10:23:56 +02:00
Thiago Macieira
45838673df Implement UTF-16 to UTF-8 case-insensitive compare and make public
Change-Id: Ied637aece2a7427b8a2dfffd16116cf3645c6359
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-05 21:51:24 -07:00
Mårten Nordheim
7b76379a89 Make use of QDecompressHelper for HTTP downloads
Changes are not too big for now. Just replaces use of the previous
calls to the zlib decompression function. And initialize
QDecompressHelper when we know the content-encoding.

Task-number: QTBUG-83269
Change-Id: I41358feaef2e7ac5f48f14e3f95ec094e0c110b7
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-05 17:19:10 +02:00
Morten Johan Sørvig
00f2d1a09b Establish baseline for QIcon test on dpr > 1
After enabling Qt::AA_UseHighDpiPixmaps, QIcon::pixmap()
now returns pixmaps larger than the requested size on
devicePixelRatio > 1 screens.

Adapt tests to account for this changed behavior.
Skip tests where it’s unclear what the the expected
behavior is, or where the test logic does not apply
to dpr > 1.

This gives a clearer indication of where we are
(39 passed, 0 failed, 9 skipped), and enables using
the qicon test to catch regressions also when running
at dpr > 1.

Remove the "lowdpi" testcase flags from the qmake and
cmake project files.

Change-Id: Ia7ce722ae356fc496a91b54e9f5d590d13b9df62
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-05 11:23:07 +02:00
Mårten Nordheim
07b008425a Privately introducing QDecompressHelper for network purposes
To support streaming decompression in QNAM.
Will also be used to refactor existing decompression code in QNAM.

Task-number: QTBUG-83269
Change-Id: Iecf3e359734163f15686c949f75d41fa4794a00e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-05 09:17:11 +02:00
Thiago Macieira
f2abfb39d7 QDebug: add operator<<(const char16_t *)
Avoids the conversion from UTF-8 for uses that are not dumping a string.

Mass conversion of Qt sources left for future opportunity.

Fixes: QTBUG-85811
Change-Id: I4ca4a35b687b46c39030fffd1626ae6c3294cacf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-04 15:13:09 -07:00
Fabian Kosmale
652062dde3 QNotifiedProperty: avoid crash
We can end up in a situation where a (soon to be destroyed) observer is
owned by a binding which is about to be deleted. If in that situation
the binding is destroyed first, we end up with a dangling pointer
and ensuing memory corruption. Instead, we now first transfer the
ownership of the observer and only destroy the binding afterwards.

Fixes: QTBUG-85824
Change-Id: I721c0319281ada981ae7896bd2e02e9a0cc901b8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-04 11:28:33 +00:00
Tor Arne Vestbø
a00ad95137 Remove last remaining bits of QtPlatformHeaders
Task-number: QTBUG-84220
Change-Id: I951e04bfe9358a99951d1d61ff47b675584b7f81
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-08-04 07:12:32 +02:00
Tor Arne Vestbø
561da776c9 Remove const volatile qualifier on return type in test
Fixes warning by Clang:

   warning: 'const volatile' type qualifiers on return type have no effect
      [-Wignored-qualifiers]
    const volatile unsigned long long * const volatile func_KVPKVull() {...}
                                        ^~~~~~~~~~~~~~~

Change-Id: Ia4aae6521c84f4a18d92ad5035af5b247d283140
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-04 05:12:31 +00:00
Andrei Golubev
b3c1093751 Introduce swap functions for QPromise/QFutureInterface
Made QPromise::swap public, added free standing swap() for
QFutureInterface and QPromise. Updated QPromise special member
functions. Extended tests

Task-number: QTBUG-84977
Change-Id: I5daf6876df306d082441dbcdf5ae4dee3bfc0ead
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-08-03 16:47:31 +02:00
Mårten Nordheim
246e712548 Move-enable QByteDataBuffer::{append,prepend}
Change-Id: I2fd342465475e3a694c8459a54957149f8b418a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-01 10:51:21 +02:00
Mårten Nordheim
5d7be66fd7 QList: Add a append(QList &&) overload
We already had append(const QList &) and now there's an overload
taking an rvalue reference.

Change-Id: Id2fbc6c57badebebeee7b80d15bb333270fa4e19
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-08-01 00:01:52 +02:00
Thiago Macieira
95afe6b244 QSharedPointer: do allow calling deleters on null pointers
I don't know why std::shared_ptr allows this, but why not.

[ChangeLog][Important Behavior Changes] QSharedPointer objects will now
call custom deleters even when the pointer being tracked was null. This
behavior is the same as std::shared_ptr.

Fixes: QTBUG-85285
Pick-to: 5.15
Change-Id: I24006db8360041f598c5fffd161c260df0313b55
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2020-07-31 10:40:25 -07:00
Thiago Macieira
fe9e6b2ceb QString::vasprintf: fix 't' modifier for integers on 64-bit
‘t’
     Specifies that the argument is a ‘ptrdiff_t’.
     This modifier was introduced in ISO C99.

We use qsizetype, which is the same width as ptrdiff_t, so it makes no
difference in va_arg().

Change-Id: Iea47e0f8fc8b40378df7fffd16255730109413a5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-31 10:36:33 -07:00
Edward Welbourne
a6b3a1e459 Remove deprecated binary json feature
Deprecated in 5.15 in favor of CBOR.

Fixes: QTBUG-81239
Change-Id: I711d4bd7dd1247f58e77ac9fa53304cbe5028918
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-31 17:12:48 +02:00
Allan Sandfeld Jensen
0792188440 Add float->qfloat16 rounding and fix the tests
Our hardware optimized conversions of float to qfloat16 rounds to even
where our table based conversion truncated to zero.

The rounding is not in this patch exactly round to even like the
hardware implementation but much closer.

Change-Id: I4c5e72c15fef9079d3660680b2727ff7ba4e768a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-31 16:50:30 +02:00
Linus Jahn
5d69aa3ee1 QCryptographicHash: Add BLAKE2b and BLAKE2s hashing algorithms
BLAKE2 does not specify requirements about specific hash sizes and
since QCryptographicHash does not support dynamic hash sizes, only the
most common hash sizes could be covered by this.

The supported hash sizes were chosen to match the ones supported by the
Linux kernel.

The new hashing algorithms for QCryptographicHash are:
 * BLAKE2b (160 bit, 256 bit, 384 bit, 512 bit)
 * BLAKE2s (128 bit, 160 bit, 224 bit, 256 bit)

[ChangeLog][QtCore][QCryptographicHash] Added BLAKE2b and BLAKE2s
hashing algorithms.

Fixes: QTBUG-78198
Change-Id: Id9e0180a974093982fdf1cdd6180988a2e5e9f4f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-31 15:05:18 +02:00
Laszlo Agocs
c5da2e6f06 Remove old qsb versions from qshader autotest
Only keep 3, 4, and 5 because 3 is the lowest version where binary JSON
is not used anymore.

Change-Id: Id0319e8eceb845017ed493d0ef6902b53050d5a6
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-07-31 12:57:06 +02:00
Fabian Kosmale
cb80720287 Expose QMetaTypeInterface::alignof in QMetaType
We already have the information in the QMetaTypeInterface, and provide
functions to access sizeof. Adding alignof support seems natural, and
should make it easier to handle over-aligned types.
This should also be helpful in QVariant.

Change-Id: I166be76f4b7d2d2e524a3a1e513bd2f361e887c1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-31 09:46:54 +02:00
Tor Arne Vestbø
47cb6ad698 Don't capture this explicitly in tests
Some compilers implicitly captures, and will warn about the unused capture.

Change-Id: Ib5e1cc3956c7eb0dc87cee834cce8a2b3dd0d30b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 18:34:16 +00:00
Alex Trotsenko
8969070cfd QEventDispatcherWin32: redesign event notifiers activation
The previous implementation multiplexed callback-based event
notification into a single proxy event (cf. 85403d0af), which was
in turn object-waited for (this was the case since the beginning
of public qt history). It makes more sense to multiplex into a
posted message, because that also works with foreign event loops
that do not know anything about our event objects.

Task-number: QTBUG-64443
Change-Id: I97945ac8b5d7c8582701077134c0aef4f3b5a18f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 18:34:34 +03:00
Laszlo Agocs
071fc289c4 Re-enable tst_qrhi on Linux
Not sure why this was disabled in the first place.

Change-Id: I66329b55fd46d03fd96818c6c7004718ddea5c79
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-29 15:04:19 +02:00
Tor Arne Vestbø
e7ade60925 Add missing override in tst_QSortFilterProxyModel
Change-Id: I8ffe92cd5a68bf86688e1d942d079ac6ff115d11
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:48 +02:00
Tor Arne Vestbø
b535a67910 Fix warning when comparing qsizetype to size_t
Change-Id: I4ea7ccb4daf05c735c831964f94c120d179521dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 12:33:33 +00:00
Tor Arne Vestbø
9023791a45 Fix warnings about unused expression results in tests
Change-Id: I401ec8a3742a5bb51a1b8b291c53395c3880117c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:29 +02:00
Tor Arne Vestbø
6f17509ad9 Fix warnings about unused members in tests
Change-Id: I741cf08c26f8a2e297926cc01968ff09e70462a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:24 +02:00
Tor Arne Vestbø
dfeedc17a2 Disable deprecation warnings in some tests
The tests are testing deprecated functionality, which we
still want to test.

Change-Id: Iad6ed35800896170c17fe019c7a6ecda22398ac3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:23 +02:00
Tor Arne Vestbø
57337f21c7 Add missing braces when constructing BigConvertible in tst_qvariant
Change-Id: Ia571e8950aa28721080dc7434921b79ffda913f4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:20 +02:00
Tor Arne Vestbø
f8d1e16da0 Add missing enumeration case in tst_QMacStyle::setSize
Change-Id: Iade36b03c6f8bdaa8feb82ef89744a399f92e21d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-29 14:33:19 +02:00
Allan Sandfeld Jensen
d782df4861 Make qfloat16 helper functions consistent with float/double versions
Infinite is only when the mantissa is 0, everything else is NaN.

std::isnormal returns false on zero.

Pick-to: 5.15
Change-Id: I897fc0dc3b8a9c557bb1922ea7ca8df501e91859
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-28 18:12:07 +02:00
Friedemann Kleint
2405aa9d67 Windows QPA: Move mime-type related classes to the new interface
Move QWindowsMime (which was a public class in Qt 4 and moved to the QPA
plugin in Qt 5) to the platform namespace and add register functions to the
native application.

Move in test code from QtWinExtras.

Task-number: QTBUG-83252
Change-Id: Iaac440e2d5cb370110919921b1eeb779600b5b65
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-28 13:20:23 +02:00
Timur Pocheptsov
1482739002 QHostAddress: resolve API issues marked with ##Qt6
Also, remove the deprecated function and its auto-test.

Change-Id: If04a54c4b91e0f76523960c7b1a5bcb8fe883ac6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-28 12:38:15 +02:00
Peng Wenhao
59e3073b1c Close memory leak in QTestLib support for string to numeric testing
QTest::toString allocates memory by calling qstrdup; that memory must
be freed by the caller.

Change-Id: I9724db0c617884cf08592968b1411f002ef23204
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-28 13:36:31 +08:00
Edward Welbourne
f4323889f1 QLine: purge deprecated API
Since 5.14: intersect(), angle().  Also removed definition of M_2PI
from test, since its last use was in the tests being removed.

Change-Id: Ie3a12247e3760e8bfdd3a659cd06245c86b198c2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-07-27 11:26:08 +02:00
Edward Welbourne
d3c8757731 Purge redundant recoding of URL fragments from QByteArray
QUrl::fromEncodedComponent_helper() only existed to support some old
methods deprecated since 5.0, that I recently removed.
It was the only caller of qt_urlRecodeByteArray() aside from that
function's own autotest.
Both were private.

Task-number: QTBUG-85700
Change-Id: I5d09fd44e768847ce51a1ae7043150922cb5314c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-07-27 11:25:49 +02:00
Edward Welbourne
f144507829 Clean up manual network stress-test
Don't attempt the remote test if we don't have a remote server.
Don't add error returns from read to byteCounter.
Don't cast from ASCII to QString in URL components.
Don't waste time encoding a path for which it's a no-op
(especially as I recently deleted the method used to do it).

Name the time-out, both for clarity and to give anyone who needs to
debug the test only one line to edit so as to increase the time-out
enough to make debugging practical.

Change-Id: I378aa96c0501f7033ca4abb82734b03b8c807f08
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-07-27 11:25:11 +02:00
Edward Welbourne
02c2c930f0 Fix some compiler errors caused by bit-rot in manual tests
Two methods that have gone away or been renamed,
an enum that now doesn't support being assigned from int.
QTime should no longer be used as a timer.
Removed a test of deprecated code that's gone away.

Task-number: QTBUG-85700
Change-Id: Idc6d59542625d22b9937084411b54b0d8aa87f00
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-27 11:20:35 +02:00
Edward Welbourne
2059170b33 Fix misplaced nullptr, used for a flag value
Task-number: QTBUG-85700
Change-Id: I34b1aa8430842d96eb515d709b49de4e60976ac9
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-07-27 11:20:14 +02:00
Tor Arne Vestbø
9a8fe34e4d tst_qicon: Enable lowdpi test using qt_add_test argument
Change-Id: I98f850c668a45d127abb1c2af5915f2cbcbd1cdb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-26 20:12:47 +02:00
Tor Arne Vestbø
bd3088ceb3 Fix warnings about unused variables and functions in tests
Change-Id: Ia758a91384083c13fb4d743f500fef7a6629dfd5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-26 18:06:46 +02:00
Tor Arne Vestbø
f418a96f9b Disable warning about self-move and self-assign-overload
Change-Id: I1d20d3f424eced5cc5787934663b9d243f75d46e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-26 18:06:34 +02:00
Tor Arne Vestbø
d1fd2ff11f Fix warning when comparing qsizetype to result of sizeof
warning: comparison of integers of different signs: 'qsizetype' (aka 'long long') and 'unsigned long'

Change-Id: I03acb1f7aed782169a0a42cd8afc84b85991cd1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-26 18:06:21 +02:00
Tor Arne Vestbø
d96193b0ec Fix warning when printing of qsizetype
warning: format specifies type 'int' but the argument has type 'qsizetype' (aka 'long long')

Change-Id: I6099b53efecea46d191d5dc019c986f99e49c1f1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-26 17:39:31 +02:00
Friedemann Kleint
f06dfb60b9 QtGui: Add Windows conversion functions for to QImage
Add conversions from/to HBITMAP, HICON to QImage. Split the pixmap
conversion functions apart to use them.

Task-number: QTBUG-81876
Change-Id: Ic0c41a402a1f6e9bec572fc4d691357bd48e6423
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-24 22:51:46 +02:00
Volker Hilsheimer
c692f41ae5 Mark QIcon test as not supporting high-DPI pixmaps
As of 951d490750, high-DPI support
for pixmaps is enabled by default, which makes this test fail
when running on a local system with a high-DPI display.

Change-Id: I3fe4674d19a57bf82aa32b01d470c714092f7e62
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-24 13:54:00 +02:00
Allan Sandfeld Jensen
c562c1fc19 Fix buffer overflow in XBM parser
Avoid parsing over the buffer limit, or interpreting non-hex
as hex.

This still leaves parsing of lines longer than 300 chars
unreliable

Change-Id: I1c57a7e530c4380f6f9040b2ec729ccd7dc7a5fb
Pick-to: 5.15 5.12
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-07-24 10:06:57 +02:00
Tor Arne Vestbø
af7a3430ed testlib: Add start time and test duration to JUnit XML
As defined by https://llg.cubic.org/docs/junit/

Change-Id: Ic7683f3d49c529674f8467d591528d4a65d3add8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-24 00:52:01 +02:00
Tor Arne Vestbø
67c877562b testlib: Output JUnitXML attributes in right order
The attributes are, like the elements, maintained in reverse
order in the underlying QTestCoreList, so we need to iterate
them backwards when printing out the resulting XML to reflect
the order they were added.

This results in e.g.:

  <testcase name="passingBenchmark" result="pass">

Instead of:

  <testcase result="pass" name="passingBenchmark">

Change-Id: Ic2eeab8de05ffedd0c41977358d5b40ff77878b1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-24 00:51:54 +02:00
Tor Arne Vestbø
a4be2bd723 testlib selftest: Actually report failures as non-zero exit code
Palm, meet face.

Change-Id: I01cd4088c8f43f7fe66398c27f5d8333468620ad
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-23 14:27:15 +02:00
Tor Arne Vestbø
e85c531c51 testlib selftest: Don't pass TESTARGS to Catch2
It doesn't understand the arguments we usually pass to testlib.

Change-Id: Iea83d1d8c31a510b2bc442cbfc810eac631322e7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-23 11:08:15 +02:00
Edward Welbourne
f16ab166bc QLogging: purge deprecated qInstallMsgHandler(QtMsgHandler)
Deprecated since 5.0.  Renamed a function in a manual test that no
longer needs to say it's Qt5-specific.

Change-Id: I6f2159c702f389d378a0e4d86bd4fe633298b100
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2020-07-23 11:05:53 +02:00
Tor Arne Vestbø
cd16858823 tst_QGraphicsSceneIndex::clear: Don't assume only one repaint
Change-Id: I037b51ebad525ced536945b2c39b0f59280e6bad
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-23 10:04:01 +02:00
Tor Arne Vestbø
81d83d5672 testlib selftest: include 'keyboard' test in generate_expected_output.py
Change-Id: Ia1d759454b2931ca838942cf9b08f8b62dfd61ce
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-22 23:23:27 +02:00
Tor Arne Vestbø
e5761061f2 testlib selftest: Only warn about missing test expectation if none was found
Change-Id: I55e19d0a7b9b58ceeee4f25612f4a1d9ec66eb76
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-22 23:23:24 +02:00
Tor Arne Vestbø
e7371c19d9 testlib: Defer signal dumper start until tests are ready to run
We don't want the signal dumper to pick up signals that our own
test machinery produces, such as the ones emitted from the watchdog
thread startup and shutdown. This would otherwise produce:

 tst_Signaldumper::initTestCase() Signal: QThread(7fc969e0d870) started ()

At startup, and at shutdown even more confusingly:

 tst_Signaldumper::UnknownTestFunc() Signal: QThread(7fc969e0d870) finished ()

Change-Id: I9e81fa168eaa92551d38d5576973bbf95ac23364
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-22 23:23:16 +02:00
Tor Arne Vestbø
304ec18a1a testlib selftest: rebaseline benchlibcallgrind results
The logic was changed in eb52d78e90 to only produce a single
result for all the benchmark iterations, but only the plain text
output was rebaselined. This was not caught by the test since we
only run this test with the plain test logger. Regenerating the
results with the python script however runs it with all loggers,
so let's fix the baseline.

Change-Id: I9ebe8a59ac3ab36694a739f98dbfffbae9a08552
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-22 23:23:12 +02:00
Tor Arne Vestbø
61b1146e5a testlib selftest: check blacklisted test for test failures
Change-Id: Ifcd1155f7627f6a9f8b379fb9e87425f9d9f2877
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-22 23:23:09 +02:00
Tor Arne Vestbø
b33c056a61 testlib selftest: unify xml quoted asserts that include line numbers
Change-Id: If66303bab10c23dd212a6abcdff3f145630e2401
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-22 23:23:05 +02:00
Tor Arne Vestbø
f1c16139e3 testlib selftest: rebaseline tap results to not include line numbers
Change-Id: I6271ac1984a3829ba1c8dcc9d6419940cb89c62b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-22 23:23:01 +02:00
Friedemann Kleint
32a26f1714 Manual touch test: Add a settings dialog for windows
Exercise the touch settings of the native interface.

Task-number: QTBUG-41433
Task-number: QTBUG-48849
Task-number: QTBUG-83252
Change-Id: I5ae95a79c00b55236dbbed9d8549f4fdf5b10b8e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-22 19:46:09 +02:00
Friedemann Kleint
a54639acd2 Fix the touch manual test to compile
Task-number: QTBUG-72167
Change-Id: I9074fc21ae8fccf66140fb38bfbd35e526506c36
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-22 12:20:16 +02:00
Richard Moe Gustavsen
76d9d86907 qnsview: don't active QWindows inside NSWindows that are not key
A QWindow should only become Active when it's inside an
NSWindow that is Key. If the NSWindow is not key, we need
to wait for it to be so, and handle window activation
from QCocoaWindow::windowDidBecomeKey() instead. Otherwise
Qt will report a QWindow as Active when, in reality, it
is not.

Change-Id: Ib7e63b374f26af527a668c7f7d863c4168a4446d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-22 09:08:32 +02:00
Tor Arne Vestbø
15a5d1996f tst_QPluginLoader: Fix MachO stub tests
The -arch_blank argument to lipo is no longer supported.

Pick-to: 5.15
Pick-to: 5.12
Change-Id: I47efcb3633f23b7a18d66211bc16d5c9dbc067c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-22 02:04:15 +02:00
Friedemann Kleint
d25589e052 QTestlib: Enable comparing QList against initializer lists/arrays
It is unnecessary to create a QList container just for comparison.

Split out helpers for comparing sequence sizes and sequences from
qCompare(QList) and add a template for an array with a non-type template
parameter for the size.

One can then write something like:

const int expected[] = {10, 12,...};
QCOMPARE(QFontDatabase.pointSizes(...), expected)

Unfortunately, any commas in such an array will be misread by macro expansion
as macro argument separators, so any expected array with more than one entry
needs an extra macro expanding __VA_ARGS__.

Change-Id: Ie7c8dc20bf669bbb25f6d7f8562455f8d03968c8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-21 22:01:20 +02:00
Edward Welbourne
e4e4bb78b7 tst_QLine: use qmath.h's constants instead of local versions
Change-Id: I41313f7e7caf3c364ae900a0b100c661aafb290d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-07-21 17:05:01 +02:00
Tor Arne Vestbø
beab436d77 Fix testlib/selftest generate_expected_output.py
Amends 40bc8d5129.

Change-Id: Iacaabec0c620db84278656501e64fc2b765e052f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-21 13:43:56 +02:00
Tor Arne Vestbø
fb2ef5fbf6 testlib selftest: Add README explaining how to run and debug tests
Change-Id: Ica08f7013933e9e6a7678c0ba1f5827efa6eff42
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-21 13:43:51 +02:00
Tor Arne Vestbø
85ce556443 testlib selftest: Properly print failing tests
We don't want to print the QString as represented by the debug
operator, but instead want to expand line feeds and other character
codes as normal.

Change-Id: I7261d8f94e7b4382733f06eb22f9a740a5c0488f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-21 13:43:48 +02:00
Tor Arne Vestbø
0bf120f5fd Ensure styles always get to polish the application palette
Before 0a93db4d82 we would polish the
application palette even when it was the default palette, as we
always recreated the system palette each time a style was set.

After the change we skipped polishing the palette unless it was set
by the user, under the assumption that the style would set its
own default palette if it wanted to override the system palette.

This turned out to break the style's ability to slightly tweak the
palette via polish (versus the more full on standardPalette approach).

We now polish both the default palette and user palettes, and we do
so as part of the normal palette update logic. This ensures that
the style also gets a chance to polish the palette when the platform
theme changes.

The polish will not have an effect on the resolve mask of the palette,
as the polish is conceptually the same as a base palette, and should
not affect e.g. Qt::AA_SetPalette.

Fixes: QTBUG-85469
Fixes: QTBUG-85188
Pick-to: 5.15
Change-Id: I869e9c442b177de4f1dc49eb75220709306f4d12
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-21 13:43:19 +02:00
Alexandru Croitor
5e0129f63c CMake: Fix configuration of CMake tests in-build-tree
Qt6 package was not found the tests were configured in-tree as opposed
to standalone tests.
Use the same trick we do for building examples in-tree.
Specify the path to the build tree packages, and don't create targets.

Amends 96e3ee0659

Change-Id: Ia60de416ce0afff5bd40be8c0c6e3c7898fd7ebf
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-07-20 18:12:23 +02:00
Edward Welbourne
f12132ff23 QCommandLineOption: purge deprecated API
Since 5.8: setHidden(), isHidden()
Part of the QCommandLineParser test also used setHidden().

Change-Id: I05a1c63ff3beb1167ed75632c1b71d7fff17f09e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-20 16:06:28 +02:00
Edward Welbourne
0a961129f0 QUrl: purge deprecated API
Since 5.0: QUrl's image of the QUrlQuery API
Remove deprecation-suppression from tst_qurl.cpp, too.

Change-Id: Ide826283cb4e177fb34fb4080502f5a4620bd5d7
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-07-20 16:06:28 +02:00
Edward Welbourne
996a7fc6f1 QChar: purge deprecated API
Since 5.3 joining() and old Joining type
Replaced by JoiningType joiningType()

Change-Id: Iefee50aaf94cec6d67b5fc004b3e68357b2015c5
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2020-07-20 16:06:28 +02:00
Lars Schmertmann
76d02d895a Fix compiler warning in tst_qstringlistmodel
Warning: redundant move in return statement [-Wredundant-move]

Change-Id: I426c8c41c52b43ae3863f5aaf86027cabb961388
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-20 09:38:58 +02:00
Shawn Rutledge
1b72f9676f Styles manual test: show active, inactive and disabled palette colors
Change-Id: I19c9648f3099ec299e0117748a2808d7a407a3e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-17 23:29:27 +02:00
Friedemann Kleint
40bc8d5129 testlib/selftests: Fix generate_expected_output.py
Hardcode the tests which were previously scanned from the source.

See qtbase/24e83de8d1924b8003c84f1df05b7befea2c5120.

Change-Id: I8fb05568977f86726b20948a9c2d1cfce5cba161
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-17 22:14:56 +02:00
Giuseppe D'Angelo
d145dbc43f SSL: add an autotest for handling of illegal datetimes in certificates
At the moment it just exposes QTBUG-84676, that is, OpenSSL
and non-OpenSSL backend act differently. Went a bit overkill
in making it data-driven, so if someone wants to add more
samples it should be easier to do so.

Change-Id: I96538c9563d12d69c217415ba85e244dda5e0cd0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-07-17 17:50:54 +02:00
Edward Welbourne
d853816307 Fix handling of Suzhou numbering system
This only arises when the system locale tells us to use its zero as
our zero digit, since no CLDR locale uses it by default. Adapt an
MS-specific QLocale::system() test to use Suzhou numbering, so as to
test this.

While updating the locale-restoration code to also restore the digits
being set in that test, add restore code for the long time format,
where previously only the short time format was restored. Add a
comment to make it less likely one of those shall be missed in future.

Fixes: QTBUG-85409
Change-Id: I343324bb563ee0e455dfe77d4825bf8c3082ca30
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-17 12:19:01 +02:00
Linus Jahn
51e3cd89a8 QDomNode: Add namespaceURI parameter to browse methods
This adds a namespaceURI parameter to the following methods of QDomNode:
firstChildElement(), lastChildElement(), nextChildElement() and
previousChildElement()

Those methods can now be used to filter for elements with a specific
namespaceURI without the need to use QDomNodeList.

[ChangeLog][QtXml][QDom] Added namespaceURI parameter to browse methods
like firstChildElement() to filter for elements with certain namespaces
without the need of QDomNodeList.

Change-Id: Ic2cfe8c6d5d5f6b5fcf27165df15bce54ad0f23a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-07-17 09:54:47 +02:00
Alexandru Croitor
96e3ee0659 CMake: Get tests/auto/cmake tests working
The tests/auto/cmake project can be configured separately as a
standalone project with qt-cmake, or as part of the overall qtbase
standalone tests.

To do that a bunch of things were done
- Ported all Qt5 strings to Qt6
- Replaced in all projects the use of add_definitions and
  include_directories with a target based approach, except for 2 tests
  where we check that the old-style approach works, otherwise the
  tests would file
- Removed some (possibly unneeded) EGL / OpenGL tests
- Fixed some C++ code
- Added setup code to tests/auto/cmake/CMakeLists.txt to figure out
  which modules are available and should be tested
- Fixed Qt6CTestMacros.cmake to be loaded by Qt6Core
- Removed the CMake tests to not be run in qmake builds of Qt because
  they would fail anyway
- Enabled the CMake tests to be part of standalone tests
- Disabled auto-passing of the C and CXX compiler cache vars when
  cross-compiling so that the tests can somewhat pass on boot2qt.
  This is the issue we encountered in
  e2b2cd9397
- Ultimately disabled tests for boot2qt, because the -rpath-link
  flag is not generated by CMake for some reason.
- Added code to setup the environment when running an executable that
  was built as part of the test, so that the proper Qt libraries are
  found. This handles both the standalone tests case and separate
  project case.

The remaining unported tests are test_import_plugins which requires
quite a bit of work to get some modules and plugins built that were
done as part of the qmake .pro files, test_plugins that checks
some Network plugins which I'm not sure about, and
test_add_big_resource which doesn't work with namespaced builds
and there's no good way of detecting those at the moment either.

Change-Id: Ic8809c72817d1db81af6c6014c11df6473ad8c75
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-07-17 09:43:04 +02:00
Volker Hilsheimer
044ca0b8a8 Cover more properties in the QAction test
Expand the getSetCheck to include all properties, and add a test to
verify the fallback logic for the tooltip property.

Use the meta object system to set and check properties in the
tooltip-test to verify that things don't break when migrating to
the new property system.

Change-Id: I56355e8b436ede46701a124a9241ed26d2c706c5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-17 08:26:56 +02:00
Edward Welbourne
d6502614d0 Deprecate QTimeLine's curveShape in favor of its easingCurve
QEasingCurve has a richer variety of curves and curveShape was already
implemented by changing the easingCurve property.

[ChangeLog][QtCore][QTimeLine] Deprecated QTimeLine's curveShape
property in favor of the easingCurve property.

Pick-to: 5.15
Change-Id: I7261c0f24d7e02bc94624f0b74d699df62de1a52
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-07-16 17:39:11 +02:00
Friedemann Kleint
b2504af4da QtGui/Windows: Move the QRegion conversion functions into QtGui
Task-number: QTBUG-81876
Change-Id: I2297291a4157e7015f499b0a6127301d9cb58526
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-16 12:09:44 +02:00
Volker Hilsheimer
124590850b Don't test for equality if types can't be compared
For types that don't have an operator==(), always trigger the binding
and the changed notification.

Task-number: QTBUG-85578
Change-Id: I41374f6d13c88106f4de83864e82172f3a248150
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-07-15 16:16:53 +02:00
Fabian Kosmale
ca54b741d6 qtypeinfo: Improve container check
Smart pointers like QSharedPointer<T> do have a value_type, but their
equality does not depend on T being comparable. Therefore, instead of
simply checking for T::value_type, test for a few other container
requirements.
This also required to add an additional check for std::optional, as that
one has an unconstrained operator== on MSVC.

Change-Id: Iefd048f7aa360f4713ecd79f80acd7dae72ee18c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-14 17:06:47 +02:00
Fabian Kosmale
8cdaeb2655 moc: allow wrapper generation for QProperty in pimpl class
Previously, only QNotifiedProperty was supported. As moc cannot
determine by itself whether the backing property is a QProperty or a
QNotifiedProperty, allow NOTIFY false to indicate that it is a plain
QProperty. For symmetry, NOTIFY true is also allowed and means that the
backing property is a QNotifiedProperty.

Change-Id: I66f3105c976ef084198ce8658bc07499a3cb1cd8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-07-14 17:06:46 +02:00
Edward Welbourne
bb6a73260e Support digit-grouping correctly
Read three more values from CLDR and add a byte to the bit-fields at
the end of QLocaleData, indicating the three group sizes. This adds
three new parameters to various low-level formatting functions. At the
same time, rename ThousandsGroup to GroupDigits, more faithfully
expressing what this (internal) option means.

This replaces commit 27d1391280 with a
fuller implementation that handles digit-grouping in any of the ways
that CLDR supports. The formerly "Indian" formatting now also applies
to at least some locales for Bangladesh, Bhutan and Sri Lanka.

Fixed Costa Rica currency formatting test that wrongly put a separator
after the first digit; the locale (in common with several Spanish
locales) requires at least two digits before the first separator.

[ChangeLog][QtCore][Important Behavior Changes] Some locales require
more than one digit before the first grouping separator; others use
group sizes other than three. The latter was partially supported (only
for India) at 5.15 but is now systematically supported; the former is
now also supported.

Task-number: QTBUG-24301
Fixes: QTBUG-81050
Change-Id: I4ea4e331f3254d1f34801cddf51f3c65d3815573
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-14 14:52:08 +02:00
Edward Welbourne
3f8eae848e Fix floating-point 'g'-format's choice between 'e' and 'f' forms
During review of a refactor (coming shortly), Thiago wondered what the
magic numbers were. On closer examination, I concluded that they were
wrong and wrote some tests to prove it. This commit adds those tests;
replaces the misguided old code with something that passes them; and
documents the reasons for the various parts of its decisions.

In the process, tidy up QLocaleData::doubleToString() somewhat and
rename some of its variables to conform to Qt coding style.

Change-Id: Ibee43659b1bdb0707639cdb444cfe941c31d409f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-14 14:52:08 +02:00
Jarek Kobus
cd787dbac9 QtConcurrent: Get rid of multi-inheritance inside RunFunctionTaskBase
Use aggregation instead. Prepare for using QPromise instead of QFutureInterface.

Task-number: QTBUG-84702
Change-Id: Ic88564dca8c83a178a281cb843032292210a6d25
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-07-14 14:52:08 +02:00
Friedemann Kleint
37d5aaa4b4 Change QWindow/QWidget::map(To/From)(Global/Parent) to operate in float
Change the functions to operate in float and add the
QPoint versions as overload calling them. This is
more in-line with the event accessors using float
and allows for removing some workarounds using a delta when
converting touch points.

Leave QPlatformWindow::map(To/From)Global() as is
for now and add helpers for float.

Change-Id: I2d46b8dbda8adff26539e358074b55073dc80b6f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-14 10:25:47 +02:00
Steffen Kieß
6d880185b1 Fix passing QDBusUnixFileDescriptors over peer-to-peer connections
Passing QDBusUnixFileDescriptors over peer-to-peer connections currently
does not work, because QDBusConnectionPrivate::setPeer() does not set
this->capabilities (unlike QDBusConnectionPrivate::setConnection()
which is executed for bus connections).

Keep track of whether the connection already has been authenticated, and
once the connection does get authenticated, update this->capabilities.

Note that sending a message directly after connecting (before any
message has been received from the peer) might still fail if the message
contains a QDBusUnixFileDescriptor.

Pick-to: 5.15
Fixes: QTBUG-85396
Change-Id: Ib83213ebcd3255fb091c6faefb3618745b8d736c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-13 20:45:20 +02:00
Laszlo Agocs
351d42175d rhi: Allow null resources in srb
In this case the srb represents the layout only, and can still be used
to create a pipeline. For setShaderResources() one will then need to use
another, layout compatible, srb that references valid resources.

Change-Id: I3ea5b63df3be8847540ca4c0c40fbd29dbed8fb7
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-07-13 14:54:30 +02:00
Edward Welbourne
72be9bdd37 tst_QCollator: avoid an unused variable warning
Change-Id: Ib173df3e9b92f06935aa4de5a1d423118877ad22
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-13 12:03:21 +02:00
Sona Kurazyan
361dc074f2 Move QRegExp and its remaining mentions out of QtCore
Task-number: QTBUG-85235
Change-Id: Ibd6c98d952c1bb9916b64715c6430fb0d3fe3843
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-13 10:53:23 +02:00
Robert Loehning
3094bcc3c5 Check returns of hex2int in get_hex_rgb
Avoids undefined behavior when trying to shift negative values.

Fixes: oss-fuzz-21860
Fixes: oss-fuzz-23968
Pick-to: 5.15 5.12
Change-Id: I879c97624e3f8ba9cf01e0a3a682379cd8c4a199
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-13 10:26:25 +02:00
Giuseppe D'Angelo
43fa292ff6 QVariant::setValue(): enable move semantics
Given we optimize for the case where the new value is of the
same type of the one already stored in the variant, enable move
assignment for that case.

As a drive-by, avoid a path to detach() for data() if we know
we're detached.

Change-Id: I9abbdc10637ce77ebb747b49d83e1ef914d997bb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-13 01:32:53 +02:00
Robert Loehning
e80be8a43d Fix buffer overflow
Fixes: oss-fuzz-23988
Pick-to: 5.15 5.12
Change-Id: I4efdbfc3c0a96917c0c8224642896088ade99f35
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-10 22:55:28 +02:00
Lars Knoll
9f33ad904a Move all the QProperty related code into one compilation unit
And mark some methods as inline.

Performance is critical for our new property system. Compiling
it in one unit makes it possible for the compiler to do a much
better job at inlining and generating optimized code.

Improves performance of binding evaluations by another 20%.

Change-Id: I5a2aa93c74d2b68418b0a9d2e34d8199bb71e3ad
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-07-10 15:07:22 +02:00
Lars Knoll
bbfecdee1e Significantly improve performance of binding evaluation
Avoid any QVariant or type dependent code in the cpp files.
Instead, let the binding wrapper determine if the value
has changed and return true/false accordingly.

This required also some reworking of the guard mechanism
for notified properties, where the guard function wrapper
now calls first the binding evaluation function and then
passes the result to the guard.

Change-Id: I350d07a508ccc0c5db7054a0efa4f270b6a78ec3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-07-10 15:07:12 +02:00
Lars Knoll
be1ce6b269 Separate the error case when evaluating bindings
There's no point in returning a usually empty error when
evaluating bindings, adding overhead to the regular code
path.

Instead, the error can be set on the currently evaluating
binding if required. This streamlines the functor used to
wrap the binding and should thus expand to less code and
execute faster in the regular case.

To achieve this, expose a pointer to the currently evaluating
binding in the private API (as QtQml needs it to be able to
report errors).

The error case now requires one additional TLS lookup, but
we don't really care about performance in that case anyway.

Change-Id: Iecb450e765244930a41d813fcf8eb4013957a6a3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-07-10 15:07:07 +02:00
Lars Knoll
0d1208f0f0 Cleanup QPropertyBindingError
Remove location(). The method would always return an empty value. If you need the location,
the binding itself has it.

Remove setDescription() and require that the description gets passed
in the constructor. Never create a d pointer if type is NoError, so we
can quickly check for it inline.

Change-Id: I7eb8a94786281069d6ea2d82567c09aa50c52ef6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-07-10 15:07:02 +02:00
Shawn Rutledge
4e400369c0 Refactor pointer event hierarchy
Some goals that have hopefully been achieved are:
- make QPointerEvent and QEventPoint resemble their Qt Quick
  counterparts to such an extent that we can remove those wrappers
  and go back to delivering the original events in Qt Quick
- make QEventPoint much smaller than QTouchEvent::TouchPoint, with no pimpl
- remove most public setters
- reduce the usage of complex constructors that take many arguments
- don't repeat ourselves: move accessors and storage upwards
  rather than having redundant ones in subclasses
- standardize the set of accessors in QPointerEvent
- maintain source compatibility as much as possible: do not require
  modifying event-handling code in any QWidget subclass

To avoid public setters we now introduce a few QMutable* subclasses.
This is a bit like the Builder pattern except that it doesn't involve
constructing a separate disposable object: the main event type can be
cast to the mutable type at any time to enable modifications, iff the
code is linked with gui-private. Therefore event classes can have
less-"complete" constructors, because internal Qt code can use setters
the same way it could use the ones in QTouchEvent before; and the event
classes don't need many friends. Even some read-accessors can be kept
private unless we are sure we want to expose them.

Task-number: QTBUG-46266
Fixes: QTBUG-72173
Change-Id: I740e4e40165b7bc41223d38b200bbc2b403e07b6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-10 14:32:56 +02:00
Friedemann Kleint
773a6bffd7 Tests: Use QVERIFY instead of QCOMPARE for empty lists
Pick-to: 5.15
Change-Id: I4da02fa11583eca3844bf42efcdf818b8bbd6a94
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2020-07-10 14:30:58 +02:00
Ulf Hermann
f9e1674094 moc: For non-STORED QProperties, expect a pointer
This way we can return a nullptr for cases where the class does not want
to provide a property at all. For example outside of bindings when
reading the default value. The moc-generated code can check for such
nullptrs and handle them.

Change-Id: I7ff478cb254012147bb7aed3feb160e3e679cb6d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-09 22:34:46 +02:00
Sona Kurazyan
577558daf5 Fix QByteArray::count implementation for longer data
The issue has been introduced when refactoring QByteArray::count
implementation (see 631127126c).

Because the last argument of QByteArrayMatcher::indexIn() method
has a defult value, it has been compiling without issues, but was being
called with incorrect size parameter. Fixed it to pass the length of the
input data correctly.

Change-Id: Ic9c2f33733131ec17276aa889f2d7ea40ec79b01
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-09 18:38:33 +02:00
Giuseppe D'Angelo
c023b025ee Qt::Modifier: do some cleanups
Qt::UNICODE_ACCEL had no effect since at least Qt 4.0. We can drop
it in Qt 6. The whole Qt::Modifier enumeration is still widely
used, so we can't drop it yet, but we should aim at doing so in
Qt 7. Add a note.

[ChangeLog][QtCore][Qt::Modifier] The Qt::UNICODE_ACCEL enumerator
has been removed. It had no effect since Qt 4.0.
[ChangeLog][QtCore][Qt::Modifier] Usage of the enumerators in
the Qt::Modifier enumeration is discouraged. The enumeration
will likely get removed in the next major version of Qt.

Change-Id: If25f30d920878d32903b91a38044f5da042c7eab
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-09 18:38:14 +02:00
Alexandru Croitor
db397d1113 CMake: Regenerate subdir test projects
And generate a few more test projects that were missing.

Change-Id: I5df51106549aa5ae09bc3c42360e14b143719547
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-07-09 09:38:39 +02:00
Alexandru Croitor
e9a328bc0e CMake: Regenerate tests with new qt_ prefixed APIs
Use pro2cmake with '--api-version 2' to force regenerate
projects to use the new prefixed qt_foo APIs.

Change-Id: I055c4837860319e93aaa6b09d646dda4fc2a4069
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-07-09 09:38:35 +02:00
Alexandru Croitor
5417f1e40c CMake: Regenerate tests
This is in preparation for regenerating them with the new qt_foo
prefixed APIs.

Change-Id: Iff34932d642b1c0186ee39f952adf3ad367fd602
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-07-09 09:38:31 +02:00
Fabian Kosmale
986d89c2ee Automatically register comparison operators in QMetaType
This removes the fully manual registration of comparison operators in
QMetaType and replaces it with an automatic registration through
Q_DECLARE_METATYPE().

[ChangeLog][QMetaType] The QMetaType::registerComparator() and
QMetaType::registerEqualsComparator() have been removed.
Q_DECLARE_METATYPE() now automatically registers any
operator==() and/or operator<() for a type visible where
it is used on that type, as part of declaring its meta-type.

Change-Id: I3df451b652b735c093533838bf32f3cc785439f8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-07-08 14:13:59 +02:00
Lars Knoll
16bc995fd1 Add type traits to safely determine the existence of comparison operators
Containers often define an operator==() or operator<() which is very useful
for generic code. But those operators can usually not be instantiated if
the template argument doesn't implement the operator.

This sometimes leads to the compiler trying all possible template expansions
and implicit conversions for the type, giving extremely long error
messages. The traits support can be used to safely constrain those
operators.

Being able to safely detect this will also allow us to fold the comparison
support that is currently a large cludge for user types directly into
QMetaType.

Change-Id: Ib84afb5348c3eb0be5161d6ba9d5fe237709c65f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-07-08 14:13:55 +02:00
Alexandru Croitor
1718948ed4 CMake: Regenerate benchmarks
Change-Id: I4154d9ebb8303338a07350b655c7b468751efd10
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-07-08 11:01:38 +02:00
Alexandru Croitor
1339cc4667 CMake: Regenerate manual tests
Change-Id: Id42b9e481375d2ec0e68b73dc1e2ff36f0cbd49e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-07-08 11:01:38 +02:00
Ulf Hermann
0cd3820e4d moc: Allow out-of-line storage for Q_PRIVATE_QPROPERTY
If you pass "STORED false" the name is interpreted as function to be
invoked in order to access the property. This allows storage of a
property in a lazily allocated data type.

Change-Id: I4d3a9cac6985c6419ce687868cb74b91921595a6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-07-08 11:01:38 +02:00
Sona Kurazyan
631127126c Introduce QByteArrayView
Created a QByteArrayView in symmetry with QStringView.
Added the basic tests symmetrical to QStringView tests.

Moved the implementations of non-modifying methods of QByteArray to
namespace QtPrivate, to be reused inline from both QByteArray and
QByteArrayView. Changed QByteArray's counterparts of those methods to
take QByteArrayView as argument instead of QByteArray. Removed
QByteArray's operator QNoImplicitBoolCast(), because it was causing
ambiguity when calling those methods with QByteArray argument (it was
there to perevnt if(!ba)/if(ba) from compiling, but currently that would
be ambiguous and won't compile anyway).

[ChangeLog][QtCore][QByteArrayView] New class.

Task-number: QTBUG-84321
Change-Id: I05f92e654cf65c95f2bb31b9c9018746ac110426
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-08 08:45:49 +02:00
Sona Kurazyan
a55e938fb4 Add tst_QByteArrayApiSymmetry test
Created tst_QByteArrayApiSymmetry test for the common APIs  of
QByteArray and QByteArrayView. Moved the tests for startsWith(),
endsWith(), indexOf(), lastIndexOf(), compare(), from tst_QByteArray
to tst_QByteArrayApiSymmetry and adapted them to check different
QByteArray/QByteArrayView combinations. Added tests for first(),
last(), sliced(), chopped(), chop(), truncate(), count(), contains()
(test inputs are taken from corresponding tst_QStringApiSymmetry
tests).

Task-number: QTBUG-84321
Change-Id: I4e712b1692e3c1271d51ddcda6c9eb8bb01e11d4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-07-08 08:45:14 +02:00
Joerg Bornemann
f96244f614 Don't set the environment variable QT_RCC_TEST anymore in tst_rcc
The reason for setting this variable was removed in commit 300bd7fff8.

Task-number: QTBUG-25078
Change-Id: Id06072c099481a258cb65b4603efe010e306b7b2
Reviewed-by: hjk <hjk@qt.io>
2020-07-08 07:56:40 +02:00
Tor Arne Vestbø
e255146183 Replace use of deprecated Q_OS_MACX in favor of Q_OS_MACOS
Change-Id: I1059d56f67be28a4cc1a66b744e81df6d0b5d00d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-08 01:09:38 +02:00
Giuseppe D'Angelo
1e8d623340 QThread::create: remove the pre-C++17 codepaths
As we require C++17 now. The configure-time test checking for
future/async is left in for the moment being.

Change-Id: Ifde39d420673f70a2277f5a645bfaad30935a381
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-07-07 20:54:12 +02:00
Shawn Rutledge
c7c28b3406 Separate QPD::tabletDevice into priv tabletDevice and queryTabletDevice
There doesn't seem to be any reason users will need to query tablet
devices by their IDs, because every event comes with a complete
instance already, and we have QInputDevice::devices() to list them all.

QPointingDevicePrivate::tabletDevice() can create a new instance if a
matching one is not found (and complains about that); it's intended
for use in QtGui, as a way to find the device if it was not part of the
QWSI event. Now it sets the parent of those auto-created instances
to QCoreApplication to avoid a memory leak.

On the other hand, queryTabletDevice() is intended for use in platform plugins
that need to check whether an instance exists; but they will take care
of creating new instances themselves, and thus have more control over the
parent and the details being stored. Now that the systemId can also be given,
the search is more likely to have a unique result, on window systems
that provide device IDs.

Rename id() to systemId() to clarify that it's a system-specific unique
device ID of some sort, not the same as the uniqueId that a stylus has.
However it seems that in practice, this will often be 0; so clarify that
if it's not unique, QInputDevicePrivate::fromId() and queryTabletDevice()
may not always find the right instance.

Clarify the function usage via comments.

Change-Id: I82bb8d1c26eeaf06f07c290828aa17ec4a31646b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-07 16:14:58 +00:00
Lars Schmertmann
6ce2f3f26b Add ; to Q_UNUSED
This is required to remove the ; from the macro with Qt 6.

Task-number: QTBUG-82978
Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-07 11:51:48 +02:00