3 #include "findresultitem.h"
7 FindResultItem::FindResultItem(const QVector<QVariant> &data, FindResultItem *parent)
15 FindResultItem::~FindResultItem()
17 qDeleteAll(childItems);
20 FindResultItem *FindResultItem::child(int number)
22 return childItems.value(number);
25 int FindResultItem::childCount() const
27 return childItems.count();
30 int FindResultItem::childNumber() const
33 return parentItem->childItems.indexOf(const_cast<FindResultItem*>(this));
38 int FindResultItem::columnCount() const
40 return itemData.count();
43 QVariant FindResultItem::data(int column) const
45 return itemData.value(column);
48 int FindResultItem::row() const
51 return parentItem->childItems.indexOf(const_cast<FindResultItem*>(this));
57 bool FindResultItem::insertChildren(int position, int count, int columns)
59 if (position < 0 || position > childItems.size())
62 for (int row = 0; row < count; ++row) {
63 QVector<QVariant> data(columns);
64 FindResultItem *item = new FindResultItem(data, this);
65 childItems.insert(position, item);
71 bool FindResultItem::insertColumns(int position, int columns)
73 if (position < 0 || position > itemData.size())
76 for (int column = 0; column < columns; ++column)
77 itemData.insert(position, QVariant());
79 foreach (FindResultItem *child, childItems)
80 child->insertColumns(position, columns);
85 FindResultItem *FindResultItem::parent()
90 bool FindResultItem::removeChildren(int position, int count)
92 if (position < 0 || position + count > childItems.size())
95 for (int row = 0; row < count; ++row)
96 delete childItems.takeAt(position);
101 bool FindResultItem::removeColumns(int position, int columns)
103 if (position < 0 || position + columns > itemData.size())
106 for (int column = 0; column < columns; ++column)
107 itemData.remove(position);
109 foreach (FindResultItem *child, childItems)
110 child->removeColumns(position, columns);
115 bool FindResultItem::setData(int column, const QVariant &value)
117 if (column < 0 || column >= itemData.size())
120 itemData[column] = value;
124 void FindResultItem::setOriginal (TreeItem *ti)
126 orgModel=ti->getModel();
130 uint FindResultItem::getOrgID()
135 VymModel* FindResultItem::getOrgModel()