当前位置: 首页>>代码示例>>C++>>正文


C++ positionUpdated函数代码示例

本文整理汇总了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";

}
开发者ID:geirwanvik,项目名称:WDrov,代码行数:32,代码来源:androidgps.cpp

示例2: connect

void GpsPosition::startGps()
{
    if (_location){
        connect(_location, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo)));
        _location->startUpdates();
    }
}
开发者ID:AnadoluPanteri,项目名称:meecast,代码行数:7,代码来源:gpsposition.cpp

示例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");

}
开发者ID:Hrehory,项目名称:EnigameQt,代码行数:28,代码来源:gpswidget.cpp

示例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!";
    }
}
开发者ID:juiceme,项目名称:rena,代码行数:31,代码来源:trackrecorder.cpp

示例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();
    }
}
开发者ID:sebastiangz,项目名称:Quantum-GIS,代码行数:32,代码来源:qgsqtlocationconnection.cpp

示例6: disconnect

void LocationWatcher::disable()
{
    if (source) {
        source->stopUpdates();
        disconnect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
                   this, SLOT(positionUpdated(QGeoPositionInfo)));
    }
}
开发者ID:qwazix,项目名称:oobProfile,代码行数:8,代码来源:locationwatcher.cpp

示例7: connect

void LocationWatcher::enable()
{
    if (getSetting("active")=="1"){
        if (source) {
            connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),this, SLOT(positionUpdated(QGeoPositionInfo)));
            source->startUpdates();
        }
    }
}
开发者ID:qwazix,项目名称:oobProfile,代码行数:9,代码来源:locationwatcher.cpp

示例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();
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:12,代码来源:clientapplication.cpp

示例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();
}
开发者ID:wpbest,项目名称:copperspice,代码行数:14,代码来源:GeolocationClientQt.cpp

示例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)));
    }
}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:14,代码来源:qgeoareamonitor_polling.cpp

示例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);
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:27,代码来源:tst_qnmeapositioninfosource.cpp

示例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();
}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:27,代码来源:qgeopositioninfosource_android.cpp

示例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();
    }
}
开发者ID:amccarthy,项目名称:qtlocation,代码行数:17,代码来源:appmodel.cpp

示例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);
}
开发者ID:robclark,项目名称:qtmobility-1.1.0,代码行数:42,代码来源:qgeopositioninfosource_wince.cpp

示例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);
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:8,代码来源:qgeopositioninfosource_android.cpp


注:本文中的positionUpdated函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。