akonadi
kdescendantsproxymodel_p.h
00001 /* 00002 Copyright (c) 2009 Stephen Kelly <steveire@gmail.com> 00003 00004 This library is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU Library General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or (at your 00007 option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00012 License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to the 00016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301, USA. 00018 */ 00019 00020 00021 #ifndef KDESCENDANTSPROXYMODEL_P_H 00022 #define KDESCENDANTSPROXYMODEL_P_H 00023 00024 #include <QtGui/QAbstractProxyModel> 00025 00026 class KDescendantsProxyModelPrivate; 00027 00067 class KDescendantsProxyModel : public QAbstractProxyModel 00068 { 00069 Q_OBJECT 00070 00071 public: 00072 00078 explicit KDescendantsProxyModel( QObject *parent = 0 ); 00079 00083 virtual ~KDescendantsProxyModel(); 00084 00088 virtual void setSourceModel( QAbstractItemModel *model ); 00089 00098 void setRootIndex( const QModelIndex &index); 00099 00137 void setDisplayAncestorData( bool display ); 00138 00142 bool displayAncestorData() const; 00143 00147 void setAncestorSeparator( const QString &separator ); 00148 00152 QString ancestorSeparator() const; 00153 00157 int descendantCount( const QModelIndex &index ) const; 00158 00159 QModelIndex mapFromSource ( const QModelIndex & sourceIndex ) const; 00160 QModelIndex mapToSource ( const QModelIndex & proxyIndex ) const; 00161 00162 virtual Qt::ItemFlags flags( const QModelIndex &index ) const; 00163 QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; 00164 virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; 00165 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; 00166 00167 virtual QMimeData* mimeData( const QModelIndexList & indexes ) const; 00168 virtual QStringList mimeTypes() const; 00169 00170 virtual bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const; 00171 virtual QModelIndex index(int, int, const QModelIndex &parent = QModelIndex() ) const; 00172 virtual QModelIndex parent(const QModelIndex&) const; 00173 virtual int columnCount(const QModelIndex& index = QModelIndex()) const; 00174 00175 virtual Qt::DropActions supportedDropActions() const; 00176 00180 virtual QModelIndexList match(const QModelIndex& start, int role, const QVariant& value, 00181 int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap ) ) const; 00182 00183 00184 private: 00185 Q_DECLARE_PRIVATE( KDescendantsProxyModel ) 00186 //@cond PRIVATE 00187 KDescendantsProxyModelPrivate *d_ptr; 00188 00189 Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeInserted(const QModelIndex &, int, int)) 00190 Q_PRIVATE_SLOT(d_func(), void sourceRowsInserted(const QModelIndex &, int, int)) 00191 Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeRemoved(const QModelIndex &, int, int)) 00192 Q_PRIVATE_SLOT(d_func(), void sourceRowsRemoved(const QModelIndex &, int, int)) 00193 Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)) 00194 Q_PRIVATE_SLOT(d_func(), void sourceRowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)) 00195 Q_PRIVATE_SLOT(d_func(), void sourceModelAboutToBeReset()) 00196 Q_PRIVATE_SLOT(d_func(), void sourceModelReset()) 00197 Q_PRIVATE_SLOT(d_func(), void sourceLayoutAboutToBeChanged()) 00198 Q_PRIVATE_SLOT(d_func(), void sourceLayoutChanged()) 00199 Q_PRIVATE_SLOT(d_func(), void sourceDataChanged(const QModelIndex &, const QModelIndex &)) 00200 Q_PRIVATE_SLOT(d_func(), void sourceModelDestroyed()) 00201 00202 Q_PRIVATE_SLOT(d_func(), void processPendingParents()) 00203 00204 00205 // Make these private, they shouldn't be called by applications 00206 // virtual bool insertRows(int , int, const QModelIndex & = QModelIndex()); 00207 // virtual bool insertColumns(int, int, const QModelIndex & = QModelIndex()); 00208 // virtual bool removeRows(int, int, const QModelIndex & = QModelIndex()); 00209 // virtual bool removeColumns(int, int, const QModelIndex & = QModelIndex()); 00210 00211 00212 //@endcond 00213 }; 00214 00215 #endif