Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
QgsRangeConfigDlg: allow to set minimum value, maximum value and step…
… widht in selected precision
  • Loading branch information
mhugent authored and github-actions[bot] committed Aug 5, 2022
1 parent 91f66f6 commit f88cc78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/gui/editorwidgets/qgsrangeconfigdlg.cpp
Expand Up @@ -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() );
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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 );
}
1 change: 1 addition & 0 deletions src/gui/editorwidgets/qgsrangeconfigdlg.h
Expand Up @@ -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 f88cc78

Please sign in to comment.