Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
API documentation for QgsFieldFormatter caches and more
  • Loading branch information
m-kuhn committed Dec 20, 2016
1 parent 1b5e577 commit 83c58d1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/qgsfieldformatter.h
Expand Up @@ -79,6 +79,14 @@ class CORE_EXPORT QgsFieldFormatter
/**
* Create a cache for a given field.
*
* This will be used in situations where a field is being represented various times in a loop. And will be passed
* to other methods on QgsFieldKit and QgsEditorWidgetWrapper.
*
* For example, the attribute table will create a cache once for each field and then use this
* cache for representation. The QgsValueRelationFieldFormatter and QgsValueRelationEditorWidget
* implement this functionality to create a lookuptable once (a QVariantMap / dict) and are
* make use of a cache if present.
*
* @note Added in 3.0
*/
virtual QVariant createCache( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config ) const;
Expand Down
10 changes: 10 additions & 0 deletions src/core/qgsvectorlayer.h
Expand Up @@ -1454,7 +1454,17 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
*/
void setConstraintExpression( int index, const QString& expression, const QString& description = QString() );

/**
* \copydoc editorWidgetSetup
*/
void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup& setup );

/**
* The editor widget setup defines which QgsFieldFormatter and editor widget will be used
* for the field at `index`.
*
* @note Added in QGIS 3.0
*/
QgsEditorWidgetSetup editorWidgetSetup( int index ) const;

/** Calculates a list of unique values contained within an attribute in the layer. Note that
Expand Down

0 comments on commit 83c58d1

Please sign in to comment.