QSettingsDialog  1.0.0
A Qt library to easily create a settings dialog for user configurable settings
qsettingsdialog.h
1 #ifndef QSETTINGSDIALOG_H
2 #define QSETTINGSDIALOG_H
3 
4 #include "qsettingsdialog_global.h"
5 #include <QObject>
6 #include <QString>
7 #include <QIcon>
8 #include <QScopedPointer>
9 #include "exceptions.h"
10 #include "qsettingsentry.h"
12 class QSettingsContainer;
13 
14 class QSettingsDialogPrivate;
16 class QSETTINGSDIALOGSHARED_EXPORT QSettingsDialog : public QObject
17 {
18  Q_OBJECT
19  friend class QSettingsDialogPrivate;
20 
21 public:
23  explicit QSettingsDialog(QObject *parent = nullptr);
25  explicit QSettingsDialog(QSettingsDisplayEngine *engine, QObject *parent = nullptr);
27  ~QSettingsDialog();
28 
30  QSettingsDisplayEngine *displayEngine() const;
32  void setDisplayEngine(QSettingsDisplayEngine *engine);
33 
34  //container organisation - getters
36  QString containerPath() const;
38  QString sectionContainerPath() const;
40  QString categoryId() const;
42  QString sectionId() const;
44  QString groupId() const;
45 
46  //container organisation - setters
48  void setCategory(const QString &id,
49  const QString &name = QString(),
50  const QIcon &icon = QIcon(),
51  const QString &tooltip = QString());
53  void setSection(const QString &id,
54  const QString &name = QString(),
55  const QIcon &icon = QIcon(),
56  const QString &tooltip = QString());
58  void setGroup(const QString &id,
59  int displayId = -1,
60  const QString &name = QString(),
61  int optional = -1,
62  const QString &tooltip = QString());
64  void unsetGroup();
65 
67  void setContainer(const QString &containerPath);
69  bool removeContainer(const QString &containerPath);
70 
72  QSettingsContainer *currentContainer(QObject *parent = nullptr);
74  QSettingsContainer *currentContainerAsync(QObject *parent = nullptr);
76  QSettingsContainer *currentSectionContainer(QObject *parent = nullptr);
78  QSettingsContainer *currentSectionContainerAsync(QObject *parent = nullptr);
79 
80  //entry organisation
82  int appendEntry(QSettingsEntry *entry);
84  int appendEntry(const QString &containerPath, QSettingsEntry *entry);
86  int prependEntry(QSettingsEntry *entry);
88  int prependEntry(const QString &containerPath, QSettingsEntry *entry);
89 
91  QSharedPointer<QSettingsEntry> getEntry(int id) const;
93  QString getEntryPath(int id) const;
95  bool removeEntry(int id);
96 
97  //helper
99  static QString createContainerPath(QString category = QString(),
100  QString section = QString(),
101  QString group = QString());
102 
103 public slots:
105  void openSettings(QWidget *parentWindow = nullptr);
107  int execSettings(QWidget *parentWindow = nullptr);
108 
109 signals:
111  void saved(bool closed);
113  void resetted();
115  void canceled();
116 
117 private slots:
118  void completed(bool close = true);
119 
120 private:
122 };
123 
124 #endif // QSETTINGSDIALOG_H
[INTERNAL USE] An interface for an engine to create display dialogs
Definition: qsettingsdisplayengine.h:38
A generic class the defines methods for settings containers.
Definition: qsettingscontainer.h:13
Represents one settings entry within the settings dialog.
Definition: qsettingsentry.h:11
The main class that represents the dialog itself.
Definition: qsettingsdialog.h:16