Qt Utilities  6.4.1
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
settingsdialog.h
Go to the documentation of this file.
1 #ifndef DIALOGS_SETTINGSDIALOG_H
2 #define DIALOGS_SETTINGSDIALOG_H
3 
4 #include "../global.h"
5 
6 #include <QDialog>
7 
8 #include <memory>
9 
10 namespace QtUtilities {
11 
12 class OptionCategoryModel;
13 class OptionCategoryFilterModel;
14 class OptionCategory;
15 class OptionPage;
16 
17 namespace Ui {
18 class SettingsDialog;
19 }
20 
21 class QT_UTILITIES_EXPORT SettingsDialog : public QDialog {
22  Q_OBJECT
23  Q_PROPERTY(bool tabBarAlwaysVisible READ isTabBarAlwaysVisible WRITE setTabBarAlwaysVisible)
24 
25 public:
26  explicit SettingsDialog(QWidget *parent = nullptr);
27  ~SettingsDialog() override;
28  bool isTabBarAlwaysVisible() const;
29  void setTabBarAlwaysVisible(bool value);
30  OptionCategoryModel *categoryModel();
31  OptionCategory *category(int categoryIndex) const;
32  OptionPage *page(int categoryIndex, int pageIndex) const;
33  void showCategory(OptionCategory *category);
34  void setSingleCategory(OptionCategory *singleCategory);
35 
36 Q_SIGNALS:
37  void applied();
38  void resetted();
39 
40 protected:
41  void showEvent(QShowEvent *event) override;
42 
43 private Q_SLOTS:
44  void currentCategoryChanged(const QModelIndex &index);
45  void updateTabWidget();
46 
47  bool apply();
48  void reset();
49 
50 private:
51  std::unique_ptr<Ui::SettingsDialog> m_ui;
52  OptionCategoryModel *m_categoryModel;
53  OptionCategoryFilterModel *m_categoryFilterModel;
54  OptionCategory *m_currentCategory;
55  bool m_tabBarAlwaysVisible;
56 };
57 
66 {
67  return m_tabBarAlwaysVisible;
68 }
69 
75 {
76  return m_categoryModel;
77 }
78 } // namespace QtUtilities
79 
80 #endif // DIALOGS_SETTINGSDIALOG_H
The OptionCategoryFilterModel class is used by SettingsDialog to filter option categories.
The OptionCategoryModel class is used by SettingsDialog to store and display option categories.
The OptionCategory class wraps associated option pages.
The OptionPage class is the base class for SettingsDialog pages.
Definition: optionpage.h:15
The SettingsDialog class provides a framework for creating settings dialogs with different categories...
OptionCategoryModel * categoryModel()
Returns the category model used by the settings dialog to manage the categories.
bool isTabBarAlwaysVisible() const
Returns whether the tab bar is always visible.
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.