@@ -484,6 +484,13 @@ QgsGrassModel::QgsGrassModel ( QObject * parent )
484
484
+ " /" + QgsGrass::getDefaultLocation ();
485
485
486
486
mIconFile = QIcon (style->standardPixmap (QStyle::SP_FileIcon));
487
+
488
+ QString iconPath = QgsApplication::themePath ();
489
+ mIconPointLayer = QIcon ( iconPath+" /mIconPointLayer.png" );
490
+ mIconLineLayer = QIcon ( iconPath+" /mIconLineLayer.png" );
491
+ mIconPolygonLayer = QIcon ( iconPath+" /mIconPolygonLayer.png" );
492
+ mIconVectorLayer = QIcon ( iconPath+" /grass/grass_browser_vector_layer.png" );
493
+ mIconRasterLayer = QIcon ( iconPath+" /grass/grass_browser_raster_layer.png" );
487
494
488
495
mRoot = new QgsGrassModelItem ();
489
496
mRoot ->mType = QgsGrassModel::Location;
@@ -784,10 +791,37 @@ QVariant QgsGrassModel::data ( const QModelIndex &index, int role ) const
784
791
785
792
if ( role == Qt::DecorationRole )
786
793
{
787
- if ( item->type () == QgsGrassModel::Raster ||
788
- item->type () == QgsGrassModel::VectorLayer )
789
- {
790
- return mIconFile ;
794
+ switch ( item->type () )
795
+ {
796
+ case QgsGrassModel::Vector :
797
+ return mIconVectorLayer ;
798
+ break ;
799
+
800
+ case QgsGrassModel::Raster :
801
+ return mIconRasterLayer ;
802
+ break ;
803
+
804
+ case QgsGrassModel::VectorLayer :
805
+ if ( item->mLayer .contains (" point" ) )
806
+ {
807
+ return mIconPointLayer ;
808
+ }
809
+ else if ( item->mLayer .contains (" line" ) )
810
+ {
811
+ return mIconLineLayer ;
812
+ }
813
+ else if ( item->mLayer .contains (" polygon" ) )
814
+ {
815
+ return mIconPolygonLayer ;
816
+ }
817
+ else
818
+ {
819
+ return mIconFile ;
820
+ }
821
+ break ;
822
+
823
+ default :
824
+ return mIconDirectory ;
791
825
}
792
826
return mIconDirectory ;
793
827
}
0 commit comments