QSettingsDialog  1.0.0
A Qt library to easily create a settings dialog for user configurable settings
qsettingslayout.h
1 #ifndef QSETTINGSLAYOUT_H
2 #define QSETTINGSLAYOUT_H
3 
4 #include "qsettingsdialog_global.h"
5 #include "exceptions.h"
6 #include <QObject>
7 #include <QList>
8 #include <QIcon>
9 #include <QSharedPointer>
10 class QSettingsDialog;
11 class QSettingsContainer;
12 
13 class QSettingsLayoutPrivate;
15 class QSETTINGSDIALOGSHARED_EXPORT QSettingsLayout
16 {
17  friend class SettingsEntryLayout;
18  friend class SettingsGroupLayout;
19  friend class SettingsSectionLayout;
20  friend class SettingsCategoryLayout;
21  friend class SettingsRootLayout;
22 
23 public:
25  enum LayoutType {
30  EntryLayout
31  };
32 
34  explicit QSettingsLayout(QSettingsDialog *settingsDialog, bool fromCurrentContainer = false);
36  explicit QSettingsLayout(QSettingsDialog *settingsDialog, const QString &containerPath, int entryId = -1);
38  explicit QSettingsLayout(QSettingsContainer *container);
39 
41  QString id() const;
43  LayoutType layoutType() const;
45  bool isNull() const;
46 
48  QSettingsDialog *dialog() const;
50  QString containerPath() const;
51 
53  QSettingsLayout parentContainer() const;
54 
56  int displayId() const;
58  void setDisplayId(int displayId);
60  QString name() const;
62  void setName(const QString &name);
64  QIcon icon() const;
66  void setIcon(const QIcon &icon);
68  QString tooltip() const;
70  void setTooltip(const QString &tooltip);
72  bool isOptional() const;
74  void setOptional(bool optional);
75 
77  QSettingsLayout defaultElement(bool allowCreateNew = false) const;
79  bool removeDefaultElement();
80 
82  int elementCount() const;
84  QSettingsLayout elementAt(int index) const;
86  int indexOfElement(const QSettingsLayout &element) const;
88  int indexOfElement(const QString &elementName) const;
90  QSettingsLayout createElement(int index,
91  const QString &id,
92  const QString &name = QString(),
93  const QIcon &icon = QIcon(),
94  const QString &tooltip = QString());
96  QSettingsLayout createGroupElement(int index,
97  const QString &id,
98  int displayId = 0,
99  const QString &name = QString(),
100  bool optional = false,
101  const QString &tooltip = QString());
103  void removeElement(int index);
105  void moveElement(int indexFrom, int indexTo);
106 
108  void transferElement(int indexFrom, QSettingsLayout targetLayout, int indexTo);
109 
110 private:
112 
113  QSettingsLayout(QSettingsLayoutPrivate *d_ptr);
114 };
115 
116 #endif // QSETTINGSLAYOUT_H
The layout represents a group.
Definition: qsettingslayout.h:29
The layout represents a section.
Definition: qsettingslayout.h:28
A generic class the defines methods for settings containers.
Definition: qsettingscontainer.h:13
The layout represents a category.
Definition: qsettingslayout.h:27
LayoutType
Defines the different elements a layout can be created for.
Definition: qsettingslayout.h:25
A general class to modifiy the appereance of elements of a settings dialog.
Definition: qsettingslayout.h:15
The main class that represents the dialog itself.
Definition: qsettingsdialog.h:16
The layout represents the dialog itself.
Definition: qsettingslayout.h:26