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();
100 minval -= 10 ^ -precision;
115 if (
config(
"Suffix" ).isValid() )
123 int minval = min.
toInt();
124 int stepval = step.
toInt();
131 mIntSpinBox->setValue( minval );
132 mIntSpinBox->setSpecialValueText(
QSettings().
value(
"qgis/nullValue",
"NULL" ).toString() );
135 mIntSpinBox->setMinimum( min.
toInt() );
137 mIntSpinBox->setMaximum( max.
toInt() );
139 mIntSpinBox->setSingleStep( step.
toInt() );
140 if (
config(
"Suffix" ).isValid() )
141 mIntSpinBox->setSuffix(
config(
"Suffix" ).toString() );
146 if ( mQgsDial || mQgsSlider )
155 mQgsSlider->setMinimum( min );
157 mQgsSlider->setMaximum( max );
159 mQgsSlider->setSingleStep( step );
165 mQgsDial->setMinimum( min );
167 mQgsDial->setMaximum( max );
169 mQgsDial->setSingleStep( step );
177 mDial->setMinimum( min.
toInt() );
179 mDial->setMaximum( max.
toInt() );
181 mDial->setSingleStep( step.
toInt() );
187 mSlider->setMinimum( min.
toInt() );
189 mSlider->setMaximum( max.
toInt() );
191 mSlider->setSingleStep( step.
toInt() );
198 return mSlider || mDial || mQgsDial || mQgsSlider || mIntSpinBox || mDoubleSpinBox;
203 if ( v.
type() == QVariant::Int )
205 if ( v.
type() == QVariant::Double )
213 if ( mDoubleSpinBox )
215 value = mDoubleSpinBox->
value();
216 if ( value == mDoubleSpinBox->
minimum() &&
config(
"AllowNull" ).toBool() )
221 else if ( mIntSpinBox )
223 value = mIntSpinBox->
value();
224 if ( value == mIntSpinBox->
minimum() &&
config(
"AllowNull" ).toBool() )
233 else if ( mQgsSlider )
239 value = mDial->
value();
243 value = mSlider->
value();
251 if ( mDoubleSpinBox )
279 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...
QgsFields fields() const
Returns the list of fields of this layer.
int precision() const
Gets the precision of the field.
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
double ANALYSIS_EXPORT max(double x, double y)
Returns the maximum of two doubles or the first argument if both are equal.
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)
const QgsField & at(int i) const
Get field at particular index (must be in range 0..N-1)
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)
double ANALYSIS_EXPORT min(double x, double y)
Returns the minimum of two doubles or the first argument if both are equal.
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)