Qt Utilities 6.12.0
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Loading...
Searching...
No Matches
optioncategory.cpp
Go to the documentation of this file.
1#include "./optioncategory.h"
2#include "./optionpage.h"
3
4namespace QtUtilities {
5
15 : QObject(parent)
16 , m_currentIndex(0)
17{
18}
19
24{
25 qDeleteAll(m_pages);
26}
27
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
54{
55 for (OptionPage *page : m_pages) {
56 if (page->hasBeenShown()) {
57 page->reset();
58 }
59 }
60}
61
66bool 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
82void OptionCategory::assignPages(const QList<OptionPage *> &pages)
83{
84 qDeleteAll(m_pages);
85 emit pagesChanged(m_pages = pages);
86}
87
102} // namespace QtUtilities
void pagesChanged(const QList< QtUtilities::OptionPage * > &pages)
Emitted when the pages changed.
bool matches(const QString &searchKeyWord) const
Returns whether the option category matches the specified searchKeyWord.
OptionCategory(QObject *parent=nullptr)
Constructs a option category.
void resetAllPages()
Resets all pages.
void assignPages(const QList< OptionPage * > &pages)
Assigns the specified pages to the category.
QList< OptionPage * > pages
~OptionCategory() override
Destroys the option category.
bool applyAllPages()
Applies all pages.
The OptionPage class is the base class for SettingsDialog pages.
Definition: optionpage.h:33