Skip to content

Commit

Permalink
Show embedded layers in italic
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jun 8, 2011
1 parent d9c853f commit 8bc8d54
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/app/legend/qgslegend.cpp
Expand Up @@ -636,6 +636,12 @@ void QgsLegend::addLayer( QgsMapLayer * layer )
}

QgsLegendLayer* llayer = new QgsLegendLayer( layer );
if( !QgsProject::instance()->layerIsEmbedded( layer->id() ).isEmpty() )
{
QFont itemFont;
itemFont.setItalic( true );
llayer->setFont( 0, itemFont );
}

//set the correct check states
blockSignals( true );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -5055,7 +5055,7 @@ void QgisApp::embedLayers()

//hardcoded for debugging
QString filepath="/home/marco/geodaten/projekte/composertest.qgs";
QString id="komb113320110516093016594";
QString id="komb113320110531113659299";

QList<QDomNode> brokenNodes;
QList< QPair< QgsVectorLayer*, QDomElement > > vectorLayerList;
Expand Down
11 changes: 10 additions & 1 deletion src/core/qgsproject.cpp
Expand Up @@ -1653,7 +1653,16 @@ bool QgsProject::createEmbeddedLayer( const QString& layerId, const QString& pro
QString id = mapLayerElem.firstChildElement("id").text();
if( id == layerId )
{
return addLayer( mapLayerElem, brokenNodes, vectorLayerList );
mEmbeddedLayers.insert( layerId, projectFilePath );
if( addLayer( mapLayerElem, brokenNodes, vectorLayerList ) )
{
return true;
}
else
{
mEmbeddedLayers.remove( layerId );
return false;
}
#if 0
QString type = mapLayerElem.attribute("type");
QgsMapLayer* layer = 0;
Expand Down
3 changes: 2 additions & 1 deletion src/core/qgsproject.h
Expand Up @@ -337,7 +337,8 @@ class CORE_EXPORT QgsProject : public QObject

QgsProjectBadLayerHandler* mBadLayerHandler;

/**Embeded layers which are defined in other projects. Key: layer id, value: project file path*/
/**Embeded layers which are defined in other projects. Key: layer id, value: project file path.
If the project file path is empty, QgsProject is going to ignore the layer for saving (e.g. because it is part and managed by an embedded group)*/
QHash< QString, QString > mEmbeddedLayers;

}; // QgsProject
Expand Down

0 comments on commit 8bc8d54

Please sign in to comment.