Skip to content
Permalink
Browse files
[layertree] Use group icon like the one from old legend
  • Loading branch information
wonder-sk committed May 23, 2014
1 parent aadc9e5 commit 8a40efe60762bdb3fe26d9ed53edf7bc6f12b785
Showing with 14 additions and 1 deletion.
  1. +12 −1 src/gui/layertree/qgslayertreemodel.cpp
  2. +2 −0 src/gui/layertree/qgslayertreemodel.h
@@ -183,7 +183,7 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const
else if ( role == Qt::DecorationRole && index.column() == 0 )
{
if ( QgsLayerTree::isGroup( node ) )
return QgsDataCollectionItem::iconDir();
return iconGroup();
else if ( QgsLayerTree::isLayer( node ) )
{
QgsMapLayer* layer = QgsLayerTree::toLayer( node )->layer();
@@ -803,3 +803,14 @@ bool QgsLayerTreeModel::removeRows( int row, int count, const QModelIndex& paren
}
return false;
}


const QIcon& QgsLayerTreeModel::iconGroup()
{
static QIcon icon;

if ( icon.isNull() )
icon = QgsApplication::getThemeIcon( "/mActionFolder.png" );

return icon;
}
@@ -124,6 +124,8 @@ class GUI_EXPORT QgsLayerTreeModel : public QAbstractItemModel
void connectToLayer( QgsLayerTreeLayer* nodeLayer );
void disconnectFromLayer( QgsLayerTreeLayer* nodeLayer );

static const QIcon& iconGroup();

protected:
QgsLayerTreeGroup* mRootNode; // not owned!
Flags mFlags;

0 comments on commit 8a40efe

Please sign in to comment.