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