[QGIS Commit] r14621 - in trunk/qgis/src/plugins/grass: . themes/gis

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Nov 13 16:23:15 EST 2010


Author: brushtyler
Date: 2010-11-13 13:23:15 -0800 (Sat, 13 Nov 2010)
New Revision: 14621

Modified:
   trunk/qgis/src/plugins/grass/CMakeLists.txt
   trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp
   trunk/qgis/src/plugins/grass/qgsgrasstools.cpp
   trunk/qgis/src/plugins/grass/qgsgrasstoolsbase.ui
   trunk/qgis/src/plugins/grass/themes/gis/grass_arrow.svg
Log:
adjusted GRASS list GUI


Modified: trunk/qgis/src/plugins/grass/CMakeLists.txt
===================================================================
--- trunk/qgis/src/plugins/grass/CMakeLists.txt	2010-11-13 20:49:09 UTC (rev 14620)
+++ trunk/qgis/src/plugins/grass/CMakeLists.txt	2010-11-13 21:23:15 UTC (rev 14621)
@@ -173,7 +173,7 @@
 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 

Modified: trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp	2010-11-13 20:49:09 UTC (rev 14620)
+++ trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp	2010-11-13 21:23:15 UTC (rev 14621)
@@ -1130,11 +1130,31 @@
     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() );
 
-  QString plusPath = iconsPath + "grass_plus.png";
+      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.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() );
@@ -1142,8 +1162,27 @@
     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; // +

Modified: trunk/qgis/src/plugins/grass/qgsgrasstools.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrasstools.cpp	2010-11-13 20:49:09 UTC (rev 14620)
+++ trunk/qgis/src/plugins/grass/qgsgrasstools.cpp	2010-11-13 21:23:15 UTC (rev 14621)
@@ -78,7 +78,7 @@
   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);
@@ -302,7 +302,7 @@
         //
         // 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

Modified: trunk/qgis/src/plugins/grass/qgsgrasstoolsbase.ui
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrasstoolsbase.ui	2010-11-13 20:49:09 UTC (rev 14620)
+++ trunk/qgis/src/plugins/grass/qgsgrasstoolsbase.ui	2010-11-13 21:23:15 UTC (rev 14621)
@@ -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">
@@ -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>

Modified: trunk/qgis/src/plugins/grass/themes/gis/grass_arrow.svg
===================================================================
--- trunk/qgis/src/plugins/grass/themes/gis/grass_arrow.svg	2010-11-13 20:49:09 UTC (rev 14620)
+++ trunk/qgis/src/plugins/grass/themes/gis/grass_arrow.svg	2010-11-13 21:23:15 UTC (rev 14621)
@@ -28,7 +28,7 @@
   <g
      id="layer1">
     <path
-       d="m 18.5,8.5 0,5 -10,0 c -0.554,0 -1,0.446 -1,1 l 0,2 c 0,0.554 0.446,1 1,1 l 10,0 0,5 9,-7 -9,-7 z"
+       d="m 13.5,13.5 -5,0 c -0.554,0 -1,0.446 -1,1 l 0,2 c 0,0.554 0.446,1 1,1 l 10,0 0,5 9,-7 -9,-7 0,5 -4.955446,0"
        id="path2984"
        style="color:#000000;fill:#e9b96e;fill-opacity:1;fill-rule:nonzero;stroke:#c17d11;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
   </g>



More information about the QGIS-commit mailing list