本文整理汇总了C++中positionUpdated函数的典型用法代码示例。如果您正苦于以下问题:C++ positionUpdated函数的具体用法?C++ positionUpdated怎么用?C++ positionUpdated使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了positionUpdated函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QObject
androidGps::androidGps(QObject *parent) : QObject(parent)
{
QGeoPositionInfoSource *source1 = QGeoPositionInfoSource::createDefaultSource(0);
connect(source1, SIGNAL(positionUpdated(QGeoPositionInfo)),
this, SLOT(positionUpdated(QGeoPositionInfo)));
connect(source1, SIGNAL(error(QGeoPositionInfoSource::Error)),
this, SLOT(error(QGeoPositionInfoSource::Error)));
if (source1) {
source1->setUpdateInterval(1000);
source1->startUpdates();
qDebug() << "Gps1 status: " << source1->sourceName();
}
QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createDefaultSource(0);
if (source)
{
source->setUpdateInterval(1000);
source->startUpdates();
}
connect(source, SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
qDebug() << source->sourceName() << "Source name";
}
示例2: connect
void GpsPosition::startGps()
{
if (_location){
connect(_location, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo)));
_location->startUpdates();
}
}
示例3: SIGNAL
void GPSWidget::startGPS()
{
// Obtain the location data source if it is not obtained already
if (!locationDataSource)
{
locationDataSource =
QGeoPositionInfoSource::createDefaultSource(this);//this
if (locationDataSource)
{
// Whenever the location data source signals that the current
// position is updated, the positionUpdated function is called.
QObject::connect(locationDataSource,
SIGNAL(positionUpdated(QGeoPositionInfo)),
this,
SLOT(positionUpdated(QGeoPositionInfo)));
// Start listening for position updates
locationDataSource->startUpdates();
} else {
// Not able to obtain the location data source
// TODO: Error handling
}
} else {
// Start listening for position updates
locationDataSource->startUpdates();
}
qWarning("startujemy z GPS updates");
}
示例4: QObject
TrackRecorder::TrackRecorder(QObject *parent) :
QObject(parent)
{
qDebug()<<"TrackRecorder constructor";
m_distance = 0.0;
m_accuracy = -1;
m_tracking = false;
m_isEmpty = true;
m_applicationActive = true;
m_autoSavePosition = 0;
// Load autosaved track if left from previous session
loadAutoSave();
// Setup periodic autosave
m_autoSaveTimer.setInterval(60000);
connect(&m_autoSaveTimer, SIGNAL(timeout()), this, SLOT(autoSave()));
m_autoSaveTimer.start();
m_posSrc = QGeoPositionInfoSource::createDefaultSource(0);
if (m_posSrc) {
m_posSrc->setUpdateInterval(1000);
connect(m_posSrc, SIGNAL(positionUpdated(QGeoPositionInfo)),
this, SLOT(positionUpdated(QGeoPositionInfo)));
connect(m_posSrc, SIGNAL(error(QGeoPositionInfoSource::Error)),
this, SLOT(positioningError(QGeoPositionInfoSource::Error)));
// Position updates are started/stopped in setIsTracking(...)
} else {
qDebug()<<"Failed initializing PositionInfoSource!";
}
}
示例5: QgsDebugMsg
void QgsQtLocationConnection::startGPS()
{
QgsDebugMsg( "Starting GPS QtLocation connection" );
// Obtain the location data source if it is not obtained already
if ( !locationDataSource )
{
locationDataSource = QGeoPositionInfoSource::createDefaultSource( this );
if ( locationDataSource )
{
locationDataSource->setPreferredPositioningMethods( QGeoPositionInfoSource::SatellitePositioningMethods ); //QGeoPositionInfoSource::AllPositioningMethods
locationDataSource->setUpdateInterval(1000);
// Whenever the location data source signals that the current
// position is updated, the positionUpdated function is called.
QObject::connect( locationDataSource,
SIGNAL( positionUpdated( QGeoPositionInfo ) ),
this,
SLOT( positionUpdated( QGeoPositionInfo ) ) );
// Start listening for position updates
locationDataSource->startUpdates();
}
else
{
// Not able to obtain the location data source
QgsDebugMsg( "No QtLocation Position Source" );
}
}
else
{
// Start listening for position updates
locationDataSource->startUpdates();
}
}
示例6: disconnect
void LocationWatcher::disable()
{
if (source) {
source->stopUpdates();
disconnect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
this, SLOT(positionUpdated(QGeoPositionInfo)));
}
}
示例7: connect
void LocationWatcher::enable()
{
if (getSetting("active")=="1"){
if (source) {
connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),this, SLOT(positionUpdated(QGeoPositionInfo)));
source->startUpdates();
}
}
}
示例8: QMainWindow
ClientApplication::ClientApplication(QWidget *parent)
: QMainWindow(parent)
{
textEdit = new QTextEdit;
setCentralWidget(textEdit);
LogFilePositionSource *source = new LogFilePositionSource(this);
connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
this, SLOT(positionUpdated(QGeoPositionInfo)));
source->startUpdates();
}
示例9: connect
void GeolocationClientQt::startUpdating()
{
if (!m_location && (m_location = QGeoPositionInfoSource::createDefaultSource(this)))
connect(m_location, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo)));
if (!m_location) {
WebCore::Page* page = QWebPagePrivate::core(m_page);
RefPtr<WebCore::GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, failedToStartServiceErrorMessage);
page->geolocationController()->errorOccurred(error.get());
return;
}
m_location->startUpdates();
}
示例10: QGeoAreaMonitor
QTM_BEGIN_NAMESPACE
#define UPDATE_INTERVAL_5S 5000
QGeoAreaMonitorPolling::QGeoAreaMonitorPolling(QObject *parent) : QGeoAreaMonitor(parent)
{
insideArea = false;
location = QGeoPositionInfoSource::createDefaultSource(this);
if (location) {
location->setUpdateInterval(UPDATE_INTERVAL_5S);
connect(location, SIGNAL(positionUpdated(QGeoPositionInfo)),
this, SLOT(positionUpdated(QGeoPositionInfo)));
}
}
示例11: source
void tst_QNmeaPositionInfoSource::requestUpdate_after_start()
{
QNmeaPositionInfoSource source(m_mode);
QNmeaPositionInfoSourceProxyFactory factory;
QNmeaPositionInfoSourceProxy *proxy = static_cast<QNmeaPositionInfoSourceProxy*>(factory.createProxy(&source));
QSignalSpy spyUpdate(proxy->source(), SIGNAL(positionUpdated(QGeoPositionInfo)));
QSignalSpy spyTimeout(proxy->source(), SIGNAL(updateTimeout()));
// Start updates with 500ms interval and requestUpdate() with 100ms
// timeout. Feed an update, and it should be emitted immediately due to
// the requestUpdate(). The update should not be emitted again after that
// (i.e. the startUpdates() interval should not cause it to be re-emitted).
QDateTime dt = QDateTime::currentDateTime().toUTC();
proxy->source()->setUpdateInterval(500);
proxy->source()->startUpdates();
proxy->source()->requestUpdate(100);
proxy->feedUpdate(dt);
QTRY_COMPARE(spyUpdate.count(), 1);
QCOMPARE(spyUpdate[0][0].value<QGeoPositionInfo>().timestamp(), dt);
QCOMPARE(spyTimeout.count(), 0);
spyUpdate.clear();
// Update has been emitted for requestUpdate(), shouldn't be emitted for startUpdates()
QTRY_COMPARE_WITH_TIMEOUT(spyUpdate.count(), 0, 1000);
}
示例12: positionUpdated
void QGeoPositionInfoSourceAndroid::updateTimeoutElapsed()
{
QGeoPositionInfo position;
position=m_lastUpdate;
if (position.isValid())
{
if (m_positionInfoState & QGeoPositionInfoSourceAndroid::RequestActive)
{
m_requestTimer->stop();
m_positionInfoState &= ~QGeoPositionInfoSourceAndroid::RequestActive;
if (m_positionInfoState & QGeoPositionInfoSourceAndroid::Stopped
||!(m_positionInfoState & QGeoPositionInfoSourceAndroid::StartUpdateActive))
{
QtLocationJni::disableUpdates(this);
}
}
emit positionUpdated(position);
}
else
{
emit updateTimeout();
}
activateTimer();
}
示例13: connect
//! [2]
void AppModel::networkSessionOpened()
{
d->src = QGeoPositionInfoSource::createDefaultSource(this);
if (d->src) {
d->useGps = true;
connect(d->src, SIGNAL(positionUpdated(QGeoPositionInfo)),
this, SLOT(positionUpdated(QGeoPositionInfo)));
d->src->startUpdates();
} else {
d->useGps = false;
d->city = "Brisbane";
emit cityChanged();
this->refreshWeather();
}
}
示例14: coordinate
/*
This is _only_ called when QGeoPositionInfoValidator::valid() returns true for the position.
This means that it is implied that:
- (data.dwValidFields & GPS_VALID_LATITUDE) != 0
- (data.dwValidFields & GPS_VALID_LONGITUDE) != 0
- (data.dwValidFields & GPS_VALID_UTC_TIME) != 0
This guarantees that the newly created position will be valid.
If the code is changed such that this is no longer guaranteed then this method will need to be
updated to test for those conditions.
*/
void QGeoPositionInfoSourceWinCE::dataUpdated(GPS_POSITION data)
{
QGeoCoordinate coordinate(data.dblLatitude, data.dblLongitude);
// The altitude is optional in QGeoCoordinate, so we do not strictly require that the
// GPS_POSITION structure has valid altitude data in order to trigger an update.
if ((data.dwValidFields & GPS_VALID_ALTITUDE_WRT_SEA_LEVEL) != 0)
coordinate.setAltitude(data.flAltitudeWRTSeaLevel);
QDate date(data.stUTCTime.wYear, data.stUTCTime.wMonth, data.stUTCTime.wDay);
QTime time(data.stUTCTime.wHour, data.stUTCTime.wMinute, data.stUTCTime.wSecond,
data.stUTCTime.wMilliseconds);
QDateTime dateTime(date, time, Qt::UTC);
QGeoPositionInfo pos(coordinate, dateTime);
// The following properties are optional, and so are set if the data is present and valid in
// the GPS_POSITION structure.
if ((data.dwValidFields & GPS_VALID_SPEED) != 0)
pos.setAttribute(QGeoPositionInfo::GroundSpeed, data.flSpeed);
if ((data.dwValidFields & GPS_VALID_HEADING) != 0)
pos.setAttribute(QGeoPositionInfo::Direction, data.flHeading);
if ((data.dwValidFields & GPS_VALID_MAGNETIC_VARIATION) != 0)
pos.setAttribute(QGeoPositionInfo::MagneticVariation, data.dblMagneticVariation);
lastPosition = pos;
emit positionUpdated(pos);
}
示例15: positionUpdated
void QGeoPositionInfoSourceAndroid::processPositionUpdate(const QGeoPositionInfo &pInfo)
{
//single update request and served as part of regular update
if (m_requestTimer.isActive())
m_requestTimer.stop();
emit positionUpdated(pInfo);
}