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


C++ QUrlQuery函数代码示例

本文整理汇总了C++中QUrlQuery函数的典型用法代码示例。如果您正苦于以下问题:C++ QUrlQuery函数的具体用法?C++ QUrlQuery怎么用?C++ QUrlQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: ClientChannel

/*!
 * Получение канала из URL адреса.
 */
ClientChannel ChatUrls::channel(const QUrl &url)
{
  ClientChannel channel;
  if (url.scheme() != LS("chat") && url.host() != LS("channel"))
    return channel;

  QStringList path = ChatUrls::path(url);
  if (path.isEmpty())
    return channel;

  QByteArray id = SimpleID::decode(path.at(0).toLatin1());
  if (!Channel::isCompatibleId(id))
    return channel;

  channel = ChatClient::channels()->get(id);
  if (channel)
    return channel;

  channel = ClientChannel(new Channel(id, ChatId::fromBase32(QUrlQuery(url).queryItemValue(LS("name")).toLatin1())));
  channel->gender().setRaw(QUrlQuery(url).queryItemValue(LS("gender")).toInt());
  if (!channel->isValid())
    return ClientChannel();

  return channel;
}
开发者ID:johnbolia,项目名称:schat,代码行数:28,代码来源:ChatUrls.cpp

示例2: QUrlQuery

void    Preview::_size()
{
    this->width = QUrlQuery(this->uri).queryItemValue("width").toUInt();
    this->height = QUrlQuery(this->uri).queryItemValue("height").toUInt();
    if (!this->width && !this->height)
    {
        this->width = 100;
        this->height = 75;
    }
    if (this->width > 800)
        this->width = 800;
    if (this->height > 600)
        this->height = 600;
}
开发者ID:nicolas-bertrand,项目名称:lightbird,代码行数:14,代码来源:Preview.cpp

示例3: areaCoordinates

bool CoreDbUrl::areaCoordinates(double* lat1, double* lat2, double* lon1, double* lon2) const
{
    bool ok;
    bool allOk = true;
    *lat1      = QUrlQuery(*this).queryItemValue(QLatin1String("lat1")).toDouble(&ok);
    allOk      = ok && allOk;
    *lat2      = QUrlQuery(*this).queryItemValue(QLatin1String("lat2")).toDouble(&ok);
    allOk      = ok && allOk;
    *lon1      = QUrlQuery(*this).queryItemValue(QLatin1String("lon1")).toDouble(&ok);
    allOk      = ok && allOk;
    *lon2      = QUrlQuery(*this).queryItemValue(QLatin1String("lon2")).toDouble(&ok);
    allOk      = ok && allOk;

    return allOk;
}
开发者ID:swatilodha,项目名称:digikam,代码行数:15,代码来源:coredburl.cpp

示例4: writeAsDxf

  void writeAsDxf( QgsServerInterface *serverIface, const QgsProject *project,
                   const QString &version,  const QgsServerRequest &request,
                   QgsServerResponse &response )
  {
    Q_UNUSED( version );

    QgsServerRequest::Parameters params = request.parameters();

    QgsWmsParameters wmsParameters( QUrlQuery( request.url() ) );
    QgsRenderer renderer( serverIface, project, wmsParameters );

    QMap<QString, QString> formatOptionsMap = parseFormatOptions( params.value( QStringLiteral( "FORMAT_OPTIONS" ) ) );

    QgsDxfExport dxf = renderer.getDxf( formatOptionsMap );

    QString codec = QStringLiteral( "ISO-8859-1" );
    QMap<QString, QString>::const_iterator codecIt = formatOptionsMap.find( QStringLiteral( "CODEC" ) );
    if ( codecIt != formatOptionsMap.constEnd() )
    {
      codec = formatOptionsMap.value( QStringLiteral( "CODEC" ) );
    }

    // Write output
    response.setHeader( "Content-Type", "application/dxf" );
    dxf.writeToFile( response.io(), codec );
  }
开发者ID:anitagraser,项目名称:QGIS,代码行数:26,代码来源:qgsdxfwriter.cpp

示例5: QUrlQuery

void Comments::anchorClicked(const QUrl & url)
{
  if(url.host().isEmpty() && url.path() == "edit")
  {
    #if QT_VERSION >= 0x050000
    int cid = QUrlQuery(url).queryItemValue("id").toInt();
    #else
    int cid = url.queryItemValue("id").toInt();
    #endif
    if(userCanEdit(cid))
    {
      ParameterList params;
      params.append("mode", "edit");
      params.append("sourceType", _sourcetype);
      params.append("source_id", _sourceid);
      params.append("comment_id", cid);
      params.append("commentIDList", _commentIDList);

      comment newdlg(this, "", true);
      newdlg.set(params);
      newdlg.exec();
      refresh();
    }
  }
  else
  {
    QDesktopServices::openUrl(url);
  }
}
开发者ID:ChristopherCotnoir,项目名称:qt-client,代码行数:29,代码来源:comments.cpp

