Akonadi Calendar

kcolumnfilterproxymodel.cpp
1 /*
2  SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB,
3  a KDAB Group company, [email protected],
4  SPDX-FileContributor: Bertjan Broeksema <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.1-or-later
7 */
8 
9 #include "kcolumnfilterproxymodel_p.h"
10 
11 #include <QVector>
12 
13 using namespace Akonadi;
14 
15 KColumnFilterProxyModel::KColumnFilterProxyModel(QObject *parent)
16  : QSortFilterProxyModel(parent)
17 {
18 }
19 
20 KColumnFilterProxyModel::~KColumnFilterProxyModel()
21 {
22 }
23 
24 QVector<int> KColumnFilterProxyModel::visbileColumns() const
25 {
26  return m_visibleColumns;
27 }
28 
29 void KColumnFilterProxyModel::setVisibleColumn(int column)
30 {
31  setVisibleColumns(QVector<int>() << column);
32 }
33 
34 void KColumnFilterProxyModel::setVisibleColumns(const QVector<int> &visibleColumns)
35 {
36  m_visibleColumns = visibleColumns;
37  invalidateFilter();
38 }
39 
40 bool KColumnFilterProxyModel::filterAcceptsColumn(int column, const QModelIndex &parent) const
41 {
42  if (!m_visibleColumns.isEmpty() && !m_visibleColumns.contains(column)) {
43  // We only filter columns out when m_visibleColumns actually contains values.
44  return false;
45  }
46 
47  return QSortFilterProxyModel::filterAcceptsColumn(column, parent);
48 }
virtual bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const const
FreeBusyManager::Singleton.
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jun 19 2021 23:12:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.