Skip to content
Permalink
Browse files

Add method to reset vector layer for data defined button

  • Loading branch information
nyalldawson committed Aug 17, 2016
1 parent b349eb8 commit eb5cc0c731e3fa840d6b809ca897692cb8921c86
Showing with 19 additions and 1 deletion.
  1. +7 −0 python/gui/qgsdatadefinedbutton.sip
  2. +5 −1 src/gui/qgsdatadefinedbutton.cpp
  3. +7 −0 src/gui/qgsdatadefinedbutton.h
@@ -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
*/
@@ -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
@@ -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
*/

0 comments on commit eb5cc0c

Please sign in to comment.
You can’t perform that action at this time.