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


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

本文整理汇总了C++中QUrl::hasFragment方法的典型用法代码示例。如果您正苦于以下问题:C++ QUrl::hasFragment方法的具体用法?C++ QUrl::hasFragment怎么用?C++ QUrl::hasFragment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QUrl的用法示例。


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

示例1: evaluateSingleton

Item UnparsedTextFN::evaluateSingleton(const DynamicContext::Ptr &context) const
{
    Q_ASSERT(m_operands.count() == 1 || m_operands.count() == 2);
    const Item href(m_operands.first()->evaluateSingleton(context));
    if(!href)
        return Item();

    const QUrl mayRela(AnyURI::toQUrl<ReportContext::XTDE1170>(href.stringValue(),
                       context,
                       this));

    const QUrl uri(context->resolveURI(mayRela, staticBaseURI()));

    if(uri.hasFragment())
    {
        context->error(QtXmlPatterns::tr("The URI cannot have a fragment"),
                       ReportContext::XTDE1170, this);
    }

    QString encoding;

    if(m_operands.count() == 2)
    {
        const Item encodingArg(m_operands.at(1)->evaluateSingleton(context));
        if(encodingArg)
            encoding = encodingArg.stringValue();
    }

    Q_ASSERT(uri.isValid() && !uri.isRelative());
    return context->resourceLoader()->openUnparsedText(uri, encoding, context, this);
}
开发者ID:xjohncz,项目名称:qt5,代码行数:31,代码来源:qunparsedtextfn.cpp

示例2: hasFragment

