Commit Graph

52429 Commits

Author SHA1 Message Date
Arno Rehn
70051c55fe Move IsSequentialContainer tagging to the appropriate macro
Originally, the template specialization QtPrivate::IsSequentialContainer
was done in Q_DECLARE_METATYPE_TEMPLATE_1ARG. This was conceptually
wrong and prevented re-using Q_DECLARE_METATYPE_TEMPLATE_1ARG.
This patch moves the specialization to
Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE, which makes it symmetrical to
Q_DECLARE_ASSOCIATIVE_CONTAINER_METATYPE and allows re-using
Q_DECLARE_METATYPE_TEMPLATE_1ARG with non-container templated types.

Change-Id: I3b952ed36e4c140bce3511aebc1e5599c4822e34
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-07-12 18:33:19 +02:00
Arno Rehn
1f2d756d92 Add QFutureInterfaceBase::get() to retrieve internals of QFuture
For generic interop with other parts of Qt, we need to be able to
extract the type-erased internal storage of QFuture<T>. In particular,
QtWebChannel needs this to transparently support QFuture<T> as a method
return type.

Task-number: QTBUG-92903
Change-Id: I763f054656b8810d58720262d364baf42c47eb37
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-07-12 18:33:19 +02:00
Marc Mutz
82bc752497 QLocalServer/Unix: don't allocate QTemporaryDir just to make it optional<>
Use std::optional<> instead.

Change-Id: Ic33ae2dd71f2b6c4347dac7c4be4dc6227edf425
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-12 17:16:11 +02:00
Marc Mutz
3552821551 QObject: make new-style-connects SFINAE-friendly
SFINAE out the new-style connect() overloads for const char*
functions.

