Skip to content
Permalink
Browse files

Remove layer/legend/palette preview from raster layer properties

These boxes were not very useful - two of them (legend and palette)
have been disabled for many years now, and the layer preview was
occasionally causing an exception when used with contour renderer,
which caused the raster properties dialog to fail to load at all.

See https://lists.osgeo.org/pipermail/qgis-developer/2020-November/062651.html

(cherry picked from commit b0f5f09)
  • Loading branch information
wonder-sk authored and nyalldawson committed Dec 21, 2020
1 parent 6d4df44 commit aad81d18b98283d71bb49199545b2a987e8e308d
Showing with 0 additions and 145 deletions.
  1. +0 −22 src/gui/raster/qgsrasterlayerproperties.cpp
  2. +0 −123 src/ui/qgsrasterlayerpropertiesbase.ui
@@ -856,24 +856,6 @@ void QgsRasterLayerProperties::sync()
mLayerOrigNameLineEd->setText( mRasterLayer->name() );
leDisplayName->setText( mRasterLayer->name() );

//get the thumbnail for the layer
QPixmap thumbnail = QPixmap::fromImage( mRasterLayer->previewAsImage( pixmapThumbnail->size() ) );
pixmapThumbnail->setPixmap( thumbnail );

// TODO fix legend + palette pixmap

//update the legend pixmap on this dialog
#if 0
pixmapLegend->setPixmap( mRasterLayer->legendAsPixmap() );
pixmapLegend->setScaledContents( true );
pixmapLegend->repaint();

//set the palette pixmap
pixmapPalette->setPixmap( mRasterLayer->paletteAsPixmap( mRasterLayer->bandNumber( mRasterLayer->grayBandName() ) ) );
pixmapPalette->setScaledContents( true );
pixmapPalette->repaint();
#endif

QgsDebugMsgLevel( QStringLiteral( "populate metadata tab" ), 2 );
/*
* Metadata Tab
@@ -1113,10 +1095,6 @@ void QgsRasterLayerProperties::apply()

mRasterLayer->setCrs( mCrsSelector->crs() );

//get the thumbnail for the layer
QPixmap thumbnail = QPixmap::fromImage( mRasterLayer->previewAsImage( pixmapThumbnail->size() ) );
pixmapThumbnail->setPixmap( thumbnail );

if ( mRasterLayer->shortName() != mLayerShortNameLineEdit->text() )
mMetadataFilled = false;
mRasterLayer->setShortName( mLayerShortNameLineEdit->text() );
@@ -1243,129 +1243,6 @@ border-radius: 2px;</string>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox10">
<property name="title">
<string>Thumbnail</string>
</property>
<layout class="QGridLayout" name="_7">
<item row="0" column="0">
<widget class="QLabel" name="pixmapThumbnail">
<property name="minimumSize">
<size>
<width>120</width>
<height>120</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>120</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox9">
<property name="title">
<string>Legend</string>
</property>
<layout class="QGridLayout" name="_8">
<item row="0" column="0">
<widget class="QLabel" name="pixmapLegend">
<property name="minimumSize">
<size>
<width>120</width>
<height>120</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>120</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox8">
<property name="title">
<string>Palette</string>
</property>
<layout class="QGridLayout" name="_9">
<item row="0" column="0">
<widget class="QLabel" name="pixmapPalette">
<property name="minimumSize">
<size>
<width>120</width>
<height>120</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>120</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

0 comments on commit aad81d1

Please sign in to comment.
You can’t perform that action at this time.