Qt Utilities 6.14.0
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Loading...
Searching...
No Matches
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
10namespace QtUtilities {
11
12class OptionCategoryModel;
13class OptionCategoryFilterModel;
14class OptionCategory;
15class OptionPage;
16
17namespace Ui {
18class SettingsDialog;
19}
20
21class QT_UTILITIES_EXPORT SettingsDialog : public QDialog {
22 Q_OBJECT
23 Q_PROPERTY(bool tabBarAlwaysVisible READ isTabBarAlwaysVisible WRITE setTabBarAlwaysVisible)
24
25public:
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 translateCategory(OptionCategory *category, const std::function<QString()> &translator);
35 void setSingleCategory(OptionCategory *singleCategory);
36 QWidget *cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const;
37 void setCornerWidget(QWidget *widget, Qt::Corner corner = Qt::TopRightCorner);
38 void addHeadingWidget(QWidget *widget);
39 void selectPage(int categoryIndex, int pageIndex);
40
41public Q_SLOTS:
42 bool apply();
43 void reset();
44
45Q_SIGNALS:
46 void applied();
47 void resetted();
49
50protected:
51 bool event(QEvent *event) override;
52 void showEvent(QShowEvent *event) override;
53
54private Q_SLOTS:
55 void currentCategoryChanged(const QModelIndex &index);
56 void updateTabWidget();
57 void retranslateTabWidget();
58
59private:
60 std::unique_ptr<Ui::SettingsDialog> m_ui;
61 OptionCategoryModel *m_categoryModel;
62 OptionCategoryFilterModel *m_categoryFilterModel;
63 OptionCategory *m_currentCategory;
64 bool m_tabBarAlwaysVisible;
65};
66
75{
76 return m_tabBarAlwaysVisible;
77}
78
84{
85 return m_categoryModel;
86}
87} // namespace QtUtilities
88
89#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:34
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.
Definition global.h:14