示例6: setEnabled

void AuthForm::url_canged(QUrl url)
{
    if (!isAuthSuccess) {
        setEnabled(true);
        setWindowOpacity(1.0);

        if(!url.toString().contains("access_token"))
        {
            return;
        }

        url = url.toString().replace("#", "?");
        token = QUrlQuery(url).queryItemValue("access_token");

        Settings::access_token = token;
        Settings::Save();
    }
    else
    {
        token = Settings::access_token;
    }

    emit auth_success(token);
    close();
}
开发者ID:Shkaf,项目名称:ed-practice,代码行数:25,代码来源:authform.cpp

示例7: urla

void Utils::testIncludeUrlParams() {
    QUrl urla(QString("http://example.com"));

    QHash<QString, QString> params;
    params.insert("simple", "c");
    params.insert("withspecial", "a?b");
    params.insert("withspace", "a b");
    params.insert("username", "a123fx b");
    params.insert("password", "[email protected]#+-$%^12&*()qweqesaf\"';`~");
    params.insert("withplus", "a+b");

    QUrl urlb = ::includeQueryParams(urla, params);

    QVERIFY(urla.scheme() == urlb.scheme());
    QVERIFY(urla.host() == urlb.host());

    Q_FOREACH (const QString& key, params.keys()) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
        QString encoded_key = QUrl::toPercentEncoding(key);
        QString encoded_value = QUrl::toPercentEncoding(params[encoded_key]);
        QUrlQuery query = QUrlQuery(urlb.query());
        QVERIFY(query.queryItemValue(encoded_key, QUrl::FullyEncoded) == encoded_value);
#else
        QVERIFY(urlb.queryItemValue(key) == params[key]);
#endif
    }
}
开发者ID:Geosparc,项目名称:seafile-client,代码行数:27,代码来源:test_utils.cpp

示例8: QUrlQuery

bool AdBlockManager::addSubscriptionFromUrl(const QUrl &url)
{
    const QList<QPair<QString, QString> > queryItems = QUrlQuery(url).queryItems(QUrl::FullyDecoded);

    QString subscriptionTitle;
    QString subscriptionUrl;

    for (int i = 0; i < queryItems.count(); ++i) {
        QPair<QString, QString> pair = queryItems.at(i);
        if (pair.first == QL1S("location"))
            subscriptionUrl = pair.second;
        else if (pair.first == QL1S("title"))
            subscriptionTitle = pair.second;
    }

    if (subscriptionTitle.isEmpty() || subscriptionUrl.isEmpty())
        return false;

    const QString message = AdBlockManager::tr("Do you want to add <b>%1</b> subscription?").arg(subscriptionTitle);

    QMessageBox::StandardButton result = QMessageBox::question(0, AdBlockManager::tr("AdBlock Subscription"), message, QMessageBox::Yes | QMessageBox::No);
    if (result == QMessageBox::Yes) {
        AdBlockManager::instance()->addSubscription(subscriptionTitle, subscriptionUrl);
        AdBlockManager::instance()->showDialog();
    }

    return true;
}
开发者ID:Martii,项目名称:qupzilla,代码行数:28,代码来源:adblockmanager.cpp

示例9: url

AuthorizationResultPtr OAuth2Response::parseAuthorizeResponse(const String& webAuthenticationResult, CallStatePtr/* callState*/)
{
    Logger::info(Tag(), "parseAuthorizeResponse");
    Logger::hidden(Tag(), "webAuthenticationResult: " + webAuthenticationResult);

    AuthorizationResultPtr parseResult = nullptr;

    QUrl url(webAuthenticationResult.data());
    if (url.hasQuery())
    {
        QUrlQuery query = QUrlQuery(url);
        if( query.hasQueryItem(OAuthConstants::oAuthReservedClaim().Code.data()) )
        {
            parseResult = std::make_shared<AuthorizationResult>(query.queryItemValue(OAuthConstants::oAuthReservedClaim().Code.data()).toStdString());
        }
        else if( query.hasQueryItem(OAuthConstants::oAuthReservedClaim().Error.data()) )
        {
            String error = query.queryItemValue(OAuthConstants::oAuthReservedClaim().Error.data()).toStdString();
            String errorDesc = query.hasQueryItem(OAuthConstants::oAuthReservedClaim().ErrorDescription.data())
                ? query.queryItemValue(OAuthConstants::oAuthReservedClaim().ErrorDescription.data(), QUrl::FullyDecoded).toStdString()
                : "";
            parseResult = std::make_shared<AuthorizationResult>(
                error,
                StringUtils::replaceAll(errorDesc, '+', ' '));
        }
        else
        {
            parseResult = std::make_shared<AuthorizationResult>(
                Constants::rmsauthError().AuthenticationFailed,
                Constants::rmsauthErrorMessage().AuthorizationServerInvalidResponse);
        }
    }

    return parseResult;
}
开发者ID:AzureAD,项目名称:rms-sdk-for-cpp,代码行数:35,代码来源:OAuth2ResponseQt.cpp

