[QGIS Commit] r14594 - in trunk/qgis/src/plugins/grass: . themes/gis
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat Nov 13 08:49:56 EST 2010
Author: brushtyler
Date: 2010-11-13 05:49:56 -0800 (Sat, 13 Nov 2010)
New Revision: 14594
Added:
trunk/qgis/src/plugins/grass/themes/gis/grass_arrow.png
trunk/qgis/src/plugins/grass/themes/gis/grass_plus.png
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
Log:
Improving the appearance of GRASS toolbox - take 2
Modified: trunk/qgis/src/plugins/grass/CMakeLists.txt
===================================================================
--- trunk/qgis/src/plugins/grass/CMakeLists.txt 2010-11-13 13:49:30 UTC (rev 14593)
+++ trunk/qgis/src/plugins/grass/CMakeLists.txt 2010-11-13 13:49:56 UTC (rev 14594)
@@ -173,6 +173,9 @@
INSTALL (FILES ${GMLS} images/world.png
DESTINATION ${QGIS_DATA_DIR}/grass)
+INSTALL (FILES themes/gis/grass_arrow.png themes/gis/grass_plus.png
+ DESTINATION ${QGIS_DATA_DIR}/grass/modules)
+
INSTALL(TARGETS qgis.g.browser
RUNTIME DESTINATION ${QGIS_LIBEXEC_DIR}/grass/bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
Modified: trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp 2010-11-13 13:49:30 UTC (rev 14593)
+++ trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp 2010-11-13 13:49:56 UTC (rev 14594)
@@ -1112,8 +1112,38 @@
if ( width <= 0 ) width = height; //should not happen
- int plusWidth = 8; // +
- int arrowWidth = 9; // ->
+ QString iconsPath = QgsApplication::pkgDataPath() + "/grass/modules/";
+ QFileInfo iconsfi( iconsPath );
+
+ int plusWidth = 8;
+ int arrowWidth = 9;
+
+ QString arrowPath = iconsPath + "grass_arrow.png";
+ QPixmap arrowPixmap;
+ iconsfi.setFile( arrowPath );
+ if ( iconsfi.exists() && arrowPixmap.load( arrowPath, "PNG" ) )
+ {
+ double scale = 1. * height / arrowPixmap.height();
+ arrowWidth = ( int )( scale * arrowPixmap.width() );
+
+ QImage img = arrowPixmap.toImage();
+ img = img.scaled( arrowWidth, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
+ arrowPixmap = QPixmap::fromImage( img );
+ }
+
+ QString plusPath = iconsPath + "grass_plus.png";
+ QPixmap plusPixmap;
+ iconsfi.setFile( plusPath );
+ 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 );
+ }
+
int buffer = 10; // buffer around a sign
if ( pixmaps.size() > 1 ) width += arrowWidth + 2 * buffer; // ->
if ( pixmaps.size() > 2 ) width += plusWidth + 2 * buffer; // +
@@ -1123,8 +1153,8 @@
//pixmap.fill( QColor( 255, 255, 255 ) );
QPainter painter( &pixmap );
- QColor color( 255, 255, 255 );
- painter.setBrush( QBrush( color ) );
+ //QColor color( 255, 255, 255 );
+ //painter.setBrush( QBrush( color ) );
painter.setRenderHint( QPainter::Antialiasing );
@@ -1134,25 +1164,13 @@
if ( i == 1 && pixmaps.size() == 3 ) // +
{
pos += buffer;
-
- painter.setPen( QPen( color, 3 ) );
- painter.drawLine( pos, height / 2, pos + plusWidth, height / 2 );
- painter.drawLine( pos + plusWidth / 2, height / 2 - plusWidth / 2, pos + plusWidth / 2, height / 2 + plusWidth / 2 );
+ painter.drawPixmap( pos, 0, plusPixmap );
pos += buffer + plusWidth;
}
if (( i == 1 && pixmaps.size() == 2 ) || ( i == 2 && pixmaps.size() == 3 ) ) // ->
{
pos += buffer;
- painter.setPen( QPen( color, 3 ) );
- painter.drawLine( pos, height / 2, pos + arrowWidth - arrowWidth / 2, height / 2 );
-
- QPolygon pa( 3 );
- pa.setPoint( 0, pos + arrowWidth / 2 + 1, height / 2 - arrowWidth / 2 );
- pa.setPoint( 1, pos + arrowWidth, height / 2 );
- pa.setPoint( 2, pos + arrowWidth / 2 + 1, height / 2 + arrowWidth / 2 );
- painter.setPen( QPen( color, 1 ) );
- painter.drawPolygon( pa );
-
+ painter.drawPixmap( pos, 0, arrowPixmap );
pos += buffer + arrowWidth;
}
painter.drawPixmap( pos, 0, pixmaps[i] );
Modified: trunk/qgis/src/plugins/grass/qgsgrasstools.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrasstools.cpp 2010-11-13 13:49:30 UTC (rev 14593)
+++ trunk/qgis/src/plugins/grass/qgsgrasstools.cpp 2010-11-13 13:49:56 UTC (rev 14594)
@@ -79,7 +79,7 @@
mListView->setModel( mModelProxy );
mListView->setItemDelegateForColumn( 0, new QgsDetailedItemDelegate() );
- mListView->setUniformItemSizes( false );
+ //mListView->setUniformItemSizes( false );
//mListView2 = new QListView(this);
//mDockWidget = new QDockWidget(tr("Grass Tools"), 0);
//mDockWidget->setWidget(mListView2);
@@ -315,7 +315,7 @@
myData.setDetail( label );
myData.setIcon( pixmap );
myData.setCheckable( false );
- myData.setRenderAsWidget( true );
+ myData.setRenderAsWidget( false );
QVariant myVariant = qVariantFromValue( myData );
mypDetailItem->setData( myVariant, Qt::UserRole );
mModelTools->appendRow( mypDetailItem );
Modified: trunk/qgis/src/plugins/grass/qgsgrasstoolsbase.ui
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrasstoolsbase.ui 2010-11-13 13:49:30 UTC (rev 14593)
+++ trunk/qgis/src/plugins/grass/qgsgrasstoolsbase.ui 2010-11-13 13:49:56 UTC (rev 14594)
@@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
- <width>400</width>
- <height>300</height>
+ <width>350</width>
+ <height>350</height>
</rect>
</property>
+ <property name="minimumSize">
+ <size>
+ <width>350</width>
+ <height>350</height>
+ </size>
+ </property>
<property name="windowTitle">
<string>Grass Tools</string>
</property>
@@ -17,7 +23,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="mTabWidget">
<property name="currentIndex">
- <number>0</number>
+ <number>1</number>
</property>
<widget class="QWidget" name="modulesTree">
<attribute name="title">
@@ -51,9 +57,6 @@
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QListView" name="mListView">
- <property name="alternatingRowColors">
- <bool>true</bool>
- </property>
<property name="wordWrap">
<bool>true</bool>
</property>
Added: trunk/qgis/src/plugins/grass/themes/gis/grass_arrow.png
===================================================================
(Binary files differ)
Property changes on: trunk/qgis/src/plugins/grass/themes/gis/grass_arrow.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/qgis/src/plugins/grass/themes/gis/grass_plus.png
===================================================================
(Binary files differ)
Property changes on: trunk/qgis/src/plugins/grass/themes/gis/grass_plus.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
More information about the QGIS-commit
mailing list