File indexing completed on 2024-03-03 06:08:56

0001 /**
0002  * SPDX-FileCopyrightText: 2021 by Alexander Stippich <a.stippich@gmx.net>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #ifndef FILTERED_OPTIONS_MODEL_H
0008 #define FILTERED_OPTIONS_MODEL_H
0009 
0010 #include <QSortFilterProxyModel>
0011 
0012 class FilteredOptionsModel : public QSortFilterProxyModel
0013 {
0014 
0015     Q_OBJECT
0016 
0017 public:
0018 
0019     explicit FilteredOptionsModel(QObject *parent = nullptr);
0020 
0021     ~FilteredOptionsModel() override;
0022 
0023     Q_INVOKABLE void showAllOptions(bool show);
0024 
0025 protected:
0026 
0027     bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
0028 
0029 private:
0030     bool m_showAllOptions = true;
0031 };
0032 
0033 #endif // FILTERED_OPTIONS_MODEL_H