qt5base-lts/tests/auto/corelib
Marc Mutz ce104cac50 QPermission: replace T data<T>() with std::optional<T> value<T>()
As discussed in API review, the default-constructed T() returned from
a mismatched data<T>() call is indistinguishable from a real T with
default state.

To make them distinguishable, return optional<T>. Call the new
function value<T>(), mimicking QVariant::value<T>(), and suggested in
API review, because data() is usually used to return raw pointers, not
values.

Remove the qWarning() on requestedType and actualType mismatch, as the
new function can be used in std::get_if/dynamic_cast-like if-then-else
chains, in which failure is part of the normal operation, and a
warning message misplaced:

  if (auto loc = perm.value<QLocationPermission>())
     ~~~ use *loc ~~~
  else if (auto con = perm.value<QContactsPermission>())
     ~~~ use *con ~~~
  ~~~ etc ~~~

Pick-to: 6.5
Change-Id: I799a58e930307323ebce8f9ac50a42455e9c017f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-01-13 21:07:18 +01:00
..
animation Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
global QTypeInfo: remove further usages of isPointer / isIntegral 2022-12-30 01:51:27 +01:00
io Give tst_QStorageInfo a QCOMPARE_op() makeover 2023-01-13 15:08:25 +01:00
itemmodels Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
kernel QPermission: replace T data<T>() with std::optional<T> value<T>() 2023-01-13 21:07:18 +01:00
mimetypes QFileInfo: use currentDateTimeUtc() 2023-01-06 17:57:52 +00:00
platform CMake: Remove direct qt_android_generate_deployment_settings call 2022-12-15 20:23:28 +01:00
plugin QUuid: add the ability to specify the byte order for 128-bit IDs 2022-12-16 19:29:10 +01:00
serialization QXmlStreamWriter: fix a thinko in doWriteToDevice(QSV) 2022-12-16 22:58:11 +01:00
text Add QString<->emscripten::val conversion functions 2023-01-13 21:07:14 +01:00
thread QPromise: improve documentation snippet 2023-01-09 10:03:48 +01:00
time Fix RTA test build for INTEGRITY 2023-01-09 11:47:37 +01:00
tools tst_QAlgorithms: don't use random numbers in the test row names 2023-01-11 11:16:20 -08:00
CMakeLists.txt Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00