Skip to content

Commit ac07255

Browse files
author
rblazek
committed
better icons
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5045 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 5e24366 commit ac07255

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

src/plugins/grass/qgsgrassmodel.cpp

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,13 @@ QgsGrassModel::QgsGrassModel ( QObject * parent )
484484
+ "/" + QgsGrass::getDefaultLocation();
485485

486486
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" );
487494

488495
mRoot = new QgsGrassModelItem();
489496
mRoot->mType = QgsGrassModel::Location;
@@ -784,10 +791,37 @@ QVariant QgsGrassModel::data ( const QModelIndex &index, int role ) const
784791

785792
if ( role == Qt::DecorationRole )
786793
{
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;
791825
}
792826
return mIconDirectory;
793827
}

src/plugins/grass/qgsgrassmodel.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ class QgsGrassModel: public QAbstractItemModel
112112
//! Icons
113113
QIcon mIconDirectory;
114114
QIcon mIconFile;
115+
QIcon mIconRasterLayer;
116+
QIcon mIconVectorLayer;
117+
QIcon mIconPointLayer;
118+
QIcon mIconLineLayer;
119+
QIcon mIconPolygonLayer;
115120
};
116121

117122
#endif // QGSGRASSMODEL_H

0 commit comments

Comments
 (0)