Skip to content

Commit

Permalink
[gui] improve load min/max widget UI/UX (#3253)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn authored and NathanW2 committed Jul 3, 2016
1 parent f470dfb commit 0fccb07
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 160 deletions.
5 changes: 4 additions & 1 deletion src/gui/raster/qgsmultibandcolorrendererwidget.cpp
Expand Up @@ -37,7 +37,10 @@ QgsMultiBandColorRendererWidget::QgsMultiBandColorRendererWidget( QgsRasterLayer
mMinMaxWidget = new QgsRasterMinMaxWidget( layer, this );
mMinMaxWidget->setExtent( extent );
mMinMaxWidget->setMapCanvas( mCanvas );
layout()->addWidget( mMinMaxWidget );
QHBoxLayout *layout = new QHBoxLayout();
layout->setContentsMargins( 0, 0, 0, 0 );
mMinMaxContainerWidget->setLayout( layout );
layout->addWidget( mMinMaxWidget );
connect( mMinMaxWidget, SIGNAL( load( int, double, double, int ) ),
this, SLOT( loadMinMax( int, double, double, int ) ) );

Expand Down
6 changes: 3 additions & 3 deletions src/gui/raster/qgsrasterminmaxwidget.cpp
Expand Up @@ -64,7 +64,7 @@ QgsMapCanvas* QgsRasterMinMaxWidget::mapCanvas()

QgsRectangle QgsRasterMinMaxWidget::extent()
{
if ( !mCurrentExtentRadioButton->isChecked() )
if ( !cbxClipExtent->isChecked() )
return QgsRectangle();

if ( mLayer && mCanvas )
Expand All @@ -91,7 +91,7 @@ void QgsRasterMinMaxWidget::on_mLoadPushButton_clicked()
double myMax = std::numeric_limits<double>::quiet_NaN();

QgsRectangle myExtent = extent(); // empty == full
if ( mCurrentExtentRadioButton->isChecked() )
if ( cbxClipExtent->isChecked() )
{
origin |= QgsRasterRenderer::MinMaxSubExtent;
}
Expand All @@ -102,7 +102,7 @@ void QgsRasterMinMaxWidget::on_mLoadPushButton_clicked()
QgsDebugMsg( QString( "myExtent.isEmpty() = %1" ).arg( myExtent.isEmpty() ) );

int mySampleSize = sampleSize(); // 0 == exact
if ( mEstimateRadioButton->isChecked() )
if ( cboAccuracy->currentIndex() == 0 )
{
origin |= QgsRasterRenderer::MinMaxEstimated;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/raster/qgsrasterminmaxwidget.h
Expand Up @@ -62,7 +62,7 @@ class GUI_EXPORT QgsRasterMinMaxWidget: public QWidget, private Ui::QgsRasterMin
QgsRectangle extent();

/** Return the selected sample size. */
int sampleSize() { return mEstimateRadioButton->isChecked() ? 250000 : 0; }
int sampleSize() { return cboAccuracy->currentIndex() == 0 ? 250000 : 0; }

// Load programmaticaly with current values
void load() { on_mLoadPushButton_clicked(); }
Expand Down
7 changes: 5 additions & 2 deletions src/ui/qgsmultibandcolorrendererwidgetbase.ui
Expand Up @@ -156,7 +156,7 @@ enhancement</string>
</property>
</widget>
</item>
<item row="3" column="4">
<item row="3" column="2">
<widget class="QLineEdit" name="mGreenMinLineEdit">
<property name="maxLength">
<number>16</number>
Expand Down Expand Up @@ -209,7 +209,7 @@ enhancement</string>
</property>
</widget>
</item>
<item row="3" column="2">
<item row="3" column="4">
<widget class="QLineEdit" name="mGreenMaxLineEdit">
<property name="maxLength">
<number>16</number>
Expand All @@ -218,6 +218,9 @@ enhancement</string>
</item>
</layout>
</item>
<item row="4" column="0" colspan="5">
<widget class="QWidget" name="mMinMaxContainerWidget" native="true"/>
</item>
</layout>
</widget>
<tabstops>
Expand Down
198 changes: 71 additions & 127 deletions src/ui/qgsrasterminmaxwidgetbase.ui
Expand Up @@ -27,26 +27,23 @@
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="mLoadMinMaxValuesGroupBox">
<widget class="QgsCollapsibleGroupBox" name="mLoadMinMaxValuesGroupBox">
<property name="title">
<string>Load min/max values</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="collapsed" stdset="0">
<bool>true</bool>
</property>
<property name="saveCollapsedState" stdset="0">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
Expand Down Expand Up @@ -174,121 +171,68 @@ standard deviation ×</string>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>3</number>

<item>
<layout class="QHBoxLayout" name="horizontalLayout_1">
<item>
<widget class="QPushButton" name="mLoadPushButton">
<property name="text">
<string>Load</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<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="QLabel" name="mColorInterpolationLabel_2">
<property name="text">
<string>Accuracy</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cboAccuracy">
<item>
<property name="text">
<string>Estimate (faster)</string>
</property>
<item>
<widget class="QGroupBox" name="mExtentGroupBox">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Extent</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="mFullExtentRadioButton">
<property name="text">
<string>Full</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="mCurrentExtentRadioButton">
<property name="text">
<string>Current</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="mAccuracyGroupBox">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Accuracy</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="mEstimateRadioButton">
<property name="text">
<string>Estimate (faster)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="mActualRadioButton">
<property name="text">
<string>Actual (slower)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="horizontalSpacer_5">
<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="QPushButton" name="mLoadPushButton">
<property name="text">
<string>Load</string>
</property>
</widget>
</item>
</layout>
</item>
</item>
<item>
<property name="text">
<string>Actual (slower)</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QCheckBox" name="cbxClipExtent">
<property name="text">
<string>Clip extent to canvas</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>


</layout>
</widget>
</item>
Expand Down
26 changes: 13 additions & 13 deletions src/ui/qgsrendererrasterpropswidgetbase.ui
Expand Up @@ -359,19 +359,6 @@
</item>
<item row="6" column="2" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="mResetColorRenderingBtn">
<property name="toolTip">
Expand Down Expand Up @@ -436,6 +423,19 @@
</layout>
</widget>
</item>
<item row="7">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
Expand Down

0 comments on commit 0fccb07

Please sign in to comment.