Add method to reset vector layer for data defined button

This commit is contained in:
Nyall Dawson 2016-08-17 10:16:34 +10:00
parent b349eb8a98
commit eb5cc0c731
3 changed files with 19 additions and 1 deletions

View File

@ -94,6 +94,13 @@ class QgsDataDefinedButton : QToolButton
*/
QgsDataDefined currentDataDefined() const;
/** Sets the vector layer associated with the button. This controls which fields are
* displayed within the widget's pop up menu.
* @param layer vector layer
* @note added in QGIS 3.0
*/
void setVectorLayer( QgsVectorLayer* layer );
/**
* Whether the current data definition or expression is to be used
*/

View File

@ -195,7 +195,6 @@ void QgsDataDefinedButton::init( const QgsVectorLayer* vl,
mActionDataTypes->setText( tr( "Field type: " ) + mDataTypesString );
}
updateFieldLists();
updateGui();
}
@ -218,6 +217,11 @@ QgsDataDefined QgsDataDefinedButton::currentDataDefined() const
return dd;
}
void QgsDataDefinedButton::setVectorLayer( QgsVectorLayer* layer )
{
mVectorLayer = layer;
}
void QgsDataDefinedButton::mouseReleaseEvent( QMouseEvent *event )
{
// Ctrl-click to toggle activated state

View File

@ -127,6 +127,13 @@ class GUI_EXPORT QgsDataDefinedButton: public QToolButton
*/
QgsDataDefined currentDataDefined() const;
/** Sets the vector layer associated with the button. This controls which fields are
* displayed within the widget's pop up menu.
* @param layer vector layer
* @note added in QGIS 3.0
*/
void setVectorLayer( QgsVectorLayer* layer );
/**
* Whether the current data definition or expression is to be used
*/