Skip to content
Permalink
Browse files

Merge pull request #2707 from pvalsecc/layer_tooltips

Layer tooltips
  • Loading branch information
NathanW2 committed Mar 3, 2016
2 parents 30449e5 + 0389a36 commit 4dbd8843bb5c6912dd5ec133f8487a40a009fa8b
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/core/layertree/qgslayertreemodel.cpp
@@ -276,7 +276,14 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const
if ( QgsLayerTree::isLayer( node ) )
{
if ( QgsMapLayer* layer = QgsLayerTree::toLayer( node )->layer() )
return layer->publicSource();
{
QString tooltip = "<b>" +
( layer->title().isEmpty() ? layer->shortName() : layer->title() ) + "</b>";
if ( !layer->abstract().isEmpty() )
tooltip += "<br/>" + layer->abstract().replace( "\n", "<br/>" );
tooltip += "<br/><i>" + layer->publicSource() + "</i>";
return tooltip;
}
}
}

0 comments on commit 4dbd884

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