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


C++ QUrl::addQueryItem方法代码示例

本文整理汇总了C++中QUrl::addQueryItem方法的典型用法代码示例。如果您正苦于以下问题:C++ QUrl::addQueryItem方法的具体用法?C++ QUrl::addQueryItem怎么用?C++ QUrl::addQueryItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QUrl的用法示例。


在下文中一共展示了QUrl::addQueryItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: doWorkSendRequest

void QueryImages::doWorkSendRequest()
{
    Q_D(QueryImages);

    // Set the url
    QUrl url = d->mediawiki.url();
    url.addQueryItem("format",  "xml");
    url.addQueryItem("action",  "query");
    url.addQueryItem("titles",  d->title);
    url.addQueryItem("prop",    "images");
    url.addQueryItem("imlimit", d->limit);
    if (!d->imcontinue.isNull())
    {
        url.addQueryItem("imcontinue", d->imcontinue);
    }

    // Set the request
    QNetworkRequest request(url);
    request.setRawHeader("User-Agent", d->mediawiki.userAgent().toUtf8());

    // Send the request
    d->reply = d->manager->get(request);
    connectReply();
    connect(d->reply, SIGNAL(finished()),
            this, SLOT(doWorkProcessReply()));
}
开发者ID:rickysarraf,项目名称:digikam,代码行数:26,代码来源:queryimages.cpp

示例2: QNetworkRequest

void
SendLogsRequest::send()
{
    QUrl url;
    url.setScheme( "http" );
    url.setHost( "oops.last.fm" );
    url.setPath( "logsubmission/add" );
    url.addEncodedQueryItem( "username", QUrl::toPercentEncoding(Ws::Username) );
    #ifdef Q_WS_MAC
        url.addQueryItem( "platform", "macosx" );
    #elif defined WIN32
        url.addQueryItem( "platform", "win32" );
    #else
        url.addQueryItem( "platform", "linux" );
    #endif
    url.addQueryItem( "clientname", QCoreApplication::applicationName() );
    url.addQueryItem( "clientversion", QCoreApplication::applicationVersion() );

    QNetworkRequest request = QNetworkRequest( url );
    request.setRawHeader( "Content-Type", "multipart/form-data;boundary=8e61d618ca16" );
    request.setRawHeader( "Accept", "*/*" );

    m_data.append( postData( "usernotes", escapeString( m_usernotes ).toLatin1() ) );
    m_data.append( postData( "logs", m_logs.join(",").toLatin1() ) );
    m_data.append( "--8e61d618ca16--" ); // close the post request
    
    m_error = false;
    QNetworkReply *reply = (new WsAccessManager( this ))->post( request, m_data );
    
    connect( reply, SIGNAL( finished() ),
             this, SLOT( onFinished() ) );
    connect( reply, SIGNAL( error( QNetworkReply::NetworkError ) ),
             this, SLOT( onError( QNetworkReply::NetworkError ) ) );
}
开发者ID:AICIDNN,项目名称:lastfm-desktop,代码行数:34,代码来源:SendLogsRequest.cpp

示例3: getUpdateUrl

QUrl DNSUpdater::getUpdateUrl() const
{
  QUrl url;
#ifdef QT_NO_OPENSSL
  url.setScheme("http");
#else
  url.setScheme("https");
#endif
  url.setUserName(m_username);
  url.setPassword(m_password);

  Q_ASSERT(!m_lastIP.isNull());
  // Service specific
  switch(m_service) {
  case DNS::DYNDNS:
    url.setHost("members.dyndns.org");
    break;
  case DNS::NOIP:
    url.setHost("dynupdate.no-ip.com");
    break;
  default:
    qWarning() << "Unrecognized Dynamic DNS service!";
    Q_ASSERT(0);
  }
  url.setPath("/nic/update");
  url.addQueryItem("hostname", m_domain);
  url.addQueryItem("myip", m_lastIP.toString());
  Q_ASSERT(url.isValid());
  qDebug() << Q_FUNC_INFO << url.toString();
  return url;
}
开发者ID:1blowme,项目名称:qBittorrent,代码行数:31,代码来源:dnsupdater.cpp

示例4: deletePrivateMessage

