本文整理汇总了C++中Album::parent方法的典型用法代码示例。如果您正苦于以下问题:C++ Album::parent方法的具体用法?C++ Album::parent怎么用?C++ Album::parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::parent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isAncestorOf
bool Album::isAncestorOf(Album* album) const
{
bool val = false;
Album* a = album;
while (a && !a->isRoot())
{
if (a == this)
{
val = true;
break;
}
a = a->parent();
}
return val;
}
示例2: slotMultipleTagDel
void TagModificationHelper::slotMultipleTagDel(QList<TAlbum* >& tags)
{
QString tagWithChildrens;
QString tagWithImages;
QMultiMap<int, TAlbum*> sortedTags;
foreach(TAlbum* const t, tags)
{
if (!t || t->isRoot())
{
continue;
}
AlbumPointer<TAlbum> tag(t);
// find number of subtags
int children = 0;
AlbumIterator iter(tag);
while (iter.current())
{
++children;
++iter;
}
if(children)
tagWithChildrens.append(tag->title() + QString(" "));
QList<qlonglong> assignedItems = DatabaseAccess().db()->getItemIDsInTag(tag->id());
if(!assignedItems.isEmpty())
tagWithImages.append(tag->title() + QString(" "));
/**
* Tags must be deleted from children to parents, if we don't want
* to step on invalid index. Use QMultiMap to order them by distance
* to root tag
*/
Album* parent = t;
int depth = 0;
while(!parent->isRoot())
{
parent = parent->parent();
depth++;
}
sortedTags.insert(depth,tag);
}
// ask for deletion of children
if (!tagWithChildrens.isEmpty())
{
int result = KMessageBox::warningContinueCancel(0,
i18n("Tags '%1' have one or more subtags. "
"Deleting them will also delete "
"the subtags. "
"Do you want to continue?",
tagWithChildrens));
if (result != KMessageBox::Continue)
{
return;
}
}
QString message;
if (!tagWithImages.isEmpty())
{
message = i18n("Tags '%1' are assigned to one or more items. "
"Do you want to continue?",
tagWithImages);
}
else
{
message = i18n("Delete '%1' tag(s)?", tagWithImages);
}
int result = KMessageBox::warningContinueCancel(0, message,
i18n("Delete Tag"),
KGuiItem(i18n("Delete"),
"edit-delete"));
if (result == KMessageBox::Continue)
{
QMultiMap<int, TAlbum*>::iterator it;
/**
* QMultimap doesn't provide reverse iterator, -1 is required
* because end() points after the last element
*/
for(it = sortedTags.end()-1; it != sortedTags.begin()-1; --it)
{
emit aboutToDeleteTag(it.value());
QString errMsg;
//.........这里部分代码省略.........