File indexing completed on 2024-05-19 05:44:22

0001 /*
0002     SPDX-FileCopyrightText: 2015-2017 Milian Wolff <mail@milianw.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #include "chartproxy.h"
0008 
0009 #include "chartmodel.h"
0010 
0011 ChartProxy::ChartProxy(bool showTotal, QObject* parent)
0012     : QSortFilterProxyModel(parent)
0013     , m_showTotal(showTotal)
0014 {
0015 }
0016 
0017 ChartProxy::~ChartProxy() = default;
0018 
0019 bool ChartProxy::filterAcceptsColumn(int sourceColumn, const QModelIndex& /*sourceParent*/) const
0020 {
0021     if (m_showTotal && sourceColumn >= 2)
0022         return false;
0023     else if (!m_showTotal && sourceColumn < 2)
0024         return false;
0025     return true;
0026 }
0027 
0028 #include "moc_chartproxy.cpp"