Skip to content

Commit

Permalink
Bump lowest possible min for numeric parameters to -DBL_MAX + 1
Browse files Browse the repository at this point in the history
We need to reserve -DBL_MAX as a special value, to allow it to
work correctly in QDoubleSpinBoxes (limitation of QDoubleSpinBox)
  • Loading branch information
nyalldawson committed Dec 1, 2017
1 parent 6b56565 commit 297e856
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/core/processing/qgsprocessingparameters.sip
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ class QgsProcessingParameterNumber : QgsProcessingParameterDefinition
Type type = Integer,
const QVariant &defaultValue = QVariant(),
bool optional = false,
double minValue = -DBL_MAX,
double minValue = -DBL_MAX + 1,
double maxValue = DBL_MAX
);
%Docstring
Expand Down
2 changes: 1 addition & 1 deletion src/core/processing/qgsprocessingparameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2003,7 +2003,7 @@ QString QgsProcessingParameterNumber::toolTip() const
{
QString text = QgsProcessingParameterDefinition::toolTip();
QStringList parts;
if ( mMin > -DBL_MAX )
if ( mMin > -DBL_MAX + 1 )
parts << QObject::tr( "Minimum value: %1" ).arg( mMin );
if ( mMax < DBL_MAX )
parts << QObject::tr( "Maximum value: %1" ).arg( mMax );
Expand Down
4 changes: 2 additions & 2 deletions src/core/processing/qgsprocessingparameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ class CORE_EXPORT QgsProcessingParameterNumber : public QgsProcessingParameterDe
Type type = Integer,
const QVariant &defaultValue = QVariant(),
bool optional = false,
double minValue = -DBL_MAX,
double minValue = -DBL_MAX + 1,
double maxValue = DBL_MAX
);

Expand Down Expand Up @@ -1159,7 +1159,7 @@ class CORE_EXPORT QgsProcessingParameterNumber : public QgsProcessingParameterDe

private:

double mMin = -DBL_MAX;
double mMin = -DBL_MAX + 1;
double mMax = DBL_MAX;
Type mDataType = Integer;
};
Expand Down

0 comments on commit 297e856

Please sign in to comment.