QGeoPositionInfoSource

The QGeoPositionInfoSource class is an abstract base class for the distribution of positional updates. More

Inheritance diagram of PySide6.QtPositioning.QGeoPositionInfoSource

Inherited by: QNmeaPositionInfoSource

Synopsis

Functions

Virtual functions

Static functions

Detailed Description

The static function createDefaultSource() creates a default position source that is appropriate for the platform, if one is available. Otherwise, QGeoPositionInfoSource will check for available plugins that implement the QGeoPositionInfoSourceFactory interface.

Users of a QGeoPositionInfoSource subclass can request the current position using , or start and stop regular position updates using and . When an update is available, is emitted. The last known position can be accessed with .

If regular position updates are required, setUpdateInterval() can be used to specify how often these updates should be emitted. If no interval is specified, updates are simply provided whenever they are available. For example:

// Emit updates every 10 seconds if available
QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(0);
if (source)
    source->setUpdateInterval(10000);

To remove an update interval that was previously set, call setUpdateInterval() with a value of 0.

Note

The position source may have a minimum value requirement for update intervals, as returned by minimumUpdateInterval() .

Note

To use this class from Android service, see Qt Positioning on Android .

class PySide6.QtPositioning.QGeoPositionInfoSource(parent)
Parameters

parentPySide6.QtCore.QObject

Creates a position source with the specified parent.

PySide6.QtPositioning.QGeoPositionInfoSource.Error

The Error enumeration represents the errors which can occur.

Constant

Description

QGeoPositionInfoSource.AccessError

The connection setup to the remote positioning backend failed because the application lacked the required privileges.

QGeoPositionInfoSource.ClosedError

The remote positioning backend closed the connection, which happens for example in case the user is switching location services to off. As soon as the location service is re-enabled regular updates will resume.

QGeoPositionInfoSource.NoError

No error has occurred.

QGeoPositionInfoSource.UnknownSourceError

An unidentified error occurred.

QGeoPositionInfoSource.UpdateTimeoutError

If was called, this error indicates that the current position could not be retrieved within the specified timeout. If was called, this error indicates that this QGeoPositionInfoSource subclass determined that it will not be able to provide further regular updates. In the latter case the error would not be emitted again until after the regular updates resume.

PySide6.QtPositioning.QGeoPositionInfoSource.PositioningMethod

Defines the types of positioning methods.

Constant

Description

QGeoPositionInfoSource.NoPositioningMethods

None of the positioning methods.

QGeoPositionInfoSource.SatellitePositioningMethods

Satellite-based positioning methods such as GPS or GLONASS.

QGeoPositionInfoSource.NonSatellitePositioningMethods

Other positioning methods such as 3GPP cell identifier or WiFi based positioning.

QGeoPositionInfoSource.AllPositioningMethods

Satellite-based positioning methods as soon as available. Otherwise non-satellite based methods.

static PySide6.QtPositioning.QGeoPositionInfoSource.availableSources()
Return type

list of strings

Returns a list of available source plugins. This includes any default backend plugin for the current platform.

PySide6.QtPositioning.QGeoPositionInfoSource.backendProperty(name)
Parameters

name – str

Return type

object

Returns the value of the backend-specific property named name, if present. Otherwise, the returned value will be invalid. Supported backend-specific properties are listed and described in Qt Positioning plugins#Default plugins .

static PySide6.QtPositioning.QGeoPositionInfoSource.createDefaultSource(parameters, parent)
Parameters
Return type

PySide6.QtPositioning.QGeoPositionInfoSource

Creates and returns a position source with the given parent that reads from the system’s default sources of location data, or the plugin with the highest available priority.

Returns nullptr if the system has no default position source, no valid plugins could be found or the user does not have the permission to access the current position.

This method passes parameters to the factory to configure the source.

static PySide6.QtPositioning.QGeoPositionInfoSource.createDefaultSource(parent)
Parameters

parentPySide6.QtCore.QObject

Return type

PySide6.QtPositioning.QGeoPositionInfoSource

Creates and returns a position source with the given parent that reads from the system’s default sources of location data, or the plugin with the highest available priority.

Returns nullptr if the system has no default position source, no valid plugins could be found or the user does not have the permission to access the current position.

static PySide6.QtPositioning.QGeoPositionInfoSource.createSource(sourceName, parent)
Parameters
Return type

PySide6.QtPositioning.QGeoPositionInfoSource

Creates and returns a position source with the given parent, by loading the plugin named sourceName.

Returns nullptr if the plugin cannot be found.

static PySide6.QtPositioning.QGeoPositionInfoSource.createSource(sourceName, parameters, parent)
Parameters
Return type

PySide6.QtPositioning.QGeoPositionInfoSource

Creates and returns a position source with the given parent, by loading the plugin named sourceName.

Returns nullptr if the plugin cannot be found.

This method passes parameters to the factory to configure the source.

PySide6.QtPositioning.QGeoPositionInfoSource.error()
Return type

Error

PySide6.QtPositioning.QGeoPositionInfoSource.errorOccurred(arg__1)
Parameters

arg__1Error

PySide6.QtPositioning.QGeoPositionInfoSource.lastKnownPosition([fromSatellitePositioningMethodsOnly=false])
Parameters

fromSatellitePositioningMethodsOnly – bool

Return type

PySide6.QtPositioning.QGeoPositionInfo

PySide6.QtPositioning.QGeoPositionInfoSource.minimumUpdateInterval()
Return type

int

PySide6.QtPositioning.QGeoPositionInfoSource.positionUpdated(update)
Parameters

updatePySide6.QtPositioning.QGeoPositionInfo

PySide6.QtPositioning.QGeoPositionInfoSource.preferredPositioningMethods()
Return type

PositioningMethods

PySide6.QtPositioning.QGeoPositionInfoSource.requestUpdate([timeout=0])
Parameters

timeout – int

PySide6.QtPositioning.QGeoPositionInfoSource.setBackendProperty(name, value)
Parameters
  • name – str

  • value – object

Return type

bool

Sets the backend-specific property named name to value. Returns true on success, false otherwise. Backend-specific properties can be used to configure the positioning subsystem behavior at runtime. Supported backend-specific properties are listed and described in Qt Positioning plugins#Default plugins .

See also

backendProperty

PySide6.QtPositioning.QGeoPositionInfoSource.setPreferredPositioningMethods(methods)
Parameters

methodsPositioningMethods

PySide6.QtPositioning.QGeoPositionInfoSource.setUpdateInterval(msec)
Parameters

msec – int

See also

updateInterval()

PySide6.QtPositioning.QGeoPositionInfoSource.sourceName()
Return type

str

PySide6.QtPositioning.QGeoPositionInfoSource.startUpdates()
PySide6.QtPositioning.QGeoPositionInfoSource.stopUpdates()
PySide6.QtPositioning.QGeoPositionInfoSource.supportedPositioningMethods()
Return type

PositioningMethods

PySide6.QtPositioning.QGeoPositionInfoSource.supportedPositioningMethodsChanged()
PySide6.QtPositioning.QGeoPositionInfoSource.updateInterval()
Return type

int