Qt Utilities 6.18.1
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Loading...
Searching...
No Matches
qtsettings.h
Go to the documentation of this file.
1#ifndef DIALOGS_QT_UTILITIES_QTSETTINGS_H
2#define DIALOGS_QT_UTILITIES_QTSETTINGS_H
3
4#include "../global.h"
5
6#if defined(QT_UTILITIES_GUI_QTWIDGETS)
7#include "./optionpage.h"
8#endif
9
10#include <QtGlobal>
11
12#include <memory>
13
14QT_FORWARD_DECLARE_CLASS(QFontDialog)
15QT_FORWARD_DECLARE_CLASS(QSettings)
16
17namespace QtUtilities {
18
19class OptionCategory;
20struct QtSettingsData;
21
22#if defined(QT_UTILITIES_GUI_QTWIDGETS)
24public:
25explicit QtAppearanceOptionPage(QtSettingsData &settings, QWidget *parentWidget = nullptr);
26
27private:
29QtSettingsData & m_settings;
30QFontDialog *m_fontDialog;
32
34public:
35explicit QtLanguageOptionPage(QtSettingsData &settings, QWidget *parentWidget = nullptr);
36
37private:
39QtSettingsData & m_settings;
41
43public:
44explicit QtEnvOptionPage(QtSettingsData &settings, QWidget *parentWidget = nullptr);
45
46private:
48QtSettingsData & m_settings;
50#endif
51
53public:
54 QtSettings();
56
57#if defined(QT_UTILITIES_GUI_QTWIDGETS)
58 void disableNotices();
59 void setRetranslatable(bool retranslatable);
60#endif
61 void restore(QSettings &settings);
62 void save(QSettings &settings) const;
63 void apply();
66 bool isPaletteDark();
67 bool hasCustomFont() const;
68 bool hasLocaleChanged() const;
69 operator QtSettingsData &() const;
70
72
73private:
74 std::unique_ptr<QtSettingsData> m_d;
75};
76} // namespace QtUtilities
77
78#if defined(QT_UTILITIES_GUI_QTWIDGETS)
79DECLARE_EXTERN_UI_FILE_BASED_OPTION_PAGE(QtAppearanceOptionPage)
82#endif
83
84#endif // DIALOGS_QT_UTILITIES_QTSETTINGS_H
The OptionCategory class wraps associated option pages.
void save(QSettings &settings) const
Saves the settings to the specified QSettings object.
OptionCategory * category()
QtSettings()
Creates a new settings object.
void reapplyDefaultIconTheme(bool isPaletteDark)
Re-applies default icon theme assuming the palette is dark or not depending on isPaletteDark.
void restore(QSettings &settings)
Restores the settings from the specified QSettings object.
bool hasLocaleChanged() const
Returns whether the last apply() call has changed the default locale.
bool isPaletteDark()
Returns whether the palette is dark.
bool hasCustomFont() const
Returns whether a custom font is set.
void apply()
Applies the current configuration.
void reevaluatePaletteAndDefaultIconTheme()
Re-evaluates whether the palette is dark and re-applies default icon theme.
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.
Definition global.h:14
#define DECLARE_EXTERN_UI_FILE_BASED_OPTION_PAGE(SomeClass)
Declares external instantiation of class declared with BEGIN_DECLARE_UI_FILE_BASED_OPTION_PAGE in a c...
Definition optionpage.h:271
#define BEGIN_DECLARE_UI_FILE_BASED_OPTION_PAGE_CUSTOM_CTOR(SomeClass)
Declares a class inheriting from Dialogs::UiFileBasedOptionPage in a convenient way.
Definition optionpage.h:215
#define END_DECLARE_OPTION_PAGE
Must be used after BEGIN_DECLARE_OPTION_PAGE and BEGIN_DECLARE_UI_FILE_BASED_OPTION_PAGE.
Definition optionpage.h:241
#define DECLARE_SETUP_WIDGETS
Declares the method setupWidget() in a convenient way.
Definition optionpage.h:300