~grass/qgis/qgis-git-trunk

« back to all changes in this revision

Viewing changes to src/app/composer/qgscomposerpicturewidget.cpp

  • Committer: Nyall Dawson
  • Date: 2015-08-22 09:01:42 UTC
  • Revision ID: git-v1:a7d8519c7f47498dc2589a580a1cd9163d87fac1
Ensure context is available to builders from data defined buttons

Show diffs side-by-side

added added

removed removed

Lines of Context:
609
609
  return QgsComposerObject::NoProperty;
610
610
}
611
611
 
 
612
static QgsExpressionContext _getExpressionContext( const void* context )
 
613
{
 
614
  const QgsComposerObject* composerObject = ( const QgsComposerObject* ) context;
 
615
  if ( !composerObject )
 
616
  {
 
617
    return QgsExpressionContext();
 
618
  }
 
619
 
 
620
  QScopedPointer< QgsExpressionContext > expContext( composerObject->createExpressionContext() );
 
621
  return QgsExpressionContext( *expContext );
 
622
}
 
623
 
612
624
void QgsComposerPictureWidget::populateDataDefinedButtons()
613
625
{
614
626
  QgsVectorLayer* vl = atlasCoverageLayer();
616
628
  //block signals from data defined buttons
617
629
  mSourceDDBtn->blockSignals( true );
618
630
 
 
631
  mSourceDDBtn->registerGetExpressionContextCallback( &_getExpressionContext, mPicture );
 
632
 
619
633
  //initialise buttons to use atlas coverage layer
620
634
  mSourceDDBtn->init( vl, mPicture->dataDefinedProperty( QgsComposerObject::PictureSource ),
621
635
                      QgsDataDefinedButton::AnyType, QgsDataDefinedButton::anyStringDesc() );