本文整理汇总了C++中QWebHistory::maximumItemCount方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebHistory::maximumItemCount方法的具体用法?C++ QWebHistory::maximumItemCount怎么用?C++ QWebHistory::maximumItemCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebHistory
的用法示例。
在下文中一共展示了QWebHistory::maximumItemCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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);
}