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-2025 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 <QObject>
18#include <QString>
19#include <Qt>
20#include "../drivers/cswordmoduleinfo.h"
21
22
23class QModelIndex;
24
26
27 Q_OBJECT
28
29public: // methods:
30
31 BtBookshelfFilterModel(QObject * parent = nullptr);
32
33 bool enabled() const noexcept { return m_enabled; }
34
35 bool filterAcceptsRow(int row, QModelIndex const & parent) const override;
36
37 int nameFilterRole() const noexcept { return m_nameFilterRole; }
38 int nameFilterKeyColumn() const noexcept { return m_nameFilterColumn; }
39 QString const & nameFilter() const noexcept { return m_nameFilter; }
40 Qt::CaseSensitivity nameFilterCase() const noexcept
41 { return m_nameFilterCase; }
42
43 int hiddenFilterRole() const noexcept { return m_hiddenFilterRole; }
45 bool showHidden() const noexcept { return m_showHidden; }
46 bool showShown() const noexcept { return m_showShown; }
47
48public Q_SLOTS:
49
50 void setEnabled(bool enable);
51
52 // Name filter:
53 void setNameFilterRole(int role);
54 void setNameFilterKeyColumn(int column);
55 void setNameFilterFixedString(QString const & nameFilter);
56 void setNameFilterCase(Qt::CaseSensitivity value);
57
58 // Hidden filter:
59 void setHiddenFilterRole(int role);
60 void setHiddenFilterKeyColumn(int column);
61 void setShowHidden(bool show);
62 void setShowShown(bool show);
63
64private: // methods:
65
66 bool nameFilterAcceptsRow(int row, QModelIndex const & parent) const;
67 bool hiddenFilterAcceptsRow(int row, QModelIndex const & parent) const;
68
69private: // fields:
70
72
73 // Name filter:
74 QString m_nameFilter;
77 Qt::CaseSensitivity m_nameFilterCase;
78
79 // Hidden filter:
84
85};
int hiddenFilterRole() const noexcept
void setNameFilterKeyColumn(int column)
bool nameFilterAcceptsRow(int row, QModelIndex const &parent) const
bool showHidden() const noexcept
void setHiddenFilterKeyColumn(int column)
bool filterAcceptsRow(int row, QModelIndex const &parent) const override
bool enabled() const noexcept
int nameFilterRole() const noexcept
bool hiddenFilterAcceptsRow(int row, QModelIndex const &parent) const
void setNameFilterCase(Qt::CaseSensitivity value)
Qt::CaseSensitivity m_nameFilterCase
int nameFilterKeyColumn() const noexcept
void setNameFilterFixedString(QString const &nameFilter)
QString const & nameFilter() const noexcept
Qt::CaseSensitivity nameFilterCase() const noexcept
bool showShown() const noexcept