Songbook-Client  0.7
This application is a manager of customguitar songbooks
 All Classes Files Functions Variables Enumerations Enumerator Pages
identity-proxy-model.hh
Go to the documentation of this file.
1 // Copyright (C) 2009-2011, Alexandre Dupas <alexandre.dupas@gmail.com>
2 //
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License as
5 // published by the Free Software Foundation; either version 2 of the
6 // License, or (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful, but
9 // WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 // 02110-1301, USA.
17 #ifndef __IDENTITY_PROXY_MODEL_HH__
18 #define __IDENTITY_PROXY_MODEL_HH__
19 
20 #include <QAbstractProxyModel>
21 
31 class CIdentityProxyModel : public QAbstractProxyModel
32 {
33  Q_OBJECT
34 
35 public:
36  CIdentityProxyModel(QObject *parent = 0);
38 
39  virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
40  virtual Qt::ItemFlags flags(const QModelIndex &index) const;
41  virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
42 
43  virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
44  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
45 
46  virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
47  virtual QModelIndex parent(const QModelIndex &index ) const;
48 
49  virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
50  virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
51 
52  virtual void setSourceModel(QAbstractItemModel *sourceModel);
53 
54 private slots:
55  void sourceColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end);
56  void sourceColumnsInserted(const QModelIndex &parent, int start, int end);
57  void sourceColumnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest);
58  void sourceColumnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest);
59  void sourceColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
60  void sourceColumnsRemoved(const QModelIndex &parent, int start, int end);
61 
62  void sourceRowsAboutToBeInserted(const QModelIndex &parent, int start, int end);
63  void sourceRowsInserted(const QModelIndex &parent, int start, int end);
64  void sourceRowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest);
65  void sourceRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest);
66  void sourceRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
67  void sourceRowsRemoved(const QModelIndex &parent, int start, int end);
68 
69  void sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
70  void sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last);
71 
72  void sourceLayoutAboutToBeChanged();
73  void sourceLayoutChanged();
74 
75  void sourceModelAboutToBeReset();
76  void sourceModelReset();
77 };
78 
79 #endif // __IDENTITY_PROXY_MODEL_HH__