17#include "moc_qgsmeshvariablestrokewidthwidget.cpp"
20#include <QDialogButtonBox>
27 double defaultMinimumvalue,
28 double defaultMaximumValue,
31 :
QgsPanelWidget( parent ), mDefaultMinimumValue( defaultMinimumvalue ), 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 );
90 : QPushButton( parent )
93 connect(
this, &QPushButton::clicked,
this, &QgsMeshVariableStrokeWidthButton::openWidget );
98 return mVariableStrokeWidth;
107void QgsMeshVariableStrokeWidthButton::openWidget()
126 QDialog *dlg =
new QDialog(
this );
127 const QString key = QStringLiteral(
"/UI/paneldialog/%1" ).arg( widget->
panelTitle() );
129 dlg->restoreGeometry( settings.
value( key ).toByteArray() );
131 dlg->setLayout(
new QVBoxLayout() );
132 dlg->layout()->addWidget( widget );
133 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
134 connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
135 connect( buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject );
136 dlg->layout()->addWidget( buttonBox );
138 if ( dlg->exec() == QDialog::Accepted )
143 settings.
setValue( key, dlg->saveGeometry() );
147void QgsMeshVariableStrokeWidthButton::updateText()
149 setText( QString(
"%1 - %2" ).arg( QLocale().toString( mVariableStrokeWidth.
minimumWidth(),
'g', 3 ), QLocale().toString( mVariableStrokeWidth.
maximumWidth(),
'g', 3 ) ) );
152double QgsMeshVariableStrokeWidthWidget::lineEditValue(
const QgsDoubleSpinBox *lineEdit )
const
154 if ( lineEdit->value() == lineEdit->
clearValue() )
156 return std::numeric_limits<double>::quiet_NaN();
159 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.