Skip to content

Commit

Permalink
[layertree] Use group icon like the one from old legend
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed May 23, 2014
1 parent aadc9e5 commit 8a40efe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/gui/layertree/qgslayertreemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions src/gui/layertree/qgslayertreemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8a40efe

Please sign in to comment.