QSettingsDialog  1.0.0
A Qt library to easily create a settings dialog for user configurable settings
qsettingswidgetdialogengine.h
1 #ifndef QSETTINGSWIDGETDIALOGENGINE_H
2 #define QSETTINGSWIDGETDIALOGENGINE_H
3 
4 #include "qsettingsdialog_global.h"
5 #include "qsettingsdisplayengine.h"
6 #include "qsettingswidgetfactoryregistry.h"
7 #include "qsettingsgroupwidgetfactory.h"
8 #include "qsettingsentry.h"
9 #include <QScopedPointer>
10 
11 class QSettingsWidgetDialogEnginePrivate;
13 class QSETTINGSDIALOGSHARED_EXPORT QSettingsWidgetDialogEngine : public QSettingsDisplayEngine
14 {
15 public:
20 
22 
24  QString searchStyleSheet() const;
25 
27  void addFactory(int displayId, QSettingsWidgetFactory *factory);
29  template<typename TSettingsWidget>
30  void addWidgetType(int displayId);
31 
33  void addGroupFactory(int displayId, QSettingsGroupWidgetFactory *factory, const UiPropertyMap &properties = UiPropertyMap());
35  template<typename TSettingsGroupWidget>
36  void addGroupWidgetType(int displayId, const UiPropertyMap &properties = UiPropertyMap());
38  void cloneGroupFactoryWithProperties(int originalId, int cloneId, const UiPropertyMap &properties);
39 
41  QSettingsWidgetBase *createWidget(int displayId,
42  const UiPropertyMap &properties,
43  QWidget *parent) const;
45  QSettingsGroupWidgetBase *createGroupWidget(int displayId,
46  QWidget *parent) const;
47 
49  static void registerGlobalFactory(int displayId, QSettingsWidgetFactory *factory);
51  template<typename TSettingsWidget>
52  static void registerGlobalWidgetType(int displayId);
53 
55  static void registerGlobalGroupFactory(int displayId, QSettingsGroupWidgetFactory *factory);
57  template<typename TSettingsGroupWidget>
58  static void registerGlobalGroupWidgetType(int displayId);
60  static void cloneGlobalGroupFactoryWithProperties(int originalId, int cloneId, const UiPropertyMap &properties);
61 
63  void addRegistry(QSettingsWidgetFactoryRegistry *registry);
65  static void registerGlobalRegistry(QSettingsWidgetFactoryRegistry *registry);
66 
67 private:
69 };
70 
71 template<typename TSettingsWidget>
73  this->addFactory(displayId, new GenericSettingsWidgetFactory<TSettingsWidget>());
74 }
75 
76 template<typename TSettingsGroupWidget>
77 void QSettingsWidgetDialogEngine::addGroupWidgetType(int displayId, const UiPropertyMap &properties) {
78  this->addGroupFactory(displayId, new GenericSettingsGroupWidgetFactory<TSettingsGroupWidget>(), properties);
79 }
80 
81 template<typename TSettingsWidget>
83  registerGlobalFactory(displayId, new GenericSettingsWidgetFactory<TSettingsWidget>());
84 }
85 
86 template<typename TSettingsGroupWidget>
88  registerGlobalGroupFactory(displayId, new GenericSettingsGroupWidgetFactory<TSettingsGroupWidget>());
89 }
90 
91 #endif // QSETTINGSWIDGETDIALOGENGINE_H
[INTERNAL USE] An interface for an engine to create display dialogs
Definition: qsettingsdisplayengine.h:38
The base class for a factory to create QSettingsWidgets.
Definition: qsettingswidgetfactory.h:8
A registry to load widget factories based on an id.
Definition: qsettingswidgetfactoryregistry.h:9
void addWidgetType(int displayId)
Adds a new settings widget factory with the given id to the default registry.
Definition: qsettingswidgetdialogengine.h:72
[INTERNAL USE] Generic base class for a factory to create QSettingsWidgets
Definition: qsettingsgroupwidgetfactory.h:20
[INTERNAL USE] Generic base class for a factory to create QSettingsWidgets
Definition: qsettingswidgetfactory.h:20
[INTERNAL USE] An interface for a display instance that can be controlled by the dialog ...
Definition: qsettingsdisplayengine.h:9
The base class for edit widgets in the settings dialog.
Definition: qsettingswidget.h:11
The base class for a factory to create QSettingsGroupWidgets.
Definition: qsettingsgroupwidgetfactory.h:8
The base class for group widgets in the settings dialog.
Definition: qsettingsgroupwidget.h:11
QHash< QString, QVariant > UiPropertyMap
a Hash for strings to variant, to provide properties for edit widgets
Definition: qsettingsdialog_global.h:42
static void registerGlobalGroupWidgetType(int displayId)
Adds a new settings group factory with the given id to the global groups.
Definition: qsettingswidgetdialogengine.h:87
The default engine implementation for the settings dialog.
Definition: qsettingswidgetdialogengine.h:13
void addGroupWidgetType(int displayId, const UiPropertyMap &properties=UiPropertyMap())
Adds a new group widget factory with the given id.
Definition: qsettingswidgetdialogengine.h:77
virtual QSettingsDisplayInstance * createInstance()=0
Creates a new display instance.
static void registerGlobalWidgetType(int displayId)
Adds a new settings widget factory with the given id to the global default registry.
Definition: qsettingswidgetdialogengine.h:82