Skip to content

Commit

Permalink
Only add feature once when python init function is set on attribute form
Browse files Browse the repository at this point in the history
Fix #10862
  • Loading branch information
m-kuhn committed Jul 22, 2014
1 parent 2b5eaee commit 9f07383
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/gui/qgsattributeformlegacyinterface.cpp
Expand Up @@ -26,6 +26,8 @@ QgsAttributeFormLegacyInterface::QgsAttributeFormLegacyInterface( const QString&
, mPyFunctionName( function )
, mPyFormVarName( pyFormName )
{
QDialogButtonBox* buttonBox = form->findChild<QDialogButtonBox*>();

mPyLayerVarName = QString( "_qgis_layer_%1" ).arg( form->layer()->id() );

QString initLayer = QString( "%1 = sip.wrapinstance( %2, qgis.core.QgsVectorLayer )" )
Expand All @@ -46,6 +48,9 @@ void QgsAttributeFormLegacyInterface::featureChanged()
QDialogButtonBox* buttonBox = form()->findChild<QDialogButtonBox*>();
if ( buttonBox )
{
// If the init function did not call disconnect, we do it here before reconnecting
// If it did call disconnect, then the call will just do nothing
QObject::disconnect( buttonBox, SIGNAL( accepted() ), form(), SLOT( accept() ) );
QObject::connect( buttonBox, SIGNAL( accepted() ), form(), SLOT( accept() ) );
}

Expand Down

0 comments on commit 9f07383

Please sign in to comment.