本文整理汇总了C++中QUrl::setScheme方法的典型用法代码示例。如果您正苦于以下问题:C++ QUrl::setScheme方法的具体用法?C++ QUrl::setScheme怎么用?C++ QUrl::setScheme使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QUrl
的用法示例。
在下文中一共展示了QUrl::setScheme方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QObject
/**
* @brief Constructs UserStore object.
* @param host
* www.evernote.com or sandbox.evernote.com
* @param authenticationToken
* This token that will be used as the default token.
*/
qevercloud::UserStore::UserStore(QString host, QString authenticationToken, QObject *parent): QObject(parent)
{
QUrl url;
url.setScheme("https");
url.setHost(host);
url.setPath("/edam/user");
url_ = url.toString(QUrl::StripTrailingSlash);
setAuthenticationToken(authenticationToken);
}
示例2: currentAddress
const QUrl AddressManager::currentAddress() const {
QUrl hifiURL;
hifiURL.setScheme(HIFI_URL_SCHEME);
hifiURL.setHost(_rootPlaceName);
hifiURL.setPath(currentPath());
return hifiURL;
}
示例3: TestFailUriInvalid
void TsDataRetrieverFTP::TestFailUriInvalid()
{
try
{
QUrl url;
url.setHost("ftp.dgi.inpe.br");
url.setPath("/operacao/");
url.setScheme("FTP");
url.setPort(21);
url.setUserName("queimadas");
url.setPassword("inpe_2012");
curl_global_init(CURL_GLOBAL_ALL);
//DataProvider information
terrama2::core::DataProvider* dataProvider = new terrama2::core::DataProvider();
terrama2::core::DataProviderPtr dataProviderPtr(dataProvider);
dataProvider->uri = url.url().toStdString();
dataProvider->intent = terrama2::core::DataProviderIntent::COLLECTOR_INTENT;
dataProvider->dataProviderType = "FTP";
dataProvider->active = true;
//empty filter
terrama2::core::Filter filter;
MockCurlWrapper mock_;
ON_CALL(mock_, verifyURL(_)).WillByDefault(Return(CURLE_COULDNT_RESOLVE_HOST));
try
{
terrama2::core::DataRetrieverFTP retrieverFTP(dataProviderPtr, std::move(mock_));
QFAIL("Exception expected!");
}
catch(const terrama2::core::DataRetrieverException& e)
{
}
curl_global_cleanup();
}
catch(const terrama2::Exception& e)
{
QFAIL(boost::get_error_info< terrama2::ErrorDescription >(e)->toStdString().c_str());
}
catch(...)
{
QFAIL("Unexpected exception!");
}
return;
}
示例4: getTranslation
void Wikipedia::getTranslation()
{
if (langCode().isEmpty() || entry().isEmpty()) {
return;
}
QSettings s;
QString lang = s.value(QStringLiteral("display/language")).toString().left(2).toUpper();
if (lang.isEmpty() || (lang == QLatin1String("C"))) {
lang = QLocale::system().name().left(2);
}
QUrl wpURL;
wpURL.setScheme(QStringLiteral("https"));
if (lang == langCode()) {
wpURL.setHost(QStringLiteral("%1.wikipedia.org").arg(langCode()));
wpURL.setPath(QStringLiteral("/wiki/%1").arg(entry()));
} else {
QString enFallback;
QMap<QString, QString> interWiki = reqTranslations(langCode(), entry());
if (interWiki.contains(QStringLiteral("en"))) {
enFallback = interWiki.value(QStringLiteral("en"));
}
while (!interWiki.contains(lang) && (interWiki[QStringLiteral("cont")] != QStringLiteral(""))) {
interWiki = reqTranslations(langCode(), entry(), interWiki[QStringLiteral("cont")]);
if (interWiki.contains(QStringLiteral("en"))) {
enFallback = interWiki.value(QStringLiteral("en"));
}
}
if (interWiki.contains(lang)) {
wpURL.setHost(QStringLiteral("%1.wikipedia.org").arg(lang));
wpURL.setPath(QStringLiteral("/wiki/%1").arg(interWiki[lang]));
} else if (!enFallback.isEmpty()) {
wpURL.setHost(QStringLiteral("en.wikipedia.org"));
wpURL.setPath(QStringLiteral("/wiki/%1").arg(enFallback));
} else {
wpURL.setHost(QStringLiteral("%1.wikipedia.org").arg(langCode()));
wpURL.setPath(QStringLiteral("/wiki/%1").arg(entry()));
}
#ifdef QT_DEBUG
qDebug() << "Wikipedia URL: " << wpURL;
#endif
}
setUrl(wpURL);
}
示例5: 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();
}
示例6: url
QUrl Session::url(const QString& path) const
{
QUrl url;
url.setScheme("http");
url.setHost(m_host);
url.setPort(EDAM_PORT);
QString uid = m_data.getProperty("Uid").toString();
url.setPath(QString("/shard/%1/%2").arg(uid).arg(path));
return url;
}
示例7: parseUrl
QString HelpBrowser::parseUrl(const QString &str)
{
if (!str.startsWith("gfile:"))
return str;
QString path = str.mid(6);
QUrl url = QUrl::fromLocalFile(path);
url.setScheme("gfile");
return url.toString();
}
示例8: QWebSecurityOriginPointerToScriptValue
QScriptValue QWebSecurityOriginPointerToScriptValue(QScriptEngine *engine, QWebSecurityOrigin* const &item)
{
QScriptValue obj = engine->newObject();
QUrl url = QUrl();
url.setHost(item->host());
url.setPort(item->port());
url.setScheme(item->scheme());
obj.setProperty("_url", qPrintable(url.toString()));
return obj;
}
示例9: 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;
}
示例10: sessionUrl
QUrl SessionListingModel::sessionUrl(int index) const
{
const Session &s = m_filtered.at(index);
QUrl url;
url.setScheme("drawpile");
url.setHost(s.host);
if(s.port != DRAWPILE_PROTO_DEFAULT_PORT)
url.setPort(s.port);
url.setPath("/" + s.id);
return url;
}
示例11: _makeLandingPageRequest
void SpotifyIO::_makeLandingPageRequest()
{
qDebug() << "tokens request";
QUrl url;
url.setScheme("https");
url.setHost(authServer);
url.setPath(landingUrl);
QNetworkRequest req(url);
req.setHeader(QNetworkRequest::UserAgentHeader, userAgent);
QObject::connect(nam->get(req), SIGNAL(finished()), this, SLOT(landingFilished()));
}
示例12: xmlRequest
// Format an URL for a XML request
static inline QUrl xmlRequest(const QString &host, const QString &request, int page = -1)
{
QUrl url;
url.setScheme(QLatin1String("http"));
url.setHost(host);
url.setPath(QLatin1Char('/') + request);
url.addQueryItem(QLatin1String("format"), QLatin1String("xml"));
if (page >= 0)
url.addQueryItem(QLatin1String("page"), QString::number(page));
return url;
}
示例13: renderToResource
QSizeF EpsRenderer::renderToResource(QTextDocument *document, const QUrl &url)
{
QSizeF size;
QImage img = renderToImage(url, &size);
QUrl internal = url;
internal.setScheme(QLatin1String("internal"));
qDebug() << internal;
document->addResource(QTextDocument::ImageResource, internal, QVariant(img) );
return size;
}
示例14: toString
QString WaveUrl::toString() const
{
QUrl url;
url.setScheme("wave");
url.setHost(m_waveletDomain);
if ( m_waveletDomain == m_waveDomain)
url.setPath( "/" + m_waveId + "/" + m_waveletId );
else
url.setPath( "/" + m_waveDomain + "$" + m_waveId + "/" + m_waveletId );
return url.toString();
}
示例15: constructUrl
QUrl PIMSearchStore::constructUrl(const Xapian::docid &docid)
{
QUrl url;
url.setScheme(QStringLiteral("akonadi"));
QUrlQuery query;
query.addQueryItem(QStringLiteral("item"), QString::number(docid));
url.setQuery(query);
return url;
}