Debian Codegraph @

Dekko/utils/RowsJoinerProxy.h

raw symbols SCIP
1 /*
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * [email protected] wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return Oleksandr Iakovliev
7 * ----------------------------------------------------------------------------
8 */
9
10 #ifndef RowsJoinerProxy_H
11 #define RowsJoinerProxy_H
12
13 #include <QAbstractItemModel>
14
15 class RowsJoinerProxy : public QAbstractItemModel {
16 Q_OBJECT
17 public:
18 RowsJoinerProxy(QObject *);
19 virtual ~RowsJoinerProxy();
20
21 int indexOf(QAbstractItemModel *) const;
22 QList<QAbstractItemModel *> models() const;
23
24 void insertSourceModel(QAbstractItemModel *, int idx = -1);
25 void removeSourceModel(QAbstractItemModel *);
26
27 QModelIndex mapToSource(const QModelIndex &) const;
28 QModelIndex mapFromSource(const QModelIndex &) const;
29
30 virtual QModelIndex parent(const QModelIndex &) const;
31 virtual QModelIndex index(int, int, const QModelIndex & p = QModelIndex()) const;
32 virtual int rowCount(const QModelIndex & p = QModelIndex()) const;
33 virtual int columnCount(const QModelIndex & p = QModelIndex()) const;
34
35 virtual Qt::ItemFlags flags(const QModelIndex & i) const { return mapToSource(i).flags(); }
36 virtual QVariant data(const QModelIndex & i, int r) const { return mapToSource(i).data(r); }
37 virtual bool setData(const QModelIndex &i, const QVariant &v, int r) {
38 if (!mapToSource(i).model()) return false;
39 QAbstractItemModel * m = const_cast<QAbstractItemModel *>(mapToSource(i).model());
40 return m->setData(mapToSource(i),v,r);
41 }
42
43 private slots:
44 void s_rowsAboutToBeInserted(QModelIndex, int, int);
45 void s_rowsAboutToBeRemoved(QModelIndex, int, int);
46 void s_rowsInserted(QModelIndex, int, int);
47 void s_rowsRemoved(QModelIndex, int, int);
48 void s_dataChanged(QModelIndex, QModelIndex);
49 void s_modelReset();
50 void s_destroyed(QObject *);
51
52 private:
53 class Private;
54 Private * d;
55 };
56
57 #endif // RowsJoinerProxy_H