Before, we detected the problem in the body of connect(), by failing
the static_assert for signal/slot argument compatibility, but that's
too late. We don't want to select that overload at all, because we
want that decltype(QObject::connect(QAction*, &QAction::triggered,
QObject*, SLOT(something())) SFINAEs instead of returning
QMetaObject::Connect, because then all the classes that provide
convenience new-style connect syntax by wrapping the
QObject::connect() call can just use that decltype() to accept
anything that will succeed in the wrapped connect() call instead of
manually trying (and failing) to provide proper overloads themselves.

[ChangeLog][QtCore][Potentially Source-Incompatible Changes]
QObject::connect(sender, pointer-to-member, [receiver, ], SLOT(~~~))
is now SFINAEd out instead of triggering a static_assert(). That means
it is now possible to use Expression SFINAE
(decltype(QObject::connect(<sender>, <signal>,
std::declval<Args>()...) to properly wrap new-style QObject::connect()
calls with a single wrapper function, greatly simplifying the
implementation, incl. passing Qt::ConnectionType arguments. For more
information on how to use this in your own code, see the sources of
QWidget::addAction().

Change-Id: I4052a49eacd63a432a9648a667adc435744a633d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-07-12 15:16:11 +00:00
Marc Mutz
505bdd07c0 QGuiApplication: remove Windows-only variable from non-Windows builds
...lest some code tries to set it to no possible effect.

Change-Id: I7aed05200c1abeda1d2f9d88ceb99a5ce6132dbf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-07-12 16:41:20 +02:00
Sona Kurazyan
42f2a9c5ce tst_QtConcurrentThreadEngine: fix the threadCount() test
Enable the check, that has been disabled because of instability, which
makes the test-case useless. The reason for instability probably was
that it doesn't always start maxThreadCount number of threads: it could
be less if the workers reuse the thread pool's already created threads
(if possible) instead of creating new one each time. But we can at least
make sure, that we're not starting more threads than expected.

Task-number: QTBUG-94463
Pick-to: 5.15 6.1 6.2
Change-Id: I8e498c377d86c49758bde0114fe6f7e0432fe993
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-07-12 15:54:41 +02:00
Andreas Buhr
e17a776157 Fix some documentation warnings
Change-Id: Icb6a689e4c4c8272df2f72fd99aaa8d258e4e7b2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-12 15:05:43 +02:00
Fabian Kosmale
c3199f018e configure: Note that -linker works also with clang
Change-Id: If91eb1b5ad9a6b67e411b4d399fc3e1ede996e41
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-12 14:46:56 +02:00
Christian Ehrlicher
e8b3d35a18 QTableView: fix selection with rows and cells in ExtendedSelection mode
QTableView stored the current row/column selection start in an own
variable instead using currentSelectionStartIndex. This leads to an
inconsistent behavior when the selection is done with a click on the
header and then in a cell (and the other way round)

Fixes: QTBUG-92561
Change-Id: I4c8bda3a938de451b6eff2819141e86a6870fbef
Pick-to: 6.1 6.2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-12 08:19:16 +00:00
Volker Hilsheimer
e71a5d5cc3 macOS: Don't make frameless tool windows miniaturizable
Amends 556fbbea6e, which breaks
translucency of frameless tool windows. Possibly a bug in macOS, a
window being made miniaturizable should not have side effects on
background or translucency.

Pick-to: 6.2 6.1 5.15
Fixes: QTBUG-95042
Task-number: QTBUG-65637
Change-Id: I651196e3cf8a9c59b250e5f1b4064cc4ded02372
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-07-12 10:14:09 +02:00
Marc Mutz
d52bb250c3 QNonContiguousByteDevice: ++explicit
Change-Id: I5d40a12704789eff10db9b1fb34f4e375651f1f0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-07-10 16:07:37 +02:00
Oliver Eftevaag
a7894855f2 Fix QTextFormat::FullWidthSelection for right-to-left text layouts
Using the QTextFormat::FullWidthSelection property to select a line
would previously not take into account right-to-left text layouts.

With this patch, the whole line should now be drawn correctly for both
left-to-right, and right-to-left layouts.

Pick-to: 6.2 6.1 5.15
Fixes: QTBUG-91125
Change-Id: Ide7b340cd7b4060e7c00e55e0011a86ffdfb5eb4
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-07-10 13:27:46 +02:00
Timur Pocheptsov
408656c6f9 Diffie-Hellman parameters: remove useless 'fix'
The workaround I had implemented based on alpha version of OpenSSL v3
and what developers (OpenSSL) said about DH back then is not going to work
in the end - they do remove all DH (struct and related functions) stuff
if you set a proper OPENSSL_API_COMPAT level. A proper re-write is required
to support OpenSSL v3, but then there is no reason to keep dead useless
code.

Pick-to: 6.2
Task-number: QTBUG-94596
Change-Id: Iae092dd08148521649a684879d30e190736e1abe
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-07-09 19:53:55 +02:00
Timur Pocheptsov
3186ca3e39 Dont's use DTLS_MAX_VERSION when setting SSL_CTX
It was fixed quite some time ago for TLS counterpart (TLS_MAX_VERSION),
but somehow the similar fix was missing for DTLS. OpenSSL v3 deprecated
those constants and they can be compiled out by OPENSSL_API_COMPAT.

Pick-to: 6.2
Task-number: QTBUG-94596
Change-Id: Ia0246170a003db900c430b2fbfc177caf05a395a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-09 19:53:54 +02:00
Marc Mutz
711ff56a64 QUuid: remove Windows-only pre-C++11 constructor implementation
Amends bd62dc1391.

Change-Id: Iba10e7d70e7bd9d7c6068632dd2f429a52945463
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-09 17:09:41 +00:00
Marc Mutz
12f72db185 QColorTrcLut: don't inherit from QEnableSharedFromThis
None of the member functions use sharedFromThis().

Change-Id: I4d1fc0c3c18830df231833ce0ef631e1bb1fc27e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-07-09 19:09:41 +02:00
Marc Mutz
79a4cca61b tst_QSharedPointer: fix -Wsuggest-override warnings
Change-Id: I1aec8d342e8e5e16b39a62c8a0c885e2915feaf9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-07-09 17:59:01 +02:00
Marc Mutz
521e801b52 QString benchmark: fix the [[nodiscard]] warnings
Change-Id: I75941c295ba7d0a9bff5f12b49db28875b97c62a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-09 17:59:01 +02:00
Marc Mutz
6cc830f7a6 tst_QFile: fix GCC -Wignored-qualifiers
The decltype() of a const auto variable will be const T, for some
T. GCC warns that in the static_cast, said const is ignored.

Fix by not casting, but declaring a variable of fitting type. Add a
scope so the next reader doesn't have to go hunting for further uses
of 'readResult' or, now, 'expected'.

Change-Id: Iebc828a522810c6f2514fb3542d8c76c755ec7a5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-09 17:59:01 +02:00
Volker Hilsheimer
637d5dd6b1 macOS: fix drawing of pushbuttons of non-standard size
Cocoa renders the bevel of a push button always in the default height of
32 pixels. We handled the case that the button is larger than that by
switching to "squared" mode, but buttons that are smaller than that got
rendered incorrectly, with the bevel being clipped.

Fix this by always rendering buttons in "squared" mode when the height
of the widget is not the same as the standard. Adjust the default height
for "mini" push buttons based on visual testing. Make the equivalent
adjustment to the focus frame logic and general positioning so that
buttons and frames are centered compared to other controls.

As a drive-by, get rid of expensive QObject::inherits calls, and replace
with qobject_cast. The headers for all the relevant widget types are
already included.

Fixes: QTBUG-85972
Pick-to: 6.2
Change-Id: I4ad66fac2313fbee385c1eadcc243f69c9cace70
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-07-09 17:03:39 +02:00
Andreas Buhr
cd0528143e add todo comment for Qt 7
Task-number: QTBUG-94546
Change-Id: I86a40dcb2b6e33140c31acc450bcd47fa6ff3f2d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-09 16:06:44 +02:00
Marc Mutz
f5bcfb8f57 Fix C++20 compilation of androiddeployqt
u8 literals changed type from const char[] to const char8_t[] in C++20
and Qt APIs that don't use QUtf8StringView aren't prepared for it. Use
a classical char literal for the time being.

Amends 857be50b2e.

Pick-to: 6.2
Change-Id: I7f194befc08ab50cdef321d8900ee3553599a19e
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-07-09 13:35:54 +00:00
Ivan Solovev
74d6c36eb7 QMap::erase - extend docs to specify iterator limitations
Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: I4a226e0bbcde91f3149db9a0697981169ec25276
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-07-09 14:45:28 +02:00
Alexey Edelev
766d5d168f Fix global header exclusion regex
Make the dot explicit in global header exclusion regex.
Ensure that '.h' states in the end of file name and support
paths.

Amends 50b55b89f3

Change-Id: I25b3d2fb54ed606a0b0806a10dbcb4ce1c65d2d8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-09 13:56:18 +02:00
Ievgenii Meshcheriakov
d804d21e8f cldr.py: Avoid raising StopIteration from generators
The behavior of StopIteration in generators was changed in Python 3
(see https://www.python.org/dev/peps/pep-0479/). Not raising that
exception makes it easier to port the code to Python 3.

Task-number: QTBUG-83488
Pick-to: 6.2
Change-Id: Iac6e3f6f1e1e8ef3a1a0d89b19d2ac2d186434f5
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-09 13:42:21 +02:00
Alexandru Croitor
451733bd57 CMake: Fix reconfiguration error when features have EMIT_IF conditions
Previously, if a feature was marked as not to be emitted and there was
no user provided value for that feature, the build system would still
save the user provided value in FEATURE_foo with a value of ON (if the
conditions were met).

After a reconfiguration, the build system would hit the code path that
checks if the user provided a value for the non-emitted feature, and
would then warn about it and reset the feature value to OFF.

This would cause errors when reconfiguring a user project, complaining
that a feature value has changed.

Make sure to not save the user provided value for a non-emitted
feature and to always set its internal feature value to OFF.

Amends c4f5762b20

Pick-to: 6.2
Fixes: QTBUG-94921
Change-Id: I257c7fd795c8a6aeba3348cb72522e4f0b006dc9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-07-09 12:44:35 +02:00
Alexandru Croitor
cde126ef26 CMake: Rename and document the feature evaluation functions
Rename various functions and variables to hopefully make the behavior
of feature evaluation clearer.

The previous names like 'set_value' or 'set_cache_value' or 'cache'
were too generic and unclear. One would have to carefully read the
code to understand what was actually set.

Add some doc comments about what FEATURE_foo and QT_FEATURE_foo
represent.

Amends c4f5762b20

Pick-to: 6.2
Task-number: QTBUG-94921
Change-Id: Ie6a7b83a4d54a83976b2706d4af82b39832d79f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-07-09 12:44:35 +02:00
Alexandru Croitor
51ae235080 CMake: Use correct MSVC runtime library for Qt object libraries
If Qt was configured with -static-runtime which implies MultiThreaded
-MT flag, the plugin initializer object libraries were still compiled
with the default -MD flag.

When an application linked to Qt, that caused linking to fail with
mismatched symbol errors between the application symbols and the
plugin initializer object library symbols.

Make sure to set the MSVC_RUNTIME_LIBRARY property on both plugin
initializer and resource object libraries, depending on the value of
QT_FEATURE_static_runtime.

We did set the property for resources added by
qt_internal_add_resource, but not for the resource created by
the public qt6_add_resources counterpart.

Pick-to: 6.2
Fixes: QTBUG-95043
Change-Id: Ia543cd0241db94a12080be2655ad420fe9ad3f24
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-07-09 12:44:35 +02:00
Alexandru Croitor
7b3d9efc04 CMake: Place internal apps in the correct output directory
In a -debug-and-release build, apps were placed under bin/Release
rather than just bin.

Apply the logic we use for tools for apps as well. Rename and move
the common functions into QtTargetHelpers.cmake.

Pick-to: 6.2
Fixes: QTBUG-95028
Change-Id: I5a9082ea50c9238c8fcf0c6dd099708fbc571bf8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-07-09 09:44:58 +02:00
Volker Hilsheimer
d2e88b8094 Fix auto completion in QFileDialog on Windows
Amends c0b3c06a7d.

The QCompleter used by QFileDialog uses starts-with matching of
the path parts, for all parts of the path. It uses the EditRole of the
underlying model for the data to match.

The path parts used for a path on Windows are "C:", "Users", "etc...",
and then finally whatever input has been typed so far. If we try to
match that against a starts-with rule against "Local Disk (C:)", then it
will fail and the completer will never have anything to show.

So, for the EditRole, return just the volume drive letter as we did before
c0b3c06a7d, not the volume name. Neither
can be edited anyway. This happens to then match the native file dialog
behavior, which doesn't complete "L" to "Local Disk (C:)" if the Computer
contents (ie. volumes) are shown.

Augment the QCompleter test case to cover that scenario (it already has
everything set up for this particular combination, even though we are
actually testing QFileSystemModel returning the correct data).

Fixes: QTBUG-94799
Task-number: QTBUG-78043
Pick-to: 5.15 6.2 6.1
Change-Id: I14844d91601e9b16dc07cff2ca48713acb7cdd09
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-07-09 00:48:44 +02:00
Alexey Edelev
f33d11796f Hide QT_USE_BUNDLED_ CACHE variables from GUI
Make QT_USE_BUNDLED_ INTERNAL to hide them from GUI like QtCreator's
CMake configurator.

Pick-to: 6.1 6.2
Change-Id: Id9dcee31c69b579bbe38611cabb98e46550b0e89
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-08 23:38:25 +02:00
Alexey Edelev
b2649754f1 Make QT_HAVE_LINK_ORDER_MATTERS INTERNAL to hide from GUI
Hide QT_HAVE_LINK_ORDER_MATTERS from GUI like QtCreator's CMake
configurator.

Pick-to: 6.1 6.2
Change-Id: I9591092f0902ad17ff260a1ca4494239a7acf6fa
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-08 23:38:25 +02:00
Thiago Macieira
8731192106 Fix qt_error_string() and QSystemError::string's lack of i18n
There are four messages that we, for some reason I don't understand,
have our own text for instead of using strerror(). But even though they
were marked for extraction, they weren't translated.

Fixes: QTBUG-95039
Pick-to: 6.2
Change-Id: I266f1bf9a4d84db39086fffd168f8c6dfe9c2cf4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-07-08 12:10:49 -07:00
Ivan Solovev
a8bcf68a5e Fix QMultiHash::keys(const T&) overload
The method was never tested, but it failed to compile after
QMultiHash was introduced as a separate class in 6.0.
This patch fixes it and adds some unit-tests to cover the case.

Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: I5dd989d4775efc6a9bb13c5ed1d892e499d95dc2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-08 20:12:14 +02:00
Cristian Maureira-Fredes
15592ec4f7 corelib: update debug_script to python 3
This script was written for Python 2, which is deprecated now.

Change-Id: I534c93922776254a4c822ac60c6fd77ca7cb9760
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2021-07-08 18:51:00 +02:00
Andreas Buhr
857be50b2e Let androiddeployqt write a dependency file
Let androiddeployqt write a dependency file so that
the build system knows when to re-run it.

Fixes: QTBUG-94567
Change-Id: I5985d707f257b22789013a74f0a6f7c4de6e5e88
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-07-08 17:30:20 +02:00
Joerg Bornemann
85e25d93b3 CMake: Set IMPORTED_{SONAME|IMPLIB} for shared libs only
In our *AdditionalTargetInfo.cmake we now set above target properties
for shared libs only, not executables.

IMPORTED_IMPLIB is only set for Windows.
IMPORTED_SONAME is only set for non-Windows platforms.

Pick-to: 6.2
Change-Id: If7f01e6bf5183cca0ac90f9afffd57c41b34dccd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-08 16:40:35 +02:00
Joerg Bornemann
7540b4bd56 Fix build of Debug projects against debug-and-release non-prefix Qt
Building a CMake project with CMAKE_BUILD_CONFIG=Debug was broken for
non-prefix debug-and-release builds of Qt.

In debug-and-release builds we set EXCLUDE_FROM_ALL on tools in the
Debug configuration. In non-prefix builds we export(EXPORT) targets, and
that also contains the non-existent Debug variants of the tools.  In
prefix builds, we install(EXPORT) instead, which only exports what is
built and installed.

Consequently, we now remove the DEBUG-related import information if the
debug variant if the target binary does not exist.

Pick-to: 6.2
Fixes: QTBUG-95027
Change-Id: I37766d5ab1e2795bcb91a348e7e72150e8a00f82
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-07-08 16:40:35 +02:00
Alex Trotsenko
1a57a4974b QLocalSocket/Win: reimplement skipData() function
The base implementation discards the data by reading into a dummy
buffer, which is slower than necessary.

Change-Id: Iabf0c4a25746af6cac5b61d7bda66d89501c808c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-07-08 16:14:11 +03:00
Ivan Solovev
82499f8147 QMultiHash::find - prevent detaching shared null
Do not detach when find(key, value) is called on an empty QMultiHash.

As a drive-by: fix return value for QMultiHash::remove() in case of
empty QMultiHash.

Task-number: QTBUG-91736
Pick-to: 6.2 6.1
Change-Id: I1e32f359e7ee9ce8403dae79d02e0b88a20ec4a5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-07-08 14:41:14 +02:00
Andrei Golubev
0ac8722d25 Test Q_CLASSINFO("foobar", #__VA_ARGS__) in tst_moc
There's a chance that this would be used in some macro, so why not test
that this thing works in general (especially since it actually works)

Change-Id: Ib9d91fbd17cf16675ae89a99f010dacc5d30967a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-07-08 08:17:34 +02:00
Marc Mutz
ebee8a1336 QDBusMarshaller: fix -Wformat-overflow
Says GCC:

qdbusmarshaller.cpp: In member function ‘QDBusMarshaller* QDBusMarshaller::beginMap(QMetaType, QMetaType)’:
qdbusmarshaller.cpp:286:17: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
  286 |         qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. "
      |                 ^

Fix by manual checking. It's a False Positive, because
QString::asprintf() can handle nullptr strings just find, but let's
make GCC happy.

Since the code snippet appears multiple times, even though GCC only
warns about one of them, take this opportunity to factor the code out
into a cold helper function.

Change-Id: I1d642f2465f34b670b179646185cba05cb16e573
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-07-08 01:49:26 +02:00
Marc Mutz
28fbed2f5c QCryptographicHash: share more code between switch cases
Now that calling hashLengthInternal() is cheap, use it to factor
common code in switch statements. For sha3, that would have been
possible before, too. Reason for duplicating the case bodies is
unclear.

Change-Id: I281617546e0b3e701315eee2f10df8d26ada92ae
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-07-08 01:49:26 +02:00
Marc Mutz
e9fffbaf81 Use QCryptographicHash::hash() more widely
... instead of the "usual" rule of three: ctor, addData(), result().

Not only does it generate less code in the caller, it's now also
faster.

Change-Id: I67c7eeb01f527b90e80a08f60c1c7f2ec1e49dd4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-07-07 23:49:26 +00:00
Marc Mutz
bd62dc1391 QUuid: clean up pre C++11 constructors
All compilers Qt 6 supports support C++11 Uniform Initialization now.

Change-Id: I1ddcc506347db1770c535047ebe2547ff33d843e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-07-08 01:49:26 +02:00
Andreas Buhr
3818046204 fix warning in cborparser with gcc 11.1
Pick-to: 6.2
Change-Id: Ie8270f2b156b194dedd115a97b93f7f800af055e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-07-07 22:07:13 +02:00
Edward Welbourne
f1d40ca5e9 Unify and clean up two identical tst_qfile::*_data() functions
Convert newRow() to addRow() to simplify formatting, use a ranged-for
iteration, take out a common factor of 1024, use QByteArray instead of
roundtripping ASCII via Unicode, and break some long lines.

Change-Id: I052730a71fb74f40a0dbd0695dcc286bc39896fb
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-07-07 19:36:49 +02:00
Edward Welbourne
1cabfd1680 Move QSKIP()s to _data() functions in QFile benchmark
Skipping once in the data function is the clean way to do this. Saves
setting up dummy data just so as to skip it, or setting up real data
and then skippin on each row.

Change-Id: I1666d134b6f206e8055fbbc5efd2e2116431a9c1
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2021-07-07 19:36:49 +02:00
Ievgenii Meshcheriakov
2300146085 locale_database: Don't attempt to access property 'message' of IOError
IOError does not have property 'message' in Python 3. Instead of
attempting to access it, just use the string representation of
the exception object. This produces the error message possibly combined
with additional arguments in both Python 2 and Python 3.

Task-number: QTBUG-83488
Pick-to: 6.2
Change-Id: Icb198a409e7f80b832e474d8390b770fdeacc6c2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-07 19:32:52 +02:00
Marc Mutz
e54faee178 QTest: remove unneeded cast in toPrettyUnicode()
char16_t, as returned from QStringView::utf16(), is guaranteed to be
unsigned, so there's no need to reinterpret_cast to ushort.

Change-Id: I7432dd26b4814c61fe70cc33ed307097ef46ce4e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-07 19:32:52 +02:00