listproxymodel.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef LISTPROXYMODEL_H
00022 #define LISTPROXYMODEL_H
00023
00024 #include <QAbstractProxyModel>
00025 #include <QItemSelection>
00026 #include <QList>
00027
00028
00036 class ListProxyModel : public QAbstractProxyModel
00037 {
00038 Q_OBJECT
00039
00040 public:
00047 Qt::ItemFlags flags(const QModelIndex &index) const;
00048
00056 QVariant data(const QModelIndex &index, int role) const;
00057
00066 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
00067
00068
00075 QModelIndex parent(const QModelIndex &index) const;
00076
00083 int rowCount(const QModelIndex &parent = QModelIndex()) const;
00084
00091 int columnCount(const QModelIndex &parent = QModelIndex()) const;
00092
00100 QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
00101
00109 QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
00110
00116 void setSourceModel(QAbstractItemModel *sourceModel);
00117
00118 public slots:
00122 void update();
00123
00124 private:
00125 void addIndexes(QModelIndex *searchIndex);
00126 QList<QModelIndex> indexList;
00127 };
00128
00129 #endif // LISTPROXYMODEL_H
00130
00131