19#include <QDialogButtonBox>
26 double defaultMinimumvalue,
27 double defaultMaximumValue,
30 mDefaultMinimumValue( defaultMinimumvalue ),
31 mDefaultMaximumValue( defaultMaximumValue )
35 mValueMinimumSpinBox->setSpecialValueText( QString( ) );
37 mValueMaximumSpinBox->setSpecialValueText( QString( ) );
44 connect( mDefaultMinMaxButton, &QPushButton::clicked,
this, &QgsMeshVariableStrokeWidthWidget::defaultMinMax );
66 mMinimumDefaultValue = minimum;
67 mMaximumDefaultValue = maximum;
82void QgsMeshVariableStrokeWidthWidget::defaultMinMax()
84 whileBlocking( mValueMinimumSpinBox )->setValue( mDefaultMinimumValue );
85 whileBlocking( mValueMaximumSpinBox )->setValue( mDefaultMaximumValue );
92 connect(
this, &QPushButton::clicked,
this, &QgsMeshVariableStrokeWidthButton::openWidget );
97 return mVariableStrokeWidth;
106void QgsMeshVariableStrokeWidthButton::openWidget()
111 mMinimumDefaultValue,
112 mMaximumDefaultValue,
130 QDialog *dlg =
new QDialog(
this );
131 const QString key = QStringLiteral(
"/UI/paneldialog/%1" ).arg( widget->
panelTitle() );
133 dlg->restoreGeometry( settings.
value( key ).toByteArray() );
135 dlg->setLayout(
new QVBoxLayout() );
136 dlg->layout()->addWidget( widget );
137 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
138 connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
139 connect( buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject );
140 dlg->layout()->addWidget( buttonBox );
142 if ( dlg->exec() == QDialog::Accepted )
147 settings.
setValue( key, dlg->saveGeometry() );
151void QgsMeshVariableStrokeWidthButton::updateText()
153 setText( QString(
"%1 - %2" ).
154 arg( QLocale().toString( mVariableStrokeWidth.
minimumWidth(),
'g', 3 ),
155 QLocale().toString( mVariableStrokeWidth.
maximumWidth(),
'g', 3 ) ) );
158double QgsMeshVariableStrokeWidthWidget::lineEditValue(
const QgsDoubleSpinBox *lineEdit )
const
160 if ( lineEdit->value() == lineEdit->
clearValue() )
162 return std::numeric_limits<double>::quiet_NaN();
165 return lineEdit->value();
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
@ MinimumValue
Reset value to minimum()
Represents a width than can vary depending on values.
void setUseAbsoluteValue(bool useAbsoluteValue)
Sets whether absolute value are used as input.
double minimumValue() const
Returns the minimum value used to defined the variable width.
void setIgnoreOutOfRange(bool ignoreOutOfRange)
Sets whether the variable width ignores out of range value.
void setMaximumValue(double maximumValue)
Sets the maximum value used to defined the variable width.
bool useAbsoluteValue() const
Returns whether absolute value are used as input.
void setMinimumValue(double minimumValue)
Sets the minimum value used to defined the variable width.
double maximumWidth() const
Returns the maximum width used to defined the variable width.
void setMaximumWidth(double maximumWidth)
Sets the maximum width used to defined the variable width.
double maximumValue() const
Returns the maximum value used to defined the variable width.
void setMinimumWidth(double minimumWidth)
Sets the minimum width used to defined the variable width.
bool ignoreOutOfRange() const
Returns whether the variable width ignores out of range value.
double minimumWidth() const
Returns the minimum width used to defined the variable width.
This class is a composition of two QSettings instances:
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.