3 #include "findresultitem.h"
7 FindResultItem::FindResultItem(const QVector<QVariant> &data, FindResultItem *parent)
14 if (data.isEmpty()) itemData.append(QVariant("empty"));
17 FindResultItem::~FindResultItem()
19 qDeleteAll(childItems);
22 FindResultItem *FindResultItem::child(int number)
24 return childItems.value(number);
27 int FindResultItem::childCount() const
29 return childItems.count();
32 int FindResultItem::childNumber() const
35 return parentItem->childItems.indexOf(const_cast<FindResultItem*>(this));
40 int FindResultItem::columnCount() const
42 return itemData.count();
45 QVariant FindResultItem::data(int column) const
47 return itemData.value(column);
50 int FindResultItem::row() const
53 return parentItem->childItems.indexOf(const_cast<FindResultItem*>(this));
58 bool FindResultItem::insertChildren(int position, int count, int columns)
60 if (position < 0 || position > childItems.size())
63 for (int row = 0; row < count; ++row) {
64 QVector<QVariant> data(columns);
65 FindResultItem *item = new FindResultItem(data, this);
66 childItems.insert(position, item);
72 bool FindResultItem::insertColumns(int position, int columns)
74 if (position < 0 || position > itemData.size())
77 for (int column = 0; column < columns; ++column)
78 itemData.insert(position, QVariant());
80 foreach (FindResultItem *child, childItems)
81 child->insertColumns(position, columns);
86 FindResultItem *FindResultItem::parent()
91 bool FindResultItem::removeChildren(int position, int count)
93 if (position < 0 || position + count > childItems.size())
96 for (int row = 0; row < count; ++row)
97 delete childItems.takeAt(position);
102 bool FindResultItem::removeColumns(int position, int columns)
104 if (position < 0 || position + columns > itemData.size())
107 for (int column = 0; column < columns; ++column)
108 itemData.remove(position);
110 foreach (FindResultItem *child, childItems)
111 child->removeColumns(position, columns);
116 bool FindResultItem::setData(int column, const QVariant &value)
118 if (column < 0 || column >= itemData.size())
121 itemData[column] = value;
125 void FindResultItem::setOriginal (TreeItem *ti)
127 orgModel=ti->getModel();
131 int FindResultItem::getOriginalID()
136 void FindResultItem::setOriginalIndex(int i)
141 int FindResultItem::getOriginalIndex()
146 VymModel* FindResultItem::getOrgModel()