BibleTime
btbookshelffiltermodel.h
Go to the documentation of this file.
1/*********
2*
3* In the name of the Father, and of the Son, and of the Holy Spirit.
4*
5* This file is part of BibleTime's source code, https://bibletime.info/
6*
7* Copyright 1999-2026 by the BibleTime developers.
8* The BibleTime source code is licensed under the GNU General Public License
9* version 2.0.
10*
11**********/
12
13#pragma once
14
15#include <QSortFilterProxyModel>
16
17#include <optional>
18#include <QString>
19#include "../drivers/cswordmoduleinfo.h"
20
21
22class QModelIndex;
23
25
26 Q_OBJECT
27
28public: // methods:
29
30 BtBookshelfFilterModel(QObject * parent = nullptr);
31
32 bool filterAcceptsRow(int row, QModelIndex const & parent) const override;
33
34 QString const & nameFilter() const noexcept { return m_nameFilter; }
35
36 bool showHidden() const noexcept { return m_showHidden; }
37
38 std::optional<CSwordModuleInfo::ModuleType> const &
39 moduleChooserType() const noexcept { return m_moduleChooserType; }
40
41 CSwordModuleInfo * module(QModelIndex const & index) const noexcept;
42
43public Q_SLOTS:
44
45 void setNameFilterFixedString(QString const & nameFilter);
46 void setShowHidden(bool show);
47 void setModuleChooserType(std::optional<CSwordModuleInfo::ModuleType> type);
48
49private: // methods:
50
51 template <typename Field, typename Value>
52 void changeFilter(Field & field, Value && value);
53
54private: // fields:
55
56 QString m_nameFilter;
58 std::optional<CSwordModuleInfo::ModuleType> m_moduleChooserType;
59
60};
std::optional< CSwordModuleInfo::ModuleType > m_moduleChooserType
CSwordModuleInfo * module(QModelIndex const &index) const noexcept
bool showHidden() const noexcept
void changeFilter(Field &field, Value &&value)
bool filterAcceptsRow(int row, QModelIndex const &parent) const override
std::optional< CSwordModuleInfo::ModuleType > const & moduleChooserType() const noexcept
void setNameFilterFixedString(QString const &nameFilter)
void setModuleChooserType(std::optional< CSwordModuleInfo::ModuleType > type)
QString const & nameFilter() const noexcept