Skip to content
Permalink
Browse files

repaint layer after commiting

  • Loading branch information
jef-n committed Jan 23, 2012
1 parent 53b6366 commit 32f3690efa05ea3cc5c19dd5d0591e81cbc2e46b
Showing with 20 additions and 14 deletions.
  1. +20 −14 src/app/qgisapp.cpp
@@ -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,24 +4392,14 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel )
{
vlayer->rollBack();
res = true;
vlayer->triggerRepaint();
}

if ( layer == activeLayer() )
{
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;
}

0 comments on commit 32f3690

Please sign in to comment.
You can’t perform that action at this time.