1 #ifndef FINDRESULTMODEL_H
2 #define FINDRESULTMODEL_H
4 #include <QAbstractItemModel>
6 #include <QTextDocument>
12 class FindResultModel : public QAbstractItemModel {
16 FindResultModel(QObject *parent = 0);
20 QVariant data(const QModelIndex &index, int role) const;
21 QVariant headerData(int section, Qt::Orientation orientation,
22 int role = Qt::DisplayRole) const;
24 QModelIndex index(FindResultItem *fri);
25 QModelIndex index(int row, int column,
26 const QModelIndex &parent = QModelIndex()) const;
27 QModelIndex parent(const QModelIndex &index) const;
29 int rowCount(const QModelIndex &parent = QModelIndex()) const;
30 int columnCount(const QModelIndex &parent = QModelIndex()) const;
32 Qt::ItemFlags flags(const QModelIndex &index) const;
33 bool setData(const QModelIndex &index, const QVariant &value,
34 int role = Qt::EditRole);
35 bool setHeaderData(int section, Qt::Orientation orientation,
36 const QVariant &value, int role = Qt::EditRole);
38 bool insertColumns(int position, int columns,
39 const QModelIndex &parent = QModelIndex());
40 bool removeColumns(int position, int columns,
41 const QModelIndex &parent = QModelIndex());
42 bool insertRows(int position, int rows,
43 const QModelIndex &parent = QModelIndex());
44 bool removeRows(int position, int rows,
45 const QModelIndex &parent = QModelIndex());
47 FindResultItem *getItem(const QModelIndex &index) const;
49 FindResultItem *addItem(TreeItem *ti);
50 FindResultItem *addSubItem(FindResultItem *parent, const QString &s,
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();
61 uint showParentsLevel;
63 FindResultItem *rootItem;
66 QTextDocument::FindFlags searchFlags;