KGantt

kganttforwardingproxymodel.h
1 /*
2  * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3  *
4  * This file is part of the KGantt library.
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #ifndef KGANTTFORWARDINGPROXYMODEL_H
10 #define KGANTTFORWARDINGPROXYMODEL_H
11 
12 #include <QAbstractProxyModel>
13 
14 #include "kganttglobal.h"
15 
16 namespace KGantt {
17  class KGANTT_EXPORT ForwardingProxyModel : public QAbstractProxyModel {
18  Q_OBJECT
19  Q_DISABLE_COPY(ForwardingProxyModel)
20  public:
21  /*! Constructor. Creates a new ForwardingProxyModel with
22  * parent \a parent
23  */
24  explicit ForwardingProxyModel( QObject* parent = nullptr );
25  ~ForwardingProxyModel() override;
26 
27  /*! Converts indexes in the source model to indexes in the proxy model */
28  /*reimp*/ QModelIndex mapFromSource ( const QModelIndex & sourceIndex ) const override;
29 
30  /*! Converts indexes in the proxy model to indexes in the source model */
31  /*reimp*/ QModelIndex mapToSource ( const QModelIndex & proxyIndex ) const override;
32 
33  /*! Sets the model to be used as the source model for this proxy.
34  * The proxy does not take ownership of the model.
35  * \see QAbstractProxyModel::setSourceModel
36  */
37  /*reimp*/ void setSourceModel( QAbstractItemModel* model ) override;
38 
39  /*! \see QAbstractItemModel::index */
40  /*reimp*/ QModelIndex index( int row, int column, const QModelIndex& parent = QModelIndex() ) const override;
41 
42  /*! \see QAbstractItemModel::parent */
43  /*reimp*/ QModelIndex parent( const QModelIndex& idx ) const override;
44 
45  /*! \see QAbstractItemModel::rowCount */
46  /*reimp*/ int rowCount( const QModelIndex& idx = QModelIndex() ) const override;
47 
48  /*! \see QAbstractItemModel::columnCount */
49  /*reimp*/ int columnCount( const QModelIndex& idx = QModelIndex() ) const override;
50 
51  /*! \see QAbstractItemModel::setData */
52  /*reimp*/ bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole ) override;
53 
54  /*reimp*/ QMimeData *mimeData(const QModelIndexList &indexes) const override;
55  /*reimp*/ bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
56  /*reimp*/ QStringList mimeTypes() const override;
57  /*reimp*/ Qt::DropActions supportedDropActions() const override;
58 
59  protected Q_SLOTS:
60  /*! Called when the source model is about to be reset.
61  * \sa QAbstractItemModel::modelAboutToBeReset()
62  */
63  virtual void sourceModelAboutToBeReset();
64 
65  /*! Called when the source model is reset
66  * \sa QAbstractItemModel::modelReset()
67  */
68  virtual void sourceModelReset();
69 
70  /*! Called just before the layout of the source model is changed.
71  * \sa QAbstractItemModel::layoutAboutToBeChanged()
72  */
73  virtual void sourceLayoutAboutToBeChanged();
74 
75  /*! Called when the layout of the source model has changed.
76  * \sa QAbstractItemModel::layoutChanged()
77  */
78  virtual void sourceLayoutChanged();
79 
80  /*! Called when the data in an existing item in the source model changes.
81  * \sa QAbstractItemModel::dataChanged()
82  */
83  virtual void sourceDataChanged( const QModelIndex& from, const QModelIndex& to );
84 
85  /*! Called just before columns are inserted into the source model.
86  * \sa QAbstractItemModel::columnsAboutToBeInserted()
87  */
88  virtual void sourceColumnsAboutToBeInserted( const QModelIndex& idx, int start, int end );
89 
90  /*! Called after columns have been inserted into the source model.
91  * \sa QAbstractItemModel::columnsInserted()
92  */
93  virtual void sourceColumnsInserted( const QModelIndex& idx, int start, int end );
94 
95  /*! Called just before columns are removed from the source model.
96  * \sa QAbstractItemModel::columnsAboutToBeRemoved()
97  */
98  virtual void sourceColumnsAboutToBeRemoved( const QModelIndex& idx, int start, int end );
99 
100  /*! Called after columns have been removed from the source model.
101  * \sa QAbstractItemModel::columnsRemoved()
102  */
103  virtual void sourceColumnsRemoved( const QModelIndex& idx, int start, int end );
104 
105 
106  /*! Called just before rows are inserted into the source model.
107  * \sa QAbstractItemModel::rowsAboutToBeInserted()
108  */
109  virtual void sourceRowsAboutToBeInserted( const QModelIndex& idx, int start, int end );
110 
111  /*! Called after rows have been inserted into the source model.
112  * \sa QAbstractItemModel::rowsInserted()
113  */
114  virtual void sourceRowsInserted( const QModelIndex& idx, int start, int end );
115 
116  /*! Called just before rows are removed from the source model.
117  * \sa QAbstractItemModel::rowsAboutToBeRemoved()
118  */
119  virtual void sourceRowsAboutToBeRemoved( const QModelIndex&, int start, int end );
120 
121  /*! Called after rows have been removed from the source model.
122  * \sa QAbstractItemModel::rowsRemoved()
123  */
124  virtual void sourceRowsRemoved( const QModelIndex&, int start, int end );
125  };
126 }
127 
128 #endif /* KGANTTFORWARDINGPROXYMODEL_H */
129 
Global namespace.
Contains KGantt macros.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Dec 5 2021 22:32:42 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.