Skip to content

Commit

Permalink
Merge pull request #8126 from elpaso/bugfix-18608-raster-legend-embed…
Browse files Browse the repository at this point in the history
…ded-widgets

Force legend update when raster properties changes
  • Loading branch information
elpaso committed Oct 8, 2018
2 parents 8c2afa6 + 12fd51e commit f6b8020
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/app/qgsrasterlayerproperties.cpp
Expand Up @@ -55,6 +55,7 @@
#include "qgshuesaturationfilter.h"
#include "qgshillshaderendererwidget.h"
#include "qgssettings.h"
#include "qgsmaplayerlegend.h"

#include <QDesktopServices>
#include <QTableWidgetItem>
Expand Down Expand Up @@ -1052,8 +1053,14 @@ void QgsRasterLayerProperties::apply()
mRasterLayer->setCustomProperty( "WMSPublishDataSourceUrl", mPublishDataSourceUrlCheckBox->isChecked() );
mRasterLayer->setCustomProperty( "WMSBackgroundLayer", mBackgroundLayerCheckBox->isChecked() );

// update symbology

// update symbology (this is now deprecated and disconnected)
Q_NOWARN_DEPRECATED_PUSH
emit refreshLegend( mRasterLayer->id(), false );
Q_NOWARN_DEPRECATED_POP

// Force a redraw of the legend
mRasterLayer->setLegend( QgsMapLayerLegend::defaultRasterLegend( mRasterLayer ) );

//make sure the layer is redrawn
mRasterLayer->triggerRepaint();
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsrasterlayerproperties.h
Expand Up @@ -141,7 +141,7 @@ class APP_EXPORT QgsRasterLayerProperties : public QgsOptionsDialogBase, private

signals:
//! Emitted when changes to layer were saved to update legend
void refreshLegend( const QString &layerID, bool expandItem );
Q_DECL_DEPRECATED void refreshLegend( const QString &layerID, bool expandItem ) SIP_DEPRECATED;

private:
QPushButton *mBtnStyle = nullptr;
Expand Down
4 changes: 3 additions & 1 deletion src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -754,8 +754,10 @@ void QgsVectorLayerProperties::apply()
mLayer->geometryOptions()->setRemoveDuplicateNodes( mRemoveDuplicateNodesCheckbox->isChecked() );
mLayer->geometryOptions()->setGeometryPrecision( mGeometryPrecisionSpinBox->value() );

// update symbology
// update symbology (this is now deprecated and disconnected)
Q_NOWARN_DEPRECATED_PUSH
emit refreshLegend( mLayer->id() );
Q_NOWARN_DEPRECATED_POP

mLayer->triggerRepaint();
// notify the project we've made a change
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsvectorlayerproperties.h
Expand Up @@ -133,8 +133,8 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private
signals:

//! Emitted when changes to layer were saved to update legend
void refreshLegend( const QString &layerID, bool expandItem );
void refreshLegend( const QString &layerID );
Q_DECL_DEPRECATED void refreshLegend( const QString &layerID, bool expandItem ) SIP_DEPRECATED;
Q_DECL_DEPRECATED void refreshLegend( const QString &layerID ) SIP_DEPRECATED;

void toggleEditing( QgsMapLayer * );

Expand Down

0 comments on commit f6b8020

Please sign in to comment.