Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qdeclarativegeolocation.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
7
53
54{
56}
57
60{
62}
63
65{
66}
67
78{
79 if (m_address && m_address->parent() == this) {
80 m_address->setAddress(src.address());
81 } else if (!m_address || m_address->parent() != this) {
82 m_address.setValue(new QDeclarativeGeoAddress(src.address(), this));
83 m_address.notify();
84 }
85
86 setCoordinate(src.coordinate());
87 setBoundingShape(src.boundingShape());
88 setExtendedAttributes(src.extendedAttributes());
89}
90
92{
93 QGeoLocation retValue;
94 retValue.setAddress(m_address ? m_address->address() : QGeoAddress());
95 retValue.setCoordinate(m_coordinate);
96 retValue.setBoundingShape(m_boundingShape);
97 retValue.setExtendedAttributes(m_extendedAttributes);
98 return retValue;
99}
100
107{
108 m_address.removeBindingUnlessInWrapper();
109 if (m_address == address)
110 return;
111
112 // implicitly deleting m_address.value() will force the QML bindings to
113 // be reevaluated by the QML engine. So we defer the deletion of the old
114 // address until a new value is assigned to the m_address.
115 QDeclarativeGeoAddress *oldAddress = nullptr;
116 if (m_address && m_address->parent() == this)
117 oldAddress = m_address.value();
118
119 m_address.setValueBypassingBindings(address);
120 m_address.notify();
121 delete oldAddress;
122}
123
125{
126 return QBindable<QDeclarativeGeoAddress *>(&m_address);
127}
128
130{
131 return m_address;
132}
133
143{
144 m_coordinate = coordinate;
145}
146
148{
149 return QBindable<QGeoCoordinate>(&m_coordinate);
150}
151
153{
154 return m_coordinate;
155}
156
181{
182 m_boundingShape = boundingShape;
183}
184
186{
187 return QBindable<QGeoShape>(&m_boundingShape);
188}
189
191{
192 return m_extendedAttributes;
193}
194
196{
197 m_extendedAttributes = attributes;
198}
199
201{
202 return QBindable<QVariantMap>(&m_extendedAttributes);
203}
204
206{
207 return m_boundingShape;
208}
209
211
212#include "moc_qdeclarativegeolocation_p.cpp"
\inmodule QtCore
Definition qproperty.h:809
void setBoundingShape(const QGeoShape &boundingShape)
void setExtendedAttributes(const QVariantMap &attributes)
QBindable< QGeoCoordinate > bindableCoordinate()
QBindable< QDeclarativeGeoAddress * > bindableAddress()
QDeclarativeGeoLocation(QObject *parent=0)
\qmltype Location \inqmlmodule QtPositioning
QBindable< QVariantMap > bindableExtendedAttributes()
QBindable< QGeoShape > bindableBoundingShape()
void setAddress(QDeclarativeGeoAddress *address)
\qmlproperty Address QtPositioning::Location::address
QDeclarativeGeoAddress * address
void setLocation(const QGeoLocation &src)
\qmlproperty QGeoLocation QtPositioning::Location::location
void setCoordinate(const QGeoCoordinate coordinate)
\qmlproperty coordinate QtPositioning::Location::coordinate
\inmodule QtPositioning
Definition qgeoaddress.h:18
\inmodule QtPositioning
\inmodule QtPositioning
void setExtendedAttributes(const QVariantMap &data)
Sets the extended attributes of the location with the parameters specified in data.
void setCoordinate(const QGeoCoordinate &position)
Sets the coordinate of the location.
void setAddress(const QGeoAddress &address)
Sets the address of the location.
void setBoundingShape(const QGeoShape &shape)
\inmodule QtPositioning
Definition qgeoshape.h:17
\inmodule QtCore
Definition qobject.h:90
Combined button and popup list for selecting options.
GLenum src
GLuint GLuint64EXT address
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent