Skip to content

Commit

Permalink
Rebase to fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and nyalldawson committed Oct 6, 2020
1 parent 37d8421 commit 1836891
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 103 deletions.
14 changes: 7 additions & 7 deletions src/gui/raster/qgscolorrampshaderwidget.cpp
Expand Up @@ -102,7 +102,7 @@ QgsColorRampShaderWidget::QgsColorRampShaderWidget( QWidget *parent )
connect( btnColorRamp, &QgsColorRampButton::colorRampChanged, this, &QgsColorRampShaderWidget::applyColorRamp );
connect( mNumberOfEntriesSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsColorRampShaderWidget::classify );
connect( mClipCheckBox, &QAbstractButton::toggled, this, &QgsColorRampShaderWidget::widgetChanged );
connect( mPrecisionSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ), this, [ = ]( int ) { autoLabel(); } );
connect( mLabelPrecisionSpinBox, qgis::overload<int>::of( &QSpinBox::valueChanged ), this, [ = ]( int ) { autoLabel(); } );
}

void QgsColorRampShaderWidget::initializeForUseWithRasterLayer()
Expand All @@ -125,11 +125,11 @@ void QgsColorRampShaderWidget::setRasterBand( int band )
{
const int maxDigits { QgsGuiUtils::significantDigits( mRasterDataProvider->dataType( mBand ) ) };
// Get current value
const int currentPrecision { mPrecisionSpinBox->value() };
mPrecisionSpinBox->setMaximum( maxDigits );
const int currentPrecision { mLabelPrecisionSpinBox->value() };
mLabelPrecisionSpinBox->setMaximum( maxDigits );
if ( currentPrecision > maxDigits )
{
mPrecisionSpinBox->setValue( maxDigits );
mLabelPrecisionSpinBox->setValue( maxDigits );
}
}
}
Expand Down Expand Up @@ -185,13 +185,13 @@ void QgsColorRampShaderWidget::autoLabel()
auto applyPrecision = [ = ]( const QString & value )
{
double val { QLocale().toDouble( value ) };
if ( mPrecisionSpinBox->value() < 0 )
if ( mLabelPrecisionSpinBox->value() < 0 )
{
const double factor = std::pow( 10, - mPrecisionSpinBox->value() );
const double factor = std::pow( 10, - mLabelPrecisionSpinBox->value() );
val = static_cast<qlonglong>( val / factor ) * factor;
return QLocale().toString( val, 'f', 0 );
}
return QLocale().toString( val, 'f', mPrecisionSpinBox->value() );
return QLocale().toString( val, 'f', mLabelPrecisionSpinBox->value() );
};

QTreeWidgetItem *currentItem = nullptr;
Expand Down
189 changes: 93 additions & 96 deletions src/ui/qgscolorrampshaderwidgetbase.ui
Expand Up @@ -26,7 +26,7 @@
<property name="bottomMargin">
<number>3</number>
</property>
<item row="3" column="0" colspan="3">
<item row="4" column="0" colspan="3">
<widget class="QTreeWidget" name="mColormapTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
Expand All @@ -40,12 +40,12 @@
<height>250</height>
</size>
</property>
<attribute name="headerDefaultSectionSize">
<number>70</number>
</attribute>
<attribute name="headerMinimumSectionSize">
<number>10</number>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>70</number>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
Expand All @@ -66,13 +66,6 @@
</column>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mColorInterpolationLabel_2">
<property name="text">
<string>Color ramp</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QgsColorRampButton" name="btnColorRamp">
<property name="sizePolicy">
Expand All @@ -95,9 +88,6 @@
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="mColorInterpolationComboBox"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mColorInterpolationLabel">
<property name="text">
Expand All @@ -106,6 +96,62 @@
</widget>
</item>
<item row="5" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="mClassificationModeLabel">
<property name="text">
<string>Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mClassificationModeComboBox"/>
</item>
<item>
<spacer name="horizontalSpacer_4">
<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="QLabel" name="mNumberOfEntriesLabel">
<property name="text">
<string>Classes</string>
</property>
</widget>
</item>
<item>
<widget class="QgsSpinBox" name="mNumberOfEntriesSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="mColorInterpolationComboBox"/>
</item>
<item row="6" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="mClassifyButton">
Expand Down Expand Up @@ -184,7 +230,7 @@
</item>
</layout>
</item>
<item row="6" column="0" colspan="3">
<item row="7" column="0" colspan="3">
<widget class="QCheckBox" name="mClipCheckBox">
<property name="toolTip">
<string>If checked, any pixels with a value out of range will not be rendered</string>
Expand All @@ -194,59 +240,6 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="mClassificationModeLabel">
<property name="text">
<string>Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mClassificationModeComboBox"/>
</item>
<item>
<spacer name="horizontalSpacer_4">
<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="QLabel" name="mNumberOfEntriesLabel">
<property name="text">
<string>Classes</string>
</property>
</widget>
</item>
<item>
<widget class="QgsSpinBox" name="mNumberOfEntriesSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="mUnitLineEdit">
<property name="toolTip">
Expand All @@ -264,6 +257,38 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mColorInterpolationLabel_2">
<property name="text">
<string>Color ramp</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Label precision</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QgsSpinBox" name="mLabelPrecisionSpinBox">
<property name="toolTip">
<string>Precision of upper and lower values in label text.
Positive is number of decimal places
Negative rounds to powers of 10</string>
</property>
<property name="minimum">
<number>-10</number>
</property>
<property name="maximum">
<number>16</number>
</property>
<property name="value">
<number>4</number>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
Expand Down Expand Up @@ -296,34 +321,6 @@
</tabstops>
<resources>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
</resources>
<connections/>
</ui>

0 comments on commit 1836891

Please sign in to comment.