void PrivateMessageController::deletePrivateMessage(const QString &urlFirstPage) {

    QRegExp catIDRegExp("cat=([0-9prive]+)");
    if(catIDRegExp.indexIn(urlFirstPage) == -1)
        return;

    const QUrl url(DefineConsts::FORUM_URL + "/modo/manageaction.php?config=hfr.inc&cat=" + catIDRegExp.cap(1) + "&type_page=forum1&moderation=0");

    QRegExp postIDRegExp("post=([0-9]+)");
    if(postIDRegExp.indexIn(urlFirstPage) == -1)
        return;

    QNetworkRequest request(url);
    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");

    QUrl params;
    params.addQueryItem("action_reaction", "valid_eff_prive");
    params.addQueryItem("topic1", postIDRegExp.cap(1));
    params.addQueryItem("hash_check", m_HashCheck);

    QNetworkReply* reply = HFRNetworkAccessManager::get()->post(request, params.encodedQuery());
    bool ok = connect(reply, SIGNAL(finished()), this, SLOT(checkMessageDeleted()));
    Q_ASSERT(ok);
    Q_UNUSED(ok);
}
开发者ID:gonztirado,项目名称:HeadlessHFR,代码行数:25,代码来源:PrivateMessageController.cpp

示例5: sendCoins

void Networking::sendCoins(QString address, QString amount)
{
    QString sendRequest;
    sendRequest = QString("https://www.instawallet.org/api/v1/w/%1/payment").arg(walletId);

    updating = true;

    QByteArray data;
    QUrl parameters;

    double convertedAmount;

    long long convertedLongAmount;

    QString stringAmount;

    convertedAmount = amount.toDouble();
    convertedLongAmount = convertedAmount * 1e8 + (convertedAmount < 0.0 ? -.5 : .5);

    stringAmount = QString("%1").arg(convertedLongAmount);

    qDebug("Amount converted to Satoshis: " + stringAmount.toAscii());

    parameters.addQueryItem("address", address);
    parameters.addQueryItem("amount", stringAmount);
    data.append(parameters.toString());
    data.remove(0, 1);

    networkPaymentManager->post(QNetworkRequest(QUrl(sendRequest)), data)->ignoreSslErrors();

    connect(networkPaymentManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(walletPaymentLoaded(QNetworkReply*)));
}
开发者ID:Matoking,项目名称:cuteCoin,代码行数:32,代码来源:Networking.cpp

示例6: login

void STULogin::login(const QString &user, const QString &passwd){

//    qDebug() << "now login " + user + "\t" + passwd;

    logining = true;  // QtNetWorkAccessManager works asynchronously
    this->user_copy = user;
//    qDebug() << this->user;
    this->passwd = passwd;  // record the user info for try again untill MAX_COUNT or login
    if (is_connected){
        wrongCount = 0;
        return;
    }
    requestAddr->setUrl(LOGIN_REQUEST_ADDR);
    QUrl params;
    params.addQueryItem(USERNAME_INPUT,user);
    params.addQueryItem(PASSWD_INPUT,passwd);
    params.addQueryItem(LOGIN_INPUT,"");

    QByteArray postData = params.encodedQuery();
    QNetworkRequest request(*requestAddr);
    request.setHeader(QNetworkRequest::ContentTypeHeader,
                      "application/x-www-form-urlencoded");
    delayForSomeTime(600);
    QNetworkReply *reply = syncHttpPost(request, postData);
    handleReply(reply);
    processStates(replyData);
    emit stateChanged(is_connected,user,used,total,left);
    //qDebug() << replyData;
}
开发者ID:Hjsmallfly,项目名称:stulogin,代码行数:29,代码来源:stulogin.cpp

示例7: Request

	void ServerHistoryManager::Request (int offset)
	{
		const auto nam = Acc_->GetCoreProxy ()->GetNetworkAccessManager ();

		auto getter = [offset, nam, this]
				(const QString& key, const VkConnection::UrlParams_t& params) -> QNetworkReply*
			{
				QUrl url ("https://api.vk.com/method/messages.getDialogs");
				url.addQueryItem ("access_token", key);
				url.addQueryItem ("count", QString::number (DlgChunkCount));
				url.addQueryItem ("offset", QString::number (offset));
				VkConnection::AddParams (url, params);

				LastOffset_ = offset;

				auto reply = nam->get (QNetworkRequest (url));
				connect (reply,
						SIGNAL (finished ()),
						this,
						SLOT (handleGotMessagesList ()));
				return reply;
			};

		Acc_->GetConnection ()->QueueRequest (getter);
	}
开发者ID:mirok0,项目名称:leechcraft,代码行数:25,代码来源:serverhistorymanager.cpp

示例8: invokeFoursquareVenueCard

