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


C++ QWebHistory::backItems方法代码示例

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


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

示例1: displayViewActions

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

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

示例3: dumpBackForwardList

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

示例4: goToHistoryItem

void QtWebKitHelpViewer::goToHistoryItem(bool forward)
{
    QAction *action = qobject_cast<QAction *>(sender());
    QTC_ASSERT(action, return);
    QWebHistory *history = m_webView->history();
    QTC_ASSERT(history, return);
    bool ok = false;
    int index = action->data().toInt(&ok);
    QTC_ASSERT(ok, return);
    if (forward)
        history->goToItem(history->forwardItems(history->count()).at(index));
    else
        history->goToItem(history->backItems(history->count()).at(index));
}
开发者ID:acacid,项目名称:qt-creator,代码行数:14,代码来源:qtwebkithelpviewer.cpp


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