Skip to content
Permalink
Browse files

Rebase to fix conflicts

  • Loading branch information
elpaso authored and nyalldawson committed Oct 6, 2020
1 parent 37d8421 commit 18368913e955186d055cc9cefe5f0446ae0156c8
Showing with 100 additions and 103 deletions.
  1. +7 −7 src/gui/raster/qgscolorrampshaderwidget.cpp
  2. +93 −96 src/ui/qgscolorrampshaderwidgetbase.ui
@@ -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()
@@ -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 );
}
}
}
@@ -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;
@@ -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">
@@ -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>
@@ -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">
@@ -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">
@@ -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">
@@ -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>
@@ -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">
@@ -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>
@@ -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.
You can’t perform that action at this time.