22 : QDialog( parent, fl )
26 connect( mLowerEdit, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this ](
double value ) { setDecimalPlaces( mLowerEdit, value ); } );
27 connect( mUpperEdit, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this ](
double value ) { setDecimalPlaces( mUpperEdit, value ); } );
32 return mLowerEdit->text();
37 return mLowerEdit->value();
42 return mUpperEdit->text();
47 return mUpperEdit->value();
53 const double value { QLocale().toDouble( val, &ok )};
54 mLowerEdit->setValue( value );
57 setDecimalPlaces( mLowerEdit, value );
64 const double value { QLocale().toDouble( val, &ok )};
65 mUpperEdit->setValue( value );
68 setDecimalPlaces( mUpperEdit, value );
72void QgsLUDialog::setDecimalPlaces(
QgsDoubleSpinBox *widget,
double value )
const
74 const QString strVal { QVariant( value ).toString() };
75 const int dotPosition( strVal.indexOf(
'.' ) );
77 if ( dotPosition >= 0 )
79 decimals = std::max<int>( 2, strVal.length() - dotPosition - 1 );
80 widget->setDecimals( decimals );
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
QString upperValue() const
QString lowerValue() const
QgsLUDialog(QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
double upperValueDouble() const
Returns the upper value.
double lowerValueDouble() const
Returns the lower value.
void setLowerValue(const QString &val)
void setUpperValue(const QString &val)