本文整理汇总了C++中QUrl::setEncodedPath方法的典型用法代码示例。如果您正苦于以下问题:C++ QUrl::setEncodedPath方法的具体用法?C++ QUrl::setEncodedPath怎么用?C++ QUrl::setEncodedPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QUrl
的用法示例。
在下文中一共展示了QUrl::setEncodedPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: host
QUrl
lastfm::UrlBuilder::url() const
{
QUrl url;
url.setScheme( "http" );
url.setHost( host() );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
url.setPath( d->path );
#else
url.setEncodedPath( d->path );
#endif
return url;
}
示例2: proxiedRequest
bool Pillow::HttpHandlerProxy::handleRequest(Pillow::HttpConnection *request)
{
if (_proxiedUrl.isEmpty()) return false;
QUrl targetUrl = _proxiedUrl;
targetUrl.setEncodedPath(request->requestPath());
if (!request->requestQueryString().isEmpty()) targetUrl.setEncodedQuery(request->requestQueryString());
if (!request->requestFragment().isEmpty()) targetUrl.setEncodedFragment(request->requestFragment());
QNetworkRequest proxiedRequest(targetUrl);
foreach (const Pillow::HttpHeader& header, request->requestHeaders())
proxiedRequest.setRawHeader(header.first, header.second);
createPipe(request, createProxiedReply(request, proxiedRequest));
return true;
}
示例3: setEncodedPath
void QUrlProto::setEncodedPath(const QByteArray &path)
{
QUrl *item = qscriptvalue_cast<QUrl*>(thisObject());
if (item)
item->setEncodedPath(path);
}
示例4: browseUrl
void GwtCallback::browseUrl(QString url)
{
QUrl qurl(url);
#ifdef Q_WS_MAC
if (qurl.scheme() == QString::fromAscii("file"))
{
QProcess open;
QStringList args;
// force use of Preview for PDFs (Adobe Reader 10.01 crashes)
if (url.toLower().endsWith(QString::fromAscii(".pdf")))
{
args.append(QString::fromAscii("-a"));
args.append(QString::fromAscii("Preview"));
args.append(url);
}
else
{
args.append(url);
}
open.start(QString::fromAscii("open"), args);
open.waitForFinished(5000);
if (open.exitCode() != 0)
{
// Probably means that the file doesn't have a registered
// application or something.
QProcess reveal;
reveal.startDetached(QString::fromAscii("open"), QStringList() << QString::fromAscii("-R") << url);
}
return;
}
#endif
if (qurl.isRelative())
{
// TODO: this should really be handled within GlobalDisplay -- rather
// than checking for a relative URL here GlobalDisplay should determine
// that a URL is relative and do the right thing (note this needs to
// account for our policy regarding /custom/* urls -- below we allow
// these to be opened in a standard browser window to match the
// behavior of standard CRAN desktop R).
// compute local url
QUrl localUrl;
localUrl.setScheme(QString::fromAscii("http"));
localUrl.setHost(QString::fromAscii("localhost"));
localUrl.setPort(options().portNumber().toInt());
localUrl.setEncodedPath(url.toAscii());
// show it in a browser or a secondary window as appropriate
if (url.startsWith(QString::fromAscii("custom/")) ||
url.startsWith(QString::fromAscii("help/")))
{
QDesktopServices::openUrl(localUrl);
}
else
{
SecondaryWindow* pBrowser = new SecondaryWindow(localUrl);
pBrowser->webView()->load(localUrl);
pBrowser->show();
pBrowser->activateWindow();
}
}
else
{
QDesktopServices::openUrl(qurl);
};
}