Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[ui] Add map layer icons in th expression builder's tree view
  • Loading branch information
nirvn authored and nyalldawson committed Mar 12, 2021
1 parent 99e2566 commit 516087e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/gui/qgsexpressiontreeview.cpp
Expand Up @@ -25,6 +25,7 @@
#include "qgssettings.h"
#include "qgsrelationmanager.h"
#include "qgsapplication.h"
#include "qgsmaplayermodel.h"


//! Returns a HTML formatted string for use as a \a relation item help.
Expand Down Expand Up @@ -411,7 +412,8 @@ void QgsExpressionTreeView::loadLayers()
QMap<QString, QgsMapLayer *>::const_iterator layerIt = layers.constBegin();
for ( ; layerIt != layers.constEnd(); ++layerIt )
{
registerItemForAllGroups( QStringList() << tr( "Map Layers" ), layerIt.value()->name(), QStringLiteral( "'%1'" ).arg( layerIt.key() ), formatLayerHelp( layerIt.value() ) );
QIcon icon = QgsMapLayerModel::iconForLayer( layerIt.value() );
registerItem( QStringLiteral( "Map Layers" ), layerIt.value()->name(), QStringLiteral( "'%1'" ).arg( layerIt.key() ), formatLayerHelp( layerIt.value() ), QgsExpressionItem::ExpressionNode, false, 1, icon );
}
}

Expand Down

0 comments on commit 516087e

Please sign in to comment.