コード例 #1
0
QGeoSearchReply* QGeoSearchManagerEngineCm::search(QString requestString,
                                                    QGeoBoundingArea *bounds,
                                                    int limit,
                                                    int offset)
{
    QNetworkRequest netRequest = QNetworkRequest(QUrl(requestString));

    QString ua = QFileInfo(QApplication::applicationFilePath()).fileName();
    ua.remove(QChar('"'), Qt::CaseInsensitive);
    ua += " (Qt";
    ua += qVersion();
    ua += " QtMobility 1.1 ) cm GeoSearchManager";
    netRequest.setRawHeader("User-Agent", ua.toAscii());

	DBG_CM(SEARCH_M, INFO_L, "netRequest" << netRequest.url().toString() );
	DBG_CM(SEARCH_M, INFO_L, "netRequest (URL encoded)" << netRequest.url().toEncoded() );

    QNetworkReply *networkReply = m_networkManager->get(netRequest);

    QGeoSearchReplyCm *reply = new QGeoSearchReplyCm(networkReply, limit, offset, bounds, this);

    connect(reply,
            SIGNAL(finished()),
            this,
            SLOT(placesFinished()));

    connect(reply,
            SIGNAL(error(QGeoSearchReply::Error, QString)),
            this,
            SLOT(placesError(QGeoSearchReply::Error, QString)));

    return reply;
}
コード例 #2
0
QGeoSearchReply* QGeoSearchManagerEngineNokia::search(QString requestString,
        QGeoBoundingArea *bounds,
        int limit,
        int offset)
{
    QNetworkReply *networkReply = m_networkManager->get(QNetworkRequest(QUrl(requestString)));
    QGeoSearchReplyNokia *reply = new QGeoSearchReplyNokia(networkReply, limit, offset, bounds, this);

    connect(reply,
            SIGNAL(finished()),
            this,
            SLOT(placesFinished()));

    connect(reply,
            SIGNAL(error(QGeoSearchReply::Error, QString)),
            this,
            SLOT(placesError(QGeoSearchReply::Error, QString)));

    return reply;
}