9#include "AbstractParentItem.h"
17 AbstractParentItem::AbstractParentItem(AbstractTreeItem *parent) :
18 AbstractTreeItem(parent) {
20 m_firstVisibleChild = NULL;
21 m_lastVisibleChild = NULL;
22 m_children =
new QList< AbstractTreeItem * >;
26 AbstractParentItem::~AbstractParentItem() {
28 for (
int i = 0; i < m_children->size(); i++) {
29 delete(*m_children)[i];
30 (*m_children)[i] = NULL;
36 if (m_firstVisibleChild) {
37 m_firstVisibleChild = NULL;
40 if (m_lastVisibleChild) {
41 m_lastVisibleChild = NULL;
46 AbstractTreeItem *AbstractParentItem::childAt(
int row)
const {
47 return m_children->value(row);
51 QList< AbstractTreeItem * > AbstractParentItem::getChildren()
const {
56 AbstractTreeItem *AbstractParentItem::getFirstVisibleChild()
const {
57 return m_firstVisibleChild;
61 AbstractTreeItem *AbstractParentItem::getLastVisibleChild()
const {
62 return m_lastVisibleChild;
66 int AbstractParentItem::indexOf(AbstractTreeItem *child)
const {
67 return m_children->indexOf(child);
71 int AbstractParentItem::childCount()
const {
72 return m_children->size();
76 void AbstractParentItem::addChild(AbstractTreeItem *child) {
90 m_children->append(child);
91 child->setParent(
this);
101 void AbstractParentItem::setFirstVisibleChild(AbstractTreeItem *child) {
102 m_firstVisibleChild = child;
106 void AbstractParentItem::setLastVisibleChild(AbstractTreeItem *child) {
107 m_lastVisibleChild = child;
This is free and unencumbered software released into the public domain.