RTC Toolkit 6.0.0
Loading...
Searching...
No Matches
gui.float_edit.FloatingPointValidator Class Reference

An input text validator that accepts decimal notation, engineering/scientific notation (e.g. More...

Inheritance diagram for gui.float_edit.FloatingPointValidator:

Public Member Functions

 __init__ (self, parent=None)
 Initialise the FloatingPointValidator object.
 
 validate (self, str input, int pos)
 Check that the input string conforms to a valid or plausible floating-point value.
 
 fixup (self, str input)
 Adjusts the input string to the nearest likely valid floating-point value.
 
 get_minimum (self)
 Getter returns the minimum value accepted by the validator.
 
 set_minimum (self, float value)
 Setter for the minimum value accepted by the validator.
 
 get_maximum (self)
 Getter returns the maximum value accepted by the validator.
 
 set_maximum (self, float value)
 Setter for the maximum value accepted by the validator.
 

Static Public Attributes

 minimum
 
 maximum
 

Protected Attributes

float _minimum = -3.4028234e38
 
float _maximum = 3.4028234e38
 

Detailed Description

An input text validator that accepts decimal notation, engineering/scientific notation (e.g.

1.25e6), positive and negative infinity and NaN values for floating-point number validation.

Constructor & Destructor Documentation

◆ __init__()

gui.float_edit.FloatingPointValidator.__init__ ( self,
parent = None )

Initialise the FloatingPointValidator object.

Parameters
parentThe optional parent Qt object of the new instance.

Member Function Documentation

◆ fixup()

gui.float_edit.FloatingPointValidator.fixup ( self,
str input )

Adjusts the input string to the nearest likely valid floating-point value.

Parameters
inputThe input string to adjust.
Returns
Corrected valid value as a string or the original if it was already valid.

◆ get_maximum()

gui.float_edit.FloatingPointValidator.get_maximum ( self)

Getter returns the maximum value accepted by the validator.

All values below and including the maximum are accepted as valid.

◆ get_minimum()

gui.float_edit.FloatingPointValidator.get_minimum ( self)

Getter returns the minimum value accepted by the validator.

All values above and including the minimum are accepted as valid.

◆ set_maximum()

gui.float_edit.FloatingPointValidator.set_maximum ( self,
float value )

Setter for the maximum value accepted by the validator.

All values below and including the maximum are accepted as valid.

Parameters
valueThe new maximum value allowed.

◆ set_minimum()

gui.float_edit.FloatingPointValidator.set_minimum ( self,
float value )

Setter for the minimum value accepted by the validator.

All values above and including the minimum are accepted as valid.

Parameters
valueThe new minimum value allowed.

◆ validate()

gui.float_edit.FloatingPointValidator.validate ( self,
str input,
int pos )

Check that the input string conforms to a valid or plausible floating-point value.

There is also a bounds check that will check that the value falls between the minimum and maximum (inclusive) set for the validator. Note that infinities are not checked against the minimum and maximum on purpose, i.e. "inf" is always accepted as valid, irrespective of the value for maximum.

Parameters
inputThe input string to check.
posThe position of the cursor within the input string.
Returns
Tuple containing the validity flag, the input and pos arguments.

Member Data Documentation

◆ _maximum

gui.float_edit.FloatingPointValidator._maximum = 3.4028234e38
protected

◆ _minimum

gui.float_edit.FloatingPointValidator._minimum = -3.4028234e38
protected

◆ maximum

gui.float_edit.FloatingPointValidator.maximum
static
Initial value:
= Property(
type=float,
fget=get_maximum,
fset=set_maximum,
doc="The maximum value allowed.",
)

◆ minimum

gui.float_edit.FloatingPointValidator.minimum
static
Initial value:
= Property(
type=float,
fget=get_minimum,
fset=set_minimum,
doc="The minimum value allowed.",
)

The documentation for this class was generated from the following file: