Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More reliable trigger of refresh when changing styles
Previously when changing the presets map canvas would not be redrawn
  • Loading branch information
wonder-sk committed Jan 8, 2015
1 parent 803e822 commit 3fbb758
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
7 changes: 0 additions & 7 deletions src/app/qgsmaplayerstyleguiutils.cpp
Expand Up @@ -103,8 +103,6 @@ void QgsMapLayerStyleGuiUtils::useStyle()
bool res = layer->styleManager()->setCurrentStyle( name );
if ( !res )
QgsDebugMsg( "Failed to set current style: " + name );

layer->triggerRepaint();
}


Expand All @@ -128,12 +126,7 @@ void QgsMapLayerStyleGuiUtils::removeStyle()
if ( name == defaultStyleName() )
name.clear();

bool needsRefresh = ( layer->styleManager()->currentStyle() == name );

bool res = layer->styleManager()->removeStyle( name );
if ( !res )
QgsDebugMsg( "Failed to remove style: " + name );

if ( needsRefresh )
layer->triggerRepaint();
}
1 change: 1 addition & 0 deletions src/core/qgsmaplayerstylemanager.cpp
Expand Up @@ -131,6 +131,7 @@ bool QgsMapLayerStyleManager::setCurrentStyle( const QString& name )
syncCurrentStyle(); // sync before unloading it
mCurrentStyle = name;
mStyles[mCurrentStyle].writeToLayer( mLayer );
mLayer->triggerRepaint();
return true;
}

Expand Down

0 comments on commit 3fbb758

Please sign in to comment.