Skip to content

Commit 83c58d1

Browse files
committedDec 20, 2016
API documentation for QgsFieldFormatter caches and more
1 parent 1b5e577 commit 83c58d1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
 

‎src/core/qgsfieldformatter.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ class CORE_EXPORT QgsFieldFormatter
7979
/**
8080
* Create a cache for a given field.
8181
*
82+
* This will be used in situations where a field is being represented various times in a loop. And will be passed
83+
* to other methods on QgsFieldKit and QgsEditorWidgetWrapper.
84+
*
85+
* For example, the attribute table will create a cache once for each field and then use this
86+
* cache for representation. The QgsValueRelationFieldFormatter and QgsValueRelationEditorWidget
87+
* implement this functionality to create a lookuptable once (a QVariantMap / dict) and are
88+
* make use of a cache if present.
89+
*
8290
* @note Added in 3.0
8391
*/
8492
virtual QVariant createCache( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config ) const;

‎src/core/qgsvectorlayer.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,17 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
14541454
*/
14551455
void setConstraintExpression( int index, const QString& expression, const QString& description = QString() );
14561456

1457+
/**
1458+
* \copydoc editorWidgetSetup
1459+
*/
14571460
void setEditorWidgetSetup( int index, const QgsEditorWidgetSetup& setup );
1461+
1462+
/**
1463+
* The editor widget setup defines which QgsFieldFormatter and editor widget will be used
1464+
* for the field at `index`.
1465+
*
1466+
* @note Added in QGIS 3.0
1467+
*/
14581468
QgsEditorWidgetSetup editorWidgetSetup( int index ) const;
14591469

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

0 commit comments

Comments
 (0)
Please sign in to comment.