[dualview] Fix crash when adding columns with feature form open

This commit is contained in:
Matthias Kuhn 2013-09-02 18:25:07 +02:00
parent 37f53b0a6d
commit ebfc874bfa
2 changed files with 7 additions and 2 deletions

View File

@ -65,6 +65,8 @@ void QgsDualView::init( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QgsDista
connect( layer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) );
connect( layer, SIGNAL( beforeCommitChanges() ), this, SLOT( editingToggled() ) );
connect( layer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) );
connect( layer, SIGNAL( attributeAdded( int ) ), this, SLOT( editingToggled() ) );
connect( layer, SIGNAL( attributeDeleted( int ) ), this, SLOT( editingToggled() ) );
initLayerCache( layer );
initModels( mapCanvas );
@ -235,7 +237,7 @@ void QgsDualView::initModels( QgsMapCanvas* mapCanvas )
mFeatureListModel = new QgsFeatureListModel( mFilterModel, mFilterModel );
}
void QgsDualView::on_mFeatureList_currentEditSelectionChanged( const QgsFeature &feat )
void QgsDualView::on_mFeatureList_currentEditSelectionChanged( QgsFeature &feat )
{
if ( !feat.isValid() )
return;
@ -249,6 +251,9 @@ void QgsDualView::on_mFeatureList_currentEditSelectionChanged( const QgsFeature
mAttributeEditorLayout->removeWidget( mAttributeDialog->dialog() );
}
if ( feat.attributes().count() != mLayerCache->layer()->pendingFields().count() )
mLayerCache->featureAtId( feat.id(), feat );
mAttributeDialog = new QgsAttributeDialog( mLayerCache->layer(), new QgsFeature( feat ), true, mDistanceArea, this, false );
mAttributeEditorLayout->addWidget( mAttributeDialog->dialog() );
mAttributeDialog->dialog()->setVisible( true );

View File

@ -171,7 +171,7 @@ class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBas
*
* @param feat The newly visible feature
*/
void on_mFeatureList_currentEditSelectionChanged( const QgsFeature &feat );
void on_mFeatureList_currentEditSelectionChanged( QgsFeature& feat );
void previewExpressionBuilder();