Skip to content

Commit

Permalink
Option for raster icon in legend
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@13904 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jul 11, 2010
1 parent f1c9014 commit f9ae9e8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/app/legend/qgslegendlayer.cpp
Expand Up @@ -365,13 +365,18 @@ QPixmap QgsLegendLayer::getOriginalPixmap()
}
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();
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsoptions.cpp
Expand Up @@ -235,6 +235,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
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();
Expand Down Expand Up @@ -489,6 +490,7 @@ void QgsOptions::saveOptions()
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() );
Expand Down
7 changes: 7 additions & 0 deletions src/ui/qgsoptionsbase.ui
Expand Up @@ -379,6 +379,13 @@
</property>
</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">
Expand Down

0 comments on commit f9ae9e8

Please sign in to comment.