Skip to content
Permalink
Browse files

Add a method for creating a QgsDataDefined from a QgsDataDefinedButton

  • Loading branch information
nyalldawson committed May 8, 2015
1 parent 2c38552 commit d970daafa3144d1d18850049b2e4355c1308801d
Showing with 22 additions and 0 deletions.
  1. +7 −0 python/gui/qgsdatadefinedbutton.sip
  2. +7 −0 src/gui/qgsdatadefinedbutton.cpp
  3. +8 −0 src/gui/qgsdatadefinedbutton.h
@@ -70,6 +70,13 @@ class QgsDataDefinedButton : QToolButton
*/
void updateDataDefined( QgsDataDefined* dd ) const;

/** Returns a QgsDataDefined which reflects the current settings from the
* button.
* @note added in QGIS 2.9
* @see updateDataDefined
*/
QgsDataDefined currentDataDefined() const;

/**
* Whether the current data definition or expression is to be used
*/
@@ -204,6 +204,13 @@ void QgsDataDefinedButton::updateDataDefined( QgsDataDefined *dd ) const
dd->setField( getField() );
}

QgsDataDefined QgsDataDefinedButton::currentDataDefined() const
{
QgsDataDefined dd;
updateDataDefined( &dd );
return dd;
}

void QgsDataDefinedButton::mouseReleaseEvent( QMouseEvent *event )
{
// Ctrl-click to toggle activated state
@@ -92,9 +92,17 @@ class GUI_EXPORT QgsDataDefinedButton: public QToolButton
/** Updates a QgsDataDefined with the current settings from the button
* @param dd QgsDataDefined to update
* @note added in QGIS 2.9
* @see currentDataDefined
*/
void updateDataDefined( QgsDataDefined* dd ) const;

/** Returns a QgsDataDefined which reflects the current settings from the
* button.
* @note added in QGIS 2.9
* @see updateDataDefined
*/
QgsDataDefined currentDataDefined() const;

/**
* Whether the current data definition or expression is to be used
*/

0 comments on commit d970daa

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