Skip to content

Commit

Permalink
adjusted GRASS list GUI
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14621 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
brushtyler committed Nov 13, 2010
1 parent 2159116 commit a2b198a
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/plugins/grass/CMakeLists.txt
Expand Up @@ -173,7 +173,7 @@ FILE (GLOB GMLS *.gml)
INSTALL (FILES ${GMLS} images/world.png
DESTINATION ${QGIS_DATA_DIR}/grass)

INSTALL (FILES themes/gis/grass_arrow.png themes/gis/grass_plus.png
INSTALL (FILES themes/gis/grass_arrow.svg themes/gis/grass_plus.svg themes/gis/grass_arrow.png themes/gis/grass_plus.png
DESTINATION ${QGIS_DATA_DIR}/grass/modules)

INSTALL(TARGETS qgis.g.browser
Expand Down
45 changes: 42 additions & 3 deletions src/plugins/grass/qgsgrassmodule.cpp
Expand Up @@ -1130,20 +1130,59 @@ QPixmap QgsGrassModule::pixmap( QString path, int height )
img = img.scaled( arrowWidth, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
arrowPixmap = QPixmap::fromImage( img );
}
/*if ( iconsfi.exists() )
{
QSvgRenderer pic;
if ( pic.load( arrowPath ) )
{
QRect br( QPoint( 0, 0 ), pic.defaultSize() );
double scale = 1. * height / br.height();
arrowWidth = ( int )( scale * br.width() );
if ( arrowWidth <= 0 ) arrowWidth = height; // should not happen
arrowPixmap = QPixmap( arrowWidth, height );
arrowPixmap.fill( Qt::transparent );
QPainter painter( &arrowPixmap );
painter.setRenderHint( QPainter::Antialiasing );
pic.render( &painter );
painter.end();
}
}*/

QString plusPath = iconsPath + "grass_plus.png";
QString plusPath = iconsPath + "grass_plus.svg";
QPixmap plusPixmap;
iconsfi.setFile( plusPath );
if ( iconsfi.exists() && plusPixmap.load( plusPath, "PNG" ) )
/*if ( iconsfi.exists() && plusPixmap.load( plusPath, "PNG" ) )
{
double scale = 1. * height / plusPixmap.height();
plusWidth = ( int )( scale * plusPixmap.width() );
QImage img = plusPixmap.toImage();
img = img.scaled( plusWidth, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
plusPixmap = QPixmap::fromImage( img );
}
}*/
if ( iconsfi.exists() )
{
QSvgRenderer pic;
if ( pic.load( plusPath ) )
{
QRect br( QPoint( 0, 0 ), pic.defaultSize() );

double scale = 1. * height / br.height();

plusWidth = ( int )( scale * br.width() );
if ( plusWidth <= 0 ) plusWidth = height; // should not happen
plusPixmap = QPixmap( plusWidth, height );
plusPixmap.fill( Qt::transparent );
QPainter painter( &plusPixmap );
painter.setRenderHint( QPainter::Antialiasing );

pic.render( &painter );
painter.end();
}
}
int buffer = height/3; // buffer around a sign
if ( pixmaps.size() > 1 ) width += arrowWidth + 2 * buffer; // ->
if ( pixmaps.size() > 2 ) width += plusWidth + 2 * buffer; // +
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/grass/qgsgrasstools.cpp
Expand Up @@ -78,7 +78,7 @@ QgsGrassTools::QgsGrassTools( QgisInterface *iface,
mModelProxy->setFilterRole( Qt::UserRole + 2 );

mListView->setModel( mModelProxy );
mListView->setItemDelegateForColumn( 0, new QgsDetailedItemDelegate() );
//mListView->setItemDelegateForColumn( 0, new QgsDetailedItemDelegate() );
//mListView->setUniformItemSizes( false );
//mListView2 = new QListView(this);
//mDockWidget = new QDockWidget(tr("Grass Tools"), 0);
Expand Down Expand Up @@ -302,7 +302,7 @@ void QgsGrassTools::addModules( QTreeWidgetItem *parent, QDomElement &element )
//
// Experimental work by Tim - add this item to our list model
//
QStandardItem * mypDetailItem = new QStandardItem( name );
QStandardItem * mypDetailItem = new QStandardItem( name + "\n" + label );
mypDetailItem->setData( name, Qt::UserRole + 1 ); //for calling runModule later
QString mySearchText = name + " - " + label;
mypDetailItem->setData( mySearchText, Qt::UserRole + 2 ); //for filtering later
Expand Down
23 changes: 18 additions & 5 deletions src/plugins/grass/qgsgrasstoolsbase.ui
Expand Up @@ -19,7 +19,7 @@
<property name="windowTitle">
<string>Grass Tools</string>
</property>
<layout class="QGridLayout">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QTabWidget" name="mTabWidget">
<property name="currentIndex">
Expand Down Expand Up @@ -54,17 +54,30 @@
<attribute name="title">
<string>Modules List</string>
</attribute>
<layout class="QGridLayout">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Filter</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="mFilterInput"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QListView" name="mListView">
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="mFilterInput"/>
</item>
</layout>
</widget>
</widget>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/themes/gis/grass_arrow.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a2b198a

Please sign in to comment.