19#include "moc_qgsludialog.cpp"
23 : QDialog( parent, fl )
27 connect( mLowerEdit, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this](
double value ) { setDecimalPlaces( mLowerEdit, value ); } );
28 connect( mUpperEdit, qOverload<double>( &QgsDoubleSpinBox::valueChanged ),
this, [
this](
double value ) { setDecimalPlaces( mUpperEdit, value ); } );
33 return mLowerEdit->text();
38 return mLowerEdit->value();
43 return mUpperEdit->text();
48 return mUpperEdit->value();
54 const double value { QLocale().toDouble( val, &ok ) };
55 mLowerEdit->setValue( value );
58 setDecimalPlaces( mLowerEdit, value );
65 const double value { QLocale().toDouble( val, &ok ) };
66 mUpperEdit->setValue( value );
69 setDecimalPlaces( mUpperEdit, value );
73void QgsLUDialog::setDecimalPlaces(
QgsDoubleSpinBox *widget,
double value )
const
75 const QString strVal { QVariant( value ).toString() };
76 const int dotPosition( strVal.indexOf(
'.' ) );
78 if ( dotPosition >= 0 )
80 decimals = std::max<int>( 2, strVal.length() - dotPosition - 1 );
81 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)