[QGIS Commit] r13904 - in trunk/qgis/src: app app/legend ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Jul 11 06:05:41 EDT 2010


Author: mhugent
Date: 2010-07-11 10:05:41 +0000 (Sun, 11 Jul 2010)
New Revision: 13904

Modified:
   trunk/qgis/src/app/legend/qgslegendlayer.cpp
   trunk/qgis/src/app/qgsoptions.cpp
   trunk/qgis/src/ui/qgsoptionsbase.ui
Log:
Option for raster icon in legend

Modified: trunk/qgis/src/app/legend/qgslegendlayer.cpp
===================================================================
--- trunk/qgis/src/app/legend/qgslegendlayer.cpp	2010-07-09 12:29:18 UTC (rev 13903)
+++ trunk/qgis/src/app/legend/qgslegendlayer.cpp	2010-07-11 10:05:41 UTC (rev 13904)
@@ -365,13 +365,18 @@
     }
     else if ( theLayer->type() == QgsMapLayer::RasterLayer )
     {
-#if 0 //MH100708: disabled for 1.5 release because of performance problems
-      QgsRasterLayer* rlayer = qobject_cast<QgsRasterLayer *>( theLayer );
-      QPixmap myPixmap( 32, 32 );
-      rlayer->thumbnailAsPixmap( &myPixmap );
-      return myPixmap;
-#endif //0
-      return QPixmap();
+      QSettings s;
+      if( s.value( "/qgis/createRasterLegendIcons", true ).toBool() )
+      {
+        QgsRasterLayer* rlayer = qobject_cast<QgsRasterLayer *>( theLayer );
+        QPixmap myPixmap( 32, 32 );
+        rlayer->thumbnailAsPixmap( &myPixmap );
+        return myPixmap;
+      }
+      else
+      {
+        return QPixmap();
+      }
     }
   }
 

Modified: trunk/qgis/src/app/qgsoptions.cpp
===================================================================
--- trunk/qgis/src/app/qgsoptions.cpp	2010-07-09 12:29:18 UTC (rev 13903)
+++ trunk/qgis/src/app/qgsoptions.cpp	2010-07-11 10:05:41 UTC (rev 13904)
@@ -235,6 +235,7 @@
   cbxIdentifyResultsDocked->setChecked( settings.value( "/qgis/dockIdentifyResults", false ).toBool() );
   cbxAddPostgisDC->setChecked( settings.value( "/qgis/addPostgisDC", false ).toBool() );
   cbxAddNewLayersToCurrentGroup->setChecked( settings.value( "/qgis/addNewLayersToCurrentGroup", false ).toBool() );
+  cbxCreateRasterLegendIcons->setChecked( settings.value( "/qgis/createRasterLegendIcons", true ).toBool() );
 
   //set the color for selections
   int myRed = settings.value( "/qgis/default_selection_color_red", 255 ).toInt();
@@ -489,6 +490,7 @@
   settings.setValue( "/qgis/dockIdentifyResults", cbxIdentifyResultsDocked->isChecked() );
   settings.setValue( "/qgis/addPostgisDC", cbxAddPostgisDC->isChecked() );
   settings.setValue( "/qgis/addNewLayersToCurrentGroup", cbxAddNewLayersToCurrentGroup->isChecked() );
+  settings.setValue( "/qgis/createRasterLegendIcons", cbxCreateRasterLegendIcons->isChecked() );
   settings.setValue( "/qgis/new_layers_visible", chkAddedVisibility->isChecked() );
   settings.setValue( "/qgis/enable_anti_aliasing", chkAntiAliasing->isChecked() );
   settings.setValue( "/qgis/enable_render_caching", chkUseRenderCaching->isChecked() );

Modified: trunk/qgis/src/ui/qgsoptionsbase.ui
===================================================================
--- trunk/qgis/src/ui/qgsoptionsbase.ui	2010-07-09 12:29:18 UTC (rev 13903)
+++ trunk/qgis/src/ui/qgsoptionsbase.ui	2010-07-11 10:05:41 UTC (rev 13904)
@@ -380,6 +380,13 @@
            </widget>
           </item>
           <item>
+           <widget class="QCheckBox" name="cbxCreateRasterLegendIcons">
+            <property name="text">
+             <string>Create raster icons in legend</string>
+            </property>
+           </widget>
+          </item>
+          <item>
            <widget class="QCheckBox" name="cbxHideSplash">
             <property name="text">
              <string>Hide splash screen at startup</string>



More information about the QGIS-commit mailing list