]> git.sven.stormbind.net Git - sven/vym.git/blob - findresultmodel.h
Import Upstream version 2.6.11
[sven/vym.git] / findresultmodel.h
1 #ifndef FINDRESULTMODEL_H
2 #define FINDRESULTMODEL_H
3
4 #include <QAbstractItemModel>
5 #include <QModelIndex>
6 #include <QTextDocument>
7 #include <QVariant>
8
9 class FindResultItem;
10 class TreeItem;
11
12 class FindResultModel : public QAbstractItemModel
13 {
14     Q_OBJECT
15
16 public:
17     FindResultModel( QObject *parent = 0);
18     ~FindResultModel();
19     void clear();
20
21     QVariant data(const QModelIndex &index, int role) const;
22     QVariant headerData(int section, Qt::Orientation orientation,
23                         int role = Qt::DisplayRole) const;
24
25     QModelIndex index (FindResultItem *fri);
26     QModelIndex index(int row, int column,
27                       const QModelIndex &parent = QModelIndex()) const;
28     QModelIndex parent(const QModelIndex &index) const;
29
30     int rowCount(const QModelIndex &parent = QModelIndex()) const;
31     int columnCount(const QModelIndex &parent = QModelIndex()) const;
32
33     Qt::ItemFlags flags(const QModelIndex &index) const;
34     bool setData(const QModelIndex &index, const QVariant &value,
35                  int role = Qt::EditRole);
36     bool setHeaderData(int section, Qt::Orientation orientation,
37                        const QVariant &value, int role = Qt::EditRole);
38
39     bool insertColumns(int position, int columns,
40                        const QModelIndex &parent = QModelIndex());
41     bool removeColumns(int position, int columns,
42                        const QModelIndex &parent = QModelIndex());
43     bool insertRows(int position, int rows,
44                     const QModelIndex &parent = QModelIndex());
45     bool removeRows(int position, int rows,
46                     const QModelIndex &parent = QModelIndex());
47
48     FindResultItem* getItem(const QModelIndex &index) const;
49
50     FindResultItem* addItem (TreeItem *ti);
51     FindResultItem* addSubItem (FindResultItem *parent,const QString &s, TreeItem *pi, int i);
52
53     void setSearchString( const QString &s);
54     QString getSearchString();
55     void setSearchFlags( QTextDocument::FindFlags f);
56     QTextDocument::FindFlags getSearchFlags();
57     void setShowParentsLevel(uint i);
58     uint getShowParentsLevel();
59
60 private:
61     uint showParentsLevel;
62
63     FindResultItem *rootItem;
64
65     QString searchString;
66     QTextDocument::FindFlags searchFlags;
67 };
68
69 #endif