Skip to content

Commit

Permalink
[GRASS] add edit renderer when plugin is inited
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Oct 16, 2015
1 parent 3c85c7e commit 15af987
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/plugins/grass/qgsgrassplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,16 @@ void QgsGrassPlugin::initGui()
mTools = new QgsGrassTools( qGisInterface, qGisInterface->mainWindow() );
qGisInterface->addDockWidget( Qt::RightDockWidgetArea, mTools );

// add edit renderer immediately so that if project was saved during editing, the layer can be loaded
if ( !QgsRendererV2Registry::instance()->renderersList().contains( "grassEdit" ) )
{
QgsRendererV2Registry::instance()->addRenderer( new QgsRendererV2Metadata( "grassEdit",
QObject::tr( "GRASS Edit" ),
QgsGrassEditRenderer::create,
QIcon(),
QgsGrassEditRendererWidget::create ) );
}

onGisbaseChanged();
mapsetChanged();
}
Expand Down Expand Up @@ -409,15 +419,6 @@ void QgsGrassPlugin::onEditingStarted()
//vectorLayer->styleManager()->addStyle( editStyleName, QgsMapLayerStyle() );
vectorLayer->styleManager()->setCurrentStyle( editStyleName );

if ( !QgsRendererV2Registry::instance()->renderersList().contains( "grassEdit" ) )
{
QgsRendererV2Registry::instance()->addRenderer( new QgsRendererV2Metadata( "grassEdit",
QObject::tr( "GRASS Edit" ),
QgsGrassEditRenderer::create,
QIcon(),
QgsGrassEditRendererWidget::create ) );
}

QgsGrassEditRenderer *renderer = new QgsGrassEditRenderer();

vectorLayer->setRendererV2( renderer );
Expand Down

0 comments on commit 15af987

Please sign in to comment.