17#include "moc_qgsmeshvariablestrokewidthwidget.cpp"
20#include <QDialogButtonBox>
27 double defaultMinimumvalue,
28 double defaultMaximumValue,
31 mDefaultMinimumValue( defaultMinimumvalue ),
32 mDefaultMaximumValue( defaultMaximumValue )
36 mValueMinimumSpinBox->setSpecialValueText( QString( ) );
38 mValueMaximumSpinBox->setSpecialValueText( QString( ) );
45 connect( mDefaultMinMaxButton, &QPushButton::clicked,
this, &QgsMeshVariableStrokeWidthWidget::defaultMinMax );
67 mMinimumDefaultValue = minimum;
68 mMaximumDefaultValue = maximum;
83void QgsMeshVariableStrokeWidthWidget::defaultMinMax()
85 whileBlocking( mValueMinimumSpinBox )->setValue( mDefaultMinimumValue );
86 whileBlocking( mValueMaximumSpinBox )->setValue( mDefaultMaximumValue );
93 connect(
this, &QPushButton::clicked,
this, &QgsMeshVariableStrokeWidthButton::openWidget );
98 return mVariableStrokeWidth;
107void QgsMeshVariableStrokeWidthButton::openWidget()
112 mMinimumDefaultValue,
113 mMaximumDefaultValue,
131 QDialog *dlg =
new QDialog(
this );
132 const QString key = QStringLiteral(
"/UI/paneldialog/%1" ).arg( widget->
panelTitle() );
134 dlg->restoreGeometry( settings.
value( key ).toByteArray() );
136 dlg->setLayout(
new QVBoxLayout() );
137 dlg->layout()->addWidget( widget );
138 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
139 connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
140 connect( buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject );
141 dlg->layout()->addWidget( buttonBox );
143 if ( dlg->exec() == QDialog::Accepted )
148 settings.
setValue( key, dlg->saveGeometry() );
152void QgsMeshVariableStrokeWidthButton::updateText()
154 setText( QString(
"%1 - %2" ).
155 arg( QLocale().toString( mVariableStrokeWidth.
minimumWidth(),
'g', 3 ),
156 QLocale().toString( mVariableStrokeWidth.
maximumWidth(),
'g', 3 ) ) );
159double QgsMeshVariableStrokeWidthWidget::lineEditValue(
const QgsDoubleSpinBox *lineEdit )
const
161 if ( lineEdit->value() == lineEdit->
clearValue() )
163 return std::numeric_limits<double>::quiet_NaN();
166 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.