File indexing completed on 2024-05-19 05:06:57
0001 /* 0002 SPDX-FileCopyrightText: 2019 Thomas Baumgart <tbaumgart@kde.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef INSTITUTIONSPROXYMODEL_H 0007 #define INSTITUTIONSPROXYMODEL_H 0008 0009 #include "kmm_models_export.h" 0010 0011 // ---------------------------------------------------------------------------- 0012 // QT Includes 0013 0014 // ---------------------------------------------------------------------------- 0015 // KDE Includes 0016 0017 // ---------------------------------------------------------------------------- 0018 // Project Includes 0019 0020 #include "accountsproxymodel.h" 0021 0022 /** 0023 * A proxy model to provide various sorting and filtering operations for @ref institutionsModel. 0024 * 0025 * Here is an example of how to use this class in combination with the @ref institutionsModel. 0026 * (in the example @a widget is a pointer to a model/view widget): 0027 * 0028 * @code 0029 * InstitutionsFilterProxyModel *filterModel = new InstitutionsFilterProxyModel(widget); 0030 * filterModel->setSourceModel(MyMoneyFile::instance()->institutionsModel()); 0031 * filterModel->sort(0); 0032 * 0033 * widget->setModel(filterModel); 0034 * @endcode 0035 * 0036 * @sa institutionsModel 0037 * 0038 * @author Thomas Baumgart 0039 * 0040 */ 0041 0042 class KMM_MODELS_EXPORT InstitutionsProxyModel : public AccountsProxyModel 0043 { 0044 Q_OBJECT 0045 Q_DISABLE_COPY(InstitutionsProxyModel) 0046 0047 public: 0048 explicit InstitutionsProxyModel(QObject *parent = nullptr); 0049 virtual ~InstitutionsProxyModel(); 0050 0051 protected: 0052 bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; 0053 bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; 0054 }; 0055 0056 #endif