findresultmodel.h
author insilmaril
Mon, 22 Mar 2010 15:37:23 +0000
changeset 841 46553c106c52
parent 837 5ecd0462f76b
child 842 bec082472471
permissions -rw-r--r--
Fixes for QLineEdit and moving vym.changelog up one level
     1 #ifndef FINDRESULTMODEL_H
     2 #define FINDRESULTMODEL_H
     3 
     4 #include <QAbstractItemModel>
     5 #include <QModelIndex>
     6 #include <QVariant>
     7 
     8 class FindResultItem;
     9 class TreeItem;
    10 
    11 class FindResultModel : public QAbstractItemModel
    12 {
    13     Q_OBJECT
    14 
    15 public:
    16     FindResultModel( QObject *parent = 0);
    17     ~FindResultModel();
    18 	void clear();
    19 
    20     QVariant data(const QModelIndex &index, int role) const;
    21     QVariant headerData(int section, Qt::Orientation orientation,
    22                         int role = Qt::DisplayRole) const;
    23 
    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;
    28 
    29     int rowCount(const QModelIndex &parent = QModelIndex()) const;
    30     int columnCount(const QModelIndex &parent = QModelIndex()) const;
    31 
    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);
    37 
    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());
    46 
    47     FindResultItem *getItem(const QModelIndex &index) const;
    48 	FindResultItem *findTreeItem (TreeItem *ti);
    49 
    50 	void addItem (TreeItem *ti);
    51 	void addItem (const QString &s);
    52 	void addSubItem (TreeItem *parent,const QString &s, TreeItem *ti, int i);
    53 
    54 private:
    55 
    56     FindResultItem *rootItem;
    57 };
    58 
    59 #endif