38 if (
config(
"Style" ).toString() ==
"Dial" )
42 else if (
config(
"Style" ).toString() ==
"Slider" )
44 editor =
new QgsSlider( Qt::Horizontal, parent );
51 case QVariant::Double:
57 case QVariant::LongLong:
70 mIntSpinBox = qobject_cast<
QSpinBox*>( editor );
71 mDial = qobject_cast<
QDial*>( editor );
72 mSlider = qobject_cast<
QSlider*>( editor );
73 mQgsDial = qobject_cast<
QgsDial*>( editor );
74 mQgsSlider = qobject_cast<
QgsSlider*>( editor );
76 bool allowNull =
config(
"AllowNull" ).toBool();
88 double step =
config(
"Step" ).toDouble();
96 min -= 10 ^ -precision;
108 if (
config(
"Suffix" ).isValid() )
118 int step =
config(
"Step" ).toInt();
125 mIntSpinBox->setValue( min );
126 mIntSpinBox->setSpecialValueText(
QSettings().
value(
"qgis/nullValue",
"NULL" ).toString() );
128 mIntSpinBox->setMinimum( min );
129 mIntSpinBox->setMaximum(
config(
"Max" ).toInt() );
130 mIntSpinBox->setSingleStep( step );
131 if (
config(
"Suffix" ).isValid() )
133 mIntSpinBox->setSuffix(
config(
"Suffix" ).toString() );
138 if ( mQgsDial || mQgsSlider )
150 mQgsSlider->setMinimum( min );
151 mQgsSlider->setMaximum( max );
152 mQgsSlider->setSingleStep( step );
157 mQgsDial->setMinimum( min );
158 mQgsDial->setMaximum( max );
159 mQgsDial->setSingleStep( step );
166 mDial->setMinimum(
config(
"Min" ).toInt() );
167 mDial->setMaximum(
config(
"Max" ).toInt() );
168 mDial->setSingleStep(
config(
"Step" ).toInt() );
173 mSlider->setMinimum(
config(
"Min" ).toInt() );
174 mSlider->setMaximum(
config(
"Max" ).toInt() );
175 mSlider->setSingleStep(
config(
"Step" ).toInt() );
182 if ( v.
type() == QVariant::Int )
184 if ( v.
type() == QVariant::Double )
192 if ( mDoubleSpinBox )
194 value = mDoubleSpinBox->
value();
195 if ( value == mDoubleSpinBox->
minimum() &&
config(
"AllowNull" ).toBool() )
200 else if ( mIntSpinBox )
202 value = mIntSpinBox->
value();
203 if ( value == mIntSpinBox->
minimum() &&
config(
"AllowNull" ).toBool() )
212 else if ( mQgsSlider )
218 value = mDial->
value();
222 value = mSlider->
value();
230 if ( mDoubleSpinBox )
258 else if ( mQgsSlider )
void setValue(const QVariant &value)
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value...
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value...
void setShowClearButton(const bool showClearButton)
determines if the widget will show a clear button
void setSingleStep(double val)
void setShowClearButton(const bool showClearButton)
determines if the widget will show a clear button
int toInt(bool *ok) const
QVariant variantValue() const
void setDecimals(int prec)
QVariant variantValue() const
void setSuffix(const QString &suffix)
void setValue(double val)
void setValue(const QVariant &value)
bool convertCompatible(QVariant &v) const
Converts the provided variant to a compatible format.
void setSpecialValueText(const QString &txt)
double toDouble(bool *ok) const
void setMinimum(double min)
const QgsFields & pendingFields() const
returns field list in the to-be-committed state
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Represents a vector layer which manages a vector based data sets.
void setMaximum(double max)