2013-12-11 21:37:59 +01:00
|
|
|
#include <QVariant>
|
|
|
|
|
2013-12-11 14:07:18 +01:00
|
|
|
#include "core/feedsmodelrootitem.h"
|
|
|
|
|
|
|
|
|
2013-12-12 10:10:17 +01:00
|
|
|
FeedsModelRootItem::FeedsModelRootItem(FeedsModelRootItem *parent_item)
|
|
|
|
: m_parentItem(parent_item) {
|
2013-12-11 14:07:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
FeedsModelRootItem::~FeedsModelRootItem() {
|
|
|
|
qDebug("Destroying FeedsModelRootItem instance.");
|
|
|
|
qDeleteAll(m_childItems);
|
|
|
|
}
|
|
|
|
|
2013-12-12 08:27:05 +01:00
|
|
|
FeedsModelRootItem *FeedsModelRootItem::parent() {
|
2013-12-12 10:10:17 +01:00
|
|
|
return m_parentItem;
|
2013-12-11 14:07:18 +01:00
|
|
|
}
|
|
|
|
|
2013-12-12 08:27:05 +01:00
|
|
|
FeedsModelRootItem *FeedsModelRootItem::child(int row) {
|
2013-12-12 10:10:17 +01:00
|
|
|
return m_childItems.value(row);
|
|
|
|
}
|
|
|
|
|
|
|
|
void FeedsModelRootItem::appendChild(FeedsModelRootItem *child) {
|
|
|
|
m_childItems.append(child);
|
2013-12-11 18:54:09 +01:00
|
|
|
}
|
|
|
|
|
2013-12-11 14:07:18 +01:00
|
|
|
int FeedsModelRootItem::columnCount() const {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2013-12-11 18:54:09 +01:00
|
|
|
int FeedsModelRootItem::row() const {
|
2013-12-12 10:10:17 +01:00
|
|
|
if (m_parentItem) {
|
|
|
|
return m_parentItem->m_childItems.indexOf(const_cast<FeedsModelRootItem*>(this));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return 0;
|
|
|
|
}
|
2013-12-11 18:54:09 +01:00
|
|
|
}
|
|
|
|
|
2013-12-11 14:07:18 +01:00
|
|
|
int FeedsModelRootItem::childCount() const {
|
|
|
|
return m_childItems.count();
|
|
|
|
}
|
2013-12-11 21:37:59 +01:00
|
|
|
|
|
|
|
QVariant FeedsModelRootItem::data(int column, int role) const {
|
2013-12-12 10:10:17 +01:00
|
|
|
Q_UNUSED(column)
|
|
|
|
Q_UNUSED(role)
|
2013-12-11 21:37:59 +01:00
|
|
|
|
|
|
|
return QVariant();
|
|
|
|
}
|