BibleTime
|
#include <item.h>
Public Types | |
enum | Type { ITEM_ROOT = 0 , ITEM_CATEGORY = 1 , ITEM_LANGUAGE = 2 , ITEM_MODULE = 3 , ITEM_INDEXING = 4 } |
Public Member Functions | |
Qt::CheckState | checkState () const |
Returns the check state of this item. More... | |
int | childIndex () const |
Returns the index of this item under its parent. More... | |
QList< Item * > & | children () |
Returns the list of child items of this node. More... | |
virtual QVariant | data (int role=Qt::DisplayRole) const |
Returns data for this item. More... | |
virtual bool | fitFor (const CSwordModuleInfo &module) const =0 |
Returns whether this item is fit to contain the given module. More... | |
template<class T > | |
T * | getGroupItem (CSwordModuleInfo &module, int &outIndex) |
int | indexFor (Item const &newItem) |
Returns the position for where the given child item would be inserted. More... | |
void | insertChild (int index, Item *newItem) |
Inserts the given item as a child at the given index. More... | |
Item (Type type) | |
virtual bool | operator< (const Item &other) const |
Comparsion operator used sorting child items. More... | |
Item * | parent () const |
Returns a pointer to the parent item of this item. More... | |
void | setCheckState (const Qt::CheckState state) |
Sets the check state of this item. More... | |
Type | type () const |
Returns the type of this item. More... | |
virtual | ~Item () |
Private Member Functions | |
void | setParent (Item *parent) noexcept |
Private Attributes | |
Qt::CheckState | m_checkState |
QList< Item * > | m_children |
Item * | m_parent |
Type | m_type |
|
virtual |
Definition at line 23 of file item.cpp.
References m_children.
|
inline |
Returns the check state of this item.
Definition at line 113 of file item.h.
References m_checkState.
Referenced by BtBookshelfTreeModel::data(), BtBookshelfTreeModel::resetParentCheckStates(), and BtBookshelfTreeModel::setData().
|
inline |
Returns the index of this item under its parent.
-1 | if this item has no parent. |
Definition at line 66 of file item.h.
References m_children, and m_parent.
Referenced by BtBookshelfTreeModel::getIndex(), BtBookshelfTreeModel::parent(), and BtBookshelfTreeModel::removeModule().
Returns the list of child items of this node.
Definition at line 60 of file item.h.
References m_children.
Referenced by BtBookshelfTreeModel::hasChildren(), BtBookshelfTreeModel::index(), BtBookshelfTreeModel::removeModule(), BtBookshelfTreeModel::resetParentCheckStates(), BtBookshelfTreeModel::rowCount(), and BtBookshelfTreeModel::setData().
|
virtual |
Returns data for this item.
Reimplemented in BookshelfModel::ModuleItem, BookshelfModel::LanguageItem, BookshelfModel::IndexingItem, and BookshelfModel::CategoryItem.
Definition at line 44 of file item.cpp.
References m_checkState, m_children, and BtBookshelfModel::ModuleHiddenRole.
Referenced by BtBookshelfTreeModel::data(), BookshelfModel::CategoryItem::data(), BookshelfModel::IndexingItem::data(), BookshelfModel::LanguageItem::data(), and operator<().
|
pure virtual |
Returns whether this item is fit to contain the given module.
[in] | module | The module to check with. |
true | If this item is a group and can contain the given module. |
false | This item is not a group or is a wrong group. |
Implemented in BookshelfModel::LanguageItem, BookshelfModel::IndexingItem, BookshelfModel::CategoryItem, BookshelfModel::ModuleItem, and BookshelfModel::RootItem.
|
inline |
Definition at line 93 of file item.h.
References BT_ASSERT, m_children, and T.
Referenced by BtBookshelfTreeModel::getGroup().
int BookshelfModel::Item::indexFor | ( | Item const & | newItem | ) |
Returns the position for where the given child item would be inserted.
[in] | newItem | Pointer to the item that would be inserted. |
Definition at line 27 of file item.cpp.
References BT_ASSERT, m_children, and type().
Referenced by BtBookshelfTreeModel::addModule(), and BtBookshelfTreeModel::getGroup().
|
inline |
Inserts the given item as a child at the given index.
[in] | index | The child index to insert the item at. |
[in] | newItem | The item to insert. |
Definition at line 85 of file item.h.
References BT_ASSERT, m_children, and setParent().
Referenced by BtBookshelfTreeModel::addModule(), and BtBookshelfTreeModel::getGroup().
|
virtual |
|
inline |
Returns a pointer to the parent item of this item.
0 | if this item has no parent. |
Definition at line 55 of file item.h.
References m_parent.
Referenced by BtBookshelfTreeModel::getIndex(), BtBookshelfTreeModel::parent(), BtBookshelfTreeModel::removeModule(), and setParent().
|
inline |
Sets the check state of this item.
[in] | state | new check state. |
Definition at line 119 of file item.h.
References m_checkState.
Referenced by BtBookshelfTreeModel::addModule(), BtBookshelfTreeModel::resetParentCheckStates(), and BtBookshelfTreeModel::setData().
|
inlineprivatenoexcept |
|
inline |
Returns the type of this item.
Definition at line 49 of file item.h.
References m_type.
Referenced by BtBookshelfTreeModel::data(), BtBookshelfTreeModel::flags(), indexFor(), operator<(), BookshelfModel::CategoryItem::operator<(), and BtBookshelfTreeModel::setData().
|
private |
Definition at line 144 of file item.h.
Referenced by checkState(), data(), and setCheckState().
Definition at line 143 of file item.h.
Referenced by childIndex(), children(), data(), getGroupItem(), indexFor(), insertChild(), and ~Item().
|
private |
Definition at line 142 of file item.h.
Referenced by childIndex(), parent(), and setParent().
|
private |
Definition at line 141 of file item.h.
Referenced by operator<(), and type().