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


C++ QWebHistory类代码示例

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


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

示例1: getZoom

WindowHistoryInformation QtWebKitWebWidget::getHistory() const
{
	QVariantHash data;
	data[QLatin1String("position")] = m_webView->page()->mainFrame()->scrollPosition();
	data[QLatin1String("zoom")] = getZoom();

	m_webView->history()->currentItem().setUserData(data);

	QWebHistory *history = m_webView->history();
	WindowHistoryInformation information;
	information.index = history->currentItemIndex();

	for (int i = 0; i < history->count(); ++i)
	{
		const QWebHistoryItem item = history->itemAt(i);
		WindowHistoryEntry entry;
		entry.url = item.url().toString();
		entry.title = item.title();
		entry.position = item.userData().toHash().value(QLatin1String("position"), QPoint(0, 0)).toPoint();
		entry.zoom = item.userData().toHash().value(QLatin1String("zoom")).toInt();

		information.entries.append(entry);
	}

	return information;
}
开发者ID:Kermit,项目名称:otter,代码行数:26,代码来源:QtWebKitWebWidget.cpp

示例2: addHistoryAction

void MainWindow::displayViewActions()
{
    ui->actionBack->setEnabled(ui->webView->canGoBack());
    ui->backButton->setEnabled(ui->webView->canGoBack());
    ui->actionForward->setEnabled(ui->webView->canGoForward());
    ui->forwardButton->setEnabled(ui->webView->canGoForward());

    ui->menuView->clear();
    ui->menuView->addAction(ui->actionBack);
    ui->menuView->addAction(ui->actionForward);
    ui->menuView->addSeparator();

    m_backMenu->clear();
    m_forwardMenu->clear();

    QWebHistory *history = ui->webView->page()->history();
    for (const QWebHistoryItem &item: history->backItems(10))
        m_backMenu->addAction(addHistoryAction(history, item));
    if (history->count() > 0)
        addHistoryAction(history, history->currentItem())->setEnabled(false);
    for (const QWebHistoryItem &item: history->forwardItems(10))
        m_forwardMenu->addAction(addHistoryAction(history, item));

    displayTabs();
}
开发者ID:mt0803,项目名称:zeal,代码行数:25,代码来源:mainwindow.cpp

示例3: aboutToShowHistoryNextMenu

void NavigationBar::aboutToShowHistoryNextMenu()
{
    if (!m_menuForward || !m_window->weView()) {
        return;
    }
    m_menuForward->clear();

    QWebHistory* history = m_window->weView()->history();
    int curindex = history->currentItemIndex();
    int count = 0;

    for (int i = curindex + 1; i < history->count(); i++) {
        QWebHistoryItem item = history->itemAt(i);
        if (item.isValid()) {
            QString title = titleForUrl(item.title(), item.url());

            const QIcon icon = iconForPage(item.url(), IconProvider::standardIcon(QStyle::SP_ArrowForward));
            Action* act = new Action(icon, title);
            act->setData(i);
            connect(act, SIGNAL(triggered()), this, SLOT(loadHistoryIndex()));
            connect(act, SIGNAL(ctrlTriggered()), this, SLOT(loadHistoryIndexInNewTab()));
            m_menuForward->addAction(act);
        }

        count++;
        if (count == 20) {
            break;
        }
    }

    m_menuForward->addSeparator();
    m_menuForward->addAction(tr("Clear history"), this, SLOT(clearHistory()));
}
开发者ID:AlexTalker,项目名称:qupzilla,代码行数:33,代码来源:navigationbar.cpp

示例4: foreach

QString DumpRenderTree::dumpBackForwardList(QWebPage* page)
{
    QWebHistory* history = page->history();

    QString result;
    result.append(QLatin1String("\n============== Back Forward List ==============\n"));

    // FORMAT:
    // "        (file test):fast/loader/resources/click-fragment-link.html  **nav target**"
    // "curr->  (file test):fast/loader/resources/click-fragment-link.html#testfragment  **nav target**"

    int maxItems = history->maximumItemCount();

    foreach (const QWebHistoryItem item, history->backItems(maxItems)) {
        if (!item.isValid())
            continue;
        result.append(dumpHistoryItem(item, 8, false));
    }

    QWebHistoryItem item = history->currentItem();
    if (item.isValid())
        result.append(dumpHistoryItem(item, 8, true));

    foreach (const QWebHistoryItem item, history->forwardItems(maxItems)) {
        if (!item.isValid())
            continue;
        result.append(dumpHistoryItem(item, 8, false));
    }

    result.append(QLatin1String("===============================================\n"));
    return result;
}
开发者ID:mcgrawp,项目名称:webkit-webcl,代码行数:32,代码来源:DumpRenderTreeQt.cpp

示例5: aboutToShowHistoryBackMenu

void NavigationBar::aboutToShowHistoryBackMenu()
{
    if (!m_menuBack || !p_QupZilla->weView()) {
        return;
    }
    m_menuBack->clear();
    QWebHistory* history = p_QupZilla->weView()->history();

    int curindex = history->currentItemIndex();
    int count = 0;

    for (int i = curindex - 1; i >= 0; i--) {
        QWebHistoryItem item = history->itemAt(i);
        if (item.isValid()) {
            QString title = titleForUrl(item.title(), item.url());

            const QIcon &icon = iconForPage(item.url(), qIconProvider->standardIcon(QStyle::SP_ArrowBack));
            Action* act = new Action(icon, title);
            act->setData(i);
            connect(act, SIGNAL(triggered()), this, SLOT(goAtHistoryIndex()));
            connect(act, SIGNAL(middleClicked()), this, SLOT(goAtHistoryIndexInNewTab()));
            m_menuBack->addAction(act);
        }

        count++;
        if (count == 20) {
            break;
        }
    }

    m_menuBack->addSeparator();
    m_menuBack->addAction(tr("Clear history"), this, SLOT(clearHistory()));
}
开发者ID:naveen246,项目名称:qupzilla,代码行数:33,代码来源:navigationbar.cpp

