mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-26 16:11:02 +08:00
52 lines
814 B
C++
52 lines
814 B
C++
#include <QStringList>
|
|
|
|
#include "treeitem.h"
|
|
|
|
TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent)
|
|
{
|
|
m_parentItem = parent;
|
|
m_itemData = data;
|
|
}
|
|
|
|
TreeItem::~TreeItem()
|
|
{
|
|
qDeleteAll(m_childItems);
|
|
}
|
|
|
|
void TreeItem::appendChild(TreeItem *item)
|
|
{
|
|
m_childItems.append(item);
|
|
}
|
|
|
|
TreeItem *TreeItem::child(int row)
|
|
{
|
|
return m_childItems.value(row);
|
|
}
|
|
|
|
int TreeItem::childCount() const
|
|
{
|
|
return m_childItems.count();
|
|
}
|
|
|
|
int TreeItem::columnCount() const
|
|
{
|
|
return m_itemData.count();
|
|
}
|
|
|
|
QVariant TreeItem::data(int column) const
|
|
{
|
|
return m_itemData.value(column);
|
|
}
|
|
|
|
TreeItem *TreeItem::parentItem()
|
|
{
|
|
return m_parentItem;
|
|
}
|
|
|
|
int TreeItem::row() const
|
|
{
|
|
if (m_parentItem)
|
|
return m_parentItem->m_childItems.indexOf(const_cast<TreeItem*>(this));
|
|
|
|
return 0;
|
|
} |