本文整理汇总了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);
}
示例2: hasFragment
bool QUrlProto::hasFragment() const
{
QUrl *item = qscriptvalue_cast<QUrl*>(thisObject());
if (item)
return item->hasFragment();
return false;
}
示例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);
}
示例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));
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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();
}
示例10: hasFragment
int Url::hasFragment ( lua_State * L )// const : bool
{
QUrl* lhs = ValueInstaller2<QUrl>::check( L, 1 );
Util::push( L, lhs->hasFragment() );
return 1;
}