Add GroupModel and corresponding unit test.

This commit is contained in:
Felix Geyer
2010-08-15 12:31:48 +02:00
parent 9b0ba46b31
commit 072a8ccf1b
12 changed files with 922 additions and 8 deletions

View File

@@ -122,6 +122,11 @@ void Group::setLastTopVisibleEntry(Entry* entry)
m_lastTopVisibleEntry = entry;
}
const Group* Group::parentGroup() const
{
return m_parent;
}
void Group::setParent(Group* parent)
{
Q_ASSERT(parent != 0);
@@ -168,12 +173,32 @@ const Database* Group::database() const
return m_db;
}
QList<Group*> Group::children() const
QList<const Group*> Group::children() const
{
QList<const Group*> constChildren;
Q_FOREACH (Group* group, m_children) {
constChildren << group;
}
return constChildren;
}
QList<Group*> Group::children()
{
return m_children;
}
QList<Entry*> Group::entries() const
QList<const Entry*> Group::entries() const
{
QList<const Entry*> constEntries;
Q_FOREACH (Entry* entry, m_entries) {
constEntries << entry;
}
return constEntries;
}
QList<Entry*> Group::entries()
{
return m_entries;
}