本文整理汇总了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();
}
示例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());
}
示例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;
}
示例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));
}