Qt Utilities  5.6.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 
23 {
24  qDeleteAll(m_pages);
25 }
26 
32 {
33  for(OptionPage *page : m_pages) {
34  if(!page->apply()) {
35  return false;
36  }
37  }
38  return true;
39 }
40 
46 {
47  for(OptionPage *page : m_pages) {
48  page->reset();
49  }
50 }
51 
55 bool OptionCategory::matches(const QString &searchKeyWord) const
56 {
57  for(OptionPage *page : m_pages) {
58  if(page->matches(searchKeyWord)) {
59  return true;
60  }
61  }
62  return false;
63 }
64 
71 void OptionCategory::assignPages(const QList<OptionPage *> pages)
72 {
73  qDeleteAll(m_pages);
74  m_pages = pages;
75  emit pagesChanged();
76 }
77 
93 }
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.