Qt Utilities  5.7.0
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
optioncategory.cpp
Go to the documentation of this file.
1 #include "./optioncategory.h"
2 #include "./optionpage.h"
3 
4 namespace Dialogs {
5 
15  : QObject(parent)
16  , m_currentIndex(0)
17 {
18 }
19 
24 {
25  qDeleteAll(m_pages);
26 }
27 
33 {
34  for (OptionPage *page : m_pages) {
35  if (!page->apply()) {
36  return false;
37  }
38  }
39  return true;
40 }
41 
47 {
48  for (OptionPage *page : m_pages) {
49  page->reset();
50  }
51 }
52 
57 bool OptionCategory::matches(const QString &searchKeyWord) const
58 {
59  for (OptionPage *page : m_pages) {
60  if (page->matches(searchKeyWord)) {
61  return true;
62  }
63  }
64  return false;
65 }
66 
73 void OptionCategory::assignPages(const QList<OptionPage *> pages)
74 {
75  qDeleteAll(m_pages);
76  m_pages = pages;
77  emit pagesChanged();
78 }
79 
94 }
The OptionPage class is the base class for SettingsDialog pages.
Definition: optionpage.h:15
void assignPages(const QList< OptionPage *> pages)
Assigns the specified pages to the category.
bool applyAllPages()
Applies all pages.
Provides common dialogs such as AboutDialog, EnterPasswordDialog and SettingsDialog.
Definition: dialogutils.h:12
void resetAllPages()
Resets all pages.
void pagesChanged()
Emitted when the pages changed.
bool matches(const QString &searchKeyWord) const
Returns whether the option category matches the specified searchKeyWord.
const QList< OptionPage * > pages() const
~OptionCategory()
Destroys the option category.
OptionCategory(QObject *parent=nullptr)
Constructs a option category.