Skip to content
Permalink
Browse files

[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 516087ed62855e74f7605b40c0c365fc5a5dd1b3
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/gui/qgsexpressiontreeview.cpp
@@ -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.
@@ -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 );
}
}

0 comments on commit 516087e

Please sign in to comment.