QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
qgseditorwidgetregistry.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgseditorwidgetregistry.h
3  --------------------------------------
4  Date : 24.4.2013
5  Copyright : (C) 2013 Matthias Kuhn
6  Email : matthias dot kuhn at gmx dot ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSEDITORWIDGETREGISTRY_H
17 #define QGSEDITORWIDGETREGISTRY_H
18 
19 #include <QObject>
20 #include <QMap>
21 
22 #include "qgseditorwidgetfactory.h"
23 
24 class QgsMapLayer;
25 class QDomNode;
26 
30 class GUI_EXPORT QgsEditorWidgetRegistry : public QObject
31 {
32  Q_OBJECT
33 
34  public:
41  static QgsEditorWidgetRegistry* instance();
43 
58  QgsEditorWidgetWrapper* create( const QString& widgetId,
59  QgsVectorLayer* vl,
60  int fieldIdx,
61  const QgsEditorWidgetConfig& config,
62  QWidget* editor, QWidget* parent,
64 
75  QgsEditorConfigWidget* createConfigWidget( const QString& widgetId, QgsVectorLayer* vl, int fieldIdx, QWidget* parent );
76 
84  QString name( const QString& widgetId );
85 
91  const QMap<QString, QgsEditorWidgetFactory*>& factories();
92 
98  QgsEditorWidgetFactory* factory( const QString& widgetId );
99 
108  bool registerWidget( const QString& widgetId, QgsEditorWidgetFactory* widgetFactory );
109 
110  protected:
112 
113  private slots:
119  void readMapLayer( QgsMapLayer* mapLayer, const QDomElement& layerElem );
120 
130  Q_DECL_DEPRECATED const QString readLegacyConfig( QgsVectorLayer* vl, const QDomElement& layerElem, QgsEditorWidgetConfig& cfg );
131 
139  void writeMapLayer( QgsMapLayer* mapLayer, QDomElement& layerElem, QDomDocument& doc ) const;
140 
146  void mapLayerAdded( QgsMapLayer* mapLayer );
147 
155  void readSymbology( const QDomElement& element, QString& errorMessage );
156 
165  void writeSymbology( QDomElement& element, QDomDocument& doc, QString& errorMessage );
166 
167  private:
168  QMap<QString, QgsEditorWidgetFactory*> mWidgetFactories;
169 };
170 
171 #endif // QGSEDITORWIDGETREGISTRY_H
Base class for all map layer types.
Definition: qgsmaplayer.h:48
This class should be subclassed for every configurable editor widget type.
Definition: qgseditorconfigwidget.h:33
This class manages all known edit widget factories.
Definition: qgseditorwidgetregistry.h:30
This class contains context information for attribute editor widgets.
Definition: qgsattributeeditorcontext.h:33
Manages an editor widget Widget and wrapper share the same parent.
Definition: qgseditorwidgetwrapper.h:41
Every attribute editor widget needs a factory, which inherits this class.
Definition: qgseditorwidgetfactory.h:37
QMap< QString, QVariant > QgsEditorWidgetConfig
Holds a set of configuration parameters for a editor widget wrapper.
Definition: qgseditorwidgetconfig.h:19
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:470