Skip to content

Commit b754ee7

Browse files
committedApr 17, 2014
fix UI inconsistencies in raster min/max widget
1 parent 3e4a915 commit b754ee7

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
 

‎src/gui/raster/qgsrasterminmaxwidget.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
***************************************************************************/
1717

1818
#include <QSettings>
19+
#include <QMessageBox>
1920

2021
#include "qgsrasterlayer.h"
2122
#include "qgsrasterminmaxwidget.h"
@@ -28,10 +29,21 @@ QgsRasterMinMaxWidget::QgsRasterMinMaxWidget( QgsRasterLayer* theLayer, QWidget
2829
setupUi( this );
2930

3031
QSettings mySettings;
32+
33+
// set contrast enhancement setting to default
34+
// ideally we should set it actual method last used to get min/max, but there is no way to know currently
35+
QString contrastEnchacementLimits = mySettings.value( "/Raster/defaultContrastEnhancementLimits", "CumulativeCut" ).toString();
36+
if ( contrastEnchacementLimits == "MinMax" )
37+
mMinMaxRadioButton->setChecked( true );
38+
else if ( contrastEnchacementLimits == "StdDev" )
39+
mStdDevRadioButton->setChecked( true );
40+
3141
double myLower = 100.0 * mySettings.value( "/Raster/cumulativeCutLower", QString::number( QgsRasterLayer::CUMULATIVE_CUT_LOWER ) ).toDouble();
3242
double myUpper = 100.0 * mySettings.value( "/Raster/cumulativeCutUpper", QString::number( QgsRasterLayer::CUMULATIVE_CUT_UPPER ) ).toDouble();
3343
mCumulativeCutLowerDoubleSpinBox->setValue( myLower );
3444
mCumulativeCutUpperDoubleSpinBox->setValue( myUpper );
45+
46+
mStdDevSpinBox->setValue( mySettings.value( "/Raster/defaultStandardDeviation", 2.0 ).toDouble() );
3547
}
3648

3749
QgsRasterMinMaxWidget::~QgsRasterMinMaxWidget()
@@ -99,6 +111,11 @@ void QgsRasterMinMaxWidget::on_mLoadPushButton_clicked()
99111
myMax = myRasterBandStats.mean + ( myStdDev * myRasterBandStats.stdDev );
100112
origin |= QgsRasterRenderer::MinMaxStdDev;
101113
}
114+
else
115+
{
116+
QMessageBox::warning( this, tr( "No option selected" ), tr( "Please select an option to load min/max values." ) );
117+
return;
118+
}
102119

103120
emit load( myBand, myMin, myMax, origin );
104121
}

‎src/ui/qgsrasterminmaxwidgetbase.ui

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ count cut</string>
3737
<property name="checked">
3838
<bool>true</bool>
3939
</property>
40+
<attribute name="buttonGroup">
41+
<string notr="true">buttonGroup</string>
42+
</attribute>
4043
</widget>
4144
</item>
4245
<item>
@@ -89,6 +92,9 @@ count cut</string>
8992
<property name="text">
9093
<string>Min / max</string>
9194
</property>
95+
<attribute name="buttonGroup">
96+
<string notr="true">buttonGroup</string>
97+
</attribute>
9298
</widget>
9399
</item>
94100
<item>
@@ -114,6 +120,9 @@ count cut</string>
114120
<string>Mean +/-
115121
standard deviation ×</string>
116122
</property>
123+
<attribute name="buttonGroup">
124+
<string notr="true">buttonGroup</string>
125+
</attribute>
117126
</widget>
118127
</item>
119128
<item>
@@ -247,4 +256,7 @@ standard deviation ×</string>
247256
</widget>
248257
<resources/>
249258
<connections/>
259+
<buttongroups>
260+
<buttongroup name="buttonGroup"/>
261+
</buttongroups>
250262
</ui>

0 commit comments

Comments
 (0)
Please sign in to comment.