QLocationPermission#

Access the user’s location. More

New in version 6.5.

Synopsis#

Functions#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

By default the request is for approximate accuracy, and only while the application is in use. Use setAccuracy() and/or setAvailability() to override the default.

Requirements#

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

Platform

Type

macOS

Usage description

NSLocationUsageDescription

iOS

Usage description

NSLocationWhenInUseUsageDescription, and NSLocationAlwaysAndWhenInUseUsageDescription if requesting Always

Android

uses-permission :ref:` <Application-Permissions>`

  • android.permission.ACCESS_FINE_LOCATION for Precise

  • android.permission.ACCESS_COARSE_LOCATION for Approximate

  • android.permission.ACCESS_BACKGROUND_LOCATION for Always

Note

Always uses-permission string has to be combined with one or both of Precise and Approximate strings.

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

See also

QPermission requestPermission() checkPermission() Application Permissions

class PySide6.QtCore.QLocationPermission#

PySide6.QtCore.QLocationPermission(other)

Parameters:

otherPySide6.QtCore.QLocationPermission

PySide6.QtCore.QLocationPermission.Accuracy#

This enum is used to control the accuracy of the location data.

Constant

Description

QLocationPermission.Approximate

An approximate location is requested.

QLocationPermission.Precise

A precise location is requested.

PySide6.QtCore.QLocationPermission.Availability#

This enum is used to control the availability of the location data.

Constant

Description

QLocationPermission.WhenInUse

The location is only available only when the application is in use.

QLocationPermission.Always

The location is available at all times, including when the application is in the background.

PySide6.QtCore.QLocationPermission.accuracy()#
Return type:

Accuracy

Returns the accuracy of the request.

See also

setAccuracy()

PySide6.QtCore.QLocationPermission.availability()#
Return type:

Availability

Returns the availability of the request.

PySide6.QtCore.QLocationPermission.setAccuracy(accuracy)#
Parameters:

accuracyAccuracy

Sets the desired accuracy of the request.

See also

accuracy()

PySide6.QtCore.QLocationPermission.setAvailability(availability)#
Parameters:

availabilityAvailability

Sets the desired availability of the request.

See also

availability()

PySide6.QtCore.QLocationPermission.swap(other)#
Parameters:

otherPySide6.QtCore.QLocationPermission