Skip to content
Permalink
Browse files
keep add feature action until non-modal attribute form is closed (fixes
  • Loading branch information
jef-n committed Oct 21, 2014
1 parent 9dbeefb commit b5f047d2d37e396b92e46473e4f24c0aeca910ea
Showing with 11 additions and 9 deletions.
  1. +6 −7 src/app/qgsfeatureaction.cpp
  2. +5 −2 src/app/qgsmaptooladdfeature.cpp
@@ -192,18 +192,17 @@ bool QgsFeatureAction::addFeature( const QgsAttributeMap& defaultAttributes, boo
dialog->setIsAddDialog( true );
dialog->setEditCommandMessage( text() );

connect( dialog->attributeForm(), SIGNAL( featureSaved( QgsFeature ) ), this, SLOT( onFeatureSaved( QgsFeature ) ) );
connect( dialog->attributeForm(), SIGNAL( featureSaved( const QgsFeature & ) ), this, SLOT( onFeatureSaved( const QgsFeature & ) ) );

if ( showModal )
{
dialog->setAttribute( Qt::WA_DeleteOnClose );
dialog->exec();
}
else
if ( !showModal )
{
setParent( dialog ); // keep dialog until the dialog is closed and destructed
dialog->show(); // will also delete the dialog on close (show() is overridden)
return true;
}

dialog->setAttribute( Qt::WA_DeleteOnClose );
dialog->exec();
}

// Will be set in the onFeatureSaved SLOT
@@ -42,8 +42,11 @@ QgsMapToolAddFeature::~QgsMapToolAddFeature()

bool QgsMapToolAddFeature::addFeature( QgsVectorLayer *vlayer, QgsFeature *f, bool showModal )
{
QgsFeatureAction action( tr( "add feature" ), *f, vlayer, -1, -1, this );
return action.addFeature( QgsAttributeMap(), showModal );
QgsFeatureAction *action = new QgsFeatureAction( tr( "add feature" ), *f, vlayer, -1, -1, this );
bool res = action->addFeature( QgsAttributeMap(), showModal );
if ( showModal )
delete action;
return res;
}

void QgsMapToolAddFeature::activate()

0 comments on commit b5f047d

Please sign in to comment.