Skip to content

Commit

Permalink
Merge pull request #2707 from pvalsecc/layer_tooltips
Browse files Browse the repository at this point in the history
Layer tooltips
  • Loading branch information
NathanW2 committed Mar 3, 2016
2 parents 30449e5 + 0389a36 commit 4dbd884
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/layertree/qgslayertreemodel.cpp
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit 4dbd884

Please sign in to comment.