/
qgseditorwidgetregistry.sip
100 lines (92 loc) · 4.21 KB
/
qgseditorwidgetregistry.sip
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/***************************************************************************
qgseditorwidgetregistry.sip
--------------------------------------
Date : 21.4.2013
Copyright : (C) 2013 Matthias Kuhn
Email : matthias dot kuhn at gmx dot ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/**
* This class manages all known edit widget factories
*/
class QgsEditorWidgetRegistry : QObject
{
%TypeHeaderCode
#include <qgseditorwidgetregistry.h>
%End
public:
/**
* This class is a singleton and has therefore to be accessed with this method instead
* of a constructor.
*
* @return The one and only instance of the editor widget registry
*/
static QgsEditorWidgetRegistry* instance();
/**
* Create an attribute editor widget wrapper of a given type for a given field.
* The editor may be NULL if you want the widget wrapper to create a default widget.
*
* @param widgetId The id of the widget type to create an attribute editor for
* @param vl The vector layer for which this widget will be created
* @param fieldIdx The field index on the specified layer for which this widget will be created
* @param config A configuration which should be used for the widget creation
* @param editor An editor widget which will be used instead of an autocreated widget
* @param parent The parent which will be used for the created wrapper and the created widget
* @param context The editor context (not available in python bindings)
*
* @return A new widget wrapper
*/
QgsEditorWidgetWrapper* create( const QString& widgetId,
QgsVectorLayer* vl,
int fieldIdx,
const QgsEditorWidgetConfig& config,
QWidget* editor,
QWidget* parent /TransferThis/,
const QgsAttributeEditorContext& context = QgsAttributeEditorContext() ) /Factory/;
/**
* Creates a configuration widget
*
* @param widgetId The id of the widget type to create a configuration widget for
* @param vl The vector layer for which this widget will be created
* @param fieldIdx The field index on the specified layer for which this widget will be created
* @param parent The parent widget for the created widget
*
* @return A new configuration widget
*/
QgsEditorConfigWidget* createConfigWidget( const QString& widgetId, QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) /Factory/;
/**
* Get the human readable name for a widget type
*
* @param widgetId The widget type to get the name for
*
* @return A human readable name
*/
QString name( const QString& widgetId );
/**
* Get access to all registered factories
*
* @return All ids and factories
*/
const QMap<QString, QgsEditorWidgetFactory*>& factories();
/**
* Get a factory for the given widget type id.
*
* @return A factory or Null if not existent
*/
QgsEditorWidgetFactory* factory( const QString& widgetId );
/**
* Register a new widget factory with the given id
*
* @param widgetId The id which will be used later to refer to this widget type
* @param widgetFactory The factory which will create this widget type
*
* @return true, if successful, false, if the widgetId is already in use or widgetFactory is NULL
*/
bool registerWidget( const QString& widgetId, QgsEditorWidgetFactory* widgetFactory /Transfer/ );
};