findresultmodel.h
changeset 825 1ad892c1a709
child 829 832e96c9abb6
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/findresultmodel.h	Tue Mar 02 13:59:19 2010 +0000
     1.3 @@ -0,0 +1,51 @@
     1.4 +#ifndef FINDRESULTMODEL_H
     1.5 +#define FINDRESULTMODEL_H
     1.6 +
     1.7 +#include <QAbstractItemModel>
     1.8 +#include <QModelIndex>
     1.9 +#include <QVariant>
    1.10 +
    1.11 +class FindResultItem;
    1.12 +
    1.13 +class FindResultModel : public QAbstractItemModel
    1.14 +{
    1.15 +    Q_OBJECT
    1.16 +
    1.17 +public:
    1.18 +    FindResultModel( QObject *parent = 0);
    1.19 +    ~FindResultModel();
    1.20 +
    1.21 +    QVariant data(const QModelIndex &index, int role) const;
    1.22 +    QVariant headerData(int section, Qt::Orientation orientation,
    1.23 +                        int role = Qt::DisplayRole) const;
    1.24 +
    1.25 +    QModelIndex index(int row, int column,
    1.26 +                      const QModelIndex &parent = QModelIndex()) const;
    1.27 +    QModelIndex parent(const QModelIndex &index) const;
    1.28 +
    1.29 +    int rowCount(const QModelIndex &parent = QModelIndex()) const;
    1.30 +    int columnCount(const QModelIndex &parent = QModelIndex()) const;
    1.31 +
    1.32 +    Qt::ItemFlags flags(const QModelIndex &index) const;
    1.33 +    bool setData(const QModelIndex &index, const QVariant &value,
    1.34 +                 int role = Qt::EditRole);
    1.35 +    bool setHeaderData(int section, Qt::Orientation orientation,
    1.36 +                       const QVariant &value, int role = Qt::EditRole);
    1.37 +
    1.38 +    bool insertColumns(int position, int columns,
    1.39 +                       const QModelIndex &parent = QModelIndex());
    1.40 +    bool removeColumns(int position, int columns,
    1.41 +                       const QModelIndex &parent = QModelIndex());
    1.42 +    bool insertRows(int position, int rows,
    1.43 +                    const QModelIndex &parent = QModelIndex());
    1.44 +    bool removeRows(int position, int rows,
    1.45 +                    const QModelIndex &parent = QModelIndex());
    1.46 +
    1.47 +private:
    1.48 +    void setupModelData(const QStringList &lines, FindResultItem *parent);
    1.49 +    FindResultItem *getItem(const QModelIndex &index) const;
    1.50 +
    1.51 +    FindResultItem *rootItem;
    1.52 +};
    1.53 +
    1.54 +#endif