summaryrefslogtreecommitdiff
path: root/src/model/ThreadModel.h
blob: 656373b2f9d6445d2f767c2e2e170a93400578d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef THREADMODEL_H
#define THREADMODEL_H

#include "social/message.h"
#include <QAbstractItemModel>

class ThreadModel : public QAbstractItemModel
{
  Q_OBJECT;

 public:

  explicit
    ThreadModel (Message *root = 0,
                 QObject *parent = 0);

  ~ThreadModel();

  void
    setRoot (Message *root);

  Qt::ItemFlags
    flags (const QModelIndex &index)
    const Q_DECL_OVERRIDE;

  QVariant
    data (const QModelIndex &index,
          int role)
    const Q_DECL_OVERRIDE;

  QModelIndex index (int row,
                     int column,
                     const QModelIndex &parent = QModelIndex())
    const Q_DECL_OVERRIDE;

  QModelIndex
    parent (const QModelIndex &index)
    const Q_DECL_OVERRIDE;

  int
    rowCount (const QModelIndex &parent = QModelIndex())
    const Q_DECL_OVERRIDE;

  int
    columnCount (const QModelIndex &parent = QModelIndex())
    const Q_DECL_OVERRIDE;

 public slots:

  void
    rowAdded (Message *msg);

  void
    rowModified (Message *msg);

 private:

  Message *m_root;
};

#endif