Qt Utilities
6.14.4
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Loading...
Searching...
No Matches
settingsdialog
optioncategory.cpp
Go to the documentation of this file.
1
#include "
./optioncategory.h
"
2
#include "
./optionpage.h
"
3
4
#include <QCoreApplication>
5
#include <QEvent>
6
7
namespace
QtUtilities
{
8
17
OptionCategory::OptionCategory
(QObject *parent)
18
: QObject(parent)
19
, m_currentIndex(0)
20
{
21
}
22
26
OptionCategory::~OptionCategory
()
27
{
28
qDeleteAll(m_pages);
29
}
30
37
bool
OptionCategory::applyAllPages
()
38
{
39
for
(
OptionPage
*page : m_pages) {
40
if
(!page->hasBeenShown()) {
41
continue
;
42
}
43
if
(!page->apply()) {
44
return
false
;
45
}
46
}
47
return
true
;
48
}
49
56
void
OptionCategory::resetAllPages
()
57
{
58
for
(
OptionPage
*page : m_pages) {
59
if
(page->hasBeenShown()) {
60
page->reset();
61
}
62
}
63
}
64
69
void
OptionCategory::retranslateAllPages
()
70
{
71
auto
event
= QEvent(QEvent::LanguageChange);
72
for
(
auto
*
const
page : m_pages) {
73
if
(page->hasBeenShown()) {
74
QCoreApplication::sendEvent(page->widget(), &event);
75
}
76
}
77
}
78
83
bool
OptionCategory::matches
(
const
QString &searchKeyWord)
const
84
{
85
for
(
OptionPage
*page : m_pages) {
86
if
(page->matches(searchKeyWord)) {
87
return
true
;
88
}
89
}
90
return
false
;
91
}
92
99
void
OptionCategory::assignPages
(
const
QList<OptionPage *> &pages)
100
{
101
qDeleteAll(m_pages);
102
emit
pagesChanged
(m_pages =
pages
);
103
}
104
119
}
// namespace QtUtilities
QtUtilities::OptionCategory::matches
bool matches(const QString &searchKeyWord) const
Returns whether the option category matches the specified searchKeyWord.
Definition
optioncategory.cpp:83
QtUtilities::OptionCategory::OptionCategory
OptionCategory(QObject *parent=nullptr)
Constructs a option category.
Definition
optioncategory.cpp:17
QtUtilities::OptionCategory::resetAllPages
void resetAllPages()
Resets all pages.
Definition
optioncategory.cpp:56
QtUtilities::OptionCategory::assignPages
void assignPages(const QList< OptionPage * > &pages)
Assigns the specified pages to the category.
Definition
optioncategory.cpp:99
QtUtilities::OptionCategory::retranslateAllPages
void retranslateAllPages()
Triggers retranslation of all pages.
Definition
optioncategory.cpp:69
QtUtilities::OptionCategory::pages
QList< OptionPage * > pages
Definition
optioncategory.h:22
QtUtilities::OptionCategory::pagesChanged
void pagesChanged(const QList< QtUtilities::OptionPage * > &pages)
Emitted when the pages changed.
QtUtilities::OptionCategory::~OptionCategory
~OptionCategory() override
Destroys the option category.
Definition
optioncategory.cpp:26
QtUtilities::OptionCategory::applyAllPages
bool applyAllPages()
Applies all pages.
Definition
optioncategory.cpp:37
QtUtilities::OptionPage
The OptionPage class is the base class for SettingsDialog pages.
Definition
optionpage.h:34
QtUtilities
!
Definition
trylocker.h:8
optioncategory.h
optionpage.h
Generated on Tue Dec 3 2024 16:57:40 for Qt Utilities by
1.12.0