Every attribute editor widget needs a factory, which inherits this class.
It provides metadata for the widgets such as the name (human readable), it serializes the configuration to an xml structure and loads the configuration from there.
It also has factory methods to create a widget wrapper for the attribute editor itself and another factory method to create a configuration dialog.
Definition at line 42 of file qgseditorwidgetfactory.h.
Override this in your implementation.
Create a new editor widget wrapper. Call QgsEditorWidgetRegistry::create() instead of calling this method directly.
- Parameters
-
vl | The vector layer on which this widget will act |
fieldIdx | The field index on which this widget will act |
editor | An editor widget if already existent. If nullptr is provided, a new widget will be created. |
parent | The parent for the wrapper class and any created widget. |
- Returns
- A new widget wrapper
Implemented in QgsBinaryWidgetFactory, QgsCheckboxWidgetFactory, QgsClassificationWidgetWrapperFactory, QgsColorWidgetFactory, QgsDateTimeEditFactory, QgsEnumerationWidgetFactory, QgsExternalResourceWidgetFactory, QgsHiddenWidgetFactory, QgsJsonEditWidgetFactory, QgsKeyValueWidgetFactory, QgsListWidgetFactory, QgsRangeWidgetFactory, QgsRelationReferenceFactory, QgsTextEditWidgetFactory, QgsUniqueValueWidgetFactory, QgsUuidWidgetFactory, QgsValueMapWidgetFactory, and QgsValueRelationWidgetFactory.
unsigned int QgsEditorWidgetFactory::fieldScore |
( |
const QgsVectorLayer * |
vl, |
|
|
int |
fieldIdx |
|
) |
| const |
|
virtual |
This method allows disabling this editor widget type for a certain field.
By default, it returns 5 for every fields. Reimplement this if you only support certain fields.
Typical return values are:
- 0: not supported
- 5: maybe support (for example, Datetime support strings depending on their content)
- 10: basic support (this is what returns TextEdit for example, since it supports everything in a crude way)
- 20: specialized support
- Parameters
-
- Returns
- 0 if the field is not supported or a bigger number if it can (the widget with the biggest number will be taken by default). The default implementation returns 5..
- See also
- supportsField()
Reimplemented in QgsBinaryWidgetFactory, QgsCheckboxWidgetFactory, QgsColorWidgetFactory, QgsDateTimeEditFactory, QgsEnumerationWidgetFactory, QgsExternalResourceWidgetFactory, QgsJsonEditWidgetFactory, QgsKeyValueWidgetFactory, QgsListWidgetFactory, QgsRelationReferenceFactory, QgsTextEditWidgetFactory, and QgsUuidWidgetFactory.
Definition at line 45 of file qgseditorwidgetfactory.cpp.