+
+public:
+ enum TreeItemFlag {
+ NoTreeItemFlag = 0x00,
+ DeleteOnLastChildRemoved = 0x01
+ };
+ Q_DECLARE_FLAGS(TreeItemFlags, TreeItemFlag)
+
+ AbstractTreeItem(AbstractTreeItem *parent = 0);
+
+ bool newChild(AbstractTreeItem *child);
+ bool newChilds(const QList<AbstractTreeItem *> &items);
+
+ bool removeChild(int row);
+ inline bool removeChild(AbstractTreeItem *child) { return removeChild(child->row()); }
+ void removeAllChilds();
+
+ bool reParent(AbstractTreeItem *newParent);
+
+ AbstractTreeItem *child(int row) const;
+
+ int childCount(int column = 0) const;
+
+ virtual int columnCount() const = 0;
+
+ virtual QVariant data(int column, int role) const = 0;
+ virtual bool setData(int column, const QVariant &value, int role) = 0;
+
+ virtual inline Qt::ItemFlags flags() const { return _flags; }
+ virtual inline void setFlags(Qt::ItemFlags flags) { _flags = flags; }
+
+ inline AbstractTreeItem::TreeItemFlags treeItemFlags() const { return _treeItemFlags; }
+ inline void setTreeItemFlags(AbstractTreeItem::TreeItemFlags flags) { _treeItemFlags = flags; }
+ int row() const;
+ inline AbstractTreeItem *parent() const { return qobject_cast<AbstractTreeItem *>(QObject::parent()); }
+
+ void dumpChildList();
+
+signals:
+ void dataChanged(int column = -1);
+
+ void beginAppendChilds(int firstRow, int lastRow);
+ void endAppendChilds();