// The Foursquare invocation calls are based on the sample available here:
// https://github.com/kylefowler/foursquare-bb10-sdk
//
// Launches a native Foursquare venue search in your app.
// This card will call back to your childCardDone slot with the appropriate
// response for the actions taken by the user.
//
// URI Params:
// query: (optional) prime the venue search with a query
// client_id: (required) the client id from your oauth consumer
// client_secret: (required) the client secret from your oauth consumer
// oauth_token: (required if no client_id/client_secret) pass this if you
//              already have an authenticated user token, this way venue
//              search results will be fitted to the user requesting them
//              for a higher quality queryless search
//
// Response:
// When the user selects a venue, you will get the venue information in
// JSON format back through the childCardDone slot in the data object.
// The venue format will match what is listed here in the core venue fields:
// https://developer.foursquare.com/docs/responses/venue
//
// If the user cancels the search without any action: the reason message will be "canceled"
// If any of the parameters are missing you will get a reason message of "invalid_credentials"
void SocialInvocation::invokeFoursquareVenueCard(const QString &venue) {
	InvokeRequest cardRequest;
	cardRequest.setTarget("com.foursquare.blackberry.venuesearch.card");
	cardRequest.setAction("bb.action.VIEW");
	cardRequest.setMimeType("venuesearch/foursquare");

	// The client_id and client_secret are the Foursquare API credentials
	// that you receive when registering your app with Foursquare.
	//
	// You can register your app with Foursquare here:
	// https://foursquare.com/developers/apps
	//
	// For more information on Foursquare API credentials, see here:
	// https://developer.foursquare.com/overview/auth

	QUrl uri = QUrl("foursquare://venues/search");

	// Replace the following values with your app's client ID and secret
	uri.addQueryItem("client_id", "UFVANV2FBBFRPXSBXHCCKECVUDANDKP5KQFKICRCA1VAFV4V");
	uri.addQueryItem("client_secret","11AY4DWL0A2CV1NXPKDMS2PJTEACRZJP0BMFXORNCKBSNVMH");

	uri.addQueryItem("query", venue);
	cardRequest.setUri(uri);

	m_invokeManager->invoke(cardRequest);
}
开发者ID:AnujAroshA,项目名称:Cascades-Samples,代码行数:50,代码来源:SocialInvocation.cpp

示例9: GetVar

QString CetonStreamHandler::GetVar(
    const QString &section, const QString &variable) const
{
    QString loc = LOC + QString("DoGetVar(%1,%2,%3,%4) - ")
        .arg(_ip_address).arg(_tuner).arg(section,variable);

    QUrl params;
    params.addQueryItem("i", QString::number(_tuner));
    params.addQueryItem("s", section);
    params.addQueryItem("v", variable);

    QString response;
    uint status;
    if (!HttpRequest("GET", "/get_var.json", params, response, status))
    {
        LOG(VB_RECORD, LOG_ERR, loc +
            QString("HttpRequest failed - %1").arg(response));
        return QString();
    }

    QRegExp regex("^\\{ \"?result\"?: \"(.*)\" \\}$");
    if (regex.indexIn(response) == -1)
    {
        LOG(VB_RECORD, LOG_ERR, loc +
            QString("unexpected http response: -->%1<--").arg(response));
        return QString();
    }

    QString result = regex.cap(1);
    LOG(VB_RECORD, LOG_DEBUG, loc + QString("got: -->%1<--").arg(result));
    return result;
}
开发者ID:acekiller,项目名称:mythtv,代码行数:32,代码来源:cetonstreamhandler.cpp

示例10: TuneProgram

bool CetonStreamHandler::TuneProgram(uint program)
{
    LOG(VB_RECORD, LOG_INFO, LOC + QString("TuneProgram(%1)").arg(program));

    QStringList program_list = GetProgramList();
    if (!program_list.contains(QString::number(program)))
    {
        LOG(VB_RECORD, LOG_ERR, LOC + 
        QString("TuneProgram(%1) - Requested program not in the program list").arg(program));
        return false;
    };


    _last_program = program;

    QUrl params;
    params.addQueryItem("instance_id", QString::number(_tuner));
    params.addQueryItem("program", QString::number(program));

    QString response;
    uint status;
    bool result = HttpRequest(
        "POST", "/program_request.cgi", params, response, status);

    if (!result)
    {
        LOG(VB_RECORD, LOG_ERR, LOC +
            QString("TuneProgram() - HTTP status = %1 - response = %2")
            .arg(status).arg(response));
    }

    return result;
}
开发者ID:acekiller,项目名称:mythtv,代码行数:33,代码来源:cetonstreamhandler.cpp

示例11: TuneVChannel

