[−][src]Struct qt_gui::QDoubleValidator
The QDoubleValidator class provides range checking of floating-point numbers.
C++ class: QDoubleValidator
.
The QDoubleValidator class provides range checking of floating-point numbers.
QDoubleValidator provides an upper bound, a lower bound, and a limit on the number of digits after the decimal point. It does not provide a fixup() function.
You can set the acceptable range in one call with setRange(), or with setBottom() and setTop(). Set the number of decimal places with setDecimals(). The validate() function returns the validation state.
QDoubleValidator uses its locale() to interpret the number. For example, in the German locale, "1,234" will be accepted as the fractional number 1.234. In Arabic locales, QDoubleValidator will accept Arabic digits.
Note: The QLocale::NumberOptions set on the locale() also affect the way the number is interpreted. For example, since QLocale::RejectGroupSeparator is not set by default, the validator will accept group separators. It is thus recommended to use QLocale::toDouble() to obtain the numeric value.
Methods
impl QDoubleValidator
[src]
pub fn bottom_changed(&self) -> Signal<(c_double,)>
[src]
This property holds the validator's minimum acceptable value
Returns a built-in Qt signal QDoubleValidator::bottomChanged
that can be passed to qt_core::Signal::connect
.
This property holds the validator's minimum acceptable value
By default, this property contains a value of -infinity.
Access functions:
double | bottom() const |
void | setBottom(double) |
Notifier signal:
void | bottomChanged(double bottom) |
See also setRange().
pub fn top_changed(&self) -> Signal<(c_double,)>
[src]
This property holds the validator's maximum acceptable value
Returns a built-in Qt signal QDoubleValidator::topChanged
that can be passed to qt_core::Signal::connect
.
This property holds the validator's maximum acceptable value
By default, this property contains a value of infinity.
Access functions:
double | top() const |
void | setTop(double) |
Notifier signal:
void | topChanged(double top) |
See also setRange().
pub fn decimals_changed(&self) -> Signal<(c_int,)>
[src]
This property holds the validator's maximum number of digits after the decimal point
Returns a built-in Qt signal QDoubleValidator::decimalsChanged
that can be passed to qt_core::Signal::connect
.
This property holds the validator's maximum number of digits after the decimal point
By default, this property contains a value of 1000.
Access functions:
int | decimals() const |
void | setDecimals(int) |
Notifier signal:
void | decimalsChanged(int decimals) |
See also setRange().
pub fn notation_changed(&self) -> Signal<(Notation,)>
[src]
This property holds the notation of how a string can describe a number
Returns a built-in Qt signal QDoubleValidator::notationChanged
that can be passed to qt_core::Signal::connect
.
This property holds the notation of how a string can describe a number
By default, this property is set to ScientificNotation.
This property was introduced in Qt 4.3.
Access functions:
QDoubleValidator::Notation | notation() const |
void | setNotation(QDoubleValidator::Notation) |
Notifier signal:
void | notationChanged(QDoubleValidator::Notation notation) |
See also Notation.
pub unsafe fn bottom(&self) -> c_double
[src]
This property holds the validator's minimum acceptable value
Calls C++ function: double QDoubleValidator::bottom() const
.
This property holds the validator's minimum acceptable value
By default, this property contains a value of -infinity.
Access functions:
double | bottom() const |
void | setBottom(double) |
See also setRange().
pub unsafe fn decimals(&self) -> c_int
[src]
This property holds the validator's maximum number of digits after the decimal point
Calls C++ function: int QDoubleValidator::decimals() const
.
This property holds the validator's maximum number of digits after the decimal point
By default, this property contains a value of 1000.
Access functions:
int | decimals() const |
void | setDecimals(int) |
See also setRange().
pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>
[src]
Calls C++ function: virtual const QMetaObject* QDoubleValidator::metaObject() const
.
pub unsafe fn new_1a(
parent: impl CastInto<MutPtr<QObject>>
) -> QBox<QDoubleValidator>
[src]
parent: impl CastInto<MutPtr<QObject>>
) -> QBox<QDoubleValidator>
Constructs a validator object with a parent object that accepts any double.
Calls C++ function: [constructor] void QDoubleValidator::QDoubleValidator(QObject* parent = …)
.
Constructs a validator object with a parent object that accepts any double.
pub unsafe fn new_4a(
bottom: c_double,
top: c_double,
decimals: c_int,
parent: impl CastInto<MutPtr<QObject>>
) -> QBox<QDoubleValidator>
[src]
bottom: c_double,
top: c_double,
decimals: c_int,
parent: impl CastInto<MutPtr<QObject>>
) -> QBox<QDoubleValidator>
Constructs a validator object with a parent object. This validator will accept doubles from bottom to top inclusive, with up to decimals digits after the decimal point.
Calls C++ function: [constructor] void QDoubleValidator::QDoubleValidator(double bottom, double top, int decimals, QObject* parent = …)
.
Constructs a validator object with a parent object. This validator will accept doubles from bottom to top inclusive, with up to decimals digits after the decimal point.
pub unsafe fn new_0a() -> QBox<QDoubleValidator>
[src]
The QDoubleValidator class provides range checking of floating-point numbers.
Calls C++ function: [constructor] void QDoubleValidator::QDoubleValidator()
.
The QDoubleValidator class provides range checking of floating-point numbers.
QDoubleValidator provides an upper bound, a lower bound, and a limit on the number of digits after the decimal point. It does not provide a fixup() function.
You can set the acceptable range in one call with setRange(), or with setBottom() and setTop(). Set the number of decimal places with setDecimals(). The validate() function returns the validation state.
QDoubleValidator uses its locale() to interpret the number. For example, in the German locale, "1,234" will be accepted as the fractional number 1.234. In Arabic locales, QDoubleValidator will accept Arabic digits.
Note: The QLocale::NumberOptions set on the locale() also affect the way the number is interpreted. For example, since QLocale::RejectGroupSeparator is not set by default, the validator will accept group separators. It is thus recommended to use QLocale::toDouble() to obtain the numeric value.
pub unsafe fn new_3a(
bottom: c_double,
top: c_double,
decimals: c_int
) -> QBox<QDoubleValidator>
[src]
bottom: c_double,
top: c_double,
decimals: c_int
) -> QBox<QDoubleValidator>
Constructs a validator object with a parent object. This validator will accept doubles from bottom to top inclusive, with up to decimals digits after the decimal point.
Calls C++ function: [constructor] void QDoubleValidator::QDoubleValidator(double bottom, double top, int decimals)
.
Constructs a validator object with a parent object. This validator will accept doubles from bottom to top inclusive, with up to decimals digits after the decimal point.
pub unsafe fn notation(&self) -> Notation
[src]
This property holds the notation of how a string can describe a number
Calls C++ function: QDoubleValidator::Notation QDoubleValidator::notation() const
.
This property holds the notation of how a string can describe a number
By default, this property is set to ScientificNotation.
This property was introduced in Qt 4.3.
Access functions:
Notation | notation() const |
void | setNotation(Notation) |
See also Notation.
pub unsafe fn qt_metacall(
&mut self,
arg1: Call,
arg2: c_int,
arg3: impl CastInto<MutPtr<*mut c_void>>
) -> c_int
[src]
&mut self,
arg1: Call,
arg2: c_int,
arg3: impl CastInto<MutPtr<*mut c_void>>
) -> c_int
Calls C++ function: virtual int QDoubleValidator::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3)
.
pub unsafe fn qt_metacast(
&mut self,
arg1: impl CastInto<Ptr<c_char>>
) -> MutPtr<c_void>
[src]
&mut self,
arg1: impl CastInto<Ptr<c_char>>
) -> MutPtr<c_void>
Calls C++ function: virtual void* QDoubleValidator::qt_metacast(const char* arg1)
.
pub unsafe fn set_bottom(&mut self, arg1: c_double)
[src]
This property holds the validator's minimum acceptable value
Calls C++ function: void QDoubleValidator::setBottom(double arg1)
.
This property holds the validator's minimum acceptable value
By default, this property contains a value of -infinity.
Access functions:
double | bottom() const |
void | setBottom(double) |
See also setRange().
pub unsafe fn set_decimals(&mut self, arg1: c_int)
[src]
This property holds the validator's maximum number of digits after the decimal point
Calls C++ function: void QDoubleValidator::setDecimals(int arg1)
.
This property holds the validator's maximum number of digits after the decimal point
By default, this property contains a value of 1000.
Access functions:
int | decimals() const |
void | setDecimals(int) |
See also setRange().
pub unsafe fn set_notation(&mut self, arg1: Notation)
[src]
This property holds the notation of how a string can describe a number
Calls C++ function: void QDoubleValidator::setNotation(QDoubleValidator::Notation arg1)
.
This property holds the notation of how a string can describe a number
By default, this property is set to ScientificNotation.
This property was introduced in Qt 4.3.
Access functions:
Notation | notation() const |
void | setNotation(Notation) |
See also Notation.
pub unsafe fn set_range_3a(
&mut self,
bottom: c_double,
top: c_double,
decimals: c_int
)
[src]
&mut self,
bottom: c_double,
top: c_double,
decimals: c_int
)
Sets the validator to accept doubles from minimum to maximum inclusive, with at most decimals digits after the decimal point.
Calls C++ function: virtual void QDoubleValidator::setRange(double bottom, double top, int decimals = …)
.
Sets the validator to accept doubles from minimum to maximum inclusive, with at most decimals digits after the decimal point.
pub unsafe fn set_range_2a(&mut self, bottom: c_double, top: c_double)
[src]
Sets the validator to accept doubles from minimum to maximum inclusive, with at most decimals digits after the decimal point.
Calls C++ function: virtual void QDoubleValidator::setRange(double bottom, double top)
.
Sets the validator to accept doubles from minimum to maximum inclusive, with at most decimals digits after the decimal point.
pub unsafe fn set_top(&mut self, arg1: c_double)
[src]
This property holds the validator's maximum acceptable value
Calls C++ function: void QDoubleValidator::setTop(double arg1)
.
This property holds the validator's maximum acceptable value
By default, this property contains a value of infinity.
Access functions:
double | top() const |
void | setTop(double) |
See also setRange().
pub unsafe fn static_meta_object() -> Ref<QMetaObject>
[src]
Returns a reference to the staticMetaObject
field.
pub unsafe fn top(&self) -> c_double
[src]
This property holds the validator's maximum acceptable value
Calls C++ function: double QDoubleValidator::top() const
.
This property holds the validator's maximum acceptable value
By default, this property contains a value of infinity.
Access functions:
double | top() const |
void | setTop(double) |
See also setRange().
pub unsafe fn tr(
s: impl CastInto<Ptr<c_char>>,
c: impl CastInto<Ptr<c_char>>,
n: c_int
) -> CppBox<QString>
[src]
s: impl CastInto<Ptr<c_char>>,
c: impl CastInto<Ptr<c_char>>,
n: c_int
) -> CppBox<QString>
Calls C++ function: static QString QDoubleValidator::tr(const char* s, const char* c, int n)
.
pub unsafe fn tr_utf8(
s: impl CastInto<Ptr<c_char>>,
c: impl CastInto<Ptr<c_char>>,
n: c_int
) -> CppBox<QString>
[src]
s: impl CastInto<Ptr<c_char>>,
c: impl CastInto<Ptr<c_char>>,
n: c_int
) -> CppBox<QString>
Calls C++ function: static QString QDoubleValidator::trUtf8(const char* s, const char* c, int n)
.
pub unsafe fn validate(
&self,
arg1: impl CastInto<MutRef<QString>>,
arg2: impl CastInto<MutRef<c_int>>
) -> State
[src]
&self,
arg1: impl CastInto<MutRef<QString>>,
arg2: impl CastInto<MutRef<c_int>>
) -> State
Reimplemented from QValidator::validate().
Calls C++ function: virtual QValidator::State QDoubleValidator::validate(QString& arg1, int& arg2) const
.
Reimplemented from QValidator::validate().
Returns Acceptable if the string input contains a double that is within the valid range and is in the correct format.
Returns Intermediate if input contains a double that is outside the range or is in the wrong format; e.g. with too many digits after the decimal point or is empty.
Returns Invalid if the input is not a double.
Note: If the valid range consists of just positive doubles (e.g. 0.0 to 100.0) and input is a negative double then Invalid is returned. If notation() is set to StandardNotation, and the input contains more digits before the decimal point than a double in the valid range may have, Invalid is returned. If notation() is ScientificNotation, and the input is not in the valid range, Intermediate is returned. The value may yet become valid by changing the exponent.
By default, the pos parameter is not used by this validator.
Methods from Deref<Target = QValidator>
pub fn changed(&self) -> Signal<()>
[src]
This signal is emitted when any property that may affect the validity of a string has changed.
Returns a built-in Qt signal QValidator::changed
that can be passed to qt_core::Signal::connect
.
This signal is emitted when any property that may affect the validity of a string has changed.
pub unsafe fn fixup(&self, arg1: impl CastInto<MutRef<QString>>)
[src]
This function attempts to change input to be valid according to this validator's rules. It need not result in a valid string: callers of this function must re-test afterwards; the default does nothing.
Calls C++ function: virtual void QValidator::fixup(QString& arg1) const
.
This function attempts to change input to be valid according to this validator's rules. It need not result in a valid string: callers of this function must re-test afterwards; the default does nothing.
Reimplementations of this function can change input even if they do not produce a valid string. For example, an ISBN validator might want to delete every character except digits and "-", even if the result is still not a valid ISBN; a surname validator might want to remove whitespace from the start and end of the string, even if the resulting string is not in the list of accepted surnames.
pub unsafe fn locale(&self) -> CppBox<QLocale>
[src]
Returns the locale for the validator. The locale is by default initialized to the same as QLocale().
Calls C++ function: QLocale QValidator::locale() const
.
Returns the locale for the validator. The locale is by default initialized to the same as QLocale().
See also setLocale() and QLocale::QLocale().
pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>
[src]
Calls C++ function: virtual const QMetaObject* QValidator::metaObject() const
.
pub unsafe fn qt_metacall(
&mut self,
arg1: Call,
arg2: c_int,
arg3: impl CastInto<MutPtr<*mut c_void>>
) -> c_int
[src]
&mut self,
arg1: Call,
arg2: c_int,
arg3: impl CastInto<MutPtr<*mut c_void>>
) -> c_int
Calls C++ function: virtual int QValidator::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3)
.
pub unsafe fn qt_metacast(
&mut self,
arg1: impl CastInto<Ptr<c_char>>
) -> MutPtr<c_void>
[src]
&mut self,
arg1: impl CastInto<Ptr<c_char>>
) -> MutPtr<c_void>
Calls C++ function: virtual void* QValidator::qt_metacast(const char* arg1)
.
pub unsafe fn set_locale(&mut self, locale: impl CastInto<Ref<QLocale>>)
[src]
Sets the locale that will be used for the validator. Unless setLocale has been called, the validator will use the default locale set with QLocale::setDefault(). If a default locale has not been set, it is the operating system's locale.
Calls C++ function: void QValidator::setLocale(const QLocale& locale)
.
Sets the locale that will be used for the validator. Unless setLocale has been called, the validator will use the default locale set with QLocale::setDefault(). If a default locale has not been set, it is the operating system's locale.
See also locale() and QLocale::setDefault().
pub unsafe fn validate(
&self,
arg1: impl CastInto<MutRef<QString>>,
arg2: impl CastInto<MutRef<c_int>>
) -> State
[src]
&self,
arg1: impl CastInto<MutRef<QString>>,
arg2: impl CastInto<MutRef<c_int>>
) -> State
This virtual function returns Invalid if input is invalid according to this validator's rules, Intermediate if it is likely that a little more editing will make the input acceptable (e.g. the user types "4" into a widget which accepts integers between 10 and 99), and Acceptable if the input is valid.
Calls C++ function: pure virtual QValidator::State QValidator::validate(QString& arg1, int& arg2) const
.
This virtual function returns Invalid if input is invalid according to this validator's rules, Intermediate if it is likely that a little more editing will make the input acceptable (e.g. the user types "4" into a widget which accepts integers between 10 and 99), and Acceptable if the input is valid.
The function can change both input and pos (the cursor position) if required.
Trait Implementations
impl CppDeletable for QDoubleValidator
[src]
unsafe fn delete(&mut self)
[src]
Destroys the validator.
Calls C++ function: virtual [destructor] void QDoubleValidator::~QDoubleValidator()
.
Destroys the validator.
impl Deref for QDoubleValidator
[src]
type Target = QValidator
The resulting type after dereferencing.
fn deref(&self) -> &QValidator
[src]
Calls C++ function: QValidator* static_cast<QValidator*>(QDoubleValidator* ptr)
.
impl DerefMut for QDoubleValidator
[src]
fn deref_mut(&mut self) -> &mut QValidator
[src]
Calls C++ function: QValidator* static_cast<QValidator*>(QDoubleValidator* ptr)
.
impl DynamicCast<QDoubleValidator> for QValidator
[src]
unsafe fn dynamic_cast(ptr: Ptr<QValidator>) -> Ptr<QDoubleValidator>
[src]
Calls C++ function: QDoubleValidator* dynamic_cast<QDoubleValidator*>(QValidator* ptr)
.
unsafe fn dynamic_cast_mut(ptr: MutPtr<QValidator>) -> MutPtr<QDoubleValidator>
[src]
Calls C++ function: QDoubleValidator* dynamic_cast<QDoubleValidator*>(QValidator* ptr)
.
impl DynamicCast<QDoubleValidator> for QObject
[src]
unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QDoubleValidator>
[src]
Calls C++ function: QDoubleValidator* dynamic_cast<QDoubleValidator*>(QObject* ptr)
.
unsafe fn dynamic_cast_mut(ptr: MutPtr<QObject>) -> MutPtr<QDoubleValidator>
[src]
Calls C++ function: QDoubleValidator* dynamic_cast<QDoubleValidator*>(QObject* ptr)
.
impl StaticDowncast<QDoubleValidator> for QValidator
[src]
unsafe fn static_downcast(ptr: Ptr<QValidator>) -> Ptr<QDoubleValidator>
[src]
Calls C++ function: QDoubleValidator* static_cast<QDoubleValidator*>(QValidator* ptr)
.
unsafe fn static_downcast_mut(
ptr: MutPtr<QValidator>
) -> MutPtr<QDoubleValidator>
[src]
ptr: MutPtr<QValidator>
) -> MutPtr<QDoubleValidator>
Calls C++ function: QDoubleValidator* static_cast<QDoubleValidator*>(QValidator* ptr)
.
impl StaticDowncast<QDoubleValidator> for QObject
[src]
unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QDoubleValidator>
[src]
Calls C++ function: QDoubleValidator* static_cast<QDoubleValidator*>(QObject* ptr)
.
unsafe fn static_downcast_mut(ptr: MutPtr<QObject>) -> MutPtr<QDoubleValidator>
[src]
Calls C++ function: QDoubleValidator* static_cast<QDoubleValidator*>(QObject* ptr)
.
impl StaticUpcast<QObject> for QDoubleValidator
[src]
unsafe fn static_upcast(ptr: Ptr<QDoubleValidator>) -> Ptr<QObject>
[src]
Calls C++ function: QObject* static_cast<QObject*>(QDoubleValidator* ptr)
.
unsafe fn static_upcast_mut(ptr: MutPtr<QDoubleValidator>) -> MutPtr<QObject>
[src]
Calls C++ function: QObject* static_cast<QObject*>(QDoubleValidator* ptr)
.
impl StaticUpcast<QValidator> for QDoubleValidator
[src]
unsafe fn static_upcast(ptr: Ptr<QDoubleValidator>) -> Ptr<QValidator>
[src]
Calls C++ function: QValidator* static_cast<QValidator*>(QDoubleValidator* ptr)
.
unsafe fn static_upcast_mut(ptr: MutPtr<QDoubleValidator>) -> MutPtr<QValidator>
[src]
Calls C++ function: QValidator* static_cast<QValidator*>(QDoubleValidator* ptr)
.
Auto Trait Implementations
impl RefUnwindSafe for QDoubleValidator
impl Send for QDoubleValidator
impl Sync for QDoubleValidator
impl Unpin for QDoubleValidator
impl UnwindSafe for QDoubleValidator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> CastInto<U> for T where
U: CastFrom<T>,
[src]
U: CastFrom<T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StaticUpcast<T> for T
[src]
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
[src]
unsafe fn static_upcast_mut(ptr: MutPtr<T>) -> MutPtr<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,