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


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

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


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

示例1: createPageUrl

QUrl Docset::createPageUrl(const QString &path, const QString &fragment) const
{
    QString realPath;
    QString realFragment;

    if (fragment.isEmpty()) {
        const QStringList urlParts = path.split(QLatin1Char('#'));
        realPath = urlParts[0];
        if (urlParts.size() > 1)
            realFragment = urlParts[1];
    } else {
        realPath = path;
        realFragment = fragment;
    }

    static const QRegularExpression dashEntryRegExp(QLatin1String("<dash_entry_.*>"));
    realPath.remove(dashEntryRegExp);
    realFragment.remove(dashEntryRegExp);

    // Absolute file path is required here to handle relative path to the docset storage (see #806).
    QUrl url = QUrl::fromLocalFile(QDir(documentPath()).absoluteFilePath(realPath));
    if (!realFragment.isEmpty()) {
        if (realFragment.startsWith(QLatin1String("//apple_ref"))
                || realFragment.startsWith(QLatin1String("//dash_ref"))) {
            url.setFragment(realFragment, QUrl::DecodedMode);
        } else {
            url.setFragment(realFragment);
        }
    }

    return url;
}
开发者ID:zealdocs,项目名称:zeal,代码行数:32,代码来源:docset.cpp

示例2: getFullOutputMappingURL

QUrl ModelBaker::getFullOutputMappingURL() const {
    QUrl appendedURL = _outputMappingURL;
    appendedURL.setFragment(_outputURLSuffix.fragment());
    appendedURL.setQuery(_outputURLSuffix.query());
    appendedURL.setUserInfo(_outputURLSuffix.userInfo());
    return appendedURL;
}
开发者ID:AndrewMeadows,项目名称:hifi,代码行数:7,代码来源:ModelBaker.cpp

示例3: showHelp

		void HelpViewer::showHelp(const String& org_url, String entry)
		{
			String url = org_url;
			String fragment;

			if (url.has('#'))
			{
				url = url.before("#");
				fragment = org_url.after("#");
			}

			QUrl qurl = QUrl::fromLocalFile((base_dir_ + url).c_str());
			if (fragment != "") qurl.setFragment(fragment.c_str());
 			browser_->setSource(qurl);

 			QTextCursor ct = browser_->textCursor();
 			if (!ct.atStart()) 
 			{
 				ct.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
				browser_->setTextCursor(ct);
 			}

			if (entry != "") browser_->find(entry.c_str(), QTextDocument::FindCaseSensitively);

			if (!isVisible())
			{
				show();
				setFloating(true);
				showMaximized();
			}
		}
开发者ID:PierFio,项目名称:ball,代码行数:31,代码来源:helpViewer.C

示例4: setFragment

