Skip to content
Permalink
Browse files
QgsRangeConfigDlg: allow to set minimum value, maximum value and step…
… widht in selected precision
  • Loading branch information
mhugent authored and nyalldawson committed Aug 6, 2022
1 parent ba3a21f commit b85f26566ce0ccef12840eb31a1bf48fe255634b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
@@ -22,6 +22,7 @@ QgsRangeConfigDlg::QgsRangeConfigDlg( QgsVectorLayer *vl, int fieldIdx, QWidget
{
setupUi( this );
precisionSpinBox->setClearValue( 4 );
setPrecision( precisionSpinBox->value() );

minimumSpinBox->setMinimum( std::numeric_limits<int>::lowest() );
minimumSpinBox->setMaximum( std::numeric_limits<int>::max() );
@@ -106,6 +107,7 @@ QgsRangeConfigDlg::QgsRangeConfigDlg( QgsVectorLayer *vl, int fieldIdx, QWidget
connect( rangeWidget, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsEditorConfigWidget::changed );
connect( allowNullCheckBox, &QAbstractButton::toggled, this, &QgsEditorConfigWidget::changed );
connect( suffixLineEdit, &QLineEdit::textChanged, this, &QgsEditorConfigWidget::changed );
connect( precisionSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsRangeConfigDlg::setPrecision );
}

QVariantMap QgsRangeConfigDlg::config()
@@ -164,3 +166,10 @@ void QgsRangeConfigDlg::rangeWidgetChanged( int index )
const QString style = rangeWidget->itemData( index ).toString();
allowNullCheckBox->setEnabled( style == QLatin1String( "SpinBox" ) );
}

void QgsRangeConfigDlg::setPrecision( int precision )
{
minimumDoubleSpinBox->setDecimals( precision );
maximumDoubleSpinBox->setDecimals( precision );
stepDoubleSpinBox->setDecimals( precision );
}
@@ -39,6 +39,7 @@ class GUI_EXPORT QgsRangeConfigDlg : public QgsEditorConfigWidget, private Ui::Q

protected slots:
void rangeWidgetChanged( int index );
void setPrecision( int precision );
};

#endif // QGSRANGECONFIGDLG_H

0 comments on commit b85f265

Please sign in to comment.