Skip to content

Commit 3871ce7

Browse files
committedMay 25, 2014
Revert "Fix #10337 - Allow attribute form on all features (new QgsFeatures are invalid)"
This reverts commit 9bdc932.
1 parent 29187e4 commit 3871ce7

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed
 

‎src/gui/qgsattributedialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,5 @@ void QgsAttributeDialog::init( QgsVectorLayer* layer, QgsFeature* feature, QgsAt
150150
mDialog->layout()->addWidget( mAttributeForm );
151151
QDialogButtonBox* buttonBox = mAttributeForm->findChild<QDialogButtonBox*>();
152152
connect( buttonBox, SIGNAL( rejected() ), mDialog, SLOT( close() ) );
153-
connect( buttonBox, SIGNAL( accepted() ), mDialog, SLOT( accept() ) );
153+
connect( buttonBox, SIGNAL( accepted() ), mDialog, SLOT( close() ) );
154154
}

‎src/gui/qgsattributeform.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,21 @@ void QgsAttributeForm::onAttributeDeleted( int idx )
227227

228228
void QgsAttributeForm::synchronizeEnabledState()
229229
{
230-
bool enabled = mLayer->isEditable();
231230
Q_FOREACH( QgsWidgetWrapper* ww, mWidgets )
232231
{
233-
ww->setEnabled( enabled );
232+
if ( mFeature.isValid() && mLayer->isEditable() )
233+
{
234+
ww->setEnabled( true );
235+
}
236+
else
237+
{
238+
ww->setEnabled( false );
239+
}
234240
}
235241

236242
QPushButton* okButton = mButtonBox->button( QDialogButtonBox::Ok );
237243
if ( okButton )
238-
okButton->setEnabled( enabled );
244+
okButton->setEnabled( mFeature.isValid() && mLayer->isEditable() );
239245
}
240246

241247
void QgsAttributeForm::init()

0 commit comments

Comments
 (0)
Please sign in to comment.