本文整理汇总了C++中QWebHistory::itemAt方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebHistory::itemAt方法的具体用法?C++ QWebHistory::itemAt怎么用?C++ QWebHistory::itemAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebHistory
的用法示例。
在下文中一共展示了QWebHistory::itemAt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadUrlBackend
void BrowserWidget::loadUrlBackend(QUrl url, bool tryFromHistory) {
if (url == homePageUrl) {
emit loadingHomePage();
} else if (tryFromHistory) {
QWebHistory *history = webView->page()->history();
for (int i = 0; i < history->count(); i++) {
if (history->itemAt(i).url() == url) {
history->goToItem(history->itemAt(i));
urlChanging(history->itemAt(i).url()); // workaround
return;
}
}
}
webView->load(url);
}
示例2: 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()));
}
示例3: getHistory
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;
}
示例4: 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()));
}
示例5: loadHistoryIndex
void NavigationBar::loadHistoryIndex()
{
QWebHistory* history = m_window->weView()->page()->history();
if (QAction* action = qobject_cast<QAction*>(sender())) {
loadHistoryItem(history->itemAt(action->data().toInt()));
}
}
示例6: 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();
}
示例7: loadHistoryIndexInNewTab
void NavigationBar::loadHistoryIndexInNewTab(int index)
{
if (QAction* action = qobject_cast<QAction*>(sender())) {
index = action->data().toInt();
}
if (index == -1) {
return;
}
QWebHistory* history = m_window->weView()->page()->history();
loadHistoryItemInNewTab(history->itemAt(index));
}
示例8: goAtHistoryIndexInNewTab
void NavigationBar::goAtHistoryIndexInNewTab(int index)
{
if (QAction* action = qobject_cast<QAction*>(sender())) {
index = action->data().toInt();
}
if (index == -1) {
return;
}
TabWidget* tabWidget = p_QupZilla->tabWidget();
int tabIndex = tabWidget->duplicateTab(tabWidget->currentIndex());
QWebHistory* history = p_QupZilla->weView(tabIndex)->page()->history();
history->goToItem(history->itemAt(index));
if (qzSettings->newTabPosition == Qz::NT_SelectedTab) {
tabWidget->setCurrentIndex(tabIndex);
}
}