Akonadi Calendar

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

KDE's Doxygen guidelines are available online.