QgsUuidWidgetFactory class
Contents
Base classes
- class QgsEditorWidgetFactory
- Every attribute editor widget needs a factory, which inherits this class.
Constructors, destructors, conversion operators
- QgsUuidWidgetFactory(const QString& name) explicit
- Constructor for QgsUuidWidgetFactory, where name is a human-readable name for the factory.
Public functions
- auto configWidget(QgsVectorLayer* vl, int fieldIdx, QWidget* parent) const -> QgsEditorConfigWidget* override
- Override this in your implementation.
- auto create(QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent) const -> QgsEditorWidgetWrapper* override
- Override this in your implementation.
- auto fieldScore(const QgsVectorLayer* vl, int fieldIdx) const -> unsigned int override
- This method allows disabling this editor widget type for a certain field.
Function documentation
QgsEditorConfigWidget* QgsUuidWidgetFactory:: configWidget(QgsVectorLayer* vl,
int fieldIdx,
QWidget* parent) const override
Override this in your implementation.
| Parameters | |
|---|---|
| vl | The layer for which the widget will be created |
| fieldIdx | The field index for which the widget will be created |
| parent | The parent widget of the created config widget |
| Returns | A configuration widget |
Create a new configuration widget for this widget type.
QgsEditorWidgetWrapper* QgsUuidWidgetFactory:: create(QgsVectorLayer* vl,
int fieldIdx,
QWidget* editor,
QWidget* parent) const override
Override this in your implementation.
| 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 NULL is provided, a new widget will be created. |
| parent | The parent for the wrapper class and any created widget. |
| Returns | A new widget wrapper |
Create a new editor widget wrapper. Call QgsEditorWidgetRegistry::
unsigned int QgsUuidWidgetFactory:: fieldScore(const QgsVectorLayer* vl,
int fieldIdx) const override
This method allows disabling this editor widget type for a certain field.
| Parameters | |
|---|---|
| vl | |
| fieldIdx | |
| 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.. |
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