bool QUrlProto::hasFragment() const
{
  QUrl *item = qscriptvalue_cast<QUrl*>(thisObject());
  if (item)
    return item->hasFragment();
  return false;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: evaluateEBV

bool UnparsedTextAvailableFN::evaluateEBV(const DynamicContext::Ptr &context) const
{
    Q_ASSERT(m_operands.count() == 1 || m_operands.count() == 2);
    const Item href(m_operands.first()->evaluateSingleton(context));
    if(!href)
        return Item();

    bool isValid = false;
    const QUrl mayRela(AnyURI::toQUrl<ReportContext::XTDE1170>(href.stringValue(),
                                                               context,
                                                               this,
                                                               &isValid));

    if(!isValid)
        return false;

    const QUrl uri(context->resolveURI(mayRela, staticBaseURI()));

    /* fn:unparsed-text() will raise an error on this. */
    if(uri.hasFragment())
        return false;

    QString encoding;

    if(m_operands.count() == 2)
    {
        const Item encodingArg(m_operands.at(1)->evaluateSingleton(context));
        if(encodingArg)
            encoding = encodingArg.stringValue();
    }

    Q_ASSERT(uri.isValid() && !uri.isRelative());
    return context->resourceLoader()->isUnparsedTextAvailable(uri, encoding);
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例4: start

void Visit::start(QStringList &arguments) {
  QUrl requestedUrl = QUrl(arguments[0]);
  page()->currentFrame()->setUrl(QUrl(requestedUrl));
  if(requestedUrl.hasFragment()) {
    // workaround for https://bugs.webkit.org/show_bug.cgi?id=32723
    page()->currentFrame()->setUrl(QUrl(requestedUrl));
  }
}
开发者ID:Pallinder,项目名称:capybara-webkit,代码行数:8,代码来源:Visit.cpp

示例5: urlEncodeQueryString

QString QzTools::urlEncodeQueryString(const QUrl &url)
{
    QString returnString = url.toString(QUrl::RemoveQuery | QUrl::RemoveFragment);

    if (url.hasQuery()) {
        returnString += QLatin1Char('?') + url.query(QUrl::FullyEncoded);
    }

    if (url.hasFragment()) {
        returnString += QLatin1Char('#') + url.fragment(QUrl::FullyEncoded);
    }

    returnString.replace(QLatin1Char(' '), QLatin1String("%20"));

    return returnString;
}
开发者ID:Kulteam,项目名称:qupzilla,代码行数:16,代码来源:qztools.cpp

示例6: handleChangedUrl

void Authorization::handleChangedUrl(QUrl const& newUrl)
{
    static QUrl const uAuthtorizationRedirectUrl(AUTHORIZATION_REDIRECT_URL);
    if(newUrl.matches(uAuthtorizationRedirectUrl,QUrl::RemoveFragment | QUrl::RemoveQuery))
    {
        if( newUrl.hasFragment() )
        {
            QUrlQuery query( newUrl.fragment() );

            QString accessToken = query.queryItemValue(QString("access_token"));
            QString userID = query.queryItemValue("user_id");
            emit success(accessToken,userID);
        }
        else
        {
            QUrlQuery query( newUrl.query() );
            QString error = query.queryItemValue(QString("error"));
            QString errorDescription = query.queryItemValue("eror_description");
            emit failure(error,errorDescription);
        }
        hide();
    }
}
开发者ID:FedyaB,项目名称:VK02014SP,代码行数:23,代码来源:authorization.cpp

示例7: resolveUrl

QUrl DocumentBrowser::resolveUrl(const QUrl &url) const
{
    if (!url.isRelative())
        return url;

    // For the second case QUrl can merge "#someanchor" with "foo.html"
    // correctly to "foo.html#someanchor"
    if (!(m_url.isRelative()
          || (m_url.scheme() == QLatin1String("file")
              && !QFileInfo(m_url.toLocalFile()).isAbsolute()))
          || (url.hasFragment() && url.path().isEmpty())) {
        return m_url.resolved(url);
    }

    // this is our last resort when current url and new url are both relative
    // we try to resolve against the current working directory in the local
    // file system.
    QFileInfo fi(m_url.toLocalFile());
    if (fi.exists()) {
        return QUrl::fromLocalFile(fi.absolutePath() + QDir::separator()).resolved(url);
    }

    return url;
}
开发者ID:DFRobot,项目名称:liteide,代码行数:24,代码来源:documentbrowser.cpp

示例8: urlEncodeQueryString

QString QzTools::urlEncodeQueryString(const QUrl &url)
{
    QString returnString = url.toString(QUrl::RemoveQuery | QUrl::RemoveFragment);

    if (url.hasQuery()) {
#if QT_VERSION >= 0x050000
        returnString += QLatin1Char('?') + url.query(QUrl::FullyEncoded);
#else
        returnString += QLatin1Char('?') + url.encodedQuery();
#endif
    }

    if (url.hasFragment()) {
#if QT_VERSION >= 0x050000
        returnString += QLatin1Char('#') + url.fragment(QUrl::FullyEncoded);
#else
        returnString += QLatin1Char('#') + url.encodedFragment();
#endif
    }

    returnString.replace(QLatin1Char(' '), QLatin1String("%20"));

    return returnString;
}
开发者ID:Shinobi-San,项目名称:qupzilla,代码行数:24,代码来源:qztools.cpp

示例9: extractMimeTypeFor

static void extractMimeTypeFor(const QUrl& url, QString& mimeType)
{
    const QString fname(url.fileName());
 
    if (fname.isEmpty() || url.hasFragment() || url.hasQuery())
        return;
 
    KMimeType::Ptr pmt = KMimeType::findByPath(fname, 0, true);

    // Further check for mime types guessed from the extension which,
    // on a web page, are more likely to be a script delivering content
    // of undecidable type. If the mime type from the extension is one
    // of these, don't use it.  Retain the original type 'text/html'.
    if (pmt->name() == KMimeType::defaultMimeType() ||
        pmt->is(QL1S("application/x-perl")) ||
        pmt->is(QL1S("application/x-perl-module")) ||
        pmt->is(QL1S("application/x-php")) ||
        pmt->is(QL1S("application/x-python-bytecode")) ||
        pmt->is(QL1S("application/x-python")) ||
        pmt->is(QL1S("application/x-shellscript")))
        return;

    mimeType = pmt->name();
}
开发者ID:KDE,项目名称:kwebkitpart,代码行数:24,代码来源:webview.cpp

示例10: hasFragment

int Url::hasFragment ( lua_State * L )// const : bool
{
	QUrl* lhs = ValueInstaller2<QUrl>::check( L, 1 );
	Util::push( L, lhs->hasFragment() );
	return 1;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:6,代码来源:QtlUrl.cpp


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