本文整理汇总了C++中BookmarkItem::parent方法的典型用法代码示例。如果您正苦于以下问题:C++ BookmarkItem::parent方法的具体用法?C++ BookmarkItem::parent怎么用?C++ BookmarkItem::parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BookmarkItem
的用法示例。
在下文中一共展示了BookmarkItem::parent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeBookmarkMessageButtonPressed
void WebBrowser::removeBookmarkMessageButtonPressed(const Plasma::MessageButton button)
{
if (button == Plasma::ButtonNo){
return;
}
const QModelIndexList list = m_bookmarkModel->match(m_bookmarkModel->index(0,0), BookmarkItem::UrlRole, m_url.prettyUrl());
if (!list.isEmpty()) {
const QModelIndex &index = list.first();
BookmarkItem *item = dynamic_cast<BookmarkItem *>(m_bookmarkModel->itemFromIndex(index));
if (item) {
KBookmark bookmark = item->bookmark();
bookmark.parentGroup().deleteBookmark(bookmark);
m_bookmarkManager->save();
}
if (item && item->parent()) {
item->parent()->removeRow(index.row());
} else {
m_bookmarkModel->removeRow(index.row());
}
}
m_addBookmark->setAction(m_addBookmarkAction);
}
示例2: removeBookmark
void WebBrowser::removeBookmark(const QModelIndex &index)
{
BookmarkItem *item = dynamic_cast<BookmarkItem *>(m_bookmarkModel->itemFromIndex(index));
if (item) {
KBookmark bookmark = item->bookmark();
const QString text(i18nc("@info", "Do you really want to remove the bookmark to %1?", bookmark.url().host()));
showMessage(KIcon("dialog-warning"), text, Plasma::ButtonYes | Plasma::ButtonNo);
return;
}
if (item && item->parent()) {
item->parent()->removeRow(index.row());
} else {
m_bookmarkModel->removeRow(index.row());
}
}