示例6: currentTab

void MainWindow::openPrevious(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers)
{
    QWebHistory *history = currentTab()->view()->history();
    QWebHistoryItem *item = 0;

    if (currentTab()->page()->isOnRekonqPage())
    {
        item = new QWebHistoryItem(history->currentItem());
    }
    else
    {
        if (history->canGoBack())
        {
            item = new QWebHistoryItem(history->backItem());
        }
    }

    if(!item)
        return;

    if (mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier)
    {
        Application::instance()->loadUrl(item->url(), Rekonq::NewTab);
    }
    else
    {
        history->goToItem(*item);
    }

    updateActions();
}
开发者ID:Fxrh,项目名称:rekonq,代码行数:31,代码来源:mainwindow.cpp

示例7: goBack

void BackButton::goBack()
{
    QAction * action = qobject_cast<QAction *>(sender());
    int index = action->data().toInt();
    QWebHistory * history = m_webView->history();
    history->goToItem(history->backItems(-index).first());
}
开发者ID:OS2World,项目名称:APP-INTERNET-Surfer,代码行数:7,代码来源:backbutton.cpp

示例8: loadHistoryIndex

void NavigationBar::loadHistoryIndex()
{
    QWebHistory* history = m_window->weView()->page()->history();

    if (QAction* action = qobject_cast<QAction*>(sender())) {
        loadHistoryItem(history->itemAt(action->data().toInt()));
    }
}
开发者ID:AlexTalker,项目名称:qupzilla,代码行数:8,代码来源:navigationbar.cpp

示例9: refreshHistory

void NavigationBar::refreshHistory()
{
    if (mApp->isClosing() || p_QupZilla->isClosing()) {
        return;
    }

    QWebHistory* history = p_QupZilla->weView()->page()->history();
    m_buttonBack->setEnabled(history->canGoBack());
    m_buttonNext->setEnabled(history->canGoForward());
}
开发者ID:naveen246,项目名称:qupzilla,代码行数:10,代码来源:navigationbar.cpp

示例10: goAtHistoryIndex

void NavigationBar::goAtHistoryIndex()
{
    QWebHistory* history = p_QupZilla->weView()->page()->history();

    if (QAction* action = qobject_cast<QAction*>(sender())) {
        history->goToItem(history->itemAt(action->data().toInt()));
    }

    refreshHistory();
}
开发者ID:naveen246,项目名称:qupzilla,代码行数:10,代码来源:navigationbar.cpp

示例11: clearWebHistory

void MainWindow::clearWebHistory()
{
    QWebHistory *history = view->history();
    history->clear();
    for (const auto &item : pageHistoryItems) {
        pageHistoryMenu->removeAction(item);
    }
    pageHistoryItems.clear();
    visitedUrls.clear();
}
开发者ID:MikeL83,项目名称:WebBrowser,代码行数:10,代码来源:mainwindow.cpp

示例12: refreshHistory

void NavigationBar::refreshHistory()
{
    if (mApp->isClosing() || !m_window->weView()) {
        return;
    }

    QWebHistory* history = m_window->weView()->page()->history();
    m_buttonBack->setEnabled(history->canGoBack());
    m_buttonForward->setEnabled(history->canGoForward());
}
开发者ID:AlexTalker,项目名称:qupzilla,代码行数:10,代码来源:navigationbar.cpp

示例13: goForwardInNewTab

void NavigationBar::goForwardInNewTab()
{
    QWebHistory* history = m_window->weView()->page()->history();

    if (!history->canGoForward()) {
        return;
    }

    loadHistoryItemInNewTab(history->forwardItem());
}
开发者ID:AlexTalker,项目名称:qupzilla,代码行数:10,代码来源:navigationbar.cpp

示例14: clearHistory

static void clearHistory(QWebPage* page)
{
    // QWebHistory::clear() leaves current page, so remove it as well by setting
    // max item count to 0, and then setting it back to it's original value.

    QWebHistory* history = page->history();
    int itemCount = history->maximumItemCount();

    history->clear();
    history->setMaximumItemCount(0);
    history->setMaximumItemCount(itemCount);
}
开发者ID:mcgrawp,项目名称:webkit-webcl,代码行数:12,代码来源:DumpRenderTreeQt.cpp

示例15: view

void WebKitBrowserExtension::saveState(QDataStream &stream)
{
    // TODO: Save information such as form data from the current page.
    QWebHistory* history = (view() ? view()->history() : 0);
    const int historyIndex = (history ? history->currentItemIndex() : -1);
    const KUrl historyUrl = (history ? KUrl(history->currentItem().url()) : m_part->url());

    stream << historyUrl
           << static_cast<qint32>(xOffset())
           << static_cast<qint32>(yOffset())
           << historyIndex
           << m_historyData;
}
开发者ID:netrunner-debian-kde-extras,项目名称:webkitkde,代码行数:13,代码来源:kwebkitpart_ext.cpp


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