qt6-bb10/tests/auto/corelib/kernel
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
..
qapplicationstatic Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qcoreapplication Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qdeadlinetimer Remove preprocessor conditionals for chrono include 2022-09-16 08:09:05 +02:00
qelapsedtimer Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qeventdispatcher Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00
qeventloop Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qjnienvironment CMake: Remove direct qt_android_generate_deployment_settings call 2022-12-15 20:23:28 +01:00
qjniobject CMake: Remove direct qt_android_generate_deployment_settings call 2022-12-15 20:23:28 +01:00
qjnitypes JNI: add generic support for array-types 2022-10-10 20:19:30 +02:00
qmath Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qmetacontainer Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qmetaenum Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qmetamethod Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qmetaobject Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qmetaobjectbuilder Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qmetaproperty Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qmetatype QMetaType: fix value-initialization in a corner case 2022-12-30 01:51:08 +01:00
qmimedata Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00
qobject Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00
qpermission QPermission: replace T data<T>() with std::optional<T> value<T>() 2023-01-13 21:07:18 +01:00
qpointer Compile guard tests in corelib/kernel that need threading support 2022-09-11 19:36:49 +02:00
qproperty QBindable: Make ordinary Q_PROPERTYs bindable 2022-11-30 21:21:03 +00:00
qsharedmemory Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qsignalblocker Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qsignalmapper Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qsocketnotifier Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qsystemsemaphore Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qtimer Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qtranslator Compile guard tests in corelib/kernel that need threading support 2022-09-11 19:36:49 +02:00
qvariant Adapt corelib to use QTimeZone in place of Qt::TimeSpec 2022-12-09 16:16:48 +01:00
qwineventnotifier Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qwinregistrykey QWinRegistryKey: Fix how we handle the default value, take 2 2022-10-28 09:27:13 +00:00
CMakeLists.txt Add minimal QPermission auto-test 2023-01-12 08:48:46 +01:00