bool CetonStreamHandler::TuneVChannel(const QString &vchannel)
{
    if ((vchannel != "0") && (_last_vchannel != "0"))
        ClearProgramNumber();

    LOG(VB_RECORD, LOG_INFO, LOC + QString("TuneVChannel(%1)").arg(vchannel));

    _last_vchannel = vchannel;

    QUrl params;
    params.addQueryItem("instance_id", QString::number(_tuner));
    params.addQueryItem("channel", vchannel);

    QString response;
    uint status;
    bool result = HttpRequest(
        "POST", "/channel_request.cgi", params, response, status);

    if (!result)
    {
        LOG(VB_RECORD, LOG_ERR, LOC +
            QString("TuneVChannel() - HTTP status = %1 - response = %2")
            .arg(status).arg(response));
    }

    return result;
}
开发者ID:acekiller,项目名称:mythtv,代码行数:27,代码来源:cetonstreamhandler.cpp

示例12: sendSocial

 // social
 void sendSocial(QString socialNetwork, QString socialAction, QString socialActionTarget) const {
   QUrl params = build_metric("social");
   params.addQueryItem("sn", socialNetwork);
   params.addQueryItem("sa", socialAction);
   params.addQueryItem("st", socialActionTarget);
   send_metric(params);
 }
开发者ID:pk-codebox-evo,项目名称:remixos-usb-tool,代码行数:8,代码来源:ganalytics.hpp

示例13: PerformTuneVChannel

bool CetonStreamHandler::PerformTuneVChannel(const QString &vchannel)
{
    LOG(VB_RECORD, LOG_INFO, LOC + QString("PerformTuneVChannel(%1)")
        .arg(vchannel));

#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    QUrl params;
#else
    QUrlQuery params;
#endif
    params.addQueryItem("instance_id", QString::number(_tuner));
    params.addQueryItem("channel", vchannel);

    QString response;
    uint status;
    bool result = HttpRequest(
        "POST", "/channel_request.cgi", params, response, status);

    if (!result)
    {
        LOG(VB_GENERAL, LOG_ERR, LOC +
            QString("PerformTuneVChannel() - HTTP status = %1 - response = %2")
            .arg(status).arg(response));
    }

    return result;
}
开发者ID:DaveDaCoda,项目名称:mythtv,代码行数:27,代码来源:cetonstreamhandler.cpp

示例14: checkUserActivated

bool ActivatePage::checkUserActivated(int user_id)
{
    serverQueryFinished = false;
    serverQueryError = false;
    label_message->setText("Logging in...");
    QString url( "https://screencloud.net/1.0/users/check_activated.xml");

    QString token, tokenSecret;

    // create a request parameters map
    QUrl bodyParams;
    bodyParams.addQueryItem("user_id", QString::number(user_id));
    bodyParams.addQueryItem("oauth_version", "1.0");
    bodyParams.addQueryItem("oauth_signature_method", "PLAINTEXT");
    bodyParams.addQueryItem("oauth_consumer_key", CONSUMER_KEY_SCREENCLOUD);
    bodyParams.addQueryItem("oauth_signature", CONSUMER_SECRET_SCREENCLOUD);

    QByteArray body = bodyParams.encodedQuery();

    QNetworkRequest request;
    request.setUrl(QUrl(url));
    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
    manager->post(request, body);
    return true;
}
开发者ID:Nothing4You,项目名称:screencloud,代码行数:25,代码来源:activatepage.cpp

示例15: checkUrl

void SoundCloud::checkUrl(const QUrl &webUrl) {
    QUrl url;

    if (webUrl.hasQueryItem("client_id")) {
        url = webUrl;
        url.setHost("api.soundcloud.com");
    }
    else {
        url.setUrl("http://api.soundcloud.com/resolve.json");
#if QT_VERSION >= 0x050000
        QUrlQuery query(url);
        query.addQueryItem("url", webUrl.toString());
        query.addQueryItem("client_id", CLIENT_ID);
        url.setQuery(query);
#else
        url.addQueryItem("url", webUrl.toString());
        url.addQueryItem("client_id", CLIENT_ID);
#endif
    }

    QNetworkRequest request(url);
    QNetworkReply *reply = this->networkAccessManager()->get(request);
    this->connect(reply, SIGNAL(finished()), this, SLOT(checkUrlIsValid()));
    this->connect(this, SIGNAL(currentOperationCancelled()), reply, SLOT(deleteLater()));
}
开发者ID:marxoft,项目名称:qdl,代码行数:25,代码来源:soundcloud.cpp


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