本文整理汇总了C++中QUrl::removeQueryItem方法的典型用法代码示例。如果您正苦于以下问题:C++ QUrl::removeQueryItem方法的具体用法?C++ QUrl::removeQueryItem怎么用?C++ QUrl::removeQueryItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QUrl
的用法示例。
在下文中一共展示了QUrl::removeQueryItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: redirectUrl
QUrl DownloadManager::redirectUrl(const QUrl& url) const
{
QUrl redirectUrl = url;
if (url.host() == QLatin1String("www.dropbox.com")) {
#if QT_VERSION >= 0x050000
QUrlQuery urlQuery(url);
QList< QPair<QString, QString> > query = urlQuery.queryItems();
for (QList< QPair<QString, QString> >::iterator it = query.begin(); it != query.end(); ++it) {
if (it->first == QLatin1String("dl")) {
if (it->second == QLatin1String("0\r\n")) {
urlQuery.removeQueryItem(QLatin1String("dl"));
urlQuery.addQueryItem(QLatin1String("dl"), QLatin1String("1\r\n"));
}
else if (it->second == QLatin1String("0")) {
urlQuery.removeQueryItem(QLatin1String("dl"));
urlQuery.addQueryItem(QLatin1String("dl"), QLatin1String("1"));
}
break;
}
}
redirectUrl.setQuery(urlQuery);
#else
QList< QPair<QString, QString> > query = url.queryItems();
for (QList< QPair<QString, QString> >::iterator it = query.begin(); it != query.end(); ++it) {
if (it->first == QLatin1String("dl")) {
if (it->second == QLatin1String("0\r\n")) {
redirectUrl.removeQueryItem(QLatin1String("dl"));
redirectUrl.addQueryItem(QLatin1String("dl"), QLatin1String("1\r\n"));
}
else if (it->second == QLatin1String("0")) {
redirectUrl.removeQueryItem(QLatin1String("dl"));
redirectUrl.addQueryItem(QLatin1String("dl"), QLatin1String("1"));
}
break;
}
}
#endif
}
else {
// When the url comes from drag and drop it may end with CR+LF. This may cause problems
// and thus should be removed.
QString str = redirectUrl.toString();
if (str.endsWith(QLatin1String("\r\n"))) {
str.chop(2);
redirectUrl.setUrl(str);
}
}
return redirectUrl;
}
示例2: removeQueryItem
int Url::removeQueryItem ( lua_State * L )// ( const QString & key )
{
QUrl* lhs = ValueInstaller2<QUrl>::check( L, 1 );
//QString* key = ValueInstaller2<QString>::check( L, 2 );
lhs->removeQueryItem( Util::toString( L, 2 ) );
return 0;
}
示例3: openLink
void BrowserFrame::openLink(QUrl url, QString title) {
// Set utm params
url.removeQueryItem("utm_source");
url.removeQueryItem("utm_medium");
url.removeQueryItem("utm_term");
url.removeQueryItem("utm_content");
url.removeQueryItem("utm_campaign");
url.addQueryItem("utm_source", "webpedia");
url.addQueryItem("utm_medium", "reader");
QWebView *browser = new QWebView(this);
browser->setUrl(url);
connect(browser, SIGNAL(loadFinished(bool)), SLOT(browserLoaded(bool)));
addTab(browser, title);
setCurrentIndex(count()-1);
}
示例4: loginUrlRequestCompleted
void NetFlixAuthProxy::loginUrlRequestCompleted(int retCode, QString body)
{
qDebug() << "temp token completed!!";
qDebug() << retCode;
qDebug() << body;
QUrl parser;
parser.setEncodedQuery(body.toUtf8());
QString url = parser.queryItemValue(STR(NETFLIX_LOGIN_URL_PARAM));
parser.removeQueryItem(STR(NETFLIX_LOGIN_URL_PARAM));
QString token = parser.queryItemValue(STR(OAUTH_TOKEN));
QString token_secret = parser.queryItemValue(STR(OAUTH_TOKEN_SECRET));
parser.removeQueryItem(STR(OAUTH_TOKEN_SECRET));
settings->setOAuthToken(token);
settings->setOAuthTokenSecret(token_secret);
QUrl loginUrl = QUrl(url);
loginUrl.setEncodedQueryItems(parser.encodedQueryItems());
qDebug() << loginUrl.toEncoded();
emit getTokenUrlSucceeded(loginUrl);
}
示例5: removeQueryItem
void QUrlProto::removeQueryItem(const QString &key)
{
QUrl *item = qscriptvalue_cast<QUrl*>(thisObject());
if (item)
item->removeQueryItem(key);
}