1/************************************************************************
2 * This file has been generated automatically from                      *
3 *                                                                      *
4 * src/gui/editorwidgets/core/qgseditorwidgetfactory.h                  *
5 *                                                                      *
6 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
7 ************************************************************************/
8
9
10
11
12class QgsEditorWidgetFactory
13{
14%Docstring
15Every attribute editor widget needs a factory, which inherits this class
16
17It provides metadata for the widgets such as the name (human readable), it serializes
18the configuration to an xml structure and loads the configuration from there.
19
20It also has factory methods to create a widget wrapper for the attribute editor itself
21and another factory method to create a configuration dialog.
22%End
23
24%TypeHeaderCode
25#include "qgseditorwidgetfactory.h"
26%End
27  public:
28
29    QgsEditorWidgetFactory( const QString &name );
30%Docstring
31Constructor
32
33:param name: A human readable name for this widget type
34%End
35
36    virtual ~QgsEditorWidgetFactory();
37
38    virtual QgsEditorWidgetWrapper *create( QgsVectorLayer *vl, int fieldIdx, QWidget *editor, QWidget *parent ) const = 0 /Factory/;
39%Docstring
40Override this in your implementation.
41Create a new editor widget wrapper. Call :py:func:`QgsEditorWidgetRegistry.create()`
42instead of calling this method directly.
43
44:param vl: The vector layer on which this widget will act
45:param fieldIdx: The field index on which this widget will act
46:param editor: An editor widget if already existent. If ``None`` is provided, a new widget will be created.
47:param parent: The parent for the wrapper class and any created widget.
48
49:return: A new widget wrapper
50%End
51
52    virtual QgsSearchWidgetWrapper *createSearchWidget( QgsVectorLayer *vl, int fieldIdx, QWidget *parent ) const /Factory/;
53
54    QString name();
55%Docstring
56Returns The human readable identifier name of this widget type
57
58:return: a name
59%End
60
61    virtual QgsEditorConfigWidget *configWidget( QgsVectorLayer *vl, int fieldIdx, QWidget *parent ) const = 0 /Factory/;
62%Docstring
63Override this in your implementation.
64Create a new configuration widget for this widget type.
65
66:param vl: The layer for which the widget will be created
67:param fieldIdx: The field index for which the widget will be created
68:param parent: The parent widget of the created config widget
69
70:return: A configuration widget
71%End
72
73    bool supportsField( const QgsVectorLayer *vl, int fieldIdx );
74%Docstring
75Check if this editor widget type supports a certain field.
76
77:param vl: The layer
78:param fieldIdx: The field index
79
80:return: ``True`` if the type is supported for this field
81
82.. seealso:: :py:func:`fieldScore`
83%End
84
85
86    virtual unsigned int fieldScore( const QgsVectorLayer *vl, int fieldIdx ) const;
87%Docstring
88This method allows disabling this editor widget type for a certain field.
89By default, it returns 5 for every fields.
90Reimplement this if you only support certain fields.
91
92Typical return values are:
93
94- 0: not supported
95- 5: maybe support (for example, Datetime support strings depending on their content)
96- 10: basic support (this is what returns TextEdit for example, since it supports everything in a crude way)
97- 20: specialized support
98
99:param vl:
100:param fieldIdx:
101
102:return: 0 if the field is not supported or a bigger number if it can (the widget with the biggest number will be
103         taken by default). The default implementation returns 5..
104
105.. seealso:: :py:func:`supportsField`
106%End
107
108};
109
110/************************************************************************
111 * This file has been generated automatically from                      *
112 *                                                                      *
113 * src/gui/editorwidgets/core/qgseditorwidgetfactory.h                  *
114 *                                                                      *
115 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
116 ************************************************************************/
117