kilobyte is kB not kb
[kdepim.git] / akonadi_next / kcolumnfilterproxymodel.h
blobc3357ae7861ff4d692dc68bd936cbbd4555cf9c5
1 /*
2 Copyright (C) 2010 Klarälvdalens Datakonsult AB,
3 a KDAB Group company, info@kdab.net,
5 author Bertjan Broeksema <broeksema@kde.org>
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef KCOLUMNFILTERPROXYMODEL_H
24 #define KCOLUMNFILTERPROXYMODEL_H
26 #include "akonadi_next_export.h"
28 #include <QtGui/QSortFilterProxyModel>
30 template <class T> class QVector;
32 namespace Future
35 class KColumnFilterProxyModelPrivate;
37 /**
38 Filter model to make only certain columns of a model visible. By default all
39 columns are visible.
41 class AKONADI_NEXT_EXPORT KColumnFilterProxyModel : public QSortFilterProxyModel
43 public:
44 explicit KColumnFilterProxyModel( QObject* parent = 0 );
45 virtual ~KColumnFilterProxyModel();
47 /**
48 Returns a vector containing the visible columns. If the vector is empy, all
49 columns are visible.
51 QVector<int> visbileColumns() const;
53 /**
54 Convenience function. Has the same effect as:
56 @code
57 setVisibleColumns( QVector<int>() << column );
58 @endcode
60 @see setVisbileColumns
62 void setVisibleColumn( int column );
64 /**
65 Change the visible columns. Pass an empty vector to make all columns visible.
67 void setVisibleColumns( const QVector<int> &visibleColumns );
69 protected:
70 virtual bool filterAcceptsColumn( int column, const QModelIndex& parent ) const;
72 private:
73 KColumnFilterProxyModelPrivate * const d_ptr;
74 Q_DECLARE_PRIVATE( KColumnFilterProxyModel )
79 #endif // KCOLUMNFILTERPROXYMODEL_H