repaint layer after commiting

This commit is contained in:
Juergen E. Fischer 2012-01-23 17:43:15 +01:00
parent 53b6366ffd
commit 32f3690efa

View File

@ -4323,11 +4323,23 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel )
if ( !vlayer->isEditable() && !vlayer->isReadOnly() )
{
vlayer->startEditing();
if ( !( vlayer->dataProvider()->capabilities() & QgsVectorDataProvider::EditingCapabilities ) )
if ( vlayer->dataProvider()->capabilities() & QgsVectorDataProvider::EditingCapabilities == 0 )
{
QMessageBox::information( 0, tr( "Start editing failed" ), tr( "Provider cannot be opened for editing" ) );
res = false;
return false;
}
vlayer->startEditing();
QSettings settings;
QString markerType = settings.value( "/qgis/digitizing/marker_style", "Cross" ).toString();
bool markSelectedOnly = settings.value( "/qgis/digitizing/marker_only_for_selected", false ).toBool();
// redraw only if markers will be drawn
if( ( !markSelectedOnly || vlayer->selectedFeatureCount() > 0 ) &&
( markerType == "Cross" || markerType == "SemiTransparentCircle" ) )
{
vlayer->triggerRepaint();
}
}
else if ( vlayer->isModified() )
@ -4358,6 +4370,8 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel )
// and try the commit again later
res = false;
}
vlayer->triggerRepaint();
break;
case QMessageBox::Discard:
@ -4366,6 +4380,8 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel )
QMessageBox::information( 0, tr( "Error" ), tr( "Problems during roll back" ) );
res = false;
}
vlayer->triggerRepaint();
break;
default:
@ -4376,6 +4392,7 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel )
{
vlayer->rollBack();
res = true;
vlayer->triggerRepaint();
}
if ( layer == activeLayer() )
@ -4383,17 +4400,6 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel )
activateDeactivateLayerRelatedActions( layer );
}
QSettings settings;
QString markerType = settings.value( "/qgis/digitizing/marker_style", "Cross" ).toString();
bool markSelectedOnly = settings.value( "/qgis/digitizing/marker_only_for_selected", false ).toBool();
// repaint only if the there will be/were markers
if (( !markSelectedOnly || vlayer->selectedFeatureCount() > 0 ) &&
( markerType == "Cross" || markerType == "SemiTransparentCircle" ) )
{
vlayer->triggerRepaint();
}
return res;
}