int Url::setFragment ( lua_State * L )// ( const QString & fragment )
{
	QUrl* lhs = ValueInstaller2<QUrl>::check( L, 1 );
	//QString* fragment = ValueInstaller2<QString>::check( L, 2 );
	lhs->setFragment( Util::toString( L, 2 ) );
	return 0;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:7,代码来源:QtlUrl.cpp

示例5: openUrl_data

void tst_QDesktopServices::openUrl_data()
{
    QTest::addColumn<QUrl>("data");
    QTest::addColumn<QString>("message");

    QUrl localFile = QUrl::fromLocalFile(QFINDTESTDATA("test.txt"));

    QTest::newRow("text-file")
            << localFile
            << "This should open test.txt in a text editor";

    localFile.setQuery("x=y");
    QTest::newRow("text-file-with-query")
            << localFile
            << "This should open test.txt in a text editor. Queries do not usually show up.";

    localFile.setQuery(QString());
    localFile.setFragment("top");
    QTest::newRow("text-file-with-fragment")
            << localFile
            << "This should open test.txt in a text editor. Fragments do not usually show up.";

    QTest::newRow("browser-plain")
            << QUrl("http://qt-project.org")
            << "This should open http://qt-project.org in the default web browser";

    QTest::newRow("search-url")
            << QUrl("http://google.com/search?q=Qt+Project")
            << "This should search \"Qt Project\" on Google";

    QTest::newRow("search-url-with-space")
            << QUrl("http://google.com/search?q=Qt Project")
            << "This should search \"Qt Project\" on Google";

    QTest::newRow("search-url-with-quotes")
            << QUrl("http://google.com/search?q=\"Qt+Project\"")
            << "This should search '\"Qt Project\"' on Google (including the quotes)";

    QTest::newRow("search-url-with-hashtag")
            << QUrl("http://google.com/search?q=%23qtproject")
            << "This should search \"#qtproject\" on Google. The # should appear in the Google search field";

    QTest::newRow("search-url-with-fragment")
            << QUrl("http://google.com/search?q=Qt+Project#top")
            << "This should search \"Qt Project\" on Google. There should be no # in the Google search field";

    // see QTBUG-32311
    QTest::newRow("search-url-with-slashes")
            << QUrl("http://google.com/search?q=/profile/5")
            << "This should search \"/profile/5\" on Google.";

    QTest::newRow("mail")
            << QUrl("mailto:[email protected]")
            << "This should open an email composer with the destination set to [email protected]";

    QTest::newRow("mail-subject")
            << QUrl("mailto:[email protected]?subject=[Development]%20Test%20Mail")
            << "This should open an email composer and tries to set the subject";
}
开发者ID:cedrus,项目名称:qt,代码行数:59,代码来源:tst_qdesktopservices.cpp

示例6: setSource

void QtWebKitHelpViewer::setSource(const QUrl &url)
{
    QUrl oldWithoutFragment = source();
    oldWithoutFragment.setFragment(QString());

    m_webView->load(url);

    // if the new url only changes the anchor,
    // then webkit does not send loadStarted nor loadFinished,
    // so we should do that manually in that case
    QUrl newWithoutFragment = url;
    newWithoutFragment.setFragment(QString());
    if (oldWithoutFragment == newWithoutFragment) {
        slotLoadStarted();
        slotLoadFinished();
    }
}
开发者ID:acacid,项目名称:qt-creator,代码行数:17,代码来源:qtwebkithelpviewer.cpp

示例7: makeUrlFromCwd

static const QUrl makeUrlFromCwd( const QString& u, const QString& ref = QString() )
{
    QUrl url = QUrl::fromLocalFile( QDir::currentPath() + QLatin1Char('/') + u) ;
    if ( !ref.isEmpty() )
        url.setFragment( ref );
    url.setPath(QDir::cleanPath( url.path() ) );
    return url;
}
开发者ID:KDE,项目名称:okular,代码行数:8,代码来源:shelltest.cpp

示例8: 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

示例9: async

Future<void> GitCloneStep::perform(const ActionContext &ctxt)
{
	return async([this, ctxt](Notifier notifier)
	{
		QUrl url = m_url;
		url.setFragment(QString());
		Git::GitRepo *repo = notifier.await(Git::GitRepo::clone(ctxt.get<InstallContextItem>().buildDir, url));
		if (!url.fragment().isEmpty()) {
			notifier.await(repo->checkout(url.fragment()));
		}
	});
}
开发者ID:02JanDal,项目名称:ralph,代码行数:12,代码来源:GitInstallationSteps.cpp

示例10: openDocset

void MainWindow::openDocset(const QModelIndex &index)
{
    if (!index.sibling(index.row(), 1).data().isNull()) {
        QStringList url_l = index.sibling(index.row(), 1).data().toString().split('#');
        QUrl url = QUrl::fromLocalFile(url_l[0]);
        if (url_l.count() > 1)
            url.setFragment(url_l[1]);
        ui->webView->load(url);

        if (!m_treeViewClicked)
            ui->webView->focus();
        else
            m_treeViewClicked = false;
    }
}
开发者ID:JIghtuse,项目名称:zeal,代码行数:15,代码来源:mainwindow.cpp

示例11: resolve

SpriteDefinition *ResourceManager::requestSpriteDefinition(
        const QString &path, int variant)
{
    QUrl url = resolve(spritePath() + path);
    url.setFragment(QString::number(variant), QUrl::DecodedMode);

    SpriteDefinition *sprite = find<SpriteDefinition>(url);
    if (!sprite) {
        sprite = new SpriteDefinition(this, url, variant);
        mResources.insert(url, sprite);
        mResourceListModel->addResource(sprite);
    }

    sprite->incRef();
    return sprite;
}
开发者ID:smglaksn,项目名称:manamobile,代码行数:16,代码来源:resourcemanager.cpp

示例12: uniqueFileName

/*!
    Given a URL, generates a unique enough filename (and subdirectory)
 */
QString QNetworkDiskCachePrivate::uniqueFileName(const QUrl &url)
{
    QUrl cleanUrl = url;
    cleanUrl.setPassword(QString());
    cleanUrl.setFragment(QString());

    QCryptographicHash hash(QCryptographicHash::Sha1);
    hash.addData(cleanUrl.toEncoded());
    // convert sha1 to base36 form and return first 8 bytes for use as string
    QByteArray id =  QByteArray::number(*(qlonglong*)hash.result().data(), 36).left(8);
    // generates <one-char subdir>/<8-char filname.d>
    uint code = (uint)id.at(id.length()-1) % 16;
    QString pathFragment = QString::number(code, 16) + QLatin1Char('/')
                             + QLatin1String(id) + CACHE_POSTFIX;

    return pathFragment;
}
开发者ID:FlavioFalcao,项目名称:qt5,代码行数:20,代码来源:qnetworkdiskcache.cpp

示例13: showGitTemplate

void QWebViewImage::showGitTemplate( const std::string& templateName, const std::string& templateType, QMap<QString, int>* changedMetrics ) {
    // Create relative webview dir url
    QString appPath = QCoreApplication::applicationDirPath();
    QString webviewPath = appPath.append( "/../share/3dsoftviz/webview/index.html" );
    QUrl baseUrl = QUrl::fromLocalFile( webviewPath );

    // Set angular template type using query string
    if ( !templateType.empty() ) {

        // Fragment represents value after # hash in url. For example: http://something/index.html#<fragment>
        baseUrl.setFragment( QString::fromStdString( templateType ) );
    }

    qDebug() << "Webview url: " << baseUrl;

    // Set html and baseUrl working directory
//	_webView->setHtml( html.c_str(), baseUrl );
    _webView->setHtml( createGitHtml( changedMetrics ), baseUrl );
}
开发者ID:garajm,项目名称:RealityNotFound,代码行数:19,代码来源:QWebViewImage.cpp

示例14: AbstractDownloadReply

DownloadFaviconReply::DownloadFaviconReply(
        const DownloadFaviconRequest &request,
        QNetworkAccessManager *network, QObject *parent) :
    AbstractDownloadReply(network, parent)
{
    m_request = request;
    QUrl favIconUrl = request.url();
    favIconUrl.setPath("/favicon.ico");
    favIconUrl.setFragment(QString());
#if QT_VERSION >= 0x050000
    favIconUrl.setQuery(QUrlQuery());
#else
    favIconUrl.setQueryItems(QList<QPair<QString, QString> >());
#endif
    fetchUrl(favIconUrl,
             request.maxRetryCount(),
             request.maxRedirectCount(),
             true);
}
开发者ID:AlekseyDurachenko,项目名称:qookmarks,代码行数:19,代码来源:downloadfaviconreply.cpp

示例15: openDocset

void MainWindow::openDocset(const QModelIndex &index)
{
    const QVariant urlStr = index.sibling(index.row(), 1).data();
    if (urlStr.isNull())
        return;

    /// TODO: Keep anchor separately from file address
    QStringList urlParts = urlStr.toString().split(QLatin1Char('#'));
    QUrl url = QUrl::fromLocalFile(urlParts[0]);
    if (urlParts.count() > 1)
        /// NOTE: QUrl::DecodedMode is a fix for #121. Let's hope it doesn't break anything.
        url.setFragment(urlParts[1], QUrl::DecodedMode);

    ui->webView->load(url);

    if (!m_treeViewClicked)
        ui->webView->focus();
    else
        m_treeViewClicked = false;
}
开发者ID:mt0803,项目名称:zeal,代码行数:20,代码来源:mainwindow.cpp


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