本文整理汇总了C++中QUrl::setAuthority方法的典型用法代码示例。如果您正苦于以下问题:C++ QUrl::setAuthority方法的具体用法?C++ QUrl::setAuthority怎么用?C++ QUrl::setAuthority使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QUrl
的用法示例。
在下文中一共展示了QUrl::setAuthority方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setAuthority
int Url::setAuthority ( lua_State * L )// ( const QString & authority )
{
QUrl* lhs = ValueInstaller2<QUrl>::check( L, 1 );
//QString* authority = ValueInstaller2<QString>::check( L, 2 );
lhs->setAuthority( Util::toString( L, 2 ) );
return 0;
}
示例2: linkClickedFinished
void SidebarPrivate::linkClickedFinished()
{
QNetworkReply * reply = static_cast< QNetworkReply * >(sender());
QString target = reply->property("__target").toString();
QVariant redirectsVariant = reply->property("__redirects");
int redirects = redirectsVariant.isNull() ? 20 : redirectsVariant.toInt();
// Redirect?
QUrl redirectedUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
if (redirectedUrl.isValid())
{
if (redirectedUrl.isRelative())
{
QUrl oldUrl = reply->url();
redirectedUrl.setScheme(oldUrl.scheme());
redirectedUrl.setAuthority(oldUrl.authority());
}
if (redirects > 0)
{
QNetworkRequest request = reply->request();
request.setUrl(redirectedUrl);
QNetworkReply * reply = networkAccessManager()->get(request);
reply->setProperty("__target", target);
connect(reply, SIGNAL(finished()), this, SLOT(linkClickedFinished()));
}
else
{
// TOO MANY REDIRECTS
}
reply->deleteLater();
return;
}
// Check headers... if PDF then launch a new window, otherwise give it to the OS
QString contentType(reply->header(QNetworkRequest::ContentTypeHeader).toString());
if (contentType.contains("application/pdf")) {
emit urlRequested(reply->request().url(), "tab");
} else {
QUrl href(reply->request().url());
if (href.isValid()) {
if (href.scheme() == "http" || href.scheme() == "https") {
if (target == "sidebar") {
webView->setUrl(href);
slideLayout->push("web");
return;
}
}
QDesktopServices::openUrl(href);
}
// FIXME error
}
reply->deleteLater();
}
示例3: buildQUrl
QUrl QHelpDBReader::buildQUrl(const QString &ns, const QString &folder,
const QString &relFileName, const QString &anchor) const
{
QUrl url;
url.setScheme(QLatin1String("qthelp"));
url.setAuthority(ns);
url.setPath(QLatin1Char('/') + folder + QLatin1Char('/') + relFileName);
url.setFragment(anchor);
return url;
}
示例4: setAuthority
void QUrlProto::setAuthority(const QString &authority)
{
QUrl *item = qscriptvalue_cast<QUrl*>(thisObject());
if (item)
item->setAuthority(authority);
}