本文整理汇总了C++中QUrlQuery函数的典型用法代码示例。如果您正苦于以下问题:C++ QUrlQuery函数的具体用法?C++ QUrlQuery怎么用?C++ QUrlQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QUrlQuery函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: QUrlQuery
void OAuth::check_URL(QUrl url)
{
url = url.toString().replace("#","?"); // т.к https://vk.com#token=13123123dsgfdgjsdklgj464624244242&id=dasd
this->token = QUrlQuery(url).queryItemValue("access_token");
this->user_id = QUrlQuery(url).queryItemValue("user_id");
if(this->token.isEmpty())
{
qDebug() <<"Error get token(check_URL)";
return;
}
audioManager->setAudioCount(this->requestManager->audioCount(this->getUserId(),this->getToken()));
emit oauthSuccess();
}
开发者ID:smyrf95,项目名称:VkAudioDownloader-Qt-C-,代码行数:19,代码来源:oauth.cpp
示例17: QObject
Responder::Responder(QHttpRequest *req, QHttpResponse *resp, QObject *parent) : QObject(parent)
{
m_req = req;
connect(req, SIGNAL(end()), resp, SLOT(end()));
connect(resp, SIGNAL(done()), this, SLOT(deleteLater()));
bool flag = false;
QString ext;
QByteArray blob;
QString fName = req->path();
if(fName.isEmpty()||(fName=="/")) fName = "index.html";
fName = QApplication::applicationDirPath() +"/html/" + fName;
QString reqBody = QUrlQuery(req->url()).queryItemValue("ob");
if(QFile::exists(fName)) {
QFile file(fName);
QFileInfo fInfo(file);
QRegExp extExpr("^.*\\.([^\\.]+)$");
if(extExpr.indexIn(fInfo.fileName())!=-1) {
ext = extExpr.cap(1);
}
if(file.open(QIODevice::ReadOnly)) {
blob = file.readAll();
flag = true;
file.close();
}
}else if(!reqBody.isEmpty()){
fName = req->url().fileName();
if(fName=="din.txt") {
blob = DynReqManager::getData(fName,reqBody).toUtf8();
flag = true;
}else if(fName=="ain.txt") {
blob = DynReqManager::getData(fName,reqBody).toUtf8();
flag = true;
}else if(fName=="message.txt") {
blob = DynReqManager::getData(fName,reqBody).toUtf8();
flag = true;
}else if(fName=="status.txt") {
blob = DynReqManager::getData(fName,reqBody).toUtf8();
flag = true;
}
}
if(flag) {
if(ext=="css") resp->setHeader("Content-Type", "text/css");
else if(ext=="js") resp->setHeader("Content-Type", "text/javascript");
else if(ext=="png") resp->setHeader("Content-Type", "image/png");
else resp->setHeader("Content-Type", "text/html");
resp->writeHead(200);
resp->write(blob);
}else {
resp->writeHead(403);
resp->write(QByteArray("File not found!"));
}
}
开发者ID:atikbif,项目名称:webDispatcher,代码行数:55,代码来源:responder.cpp
示例18: Q_ASSERT
QUrlQuery CommandManager::forgeQuery(const QString &path, const QString &postfix)
{
Q_ASSERT(path.length() > 0 && path[0] == '/');
QString postfixsep = "";
if (!postfix.isEmpty() && path[path.length() - 1] != '/')
postfixsep = "/";
return QUrlQuery(QString("%1%2%3%4").arg(websiteUrl).arg(path).arg(postfixsep).arg(postfix.isEmpty() ? "" : postfix + ".json"));
}
开发者ID:Guid75,项目名称:showdevant,代码行数:11,代码来源:commandmanager.cpp
示例19: httpMethod
/**
* @brief Create an AWS V4 Signature canonical request.
*
* @param[in] operation The HTTP method being used for the request.
* @param[in] request The network request to generate a canonical request for.
* @param[in] payload Optional data being submitted in the request (eg for `PUT` and `POST` operations).
* @param[out] signedHeaders A semi-colon separated list of the names of all headers
* included in the result.
*
* @return An AWS V4 Signature canonical request.
*
* @see http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html
*/
QByteArray AwsSignatureV4Private::canonicalRequest(const QNetworkAccessManager::Operation operation,
const QNetworkRequest &request, const QByteArray &payload,
QByteArray * const signedHeaders) const
{
return httpMethod(operation).toUtf8() + '\n' +
canonicalPath(request.url()).toUtf8() + '\n' +
canonicalQuery(QUrlQuery(request.url())) + '\n' +
canonicalHeaders(request, signedHeaders) + '\n' +
*signedHeaders + '\n' +
QCryptographicHash::hash(payload, hashAlgorithm).toHex();
}
开发者ID:gitter-badger,项目名称:libqtaws,代码行数:24,代码来源:awssignaturev4.cpp
示例20: QUrlQuery
void StackOverflowAuth::tokenReady()
{
OAUTH_PREPARE_REPLY
const QByteArray token = QUrlQuery(QUrl(LC('?') + raw)).queryItemValue(LS("access_token")).toUtf8();
log(NodeLog::InfoLevel, "Token is successfully received");
QNetworkRequest request(QUrl(LS("https://api.stackexchange.com/2.1/me?order=desc&sort=reputation&site=stackoverflow&access_token=") + token + LS("&key=") + m_provider->publicKey));
QNetworkReply *reply = m_manager->get(request);
connect(reply, SIGNAL(finished()), SLOT(dataReady()));
}
开发者ID:johnbolia,项目名称:schat,代码行数:11,代码来源:StackOverflowAuth.cpp
注:本文中的QUrlQuery函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论