File indexing completed on 2024-05-12 16:42:19

0001 /*
0002     SPDX-FileCopyrightText: 2014 Christian Dávid <christian-david@web.de>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef ONLINEBANKINGACCOUNTSFILTERPROXYMODEL_H
0007 #define ONLINEBANKINGACCOUNTSFILTERPROXYMODEL_H
0008 
0009 #include "kmm_models_export.h"
0010 #include <QSortFilterProxyModel>
0011 
0012 class KMM_MODELS_EXPORT OnlineBankingAccountsFilterProxyModel : public QSortFilterProxyModel
0013 {
0014     Q_OBJECT
0015 
0016 public:
0017     explicit OnlineBankingAccountsFilterProxyModel(QObject* parent = 0);
0018 
0019     /**
0020      * @brief Makes accounts which do not support any onlineJob non-selectable
0021      */
0022     Qt::ItemFlags flags(const QModelIndex& index) const override;
0023 
0024 protected:
0025     bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const final override;
0026 
0027 private:
0028     /**
0029      * @brief Has parent at least one visible child?
0030      */
0031     bool filterAcceptsParent(const QModelIndex& index) const;
0032 };
0033 
0034 #endif // ONLINEBANKINGACCOUNTSFILTERPROXYMODEL_H