Skip to content

Commit

Permalink
Button to store data in project activates the property if it exists i…
Browse files Browse the repository at this point in the history
…n auxiliary layer
  • Loading branch information
pblottiere committed Oct 9, 2017
1 parent 0c21e51 commit e1781b9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/app/qgsdiagramproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,8 +1069,9 @@ void QgsDiagramProperties::createAuxiliaryField()
const QgsDiagramLayerSettings::Property key = static_cast< QgsDiagramLayerSettings::Property >( button->propertyKey() );
const QgsPropertyDefinition def = QgsDiagramLayerSettings::propertyDefinitions()[key];

// create property in auxiliary storage
mLayer->auxiliaryLayer()->addAuxiliaryField( def );
// create property in auxiliary storage if necessary
if ( !mLayer->auxiliaryLayer()->exists( def ) )
mLayer->auxiliaryLayer()->addAuxiliaryField( def );

// update property with join field name from auxiliary storage
QgsProperty property = button->toProperty();
Expand Down
5 changes: 3 additions & 2 deletions src/app/qgslabelinggui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,9 @@ void QgsLabelingGui::createAuxiliaryField()
const QgsPalLayerSettings::Property key = static_cast< QgsPalLayerSettings::Property >( button->propertyKey() );
const QgsPropertyDefinition def = QgsPalLayerSettings::propertyDefinitions()[key];

// create property in auxiliary storage
mLayer->auxiliaryLayer()->addAuxiliaryField( def );
// create property in auxiliary storage if necessary
if ( !mLayer->auxiliaryLayer()->exists( def ) )
mLayer->auxiliaryLayer()->addAuxiliaryField( def );

// update property with join field name from auxiliary storage
QgsProperty property = button->toProperty();
Expand Down
13 changes: 8 additions & 5 deletions src/gui/qgspropertyoverridebutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ QgsPropertyOverrideButton::QgsPropertyOverrideButton( QWidget *parent,
mActionDescription = new QAction( tr( "Description..." ), this );

mActionCreateAuxiliaryField = new QAction( tr( "Store data in the project" ), this );
mActionCreateAuxiliaryField->setCheckable( true );

mActionExpDialog = new QAction( tr( "Edit..." ), this );
mActionExpression = nullptr;
Expand Down Expand Up @@ -337,13 +338,15 @@ void QgsPropertyOverrideButton::aboutToShowMenu()

const QgsAuxiliaryLayer *alayer = mVectorLayer->auxiliaryLayer();

mActionCreateAuxiliaryField->setEnabled( true );
mActionCreateAuxiliaryField->setChecked( false );
if ( alayer && alayer->exists( mDefinition ) )
{
mActionCreateAuxiliaryField->setEnabled( false );
}
else
{
mActionCreateAuxiliaryField->setEnabled( true );
if ( mProperty.field() == QgsAuxiliaryField::name( mDefinition, true ) )
{
mActionCreateAuxiliaryField->setEnabled( false );
mActionCreateAuxiliaryField->setChecked( true );
}
}

bool fieldActive = false;
Expand Down

0 comments on commit e1781b9

Please sign in to comment.