QContactsPermission Class

Access the user's contacts. 更多...

头: #include <QPermissions>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
Since: Qt 6.5

公共类型

enum AccessMode { ReadOnly, ReadWrite }

公共函数

QContactsPermission::AccessMode accessMode () const
void setAccessMode (QContactsPermission::AccessMode mode )

详细描述

By default the request is for read-only access. Use setAccessMode () to override the default.

要求

To request this permission at runtime, the following platform specific usage declarations have to be made at build time:

平台 类型
Apple Usage description NSContactsUsageDescription
Android uses-permission android.permission.READ_CONTACTS . android.permission.WRITE_CONTACTS if QContactsPermission::accessMode () is set to AccessMode::ReadWrite.

Please see the individual usage declaration types for how to add them to your project.

另请参阅 QPermission , QCoreApplication::requestPermission (), QCoreApplication::checkPermission (),和 应用程序权限 .

成员类型文档编制

enum QContactsPermission:: AccessMode

This enum is used to control access to the contacts data.

常量 描述
QContactsPermission::ReadOnly 0 Read-only access to the contacts data (the default).
QContactsPermission::ReadWrite 1 Read and write access to the contacts data.

另请参阅 setAccessMode and accessMode .

成员函数文档编制

QContactsPermission::AccessMode QContactsPermission:: accessMode () const

Returns AccessMode::ReadWrite when the request is for read-write and AccessMode::ReadOnly when it is for read-only access to the contacts.

另请参阅 setAccessMode ().

void QContactsPermission:: setAccessMode ( QContactsPermission::AccessMode mode )

Sets whether the request is for read-write ( mode == AccessMode::ReadOnly) or read-only ( mode == AccessMode::ReadOnly) access to the contacts.

另请参阅 accessMode ().