X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Ftreemodel.h;h=faad7922ad591c43498614ae4a18f644324861d1;hp=d73b8fccd2857b26b54354aa5b5ba4d7428e06f9;hb=6609a6b6f50274e90ecca1aca2c0e2e9ad2e6327;hpb=4bdda41a706b963c0163d38764acb3ffea52f256 diff --git a/src/client/treemodel.h b/src/client/treemodel.h index d73b8fcc..faad7922 100644 --- a/src/client/treemodel.h +++ b/src/client/treemodel.h @@ -23,6 +23,7 @@ #include #include +#include #include /***************************************** @@ -30,6 +31,7 @@ *****************************************/ class TreeItem : public QObject { Q_OBJECT + Q_PROPERTY(uint id READ id) public: TreeItem(const QList &data, TreeItem *parent = 0); @@ -39,15 +41,19 @@ public: void appendChild(TreeItem *child); void removeChild(int row); - TreeItem *child(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; int row() const; TreeItem *parent(); protected: - QList childItems; + QList childItems; + QHash childHash; // uint to be compatible to qHash functions TreeItem *parentItem; QList itemData; }; @@ -67,6 +73,7 @@ public: virtual Qt::ItemFlags flags(const QModelIndex &index) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + QModelIndex indexById(uint id, const QModelIndex &parent = QModelIndex()) const; QModelIndex parent(const QModelIndex &index) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; @@ -76,7 +83,7 @@ public: protected: bool removeRow(int row, const QModelIndex &parent = QModelIndex()); bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); - + TreeItem *rootItem; };