Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Range Widget: Only enable for supported data types
And some doxymentation
  • Loading branch information
m-kuhn committed Aug 25, 2014
1 parent dddf895 commit 3d7d240
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/gui/editorwidgets/core/qgseditorwidgetfactory.h
Expand Up @@ -107,6 +107,8 @@ class GUI_EXPORT QgsEditorWidgetFactory
* @param vl The layer
* @param fieldIdx The field index
* @return True if the type is supported for this field
*
* @see isFieldSupported( QgsVectorLayer* vl, ind fieldIdx )
*/
inline bool supportsField( QgsVectorLayer* vl, int fieldIdx ) { return isFieldSupported( vl, fieldIdx ); }

Expand Down Expand Up @@ -154,6 +156,8 @@ class GUI_EXPORT QgsEditorWidgetFactory
* @param vl
* @param fieldIdx
* @return True if the field is supported.
*
* @see supportsField( QgsVectorLayer* vl, fieldIdx )
*/
virtual bool isFieldSupported( QgsVectorLayer* vl, int fieldIdx );

Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsrangewidgetfactory.cpp
Expand Up @@ -60,7 +60,7 @@ void QgsRangeWidgetFactory::writeConfig( const QgsEditorWidgetConfig& config, QD
configElement.setAttribute( "Step", config["Step"].toInt() );
}

bool QgsRangeWidgetFactory::supportsField( QgsVectorLayer* vl, int fieldIdx )
bool QgsRangeWidgetFactory::isFieldSupported( QgsVectorLayer* vl, int fieldIdx )
{
switch ( vl->pendingFields()[fieldIdx].type() )
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsrangewidgetfactory.h
Expand Up @@ -31,7 +31,7 @@ class GUI_EXPORT QgsRangeWidgetFactory : public QgsEditorWidgetFactory
virtual void writeConfig( const QgsEditorWidgetConfig& config, QDomElement& configElement, QDomDocument& doc, const QgsVectorLayer* layer, int fieldIdx );

private:
bool supportsField( QgsVectorLayer *vl, int fieldIdx );
virtual bool isFieldSupported( QgsVectorLayer *vl, int fieldIdx );
};

#endif // QGSRANGEWIDGETFACTORY_H

0 comments on commit 3d7d240

Please sign in to comment.