Qt:Документация 4.3.2/qdoublevalidator

Материал из Wiki.crossplatform.ru

Версия от 10:56, 14 ноября 2008; Root (Обсуждение | вклад)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] QDoubleValidator Class Reference
[модуль QtGui ]

The QDoubleValidator class provides range checking of floating-point numbers. More...

 #include <QDoubleValidator>

Inherits QValidator.

[править] Открытые типы

  • enum Notation { StandardNotation, ScientificNotation }

[править] Свойства

  • 1 свойство унаследованное от QObject

[править] Открытые функции

  • 4 открытых функций унаследованных от QValidator
  • 29 открытых функций унаследованных от QObject

[править] Дополнительные унаследованные члены

  • 1 открытый слот унаследованный от QObject
  • 1 сигнал унаследованный от QObject
  • 5 статических открытых члена унаследованных от QObject
  • 7 защищенных функций унаследованных от QObject

[править] Подробное описание

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.

In addition, QDoubleValidator is always guaranteed to accept a number formatted according to the "C" locale. QDoubleValidator will not accept numbers with thousand-seperators.

See also QIntValidator, QRegExpValidator, and Line Edits Example.


[править] Описание типов членов

[править]
enum QDoubleValidator::Notation

This enum defines the allowed notations for entering a double.


Constant Value Description
QDoubleValidator::StandardNotation 0 The string is written as a standard number (i.e. 0.015).
QDoubleValidator::ScientificNotation 1 The string is written in scientific form. It may have an exponent part(i.e. 1.5E-2).

This enum was introduced in Qt 4.3.


[править] Описание свойств

[править]
bottom : double

This property holds the validator's minimum acceptable value.

Функции доступа:

  • double bottom () const
  • void setBottom ( double )

See also setRange().

[править]
decimals : int

This property holds the validator's maximum number of digits after the decimal point.

Функции доступа:

  • int decimals () const
  • void setDecimals ( int )

See also setRange().

[править]
notation : Notation

This property holds the notation of how a string can describe a number.

This property was introduced in Qt 4.3.

Функции доступа:

  • Notation notation () const
  • void setNotation ( Notation )

See also Notation.

[править]
top : double

This property holds the validator's maximum acceptable value.

Функции доступа:

  • double top () const
  • void setTop ( double )

See also setRange().


[править] Описание функций-членов

[править]
QDoubleValidator::QDoubleValidator ( QObject * parent )

Constructs a validator object with a parent object that accepts any double.

[править]
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.

[править]
QDoubleValidator::~QDoubleValidator ()

Destroys the validator.

[править]
void QDoubleValidator::setRange ( double minimum, double maximum, int decimals = 0 ) [virtual]

Sets the validator to accept doubles from minimum to maximum inclusive, with at most decimals digits after the decimal point.

[править]
QValidator::State QDoubleValidator::validate ( QString & input, int & pos ) const [virtual]

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.

Reimplemented from QValidator.


Copyright © 2007 Trolltech Trademarks
Qt 4.3.2