Skip to content

Commit 9a91aa4

Browse files
author
brushtyler
committed
adjusted GRASS list GUI
git-svn-id: http://svn.osgeo.org/qgis/trunk@14621 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 899a11d commit 9a91aa4

File tree

5 files changed

+64
-12
lines changed

5 files changed

+64
-12
lines changed

src/plugins/grass/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ FILE (GLOB GMLS *.gml)
173173
INSTALL (FILES ${GMLS} images/world.png
174174
DESTINATION ${QGIS_DATA_DIR}/grass)
175175

176-
INSTALL (FILES themes/gis/grass_arrow.png themes/gis/grass_plus.png
176+
INSTALL (FILES themes/gis/grass_arrow.svg themes/gis/grass_plus.svg themes/gis/grass_arrow.png themes/gis/grass_plus.png
177177
DESTINATION ${QGIS_DATA_DIR}/grass/modules)
178178

179179
INSTALL(TARGETS qgis.g.browser

src/plugins/grass/qgsgrassmodule.cpp

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,20 +1130,59 @@ QPixmap QgsGrassModule::pixmap( QString path, int height )
11301130
img = img.scaled( arrowWidth, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
11311131
arrowPixmap = QPixmap::fromImage( img );
11321132
}
1133+
/*if ( iconsfi.exists() )
1134+
{
1135+
QSvgRenderer pic;
1136+
if ( pic.load( arrowPath ) )
1137+
{
1138+
QRect br( QPoint( 0, 0 ), pic.defaultSize() );
1139+
1140+
double scale = 1. * height / br.height();
1141+
1142+
arrowWidth = ( int )( scale * br.width() );
1143+
if ( arrowWidth <= 0 ) arrowWidth = height; // should not happen
1144+
arrowPixmap = QPixmap( arrowWidth, height );
1145+
arrowPixmap.fill( Qt::transparent );
1146+
QPainter painter( &arrowPixmap );
1147+
painter.setRenderHint( QPainter::Antialiasing );
1148+
1149+
pic.render( &painter );
1150+
painter.end();
1151+
}
1152+
}*/
11331153

1134-
QString plusPath = iconsPath + "grass_plus.png";
1154+
QString plusPath = iconsPath + "grass_plus.svg";
11351155
QPixmap plusPixmap;
11361156
iconsfi.setFile( plusPath );
1137-
if ( iconsfi.exists() && plusPixmap.load( plusPath, "PNG" ) )
1157+
/*if ( iconsfi.exists() && plusPixmap.load( plusPath, "PNG" ) )
11381158
{
11391159
double scale = 1. * height / plusPixmap.height();
11401160
plusWidth = ( int )( scale * plusPixmap.width() );
11411161
11421162
QImage img = plusPixmap.toImage();
11431163
img = img.scaled( plusWidth, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
11441164
plusPixmap = QPixmap::fromImage( img );
1145-
}
1165+
}*/
1166+
if ( iconsfi.exists() )
1167+
{
1168+
QSvgRenderer pic;
1169+
if ( pic.load( plusPath ) )
1170+
{
1171+
QRect br( QPoint( 0, 0 ), pic.defaultSize() );
11461172

1173+
double scale = 1. * height / br.height();
1174+
1175+
plusWidth = ( int )( scale * br.width() );
1176+
if ( plusWidth <= 0 ) plusWidth = height; // should not happen
1177+
plusPixmap = QPixmap( plusWidth, height );
1178+
plusPixmap.fill( Qt::transparent );
1179+
QPainter painter( &plusPixmap );
1180+
painter.setRenderHint( QPainter::Antialiasing );
1181+
1182+
pic.render( &painter );
1183+
painter.end();
1184+
}
1185+
}
11471186
int buffer = height/3; // buffer around a sign
11481187
if ( pixmaps.size() > 1 ) width += arrowWidth + 2 * buffer; // ->
11491188
if ( pixmaps.size() > 2 ) width += plusWidth + 2 * buffer; // +

src/plugins/grass/qgsgrasstools.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ QgsGrassTools::QgsGrassTools( QgisInterface *iface,
7878
mModelProxy->setFilterRole( Qt::UserRole + 2 );
7979

8080
mListView->setModel( mModelProxy );
81-
mListView->setItemDelegateForColumn( 0, new QgsDetailedItemDelegate() );
81+
//mListView->setItemDelegateForColumn( 0, new QgsDetailedItemDelegate() );
8282
//mListView->setUniformItemSizes( false );
8383
//mListView2 = new QListView(this);
8484
//mDockWidget = new QDockWidget(tr("Grass Tools"), 0);
@@ -302,7 +302,7 @@ void QgsGrassTools::addModules( QTreeWidgetItem *parent, QDomElement &element )
302302
//
303303
// Experimental work by Tim - add this item to our list model
304304
//
305-
QStandardItem * mypDetailItem = new QStandardItem( name );
305+
QStandardItem * mypDetailItem = new QStandardItem( name + "\n" + label );
306306
mypDetailItem->setData( name, Qt::UserRole + 1 ); //for calling runModule later
307307
QString mySearchText = name + " - " + label;
308308
mypDetailItem->setData( mySearchText, Qt::UserRole + 2 ); //for filtering later

src/plugins/grass/qgsgrasstoolsbase.ui

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<property name="windowTitle">
2020
<string>Grass Tools</string>
2121
</property>
22-
<layout class="QGridLayout">
22+
<layout class="QGridLayout" name="gridLayout_2">
2323
<item row="0" column="0">
2424
<widget class="QTabWidget" name="mTabWidget">
2525
<property name="currentIndex">
@@ -54,17 +54,30 @@
5454
<attribute name="title">
5555
<string>Modules List</string>
5656
</attribute>
57-
<layout class="QGridLayout">
57+
<layout class="QGridLayout" name="gridLayout">
5858
<item row="0" column="0">
59+
<widget class="QLabel" name="label">
60+
<property name="text">
61+
<string>Filter</string>
62+
</property>
63+
</widget>
64+
</item>
65+
<item row="0" column="1">
66+
<widget class="QLineEdit" name="mFilterInput"/>
67+
</item>
68+
<item row="1" column="0" colspan="2">
5969
<widget class="QListView" name="mListView">
70+
<property name="horizontalScrollBarPolicy">
71+
<enum>Qt::ScrollBarAlwaysOff</enum>
72+
</property>
73+
<property name="alternatingRowColors">
74+
<bool>true</bool>
75+
</property>
6076
<property name="wordWrap">
6177
<bool>true</bool>
6278
</property>
6379
</widget>
6480
</item>
65-
<item row="1" column="0">
66-
<widget class="QLineEdit" name="mFilterInput"/>
67-
</item>
6881
</layout>
6982
</widget>
7083
</widget>

src/plugins/grass/themes/gis/grass_arrow.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)