Skip to content

Commit

Permalink
keep add feature action until non-modal attribute form is closed (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Oct 21, 2014
1 parent 9dbeefb commit b5f047d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
13 changes: 6 additions & 7 deletions src/app/qgsfeatureaction.cpp
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/app/qgsmaptooladdfeature.cpp
Expand Up @@ -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()
Expand Down

0 comments on commit b5f047d

Please sign in to comment.