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


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

本文整理汇总了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;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:7,代码来源:QtlUrl.cpp

示例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();
}
开发者ID:project-renard-survey,项目名称:utopia-documents-mirror,代码行数:56,代码来源:sidebar.cpp

示例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;
}
开发者ID:xjohncz,项目名称:qt5,代码行数:10,代码来源:qhelpdbreader.cpp

示例4: setAuthority

void QUrlProto::setAuthority(const QString &authority)
{
  QUrl *item = qscriptvalue_cast<QUrl*>(thisObject());
  if (item)
    item->setAuthority(authority);
}
开发者ID:,项目名称:,代码行数:6,代码来源:


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