8#pragma qt_class(QPermissions)
11#include <QtCore/qglobal.h>
12#include <QtCore/qtmetamacros.h>
13#include <QtCore/qvariant.h>
15#include <QtCore/qshareddata_impl.h>
16#include <QtCore/qtypeinfo.h>
17#include <QtCore/qmetatype.h>
27#ifndef QT_NO_DEBUG_STREAM
36 template <
typename T,
typename Enable =
void>
37 static constexpr inline bool is_permission_v =
false;
40 using if_permission = std::enable_if_t<is_permission_v<T>,
bool>;
44 template <
typename T, if_permission<T> = true>
51 template <
typename T, if_permission<T> = true>
54 if (
auto p =
data(QMetaType::fromType<T>()))
55 return *
static_cast<const T *
>(
p);
59#ifndef QT_NO_DEBUG_STREAM
73constexpr bool QPermission::is_permission_v<T, typename T::QtPermissionHelper> =
true;
75#define QT_PERMISSION(ClassName) \
76 using QtPermissionHelper = void; \
77 friend class QPermission; \
80 U(ShortData _data) : data(_data) {} \
81 U(ClassName##Private *_d) : d(_d) {} \
83 ClassName##Private *d; \
86 Q_CORE_EXPORT ClassName(); \
87 Q_CORE_EXPORT ClassName(const ClassName &other) noexcept; \
88 ClassName(ClassName &&other) noexcept \
89 : u{other.u} { other.u.d = nullptr; } \
90 Q_CORE_EXPORT ~ClassName(); \
91 Q_CORE_EXPORT ClassName &operator=(const ClassName &other) noexcept; \
92 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(ClassName) \
93 void swap(ClassName &other) noexcept { std::swap(u, other.u); } \
97class QLocationPermissionPrivate;
124 char reserved[
sizeof(
void*) -
sizeof(accuracy) -
sizeof(availability)];
130class QCalendarPermissionPrivate;
147 char reserved[
sizeof(
void*) -
sizeof(
mode)];
153class QContactsPermissionPrivate;
170 char reserved[
sizeof(
void*) -
sizeof(
mode)];
176class QBluetoothPermissionPrivate;
187 Q_FLAG(CommunicationModes)
195 char reserved[
sizeof(
void*) -
sizeof(
mode)];
202#define Q_DECLARE_MINIMAL_PERMISSION(ClassName) \
203 class ClassName##Private; \
206 struct ShortData { char reserved[sizeof(void*)]; }; \
207 QT_PERMISSION(ClassName) \
209 Q_DECLARE_SHARED(ClassName)
215#undef Q_DECLARE_MINIMAL_PERMISSION
Access Bluetooth peripherals.
Q_CORE_EXPORT CommunicationModes communicationModes() const
Q_CORE_EXPORT void setCommunicationModes(CommunicationModes modes)
Access the user's calendar.
Q_CORE_EXPORT void setAccessMode(AccessMode mode)
Sets whether the request is for read-write (mode == AccessMode::ReadOnly) or read-only (mode == Acces...
Q_CORE_EXPORT AccessMode accessMode() const
Returns AccessMode::ReadWrite when the request is for read-write and AccessMode::ReadOnly when it is ...
AccessMode
This enum is used to control access to the calendar data.
Access the camera for taking pictures or videos.
Access the user's location.
Availability
This enum is used to control the availability of the location data.
Q_CORE_EXPORT void setAvailability(Availability availability)
Sets the desired availability of the request.
Q_CORE_EXPORT void setAccuracy(Accuracy accuracy)
Sets the desired accuracy of the request.
Accuracy
This enum is used to control the accuracy of the location data.
Q_CORE_EXPORT Availability availability() const
Returns the availability of the request.
Q_CORE_EXPORT Accuracy accuracy() const
Returns the accuracy of the request.
Access the microphone for monitoring or recording sound.
\inmodule QtCore \inheaderfile QPermissions
friend Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QPermission &)
std::optional< T > value() const
QMetaType type() const
Returns the type of the permission.
Qt::PermissionStatus status() const
Returns the status of the permission.
QMetaType metaType() const
Combined button and popup list for selecting options.
QDateTimePrivate::QDateTimeShortData ShortData
#define Q_DECLARE_FLAGS(Flags, Enum)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define QT_PERMISSION(ClassName)
#define Q_DECLARE_MINIMAL_PERMISSION(ClassName)
#define QT_REQUIRE_CONFIG(feature)