本文整理汇总了C++中BookmarkItem::updateVisitCount方法的典型用法代码示例。如果您正苦于以下问题:C++ BookmarkItem::updateVisitCount方法的具体用法?C++ BookmarkItem::updateVisitCount怎么用?C++ BookmarkItem::updateVisitCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BookmarkItem
的用法示例。
在下文中一共展示了BookmarkItem::updateVisitCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createLoadRequest
LoadRequest LocationCompleter::createLoadRequest(const QModelIndex &index)
{
LoadRequest request;
BookmarkItem *bookmark = nullptr;
if (index.data(LocationCompleterModel::HistoryRole).toBool()) {
request = index.data(LocationCompleterModel::UrlRole).toUrl();
} else if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
bookmark = static_cast<BookmarkItem*>(index.data(LocationCompleterModel::BookmarkItemRole).value<void*>());
} else if (index.data(LocationCompleterModel::SearchSuggestionRole).toBool()) {
const QString text = index.data(LocationCompleterModel::TitleRole).toString();
request = mApp->searchEnginesManager()->searchResult(LocationBar::searchEngine(), text);
} else if (index.data(LocationCompleterModel::VisitSearchItemRole).toBool()) {
const auto action = LocationBar::loadAction(m_originalText);
switch (action.type) {
case LocationBar::LoadAction::Url:
case LocationBar::LoadAction::Search:
request = action.loadRequest;
break;
case LocationBar::LoadAction::Bookmark:
bookmark = action.bookmark;
break;
default:
break;
}
}
if (bookmark) {
bookmark->updateVisitCount();
request = bookmark->url();
}
return request;
}
示例2: createLoadRequest
LoadRequest LocationBar::createLoadRequest() const
{
LoadRequest req;
// Check for Search Engine shortcut
int firstSpacePos = text().indexOf(QLatin1Char(' '));
if (firstSpacePos != -1) {
const QString shortcut = text().left(firstSpacePos);
const QString searchedString = text().mid(firstSpacePos).trimmed();
SearchEngine en = mApp->searchEnginesManager()->engineForShortcut(shortcut);
if (!en.name.isEmpty()) {
req = mApp->searchEnginesManager()->searchResult(en, searchedString);
}
}
// Check for Bookmark keyword
QList<BookmarkItem*> items = mApp->bookmarks()->searchKeyword(text());
if (!items.isEmpty()) {
BookmarkItem* item = items.first();
item->updateVisitCount();
req.setUrl(item->url());
}
if (req.isEmpty()) {
const QUrl guessedUrl = WebView::guessUrlFromString(text());
if (!guessedUrl.isEmpty())
req.setUrl(guessedUrl);
else
req.setUrl(QUrl::fromEncoded(text().toUtf8()));
}
return req;
}
示例3: indexShiftActivated
void LocationCompleter::indexShiftActivated(const QModelIndex &index)
{
Q_ASSERT(index.isValid());
if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
BookmarkItem* bookmark = static_cast<BookmarkItem*>(index.data(LocationCompleterModel::BookmarkItemRole).value<void*>());
bookmark->updateVisitCount();
}
const QUrl url = index.data(LocationCompleterModel::UrlRole).toUrl();
const int tabPos = index.data(LocationCompleterModel::TabPositionTabRole).toInt();
// Load url (instead of switching to tab) with shift activation
if (tabPos > -1) {
loadUrl(url);
return;
}
closePopup();
// Clear locationbar
emit clearCompletion();
// Open new window
mApp->createWindow(Qz::BW_NewWindow, url);
}
示例4: createLoadRequest
LoadRequest LocationBar::createLoadRequest() const
{
LoadRequest req;
const QString &t = text().trimmed();
// Check for Search Engine shortcut
int firstSpacePos = t.indexOf(QLatin1Char(' '));
if (firstSpacePos != -1) {
const QString shortcut = t.left(firstSpacePos);
const QString searchedString = t.mid(firstSpacePos).trimmed();
SearchEngine en = mApp->searchEnginesManager()->engineForShortcut(shortcut);
if (!en.name.isEmpty()) {
req = mApp->searchEnginesManager()->searchResult(en, searchedString);
}
}
// Check for Bookmark keyword
QList<BookmarkItem*> items = mApp->bookmarks()->searchKeyword(t);
if (!items.isEmpty()) {
BookmarkItem* item = items.at(0);
item->updateVisitCount();
req.setUrl(item->url());
}
if (req.isEmpty()) {
// One word needs special handling, because QUrl::fromUserInput
// would convert it to QUrl("http://WORD")
if (!t.contains(QL1C(' ')) && !t.contains(QL1C('.'))) {
req.setUrl(QUrl(t));
}
else {
const QUrl &guessed = QUrl::fromUserInput(t);
if (!guessed.isEmpty())
req.setUrl(guessed);
else
req.setUrl(QUrl::fromEncoded(t.toUtf8()));
}
}
return req;
}
示例5: indexCtrlActivated
void LocationCompleter::indexCtrlActivated(const QModelIndex &index)
{
Q_ASSERT(index.isValid());
Q_ASSERT(m_window);
if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
BookmarkItem* bookmark = static_cast<BookmarkItem*>(index.data(LocationCompleterModel::BookmarkItemRole).value<void*>());
bookmark->updateVisitCount();
}
const QUrl url = index.data(LocationCompleterModel::UrlRole).toUrl();
const QString title = index.data(LocationCompleterModel::TitleRole).toString();
closePopup();
// Clear locationbar
emit clearCompletion();
// Open url in new tab
m_window->tabWidget()->addView(url, title, Qz::NT_CleanSelectedTab);
}
示例6: indexActivated
void LocationCompleter::indexActivated(const QModelIndex &index)
{
Q_ASSERT(index.isValid());
const QUrl url = index.data(LocationCompleterModel::UrlRole).toUrl();
const int tabPos = index.data(LocationCompleterModel::TabPositionTabRole).toInt();
// Switch to tab with simple index activation
if (tabPos > -1) {
BrowserWindow* window = static_cast<BrowserWindow*>(index.data(LocationCompleterModel::TabPositionWindowRole).value<void*>());
Q_ASSERT(window);
switchToTab(window, tabPos);
return;
}
if (index.data(LocationCompleterModel::BookmarkRole).toBool()) {
BookmarkItem* bookmark = static_cast<BookmarkItem*>(index.data(LocationCompleterModel::BookmarkItemRole).value<void*>());
bookmark->updateVisitCount();
}
loadUrl(url);
}