X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Ftreemodel.h;h=f1317be72cf99552213962b801095329958829cb;hp=faad7922ad591c43498614ae4a18f644324861d1;hb=a30b5992589c96fcb1eca1af36465a955d2cf6ff;hpb=0555b01cbb4789122de7bc0a5325c664fbed87cd diff --git a/src/client/treemodel.h b/src/client/treemodel.h index faad7922..f1317be7 100644 --- a/src/client/treemodel.h +++ b/src/client/treemodel.h @@ -32,30 +32,44 @@ class TreeItem : public QObject { Q_OBJECT Q_PROPERTY(uint id READ id) - + public: TreeItem(const QList &data, TreeItem *parent = 0); TreeItem(TreeItem *parent = 0); virtual ~TreeItem(); - + void appendChild(TreeItem *child); void removeChild(int row); - + virtual uint id() const; + TreeItem *child(int row) const; TreeItem *childById(const uint &) const; + int childCount() const; int columnCount() const; + virtual QVariant data(int column, int role) const; - virtual Qt::ItemFlags flags() const; + + Qt::ItemFlags flags() const; + void setFlags(Qt::ItemFlags); + int row() const; TreeItem *parent(); - + + +private slots: + void childDestroyed(); + + protected: - QList childItems; - QHash childHash; // uint to be compatible to qHash functions - TreeItem *parentItem; QList itemData; + +private: + QList _childItems; + QHash _childHash; // uint to be compatible to qHash functions + TreeItem *_parentItem; + Qt::ItemFlags _flags; }; @@ -64,11 +78,11 @@ protected: *****************************************/ class TreeModel : public QAbstractItemModel { Q_OBJECT - + public: TreeModel(const QList &, QObject *parent = 0); virtual ~TreeModel(); - + QVariant data(const QModelIndex &index, int role) const; virtual Qt::ItemFlags flags(const QModelIndex &index) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;