Skip to content

Commit 22599db

Browse files
author
mhugent
committed
Option for raster icon in legend
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13904 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent a2179e4 commit 22599db

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

src/app/legend/qgslegendlayer.cpp

+12-7
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,18 @@ QPixmap QgsLegendLayer::getOriginalPixmap()
365365
}
366366
else if ( theLayer->type() == QgsMapLayer::RasterLayer )
367367
{
368-
#if 0 //MH100708: disabled for 1.5 release because of performance problems
369-
QgsRasterLayer* rlayer = qobject_cast<QgsRasterLayer *>( theLayer );
370-
QPixmap myPixmap( 32, 32 );
371-
rlayer->thumbnailAsPixmap( &myPixmap );
372-
return myPixmap;
373-
#endif //0
374-
return QPixmap();
368+
QSettings s;
369+
if( s.value( "/qgis/createRasterLegendIcons", true ).toBool() )
370+
{
371+
QgsRasterLayer* rlayer = qobject_cast<QgsRasterLayer *>( theLayer );
372+
QPixmap myPixmap( 32, 32 );
373+
rlayer->thumbnailAsPixmap( &myPixmap );
374+
return myPixmap;
375+
}
376+
else
377+
{
378+
return QPixmap();
379+
}
375380
}
376381
}
377382

src/app/qgsoptions.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
235235
cbxIdentifyResultsDocked->setChecked( settings.value( "/qgis/dockIdentifyResults", false ).toBool() );
236236
cbxAddPostgisDC->setChecked( settings.value( "/qgis/addPostgisDC", false ).toBool() );
237237
cbxAddNewLayersToCurrentGroup->setChecked( settings.value( "/qgis/addNewLayersToCurrentGroup", false ).toBool() );
238+
cbxCreateRasterLegendIcons->setChecked( settings.value( "/qgis/createRasterLegendIcons", true ).toBool() );
238239

239240
//set the color for selections
240241
int myRed = settings.value( "/qgis/default_selection_color_red", 255 ).toInt();
@@ -489,6 +490,7 @@ void QgsOptions::saveOptions()
489490
settings.setValue( "/qgis/dockIdentifyResults", cbxIdentifyResultsDocked->isChecked() );
490491
settings.setValue( "/qgis/addPostgisDC", cbxAddPostgisDC->isChecked() );
491492
settings.setValue( "/qgis/addNewLayersToCurrentGroup", cbxAddNewLayersToCurrentGroup->isChecked() );
493+
settings.setValue( "/qgis/createRasterLegendIcons", cbxCreateRasterLegendIcons->isChecked() );
492494
settings.setValue( "/qgis/new_layers_visible", chkAddedVisibility->isChecked() );
493495
settings.setValue( "/qgis/enable_anti_aliasing", chkAntiAliasing->isChecked() );
494496
settings.setValue( "/qgis/enable_render_caching", chkUseRenderCaching->isChecked() );

src/ui/qgsoptionsbase.ui

+7
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,13 @@
379379
</property>
380380
</widget>
381381
</item>
382+
<item>
383+
<widget class="QCheckBox" name="cbxCreateRasterLegendIcons">
384+
<property name="text">
385+
<string>Create raster icons in legend</string>
386+
</property>
387+
</widget>
388+
</item>
382389
<item>
383390
<widget class="QCheckBox" name="cbxHideSplash">
384391
<property name="text">

0 commit comments

Comments
 (0)