Skip to content
Permalink
Browse files

Make layer tooltips more user friendly

Now the layer tooltips (in the layer tree) contains:
* title (or the short name, if title empty)
* abstract (if not empty)
* URL
  • Loading branch information
Patrick Valsecchi
Patrick Valsecchi committed Feb 26, 2016
1 parent 493d13d commit 0389a36c6396e3253178bb492f2bd979626b6066
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 0389a36

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