mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
keep add feature action until non-modal attribute form is closed (fixes #11461)
This commit is contained in:
parent
9dbeefb688
commit
b5f047d2d3
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user