Skip to content

Commit f6b8020

Browse files
authoredOct 8, 2018
Merge pull request #8126 from elpaso/bugfix-18608-raster-legend-embedded-widgets
Force legend update when raster properties changes
2 parents 8c2afa6 + 12fd51e commit f6b8020

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed
 

‎src/app/qgsrasterlayerproperties.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include "qgshuesaturationfilter.h"
5656
#include "qgshillshaderendererwidget.h"
5757
#include "qgssettings.h"
58+
#include "qgsmaplayerlegend.h"
5859

5960
#include <QDesktopServices>
6061
#include <QTableWidgetItem>
@@ -1052,8 +1053,14 @@ void QgsRasterLayerProperties::apply()
10521053
mRasterLayer->setCustomProperty( "WMSPublishDataSourceUrl", mPublishDataSourceUrlCheckBox->isChecked() );
10531054
mRasterLayer->setCustomProperty( "WMSBackgroundLayer", mBackgroundLayerCheckBox->isChecked() );
10541055

1055-
// update symbology
1056+
1057+
// update symbology (this is now deprecated and disconnected)
1058+
Q_NOWARN_DEPRECATED_PUSH
10561059
emit refreshLegend( mRasterLayer->id(), false );
1060+
Q_NOWARN_DEPRECATED_POP
1061+
1062+
// Force a redraw of the legend
1063+
mRasterLayer->setLegend( QgsMapLayerLegend::defaultRasterLegend( mRasterLayer ) );
10571064

10581065
//make sure the layer is redrawn
10591066
mRasterLayer->triggerRepaint();

‎src/app/qgsrasterlayerproperties.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class APP_EXPORT QgsRasterLayerProperties : public QgsOptionsDialogBase, private
141141

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

146146
private:
147147
QPushButton *mBtnStyle = nullptr;

‎src/app/qgsvectorlayerproperties.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,10 @@ void QgsVectorLayerProperties::apply()
754754
mLayer->geometryOptions()->setRemoveDuplicateNodes( mRemoveDuplicateNodesCheckbox->isChecked() );
755755
mLayer->geometryOptions()->setGeometryPrecision( mGeometryPrecisionSpinBox->value() );
756756

757-
// update symbology
757+
// update symbology (this is now deprecated and disconnected)
758+
Q_NOWARN_DEPRECATED_PUSH
758759
emit refreshLegend( mLayer->id() );
760+
Q_NOWARN_DEPRECATED_POP
759761

760762
mLayer->triggerRepaint();
761763
// notify the project we've made a change

‎src/app/qgsvectorlayerproperties.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private
133133
signals:
134134

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

139139
void toggleEditing( QgsMapLayer * );
140140

0 commit comments

Comments
 (0)
Please sign in to comment.