Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QGeoLocation Class Reference

\inmodule QtPositioning More...

#include <qgeolocation.h>

+ Collaboration diagram for QGeoLocation:

Public Member Functions

 QGeoLocation ()
 Constructs an new location object.
 
 QGeoLocation (const QGeoLocation &other)
 Constructs a copy of other.
 
 QGeoLocation (QGeoLocation &&other) noexcept=default
 
 ~QGeoLocation ()
 Destroys the location object.
 
QGeoLocationoperator= (const QGeoLocation &other)
 Assigns other to this location and returns a reference to this location.
 
void swap (QGeoLocation &other) noexcept
 
QGeoAddress address () const
 Returns the address of the location.
 
void setAddress (const QGeoAddress &address)
 Sets the address of the location.
 
QGeoCoordinate coordinate () const
 Returns the coordinate of the location.
 
void setCoordinate (const QGeoCoordinate &position)
 Sets the coordinate of the location.
 
QGeoShape boundingShape () const
 
void setBoundingShape (const QGeoShape &shape)
 
QVariantMap extendedAttributes () const
 Returns the extended attributes associated to this location.
 
void setExtendedAttributes (const QVariantMap &data)
 Sets the extended attributes of the location with the parameters specified in data.
 
bool isEmpty () const
 Returns true if the location coordinate is \l {QGeoCoordinate::isValid} {invalid}, and all the other location fields are empty.
 

Friends

bool operator== (const QGeoLocation &lhs, const QGeoLocation &rhs)
 Returns true if the lhs location is equal to rhs, otherwise returns false.
 
bool operator!= (const QGeoLocation &lhs, const QGeoLocation &rhs)
 Returns true if the lhs location is not equal to rhs, otherwise returns false.
 

Related Symbols

(Note that these are not member symbols.)

size_t qHash (const QGeoLocation &location, size_t seed) noexcept
 Returns the hash value for the location, using seed for the calculation.
 

Detailed Description

\inmodule QtPositioning

Since
5.2

The QGeoLocation class represents basic information about a location.

A QGeoLocation consists of a coordinate and corresponding address, along with an optional bounding shape, which is the recommended region to be displayed when viewing the location.

Definition at line 19 of file qgeolocation.h.

Constructor & Destructor Documentation

◆ QGeoLocation() [1/3]

QGeoLocation::QGeoLocation ( )

Constructs an new location object.

Definition at line 63 of file qgeolocation.cpp.

◆ QGeoLocation() [2/3]

QGeoLocation::QGeoLocation ( const QGeoLocation & other)

Constructs a copy of other.

Definition at line 71 of file qgeolocation.cpp.

◆ QGeoLocation() [3/3]

QGeoLocation::QGeoLocation ( QGeoLocation && other)
defaultnoexcept
Since
6.2

Constructs a geo location object by moving from other.

Note
The moved-from QGeoLocation object can only be destroyed or assigned to. The effect of calling other functions than the destructor or one of the assignment operators is undefined.

◆ ~QGeoLocation()

QGeoLocation::~QGeoLocation ( )

Destroys the location object.

Definition at line 90 of file qgeolocation.cpp.

Member Function Documentation

◆ address()

QGeoAddress QGeoLocation::address ( ) const

Returns the address of the location.

Definition at line 137 of file qgeolocation.cpp.

◆ boundingShape()

QGeoShape QGeoLocation::boundingShape ( ) const
Since
6.2

Returns a bounding shape which represents the recommended region to display when viewing this location.

For example, a building's location may have a region centered around the building, but the region is large enough to show it's immediate surrounding geographical context.

Note
This method was introduced in Qt6 instead of boundingBox() method. It returns a QGeoShape instead of a QGeoRectangle. Use \l QGeoShape::boundingGeoRectangle() to obtain a bounding QGeoRectangle for the shape.

Definition at line 181 of file qgeolocation.cpp.

◆ coordinate()

QGeoCoordinate QGeoLocation::coordinate ( ) const

Returns the coordinate of the location.

Definition at line 153 of file qgeolocation.cpp.

◆ extendedAttributes()

QVariantMap QGeoLocation::extendedAttributes ( ) const

Returns the extended attributes associated to this location.

Extended attributes are backend-dependent and can be location-dependent.

Since
5.13

Definition at line 202 of file qgeolocation.cpp.

◆ isEmpty()

bool QGeoLocation::isEmpty ( ) const

Returns true if the location coordinate is \l {QGeoCoordinate::isValid} {invalid}, and all the other location fields are empty.

Otherwise returns false.

Definition at line 223 of file qgeolocation.cpp.

◆ operator=()

QGeoLocation & QGeoLocation::operator= ( const QGeoLocation & other)

Assigns other to this location and returns a reference to this location.

Since
6.2

Move-assings other to this location and returns a reference to this location.

Note
The moved-from QGeoLocation object can only be destroyed or assigned to. The effect of calling other functions than the destructor or one of the assignment operators is undefined.

Definition at line 99 of file qgeolocation.cpp.

◆ setAddress()

void QGeoLocation::setAddress ( const QGeoAddress & address)

Sets the address of the location.

Definition at line 145 of file qgeolocation.cpp.

◆ setBoundingShape()

void QGeoLocation::setBoundingShape ( const QGeoShape & boundingShape)
Since
6.2

Sets the boundingShape of the location.

Definition at line 191 of file qgeolocation.cpp.

◆ setCoordinate()

void QGeoLocation::setCoordinate ( const QGeoCoordinate & position)

Sets the coordinate of the location.

Definition at line 161 of file qgeolocation.cpp.

◆ setExtendedAttributes()

void QGeoLocation::setExtendedAttributes ( const QVariantMap & data)

Sets the extended attributes of the location with the parameters specified in data.

Since
5.13

Definition at line 213 of file qgeolocation.cpp.

◆ swap()

void QGeoLocation::swap ( QGeoLocation & other)
inlinenoexcept

Definition at line 30 of file qgeolocation.h.

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const QGeoLocation & lhs,
const QGeoLocation & rhs )
friend

Returns true if the lhs location is not equal to rhs, otherwise returns false.

Definition at line 36 of file qgeolocation.h.

◆ operator==

bool operator== ( const QGeoLocation & lhs,
const QGeoLocation & rhs )
friend

Returns true if the lhs location is equal to rhs, otherwise returns false.

Definition at line 32 of file qgeolocation.h.

◆ qHash()

size_t qHash ( const QGeoLocation & location,
size_t seed )
related

Returns the hash value for the location, using seed for the calculation.

Note
The hash does not take extended attributes into account. This means that two geo location objects that differ only in the extended attributes will provide similar hashes.

Definition at line 243 of file qgeolocation.cpp.


The documentation for this class was generated from the following files: