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
optioncategory.h
Go to the documentation of this file.
1#ifndef DIALOGS_OPTIONSCATEGORY_H
2#define DIALOGS_OPTIONSCATEGORY_H
3
4#include "../global.h"
5
6#include <QIcon>
7#include <QList>
8#include <QObject>
9
10#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
11Q_MOC_INCLUDE("settingsdialog/optionpage.h")
12#endif
13
14namespace QtUtilities {
15
16class OptionPage;
17
18class QT_UTILITIES_EXPORT OptionCategory : public QObject {
19 Q_OBJECT
20 Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged)
21 Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY iconChanged)
22 Q_PROPERTY(QList<OptionPage *> pages READ pages WRITE assignPages NOTIFY pagesChanged)
23
24public:
25 explicit OptionCategory(QObject *parent = nullptr);
26 ~OptionCategory() override;
27
28 const QString &displayName() const;
29 void setDisplayName(const QString &displayName);
30 const QIcon &icon() const;
31 void setIcon(const QIcon &icon);
32 const QList<OptionPage *> &pages() const;
33 void assignPages(const QList<OptionPage *> &pages);
34 bool applyAllPages();
35 void resetAllPages();
36 void retranslateAllPages();
37 bool matches(const QString &searchKeyWord) const;
38 int currentIndex() const;
39 void setCurrentIndex(int currentIndex);
40
41Q_SIGNALS:
42 void displayNameChanged(const QString &displayName);
43 void iconChanged(const QIcon &icon);
44 void pagesChanged(const QList<QtUtilities::OptionPage *> &pages);
45
46private:
47 QString m_displayName;
48 QIcon m_icon;
49 QList<OptionPage *> m_pages;
50 int m_currentIndex;
51};
52
56inline const QString &OptionCategory::displayName() const
57{
58 return m_displayName;
59}
60
64inline void OptionCategory::setDisplayName(const QString &displayName)
65{
66 emit displayNameChanged(m_displayName = displayName);
67}
68
72inline const QIcon &OptionCategory::icon() const
73{
74 return m_icon;
75}
76
80inline void OptionCategory::setIcon(const QIcon &icon)
81{
82 emit iconChanged(m_icon = icon);
83}
84
88inline const QList<OptionPage *> &OptionCategory::pages() const
89{
90 return m_pages;
91}
92
98inline int OptionCategory::currentIndex() const
99{
100 return m_currentIndex;
101}
102
107inline void OptionCategory::setCurrentIndex(int currentIndex)
108{
109 m_currentIndex = currentIndex;
110}
111} // namespace QtUtilities
112
113#endif // DIALOGS_OPTIONSCATEGORY_H
The OptionCategory class wraps associated option pages.
The OptionPage class is the base class for SettingsDialog pages.
Definition optionpage.h:34
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.
Definition global.h:14