示例10: qWarning

bool OpenLocalHelper::openLocalFile(const QUrl &url)
{
    if (url.scheme() != kSeafileProtocolScheme) {
        qWarning("[OpenLocalHelper] unknown scheme %s\n", url.scheme().toUtf8().data());
        return false;
    }

    if (url.host() != kSeafileProtocolHostOpenFile) {
        qWarning("[OpenLocalHelper] unknown command %s\n", url.host().toUtf8().data());
        return false;
    }

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    QUrlQuery url_query = QUrlQuery(url.query());
    QString repo_id = url_query.queryItemValue("repo_id", QUrl::FullyDecoded);
    QString email = url_query.queryItemValue("email", QUrl::FullyDecoded);
    QString path = url_query.queryItemValue("path", QUrl::FullyDecoded);
#else
    QString repo_id = url.queryItemValue("repo_id");
    QString email = url.queryItemValue("email");
    QString path = url.queryItemValue("path");
#endif

    if (repo_id.size() < 36) {
        qWarning("[OpenLocalHelper] invalid repo_id %s\n", repo_id.toUtf8().data());
        return false;
    }

    qDebug("[OpenLocalHelper] open local file: repo %s, path %s\n",
           repo_id.toUtf8().data(), path.toUtf8().data());

    RepoService::instance()->openLocalFile(repo_id, path);

    return true;
}
开发者ID:moobyfr,项目名称:seafile-client,代码行数:35,代码来源:open-local-helper.cpp

示例11: QUrlQuery

QJsonObject festrip_api::user_update(QString password,
                                    QString nickname,
                                    QString twitterId,
                                    QString name,
                                    QString lastname,
                                    QString gender,
                                    QString countryId,
                                    QString cityId,
                                    QString avatar)
{
    QUrlQuery query = QUrlQuery(QUrl(QString(FESTRIP_URL).append("/api/user/")));
    // Fill in query
    query.addQueryItem("query", "update");
    query.addQueryItem("token", token.toString());
    query.addQueryItem("password", password);
    query.addQueryItem("nickname", nickname);
    query.addQueryItem("twitterId", twitterId);
    query.addQueryItem("name", name);
    query.addQueryItem("lastname", lastname);
    query.addQueryItem("gender", gender);
    query.addQueryItem("countryId", countryId);
    query.addQueryItem("cityId", cityId);
    query.addQueryItem("avatar", avatar);
    // Send query to server
     QJsonObject response = send_query(POST, query);
    // Return JSON
    return(response);
}
开发者ID:nachootal,项目名称:sailtrip,代码行数:28,代码来源:festrip_api.cpp

示例12: serviceUrl

  QString serviceUrl( const QgsServerRequest &request, const QgsProject *project )
  {
    QString href;
    if ( project )
    {
      href = QgsServerProjectUtils::wmtsServiceUrl( *project );
    }

    // Build default url
    if ( href.isEmpty() )
    {
      QUrl url = request.originalUrl();

      QgsWmtsParameters params;
      params.load( QUrlQuery( url ) );
      params.remove( QgsServerParameter::REQUEST );
      params.remove( QgsServerParameter::VERSION_SERVICE );
      params.remove( QgsServerParameter::SERVICE );

      url.setQuery( params.urlQuery() );
      href = url.toString();
    }

    return  href;
  }
开发者ID:alexbruy,项目名称:QGIS,代码行数:25,代码来源:qgswmtsutils.cpp

示例13: QFETCH

void tst_QUrlQuery::old_hasQueryItem()
{
    QFETCH(QString, url);
    QFETCH(QString, item);
    QFETCH(bool, trueFalse);

    QCOMPARE(QUrlQuery(url).hasQueryItem(item), trueFalse);
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:8,代码来源:tst_qurlquery.cpp

示例14: QT_VERSION_CHECK

bool UTIL::urlHasQueryItem( const QUrl& url, const QString& key )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
    return QUrlQuery( url ).hasQueryItem( key );
#else
    return url.hasQueryItem( key );
#endif
}
开发者ID:kehugter,项目名称:Yarock,代码行数:8,代码来源:utilities.cpp

示例15: QString

void SettingsDialog::onWebviewLoaded(){
    QUrl url = webView->url();
    if(url.host() == QString("ivle.nus.edu.sg")&&
            url.path() == QString("/api/login/login_result.ashx")&&
            QUrlQuery(url).queryItemValue("r") == QString("0")){
        qDebug()<<"OK!";
        webviewDialog->close();
        emit gottenToken(webView->page()->mainFrame()->toPlainText());
    }
}
开发者ID:Kaikj,项目名称:IVLEDownloader,代码行数:10,代码来源:settingsdialog.cpp


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