Qt Utilities
6.4.1
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
settingsdialog
optioncategory.cpp
Go to the documentation of this file.
1
#include "
./optioncategory.h
"
2
#include "
./optionpage.h
"
3
4
namespace
QtUtilities
{
5
14
OptionCategory::OptionCategory
(QObject *parent)
15
: QObject(parent)
16
, m_currentIndex(0)
17
{
18
}
19
23
OptionCategory::~OptionCategory
()
24
{
25
qDeleteAll(m_pages);
26
}
27
34
bool
OptionCategory::applyAllPages
()
35
{
36
for
(
OptionPage
*page : m_pages) {
37
if
(!page->hasBeenShown()) {
38
continue
;
39
}
40
if
(!page->apply()) {
41
return
false
;
42
}
43
}
44
return
true
;
45
}
46
53
void
OptionCategory::resetAllPages
()
54
{
55
for
(
OptionPage
*page : m_pages) {
56
if
(page->hasBeenShown()) {
57
page->reset();
58
}
59
}
60
}
61
66
bool
OptionCategory::matches
(
const
QString &searchKeyWord)
const
67
{
68
for
(
OptionPage
*page : m_pages) {
69
if
(page->matches(searchKeyWord)) {
70
return
true
;
71
}
72
}
73
return
false
;
74
}
75
82
void
OptionCategory::assignPages
(
const
QList<OptionPage *> &pages)
83
{
84
qDeleteAll(m_pages);
85
emit
pagesChanged
(m_pages =
pages
);
86
}
87
102
}
// namespace QtUtilities
QtUtilities::OptionCategory::matches
bool matches(const QString &searchKeyWord) const
Returns whether the option category matches the specified searchKeyWord.
Definition:
optioncategory.cpp:66
QtUtilities::OptionCategory::OptionCategory
OptionCategory(QObject *parent=nullptr)
Constructs a option category.
Definition:
optioncategory.cpp:14
QtUtilities::OptionCategory::resetAllPages
void resetAllPages()
Resets all pages.
Definition:
optioncategory.cpp:53
QtUtilities::OptionCategory::assignPages
void assignPages(const QList< OptionPage * > &pages)
Assigns the specified pages to the category.
Definition:
optioncategory.cpp:82
QtUtilities::OptionCategory::pages
QList< OptionPage * > pages
Definition:
optioncategory.h:22
QtUtilities::OptionCategory::~OptionCategory
~OptionCategory() override
Destroys the option category.
Definition:
optioncategory.cpp:23
QtUtilities::OptionCategory::pagesChanged
void pagesChanged(const QList< OptionPage * > &pages)
Emitted when the pages changed.
QtUtilities::OptionCategory::applyAllPages
bool applyAllPages()
Applies all pages.
Definition:
optioncategory.cpp:34
QtUtilities::OptionPage
The OptionPage class is the base class for SettingsDialog pages.
Definition:
optionpage.h:15
QtUtilities
!
Definition:
trylocker.h:8
optioncategory.h
optionpage.h
Generated on Tue May 4 2021 23:02:23 for Qt Utilities by
1.9.1