QGeoLocation Class

The QGeoLocation class represents basic information about a location. 更多...

頭: #include <QGeoLocation>
CMake: find_package(Qt6 REQUIRED COMPONENTS Positioning)
target_link_libraries(mytarget PRIVATE Qt6::Positioning)
qmake: QT += positioning

公共函數

QGeoLocation ()
QGeoLocation (const QGeoLocation & other )
(從 6.2 起) QGeoLocation (QGeoLocation && other )
~QGeoLocation ()
QGeoAddress address () const
(從 6.2 起) QGeoShape boundingShape () const
QGeoCoordinate coordinate () const
QVariantMap extendedAttributes () const
bool isEmpty () const
void setAddress (const QGeoAddress & address )
(從 6.2 起) void setBoundingShape (const QGeoShape & boundingShape )
void setCoordinate (const QGeoCoordinate & coordinate )
void setExtendedAttributes (const QVariantMap & data )
(從 6.2 起) void swap (QGeoLocation & other )
(從 6.2 起) QGeoLocation & operator= (QGeoLocation && other )
QGeoLocation & operator= (const QGeoLocation & other )
size_t qHash (const QGeoLocation & location , size_t seed = 0)
bool operator!= (const QGeoLocation & lhs , const QGeoLocation & rhs )
bool operator== (const QGeoLocation & lhs , const QGeoLocation & rhs )

詳細描述

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.

成員函數文檔編製

QGeoLocation:: QGeoLocation ()

Constructs an new location object.

QGeoLocation:: QGeoLocation (const QGeoLocation & other )

構造副本為 other

[noexcept, since 6.2] QGeoLocation:: QGeoLocation ( QGeoLocation && other )

Constructs a geo location object by moving from other .

注意: 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.

該函數在 Qt 6.2 引入。

[noexcept] QGeoLocation:: ~QGeoLocation ()

Destroys the location object.

QGeoAddress QGeoLocation:: address () const

Returns the address of the location.

另請參閱 setAddress ().

[since 6.2] QGeoShape QGeoLocation:: boundingShape () const

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.

注意: This method was introduced in Qt6 instead of boundingBox() method. It returns a QGeoShape 而不是 QGeoRectangle 。使用 QGeoShape::boundingGeoRectangle () to obtain a bounding QGeoRectangle for the shape.

該函數在 Qt 6.2 引入。

另請參閱 setBoundingShape ().

QGeoCoordinate QGeoLocation:: coordinate () const

Returns the coordinate of the location.

另請參閱 setCoordinate ().

QVariantMap QGeoLocation:: extendedAttributes () const

Returns the extended attributes associated to this location. Extended attributes are backend-dependent and can be location-dependent.

另請參閱 setExtendedAttributes ().

bool QGeoLocation:: isEmpty () const

返迴 true if the location coordinate is 無效 , and all the other location fields are empty. Otherwise returns false .

void QGeoLocation:: setAddress (const QGeoAddress & address )

設置 address of the location.

另請參閱 address ().

[since 6.2] void QGeoLocation:: setBoundingShape (const QGeoShape & boundingShape )

設置 boundingShape of the location.

該函數在 Qt 6.2 引入。

另請參閱 boundingShape ().

void QGeoLocation:: setCoordinate (const QGeoCoordinate & coordinate )

設置 coordinate of the location.

另請參閱 coordinate ().

void QGeoLocation:: setExtendedAttributes (const QVariantMap & data )

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

另請參閱 extendedAttributes ().

[noexcept, since 6.2] void QGeoLocation:: swap ( QGeoLocation & other )

Swaps this location with other 。此操作很快且從不失敗。

該函數在 Qt 6.2 引入。

[noexcept, since 6.2] QGeoLocation &QGeoLocation:: operator= ( QGeoLocation && other )

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

注意: 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.

該函數在 Qt 6.2 引入。

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

賦值 other to this location and returns a reference to this location.

相關非成員

[noexcept] size_t qHash (const QGeoLocation & location , size_t seed = 0)

返迴哈希值為 location ,使用 seed for the calculation.

注意: 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.

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

返迴 truelhs location is not equal to rhs ,否則返迴 false .

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

返迴 truelhs location is equal to rhs ,否則返迴 false .